Bugfix usercard animations not showing

This commit is contained in:
Jeremy Zhang 2018-03-04 08:18:21 +00:00
parent bd7e1419d7
commit 11b6e447ae
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, "0000", True),
'avatar_url': generate_avatar_url(usrdb.user_id, usrdb.avatar),
}
users['authenticated'].append(meta)
return users
@ -469,7 +469,7 @@ def user_info(guild_id, user_id):
usr["nickname"] = member.nickname
usr["discriminator"] = member.discriminator
usr["avatar"] = member.avatar
usr["avatar_url"] = generate_avatar_url(usr["id"], usr["avatar"], usr["discriminator"])
usr["avatar_url"] = generate_avatar_url(usr["id"], usr["avatar"], usr["discriminator"], True)
roles = get_member_roles(guild_id, user_id)
dbguild = db.session.query(Guilds).filter(Guilds.guild_id == guild_id).first()
guild_roles = json.loads(dbguild.roles)

View File

@ -97,6 +97,8 @@ def check_user_permission(guild_id, id):
def generate_avatar_url(id, av, discrim="0000", allow_animate=False):
if av:
print(allow_animate)
print(str(av).startswith("a_"))
if allow_animate and str(av).startswith("a_"):
return avatar_base_url + str(id) + '/' + str(av) + '.gif'
return avatar_base_url + str(id) + '/' + str(av) + '.png'