From cea1dffb171653df1f9b74f8f60bcf9607df2b86 Mon Sep 17 00:00:00 2001
From: PixeL <officialpixelinc@gmail.com>
Date: Mon, 20 Jan 2020 13:29:51 -0600
Subject: [PATCH] Add MessageReactionRemoveEmoji event and endpoint (#172)

---
 disco/api/client.py     |  3 +++
 disco/api/http.py       |  2 ++
 disco/gateway/events.py | 28 ++++++++++++++++++++++++++++
 disco/types/message.py  | 16 ++++++++++++++++
 4 files changed, 49 insertions(+)

diff --git a/disco/api/client.py b/disco/api/client.py
index 0993ea3..bc17ff3 100644
--- a/disco/api/client.py
+++ b/disco/api/client.py
@@ -230,6 +230,9 @@ class APIClient(LoggingClass):
 
         self.http(route, obj)
 
+    def channels_messages_reactions_delete_emoji(self, channel, message, emoji):
+        self.http(Routes.CHANNELS_MESSAGES_REACTIONS_DELETE_EMOJI, dict(channel=channel, message=message, emoji=emoji))
+
     def channels_permissions_modify(self, channel, permission, allow, deny, typ, reason=None):
         self.http(Routes.CHANNELS_PERMISSIONS_MODIFY, dict(channel=channel, permission=permission), json={
             'allow': allow,
diff --git a/disco/api/http.py b/disco/api/http.py
index 8bffb0d..54e3d28 100644
--- a/disco/api/http.py
+++ b/disco/api/http.py
@@ -54,6 +54,8 @@ class Routes(object):
     CHANNELS_MESSAGES_REACTIONS_DELETE_ME = (HTTPMethod.DELETE, CHANNELS + '/messages/{message}/reactions/{emoji}/@me')
     CHANNELS_MESSAGES_REACTIONS_DELETE_USER = (HTTPMethod.DELETE,
                                                CHANNELS + '/messages/{message}/reactions/{emoji}/{user}')
+    CHANNELS_MESSAGES_REACTIONS_DELETE_EMOJI = (HTTPMethod.DELETE,
+                                                CHANNELS + '/messages/{message}/reactions/{emoji}')
     CHANNELS_PERMISSIONS_MODIFY = (HTTPMethod.PUT, CHANNELS + '/permissions/{permission}')
     CHANNELS_PERMISSIONS_DELETE = (HTTPMethod.DELETE, CHANNELS + '/permissions/{permission}')
     CHANNELS_INVITES_LIST = (HTTPMethod.GET, CHANNELS + '/invites')
diff --git a/disco/gateway/events.py b/disco/gateway/events.py
index 5bc2c05..172c3e0 100644
--- a/disco/gateway/events.py
+++ b/disco/gateway/events.py
@@ -716,3 +716,31 @@ class MessageReactionRemoveAll(GatewayEvent):
     @property
     def guild(self):
         return self.channel.guild
+
+
+class MessageReactionRemoveEmoji(GatewayEvent):
+    """
+    Sent when all reactions of a single emoji are removed from a message.
+    Attributes
+    ----------
+    guild_id : Snowflake
+        The guild ID the message is in.
+    channel_id : Snowflake
+        The channel ID the message is in.
+    message_id : Snowflake
+        The ID of the message for which the reaction was removed from.
+    emoji : :class:`disco.types.message.MessageReactionEmoji`
+        The emoji that was removed.
+    """
+    guild_id = Field(snowflake)
+    channel_id = Field(snowflake)
+    message_id = Field(snowflake)
+    emoji = Field(MessageReactionEmoji)
+
+    @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 27f063d..935a7a5 100644
--- a/disco/types/message.py
+++ b/disco/types/message.py
@@ -512,6 +512,22 @@ class Message(SlottedModel):
             emoji,
             user)
 
+    def delete_single_reaction(self, emoji):
+        """
+        Deletes all reactions of a single emoji from a message.
+        Parameters
+        ----------
+        emoji : `Emoji`|str
+            An emoji or string representing an emoji
+        """
+        if isinstance(emoji, Emoji):
+            emoji = emoji.to_string()
+
+        self.client.api.channels_messages_reactions_delete_emoji(
+            self.channel_id,
+            self.id,
+            emoji)
+
     def is_mentioned(self, entity):
         """
         Returns