From b00e82da634ea933066a2f65018c6059caa24e4a Mon Sep 17 00:00:00 2001 From: Andrei Date: Sat, 18 Mar 2017 21:33:08 -0700 Subject: [PATCH] Add MessageReactionRemoveAll utils, Message.get_reactors --- disco/gateway/events.py | 8 ++++++++ disco/types/message.py | 15 +++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/disco/gateway/events.py b/disco/gateway/events.py index 3f6bbf1..5033b03 100644 --- a/disco/gateway/events.py +++ b/disco/gateway/events.py @@ -658,3 +658,11 @@ class MessageReactionRemoveAll(GatewayEvent): """ channel_id = Field(snowflake) message_id = Field(snowflake) + + @property + def channel(self): + return self.client.state.channels.get(self.channel_id) + + @property + def guild(self): + return self.channel.guild diff --git a/disco/types/message.py b/disco/types/message.py index 821c9c3..9b33d11 100644 --- a/disco/types/message.py +++ b/disco/types/message.py @@ -299,6 +299,21 @@ class Message(SlottedModel): """ return self.client.api.channels_messages_delete(self.channel_id, self.id) + def get_reactors(self, emoji): + """ + Returns an list of users who reacted to this message with the given emoji. + + Returns + ------- + list(:class:`User`) + The users who reacted. + """ + return self.client.api.channels_messages_reactions_get( + self.channel_id, + self.id, + emoji + ) + def create_reaction(self, emoji): if isinstance(emoji, Emoji): emoji = emoji.to_string()