From 8687a47c146fd824b3985bafd98344d125601002 Mon Sep 17 00:00:00 2001 From: Andrei Date: Mon, 24 Apr 2017 15:32:17 -0700 Subject: [PATCH] Add Guild.get_invites, Guild.get_emojis, MessageReactionAdd.delete --- disco/api/client.py | 4 ++++ disco/gateway/events.py | 8 ++++++++ disco/types/guild.py | 6 ++++++ 3 files changed, 18 insertions(+) diff --git a/disco/api/client.py b/disco/api/client.py index bf0ec30..04b9b32 100644 --- a/disco/api/client.py +++ b/disco/api/client.py @@ -314,6 +314,10 @@ class APIClient(LoggingClass): def guilds_roles_delete(self, guild, role): self.http(Routes.GUILDS_ROLES_DELETE, dict(guild=guild, role=role)) + def guilds_invites_list(self, guild): + r = self.http(Routes.GUILDS_INVITES_LIST, dict(guild=guild)) + return Invite.create_map(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/gateway/events.py b/disco/gateway/events.py index d14a13d..3f90ea8 100644 --- a/disco/gateway/events.py +++ b/disco/gateway/events.py @@ -610,6 +610,14 @@ class MessageReactionAdd(GatewayEvent): user_id = Field(snowflake) emoji = Field(MessageReactionEmoji) + def delete(self): + self.client.api.channels_messages_reactions_delete( + self.channel_id, + self.message_id, + self.emoji, + self.uesr_id + ) + @property def channel(self): return self.client.state.channels.get(self.channel_id) diff --git a/disco/types/guild.py b/disco/types/guild.py index cbd9ff0..594d56a 100644 --- a/disco/types/guild.py +++ b/disco/types/guild.py @@ -442,3 +442,9 @@ class Guild(SlottedModel, Permissible): def leave(self): return self.client.api.users_me_guilds_delete(self.id) + + def get_invites(self): + return self.client.api.guilds_invites_list(self.id) + + def get_emojis(self): + return self.client.api.guilds_emojis_list(self.id)