From ff401271e65999f156255baba842f4d6a7b75ca2 Mon Sep 17 00:00:00 2001 From: Jeremy Zhang Date: Sat, 17 Feb 2018 04:27:21 +0000 Subject: [PATCH] Avatar handling with png, not jpg --- webapp/titanembeds/blueprints/gateway/gateway.py | 4 ++-- webapp/titanembeds/oauth.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/webapp/titanembeds/blueprints/gateway/gateway.py b/webapp/titanembeds/blueprints/gateway/gateway.py index f38ad10..1628166 100644 --- a/webapp/titanembeds/blueprints/gateway/gateway.py +++ b/webapp/titanembeds/blueprints/gateway/gateway.py @@ -168,7 +168,7 @@ class Gateway(Namespace): usr["avatar"] = member.avatar usr["color"] = self.get_user_color(guild_id, usr["id"]) if (usr["avatar"]): - usr["avatar_url"] = "https://cdn.discordapp.com/avatars/{}/{}.jpg".format(usr["id"], usr["avatar"]) + usr["avatar_url"] = "https://cdn.discordapp.com/avatars/{}/{}.png".format(usr["id"], usr["avatar"]) usr["roles"] = json.loads(member.roles) usr["stargazer"] = "star" in get_badges(member.user_id) else: @@ -180,7 +180,7 @@ class Gateway(Namespace): usr["avatar"] = member.avatar usr["color"] = self.get_user_color(guild_id, usr["id"]) if (usr["avatar"]): - usr["avatar_url"] = "https://cdn.discordapp.com/avatars/{}/{}.jpg".format(usr["id"], usr["avatar"]) + usr["avatar_url"] = "https://cdn.discordapp.com/avatars/{}/{}.png".format(usr["id"], usr["avatar"]) usr["roles"] = json.loads(member.roles) usr["stargazer"] = "star" in get_badges(member.user_id) emit("lookup_user_info", usr) diff --git a/webapp/titanembeds/oauth.py b/webapp/titanembeds/oauth.py index 18468ff..a6f121b 100644 --- a/webapp/titanembeds/oauth.py +++ b/webapp/titanembeds/oauth.py @@ -97,14 +97,14 @@ def check_user_permission(guild_id, id): def generate_avatar_url(id, av, discrim="0000"): if av: - return avatar_base_url + str(id) + '/' + str(av) + '.jpg' + return avatar_base_url + str(id) + '/' + str(av) + '.png' else: default_av = [0, 1, 2, 3, 4] discrim = int(discrim) return "https://cdn.discordapp.com/embed/avatars/{}.png".format(default_av[int(discrim) % len(default_av)]) def generate_guild_icon_url(id, hash): - return guild_icon_url + str(id) + "/" + str(hash) + ".jpg" + return guild_icon_url + str(id) + "/" + str(hash) + ".png" def generate_bot_invite_url(guild_id): url = "https://discordapp.com/oauth2/authorize?&client_id={}&scope=bot&permissions={}&guild_id={}".format(config['client-id'], '641195117', guild_id)