From 26c0e7444fcb68a2ff08661d6eeb0e771450c797 Mon Sep 17 00:00:00 2001 From: Jeremy Zhang Date: Wed, 9 Aug 2017 04:40:12 +0000 Subject: [PATCH] Fixes #30, member list hoisting, hopefully. --- webapp/titanembeds/blueprints/api/api.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/webapp/titanembeds/blueprints/api/api.py b/webapp/titanembeds/blueprints/api/api.py index 43918ff..c796a73 100644 --- a/webapp/titanembeds/blueprints/api/api.py +++ b/webapp/titanembeds/blueprints/api/api.py @@ -262,10 +262,14 @@ def get_online_discord_users(guild_id, embed): member["hoist-role"] = None member["color"] = None if apimem: - for roleid in reversed(apimem["roles"]): + mem_roles = [] + for roleid in apimem["roles"]: role = guildroles_filtered.get(roleid) if not role: continue + mem_roles.append(role) + mem_roles = sorted(mem_roles, key=lambda k: k['position']) + for role in mem_roles: if role["color"] != 0: member["color"] = '{0:02x}'.format(role["color"]) #int to hex if role["hoist"]: