Browse Source

Update user.py

Code cleanup as per z64
pull/113/head
Dooley_labs 7 years ago
committed by GitHub
parent
commit
4d924e892f
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      disco/types/user.py

8
disco/types/user.py

@ -25,12 +25,12 @@ class User(SlottedModel, with_equality('id'), with_hash('id')):
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_') and fmt is None:
if fmt is not None:
return 'https://cdn.discordapp.com/avatars/{}/{}.{}?size={}'.format(self.id, self.avatar, fmt, size)
if self.avatar.startswith('a_'):
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)
return 'https://cdn.discordapp.com/avatars/{}/{}.webp?size={}'.format(self.id, self.avatar, size)
@property
def default_avatar(self):

Loading…
Cancel
Save