diff options
| author | Rapptz <[email protected]> | 2016-12-22 22:07:18 -0500 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2016-12-23 00:43:19 -0500 |
| commit | 4d59bca4aa01976d58d7ad06217562778c70a54a (patch) | |
| tree | c6f480e424887979f65b6d3c9216ce9f04fc3432 /discord/user.py | |
| parent | Properly propagate loop. Fixes #420. (diff) | |
| download | discord.py-4d59bca4aa01976d58d7ad06217562778c70a54a.tar.xz discord.py-4d59bca4aa01976d58d7ad06217562778c70a54a.zip | |
Support animated avatars in User.avatar_url.
Diffstat (limited to 'discord/user.py')
| -rw-r--r-- | discord/user.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/discord/user.py b/discord/user.py index 9dc0ded7..37f0cc51 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): |