Browse Source

Add Guild embed related endpoints. (#163)

* Guild Embed endpoints

* Fix failing test
staging/v1.0.0
Snabbare Hastighet 5 years ago
committed by Andrei Zbikowski
parent
commit
40d22921fa
  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.types.user import User
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.invite import Invite
from disco.types.voice import VoiceRegion
@ -516,6 +516,18 @@ class APIClient(LoggingClass):
r = self.http(Routes.GUILDS_VANITY_URL_GET, dict(guild=guild))
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):
r = self.http(Routes.GUILDS_WEBHOOKS_LIST, dict(guild=guild))
return Webhook.create_map(self.client, r.json())

5
disco/types/guild.py

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

Loading…
Cancel
Save