Add user to guild first

Might fix the authed discord user feature...
This commit is contained in:
Jeremy "EndenDragon" Zhang 2017-05-13 14:27:47 -07:00 committed by GitHub
parent ddd9a2916a
commit b0acab060a

View File

@ -398,13 +398,13 @@ def create_authenticated_user():
if not check_guild_existance(guild_id):
abort(404)
if not checkUserBanned(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'])
db_user = db.session.query(AuthenticatedUsers).filter(and_(AuthenticatedUsers.guild_id == guild_id, AuthenticatedUsers.client_id == session['user_id'])).first()
if not db_user:
db_user = AuthenticatedUsers(guild_id, session['user_id'])
db.session.add(db_user)
db.session.commit()
if not check_user_in_guild(guild_id):
discord_api.add_guild_member(guild_id, session['user_id'], session['user_keys']['access_token'])
status = update_user_status(guild_id, session['username'])
return jsonify(status=status)
else: