aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRapptz <[email protected]>2016-11-21 02:49:50 -0500
committerRapptz <[email protected]>2016-11-21 02:49:50 -0500
commit92c3c2804d7f543adf1f17d17ac28455b07d3575 (patch)
tree06df5ca600680b7256d0ff043afe339d9ae39e94
parentAdd missing bucket for endpoints. (diff)
downloaddiscord.py-92c3c2804d7f543adf1f17d17ac28455b07d3575.tar.xz
discord.py-92c3c2804d7f543adf1f17d17ac28455b07d3575.zip
Support MESSAGE_REACTION_REMOVE_ALL event.
-rw-r--r--discord/state.py7
-rw-r--r--docs/api.rst9
2 files changed, 16 insertions, 0 deletions
diff --git a/discord/state.py b/discord/state.py
index 9df36cf0..6a75491e 100644
--- a/discord/state.py
+++ b/discord/state.py
@@ -274,6 +274,13 @@ class ConnectionState:
self.dispatch('reaction_add', reaction, member)
+ def parse_message_reaction_remove_all(self, data):
+ message = self._get_message(data['message_id'])
+ if message is not None:
+ old_reactions = message.reactions.copy()
+ message.reactions.clear()
+ self.dispatch('reaction_clear', message, old_reactions)
+
def parse_message_reaction_remove(self, data):
message = self._get_message(data['message_id'])
if message is not None:
diff --git a/docs/api.rst b/docs/api.rst
index bd2cf40c..8bc09e93 100644
--- a/docs/api.rst
+++ b/docs/api.rst
@@ -233,6 +233,15 @@ to handle it, which defaults to print a traceback and ignore the exception.
:param reaction: A :class:`Reaction` showing the current state of the reaction.
:param user: A :class:`User` or :class:`Member` of the user who removed the reaction.
+.. function:: on_reaction_clear(message, reactions)
+
+ Called when a message has all its reactions removed from it. Similar to on_message_edit,
+ if the message is not found in the :attr:`Client.messages` cache, then this event
+ will not be called.
+
+ :param message: The :class:`Message` that had its reactions cleared.
+ :param reactions: A list of :class:`Reaction`\s that were removed.
+
.. function:: on_channel_delete(channel)
on_channel_create(channel)