Browse Source

Update user.py

This should keep everyone happy... hopefully 🤔
pull/113/head
Dooley_labs 7 years ago
committed by GitHub
parent
commit
87172ff5b4
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      disco/types/user.py

6
disco/types/user.py

@ -22,12 +22,14 @@ 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, fmt=None, size=1024):
if not self.avatar:
return 'https://cdn.discordapp.com/embed/avatars/{}.png'.format(self.default_avatar.value)
elif self.avatar.startswith('a_'):
elif self.avatar.startswith('a_') and fmt is None:
return 'https://cdn.discordapp.com/avatars/{}/{}.gif?size={}'.format(self.id, self.avatar, size)
else:
if fmt is None:
fmt='webp'
return 'https://cdn.discordapp.com/avatars/{}/{}.{}?size={}'.format(self.id, self.avatar, fmt, size)
@property

Loading…
Cancel
Save