Browse Source

Update user.py

Undid removal of size and webp
pull/113/head
Dooley_labs 7 years ago
committed by GitHub
parent
commit
cf8d1c0666
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,13 +22,13 @@ class User(SlottedModel, with_equality('id'), with_hash('id')):
presence = Field(None) presence = Field(None)
def get_avatar_url(self): def get_avatar_url(self, fmt='webp', size=1024):
if not self.avatar: if not self.avatar:
return 'https://cdn.discordapp.com/embed/avatars/{}.png'.format(self.default_avatar.value) return 'https://cdn.discordapp.com/embed/avatars/{}.png'.format(self.default_avatar.value)
elif self.avatar.startswith('a_'): elif self.avatar.startswith('a_'):
return 'https://cdn.discordapp.com/avatars/{}/{}.gif'.format(self.id, self.avatar) return 'https://cdn.discordapp.com/avatars/{}/{}.gif?size={}'.format(self.id, self.avatar, size)
else: else:
return 'https://cdn.discordapp.com/avatars/{}/{}.png'.format(self.id, self.avatar) return 'https://cdn.discordapp.com/avatars/{}/{}.{}?size={}'.format(self.id, self.avatar, fmt, size)
@property @property
def default_avatar(self): def default_avatar(self):

Loading…
Cancel
Save