Add support for animated avatars

This commit is contained in:
thecosmos
2019-11-22 00:56:33 +05:30
parent 835733965e
commit 73d8174533
2 changed files with 5 additions and 3 deletions

View File

@@ -60,7 +60,8 @@ class User(DiscordModelsBase):
@property
def avatar_url(self):
"""A property returning direct URL to user's avatar."""
return configs.USER_AVATAR_BASE_URL.format(user_id=self.id, avatar_hash=self.avatar_hash)
image_format = configs.ANIMATED_IMAGE_FORMAT if self.is_avatar_animated else configs.IMAGE_FORMAT
return configs.USER_AVATAR_BASE_URL.format(user_id=self.id, avatar_hash=self.avatar_hash, format=image_format)
@property
def is_avatar_animated(self):