From a6bf792dec87dae05da4767a4ad8b53b4d19a732 Mon Sep 17 00:00:00 2001 From: Rapptz <rapptz@gmail.com> Date: Thu, 21 Dec 2017 18:50:34 -0500 Subject: [PATCH] Animated emoji support. --- discord/emoji.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/discord/emoji.py b/discord/emoji.py index 869b43848..42f4183cd 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):