From fdc4ff0a5341e4088d49d1d1b2961589cbe0a463 Mon Sep 17 00:00:00 2001 From: Luke Date: Thu, 31 Oct 2019 09:51:16 +0000 Subject: [PATCH] Guild Embed endpoints --- disco/api/client.py | 14 +++++++++++++- disco/types/guild.py | 5 +++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/disco/api/client.py b/disco/api/client.py index e1ca1f7..d326306 100644 --- a/disco/api/client.py +++ b/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()) diff --git a/disco/types/guild.py b/disco/types/guild.py index e7c16a7..20f171b 100644 --- a/disco/types/guild.py +++ b/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.