Browse Source

Guild Embed endpoints

pull/163/head
Luke 6 years ago
parent
commit
fdc4ff0a53
  1. 14
      disco/api/client.py
  2. 5
      disco/types/guild.py

14
disco/api/client.py

@ -11,7 +11,7 @@ from disco.util.logging import LoggingClass
from disco.util.sanitize import S from disco.util.sanitize import S
from disco.types.user import User from disco.types.user import User
from disco.types.message import Message from disco.types.message import Message
from disco.types.guild import Guild, GuildMember, GuildBan, PruneCount, Role, GuildEmoji, AuditLogEntry from disco.types.guild import Guild, GuildMember, GuildBan, GuildEmbed, PruneCount, Role, GuildEmoji, AuditLogEntry
from disco.types.channel import Channel from disco.types.channel import Channel
from disco.types.invite import Invite from disco.types.invite import Invite
from disco.types.voice import VoiceRegion from disco.types.voice import VoiceRegion
@ -516,6 +516,18 @@ class APIClient(LoggingClass):
r = self.http(Routes.GUILDS_VANITY_URL_GET, dict(guild=guild)) r = self.http(Routes.GUILDS_VANITY_URL_GET, dict(guild=guild))
return Invite.create(self.client, r.json()) return Invite.create(self.client, r.json())
def guilds_embed_get(self, guild):
r = self.http(Routes.GUILDS_EMBED_GET, dict(guild=guild))
return GuildEmbed.create(self.client, r.json())
def guilds_embed_modify(self, guild, reason=None, **kwargs):
r = self.http(
Routes.GUILDS_EMBED_MODIFY,
dict(guild=guild),
json=kwargs,
headers=_reason_header(reason))
return GuildEmbed.create(self.client, r.json())
def guilds_webhooks_list(self, guild): def guilds_webhooks_list(self, guild):
r = self.http(Routes.GUILDS_WEBHOOKS_LIST, dict(guild=guild)) r = self.http(Routes.GUILDS_WEBHOOKS_LIST, dict(guild=guild))
return Webhook.create_map(self.client, r.json()) return Webhook.create_map(self.client, r.json())

5
disco/types/guild.py

@ -137,6 +137,11 @@ class GuildBan(SlottedModel):
reason = Field(text) reason = Field(text)
class GuildEmbed(SlottedModel):
enabled = Field(bool)
channel_id = Field(snowflake)
class GuildMember(SlottedModel): class GuildMember(SlottedModel):
""" """
A GuildMember object. A GuildMember object.

Loading…
Cancel
Save