JSON dump the roles before putting in db

This commit is contained in:
Jeremy Zhang 2018-07-08 20:38:59 +00:00
parent d14f9889eb
commit 7ff8bcdefe

View File

@ -200,7 +200,7 @@ def get_member_roles(guild_id, user_id):
member = discord_api.get_guild_member(guild_id, user_id)
if member["success"]:
roles = list(map(int, member["content"]["roles"]))
member = GuildMembers(guild_id, user_id, member["content"]["user"]["username"], int(member["content"]["user"]["discriminator"]), member["content"].get("nick", None), member["content"]["user"]["avatar"], True, False, roles)
member = GuildMembers(guild_id, user_id, member["content"]["user"]["username"], int(member["content"]["user"]["discriminator"]), member["content"].get("nick", None), member["content"]["user"]["avatar"], True, False, json.dumps(roles))
db.session.add(member)
db.session.commit()
else: