aboutsummaryrefslogtreecommitdiff
path: root/discord/emoji.py
diff options
context:
space:
mode:
authorRapptz <[email protected]>2017-12-21 18:50:34 -0500
committerRapptz <[email protected]>2017-12-21 18:51:47 -0500
commita6bf792dec87dae05da4767a4ad8b53b4d19a732 (patch)
tree3fbd27d8120137b32e1045bd3d330a5ac7a0c232 /discord/emoji.py
parentProper variable name in Client.clear. (diff)
downloaddiscord.py-a6bf792dec87dae05da4767a4ad8b53b4d19a732.tar.xz
discord.py-a6bf792dec87dae05da4767a4ad8b53b4d19a732.zip
Animated emoji support.
Diffstat (limited to 'discord/emoji.py')
-rw-r--r--discord/emoji.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/discord/emoji.py b/discord/emoji.py
index 869b4384..42f4183c 100644
--- a/discord/emoji.py
+++ b/discord/emoji.py
@@ -122,12 +122,14 @@ class Emoji(Hashable):
The emoji's ID.
require_colons: bool
If colons are required to use this emoji in the client (:PJSalt: vs PJSalt).
+ animated: bool
+ Whether an emoji is animated or not.
managed: bool
If this emoji is managed by a Twitch integration.
guild_id: int
The guild ID the emoji belongs to.
"""
- __slots__ = ('require_colons', 'managed', 'id', 'name', '_roles', 'guild_id', '_state')
+ __slots__ = ('require_colons', 'animated', 'managed', 'id', 'name', '_roles', 'guild_id', '_state')
def __init__(self, *, guild, state, data):
self.guild_id = guild.id
@@ -139,6 +141,7 @@ class Emoji(Hashable):
self.managed = emoji['managed']
self.id = int(emoji['id'])
self.name = emoji['name']
+ self.animated = emoji.get('animated', False)
self._roles = set(emoji.get('roles', []))
def _iterator(self):
@@ -152,6 +155,8 @@ class Emoji(Hashable):
return self._iterator()
def __str__(self):
+ if self.animated:
+ return '<a:{0.name}:{0.id}>'.format(self)
return "<:{0.name}:{0.id}>".format(self)
def __repr__(self):