From 4d924e892f29bf950993771dedec3edb3a1944c4 Mon Sep 17 00:00:00 2001 From: Dooley_labs Date: Sat, 6 Oct 2018 20:36:08 -0400 Subject: [PATCH] Update user.py Code cleanup as per z64 --- disco/types/user.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/disco/types/user.py b/disco/types/user.py index 45bdc19..63e9542 100644 --- a/disco/types/user.py +++ b/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):