Gif avatars for user cards

This commit is contained in:
Jeremy Zhang 2018-03-04 08:10:15 +00:00
parent 309d2de7c7
commit aa5a4fa79a
2 changed files with 4 additions and 2 deletions

View File

@ -140,7 +140,7 @@ def get_online_embed_users(guild_id):
'username': usrdb.username,
'nickname': usrdb.nickname,
'discriminator': usrdb.discriminator,
'avatar_url': generate_avatar_url(usrdb.user_id, usrdb.avatar),
'avatar_url': generate_avatar_url(usrdb.user_id, usrdb.avatar, "0000", True),
}
users['authenticated'].append(meta)
return users

View File

@ -95,8 +95,10 @@ def check_user_permission(guild_id, id):
return user_has_permission(guild['permissions'], id) or guild['owner']
return False
def generate_avatar_url(id, av, discrim="0000"):
def generate_avatar_url(id, av, discrim="0000", allow_animate=False):
if av:
if allow_animate && str(av).startswith("a_"):
return avatar_base_url + str(id) + '/' + str(av) + '.gif'
return avatar_base_url + str(id) + '/' + str(av) + '.png'
else:
default_av = [0, 1, 2, 3, 4]