Targeting user messages by roles is now possible

This commit is contained in:
Jeremy Zhang 2018-01-16 10:40:27 +00:00
parent 37a992b8b1
commit 10e3d39acf
2 changed files with 4 additions and 1 deletions

View File

@ -164,6 +164,7 @@ class Gateway(Namespace):
usr["color"] = self.get_user_color(guild_id, usr["id"]) usr["color"] = self.get_user_color(guild_id, usr["id"])
if (usr["avatar"]): 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/{}/{}.jpg".format(usr["id"], usr["avatar"])
usr["roles"] = json.loads(member.roles)
usr["stargazer"] = "star" in get_badges(member.user_id) usr["stargazer"] = "star" in get_badges(member.user_id)
else: else:
member = db.session.query(GuildMembers).filter(GuildMembers.guild_id == guild_id, GuildMembers.nickname == name, GuildMembers.discriminator == discriminator).first() member = db.session.query(GuildMembers).filter(GuildMembers.guild_id == guild_id, GuildMembers.nickname == name, GuildMembers.discriminator == discriminator).first()
@ -175,6 +176,7 @@ class Gateway(Namespace):
usr["color"] = self.get_user_color(guild_id, usr["id"]) usr["color"] = self.get_user_color(guild_id, usr["id"])
if (usr["avatar"]): 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/{}/{}.jpg".format(usr["id"], usr["avatar"])
usr["roles"] = json.loads(member.roles)
usr["stargazer"] = "star" in get_badges(member.user_id) usr["stargazer"] = "star" in get_badges(member.user_id)
emit("lookup_user_info", usr) emit("lookup_user_info", usr)
self.teardown_db_session() self.teardown_db_session()

View File

@ -1200,9 +1200,10 @@
parent.find(".chatusername").addClass("stargazer"); parent.find(".chatusername").addClass("stargazer");
} }
if (usr.avatar_url) { if (usr.avatar_url) {
parent.attr("discord_userid", usr.id);
parent.find(".authoravatar").prop("src", usr.avatar_url); parent.find(".authoravatar").prop("src", usr.avatar_url);
} }
parent.attr("discord_userid", usr.id);
parent.attr("discord_userroles", usr.roles.join(" "));
} }
collapse_messages(); collapse_messages();
} }