aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRapptz <[email protected]>2016-11-03 20:03:36 -0400
committerRapptz <[email protected]>2016-11-03 20:16:39 -0400
commit12a3403af3cf7052c715d8e52edc6e712f257167 (patch)
tree2d18fcd9261aa47235ba366abc3ef7299dafe295
parentInject full Emoji to Reaction if we have it. (diff)
downloaddiscord.py-12a3403af3cf7052c715d8e52edc6e712f257167.tar.xz
discord.py-12a3403af3cf7052c715d8e52edc6e712f257167.zip
Change reaction events signature and name.
This changes the event signature to be (reaction, user) instead of (message, reaction, user) since the reaction data class already has the message being reacted to as a member. The name was shortened from on_message_reaction_ to on_reaction_ since the message prefix was deemed redundant.
-rw-r--r--discord/state.py4
-rw-r--r--docs/api.rst22
2 files changed, 19 insertions, 7 deletions
diff --git a/discord/state.py b/discord/state.py
index 00b0e06f..3c687313 100644
--- a/discord/state.py
+++ b/discord/state.py
@@ -272,7 +272,7 @@ class ConnectionState:
channel = self.get_channel(data['channel_id'])
member = self._get_member(channel, data['user_id'])
- self.dispatch('message_reaction_add', message, reaction, member)
+ self.dispatch('reaction_add', reaction, member)
def parse_message_reaction_remove(self, data):
message = self._get_message(data['message_id'])
@@ -291,7 +291,7 @@ class ConnectionState:
channel = self.get_channel(data['channel_id'])
member = self._get_member(channel, data['user_id'])
- self.dispatch('message_reaction_remove', message, reaction, member)
+ self.dispatch('reaction_remove', reaction, member)
def parse_presence_update(self, data):
server = self._get_server(data.get('guild_id'))
diff --git a/docs/api.rst b/docs/api.rst
index 72162f51..7df83e97 100644
--- a/docs/api.rst
+++ b/docs/api.rst
@@ -207,23 +207,29 @@ to handle it, which defaults to print a traceback and ignore the exception.
:param before: A :class:`Message` of the previous version of the message.
:param after: A :class:`Message` of the current version of the message.
-.. function:: on_message_reaction_add(message, reaction, user)
+.. function:: on_reaction_add(reaction, user)
Called when a message has a reaction added to it. Similar to on_message_edit,
- if the message is not found in the :attr:`Client.messages` cache, then this
+ if the message is not found in the :attr:`Client.messages` cache, then this
event will not be called.
- :param message: A :class:`Message` that was reacted to.
+ .. note::
+
+ To get the message being reacted, access it via :attr:`Reaction.message`.
+
:param reaction: A :class:`Reaction` showing the current state of the reaction.
:param user: A :class:`User` or :class:`Member` of the user who added the reaction.
-.. function:: on_message_reaction_remove(message, reaction, user)
+.. function:: on_reaction_remove(reaction, user)
Called when a message has a reaction 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: A :class:`Message` that was reacted to.
+ .. note::
+
+ To get the message being reacted, access it via :attr:`Reaction.message`.
+
: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.
@@ -631,6 +637,12 @@ Message
.. autoclass:: Message
:members:
+Reaction
+~~~~~~~~~
+
+.. autoclass:: Reaction
+ :members:
+
CallMessage
~~~~~~~~~~~~