aboutsummaryrefslogtreecommitdiff
path: root/discord/reaction.py
diff options
context:
space:
mode:
authorkhazhyk <[email protected]>2016-10-27 20:32:14 -0700
committerRapptz <[email protected]>2016-11-03 04:39:45 -0400
commit4d87b2f8176883a7f962844e8d6ddd90e9714c54 (patch)
treee4937044e9d6599c42865be137d91a1d9ca3ae10 /discord/reaction.py
parentAdd support for reactions. (diff)
downloaddiscord.py-4d87b2f8176883a7f962844e8d6ddd90e9714c54.tar.xz
discord.py-4d87b2f8176883a7f962844e8d6ddd90e9714c54.zip
Inject full Emoji to Reaction if we have it.
Reaction objects with custom Emoji are partial. If we know of this Emoji (can find it on this client) then inject it. Otherwise, leave it as a hollow Emoji. We can still react with a hollow Emoji, but can't get other metadata about it.
Diffstat (limited to 'discord/reaction.py')
-rw-r--r--discord/reaction.py18
1 files changed, 5 insertions, 13 deletions
diff --git a/discord/reaction.py b/discord/reaction.py
index ec30fa22..7232a7b4 100644
--- a/discord/reaction.py
+++ b/discord/reaction.py
@@ -62,19 +62,11 @@ class Reaction:
__slots__ = ['message', 'count', 'emoji', 'me', 'custom_emoji']
def __init__(self, **kwargs):
- self.message = kwargs.pop('message')
- self._from_data(kwargs)
-
- def _from_data(self, reaction):
- self.count = reaction.get('count', 1)
- self.me = reaction.get('me')
- emoji = reaction['emoji']
- if emoji['id']:
- self.custom_emoji = True
- self.emoji = Emoji(server=None, id=emoji['id'], name=emoji['name'])
- else:
- self.custom_emoji = False
- self.emoji = emoji['name']
+ self.message = kwargs.get('message')
+ self.emoji = kwargs['emoji']
+ self.count = kwargs.get('count', 1)
+ self.me = kwargs.get('me')
+ self.custom_emoji = isinstance(self.emoji, Emoji)
def __eq__(self, other):
return isinstance(other, self.__class__) and other.emoji == self.emoji