From a022e9a157d95374355bc96faf4e9fe4aef47227 Mon Sep 17 00:00:00 2001 From: Dooley_labs Date: Sat, 6 Oct 2018 02:16:17 -0400 Subject: [PATCH] Update user.py Add proper gif integration to get_avatar_url --- disco/types/user.py | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/disco/types/user.py b/disco/types/user.py index 0eeca8d..81f1046 100644 --- a/disco/types/user.py +++ b/disco/types/user.py @@ -22,16 +22,13 @@ class User(SlottedModel, with_equality('id'), with_hash('id')): presence = Field(None) - def get_avatar_url(self, fmt='webp', size=1024): + def get_avatar_url(self): if not self.avatar: return 'https://cdn.discordapp.com/embed/avatars/{}.png'.format(self.default_avatar.value) - - return 'https://cdn.discordapp.com/avatars/{}/{}.{}?size={}'.format( - self.id, - self.avatar, - fmt, - size, - ) + elif self.avatar.startswith('a_'): + return 'https://cdn.discordapp.com/avatars/{}/{}.gif'.format(self.id, self.avatar) + else: + return 'https://cdn.discordapp.com/avatars/{}/{}.png'.format(self.id, self.avatar) @property def default_avatar(self):