From 4d59bca4aa01976d58d7ad06217562778c70a54a Mon Sep 17 00:00:00 2001 From: Rapptz Date: Thu, 22 Dec 2016 22:07:18 -0500 Subject: [PATCH] Support animated avatars in User.avatar_url. --- discord/user.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/discord/user.py b/discord/user.py index 9dc0ded7c..37f0cc518 100644 --- a/discord/user.py +++ b/discord/user.py @@ -85,7 +85,12 @@ class User: the user has no avatar.""" if self.avatar is None: return '' - return 'https://discordapp.com/api/users/{0.id}/avatars/{0.avatar}.jpg'.format(self) + + url = 'https://images.discordapp.net/avatars/{0.id}/{0.avatar}.{1}?size=1024' + if self.avatar.startswith('a_'): + return url.format(self, 'gif') + else: + return url.format(self, 'webp') @property def default_avatar(self):