Sanity check in case add member fails

This commit is contained in:
Jeremy Zhang 2017-09-17 23:41:08 +00:00
parent dfd974db53
commit a9a261634a

View File

@ -388,7 +388,9 @@ def create_authenticated_user():
abort(404) abort(404)
if not checkUserBanned(guild_id): if not checkUserBanned(guild_id):
if not check_user_in_guild(guild_id): if not check_user_in_guild(guild_id):
discord_api.add_guild_member(guild_id, session['user_id'], session['user_keys']['access_token']) add_member = discord_api.add_guild_member(guild_id, session['user_id'], session['user_keys']['access_token'])
if not add_member["success"]:
abort(403)
db_user = db.session.query(AuthenticatedUsers).filter(and_(AuthenticatedUsers.guild_id == guild_id, AuthenticatedUsers.client_id == session['user_id'])).first() db_user = db.session.query(AuthenticatedUsers).filter(and_(AuthenticatedUsers.guild_id == guild_id, AuthenticatedUsers.client_id == session['user_id'])).first()
if not db_user: if not db_user:
db_user = AuthenticatedUsers(guild_id, session['user_id']) db_user = AuthenticatedUsers(guild_id, session['user_id'])