aboutsummaryrefslogtreecommitdiff
path: root/discord/message.py
diff options
context:
space:
mode:
authorkhazhyk <[email protected]>2016-10-26 21:34:28 -0700
committerkhazhyk <[email protected]>2016-10-27 21:36:32 -0700
commitc4acc0e1a169cebf2adbf974df802ac4b802efec (patch)
tree39e30d0ed4093118bf8a76663e9ad5f0937528a7 /discord/message.py
parentAdd around parameter to LogsFromIterator. (diff)
downloaddiscord.py-c4acc0e1a169cebf2adbf974df802ac4b802efec.tar.xz
discord.py-c4acc0e1a169cebf2adbf974df802ac4b802efec.zip
Add support for reactions.
Reactions can be be standard emojis, or custom server emojis. Adds - add/remove_reaction - get_reaction_users - Messages have new field reactions - new events - message_reaction_add, message_reaction_remove - new permission - add_reactions
Diffstat (limited to 'discord/message.py')
-rw-r--r--discord/message.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/discord/message.py b/discord/message.py
index 0413424e..d2bdf87e 100644
--- a/discord/message.py
+++ b/discord/message.py
@@ -26,6 +26,7 @@ DEALINGS IN THE SOFTWARE.
from . import utils
from .user import User
+from .reaction import Reaction
from .object import Object
from .calls import CallMessage
import re
@@ -102,6 +103,8 @@ class Message:
A list of attachments given to a message.
pinned: bool
Specifies if the message is currently pinned.
+ reactions : List[:class:`Reaction`]
+ Reactions to a message. Reactions can be either custom emoji or standard unicode emoji.
"""
__slots__ = [ 'edited_timestamp', 'timestamp', 'tts', 'content', 'channel',
@@ -109,7 +112,7 @@ class Message:
'channel_mentions', 'server', '_raw_mentions', 'attachments',
'_clean_content', '_raw_channel_mentions', 'nonce', 'pinned',
'role_mentions', '_raw_role_mentions', 'type', 'call',
- '_system_content' ]
+ '_system_content', 'reactions' ]
def __init__(self, **kwargs):
self._update(**kwargs)
@@ -135,6 +138,7 @@ class Message:
self._handle_upgrades(data.get('channel_id'))
self._handle_mentions(data.get('mentions', []), data.get('mention_roles', []))
self._handle_call(data.get('call'))
+ self.reactions = [Reaction(message=self, **reaction) for reaction in data.get('reactions', [])]
# clear the cached properties
cached = filter(lambda attr: attr[0] == '_', self.__slots__)