Browse Source
Update user.py
Add proper gif integration to get_avatar_url
pull/113/head
Dooley_labs
7 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
5 additions and
8 deletions
-
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): |
|
|
|