From ed122c4bea660003e7324a87b11eea1cc90a231e Mon Sep 17 00:00:00 2001 From: Sebastian Winkler Date: Wed, 10 Jan 2018 16:25:41 +0100 Subject: [PATCH] adds support for animated emoji --- disco/types/guild.py | 7 +++++++ disco/types/message.py | 3 +++ 2 files changed, 10 insertions(+) diff --git a/disco/types/guild.py b/disco/types/guild.py index 5c2a0d7..5683437 100644 --- a/disco/types/guild.py +++ b/disco/types/guild.py @@ -54,6 +54,8 @@ class GuildEmoji(Emoji): Whether this emoji is managed by an integration. roles : list(snowflake) Roles this emoji is attached to. + animated : bool + Whether this emoji is animated. """ id = Field(snowflake) guild_id = Field(snowflake) @@ -61,8 +63,11 @@ class GuildEmoji(Emoji): require_colons = Field(bool) managed = Field(bool) roles = ListField(snowflake) + animated = Field(bool) def __str__(self): + if self.animated: + return u''.format(self.name, self.id) return u'<:{}:{}>'.format(self.name, self.id) def update(self, **kwargs): @@ -73,6 +78,8 @@ class GuildEmoji(Emoji): @property def url(self): + if self.animated: + return 'https://discordapp.com/api/emojis/{}.gif'.format(self.id) return 'https://discordapp.com/api/emojis/{}.png'.format(self.id) @cached_property diff --git a/disco/types/message.py b/disco/types/message.py index dcac07e..b97a5e0 100644 --- a/disco/types/message.py +++ b/disco/types/message.py @@ -37,9 +37,12 @@ class Emoji(SlottedModel): The emoji ID (will be none if this is not a custom emoji). name : str The name of this emoji. + animated : bool + Whether this emoji is animated. """ id = Field(snowflake) name = Field(text) + animated = Field(bool) @cached_property def custom(self):