mirror of
https://github.com/TitanEmbeds/Titan.git
synced 2025-01-24 21:08:28 +01:00
Add checks for authenticated users revocation status
This commit is contained in:
parent
11996427fa
commit
4a09678a8d
@ -22,7 +22,12 @@ def checkUserRevoke(guild_id, user_key=None):
|
|||||||
dbUser = UnauthenticatedUsers.query.filter(and_(UnauthenticatedUsers.guild_id == guild_id, UnauthenticatedUsers.user_key == user_key)).first()
|
dbUser = UnauthenticatedUsers.query.filter(and_(UnauthenticatedUsers.guild_id == guild_id, UnauthenticatedUsers.user_key == user_key)).first()
|
||||||
revoked = dbUser.isRevoked()
|
revoked = dbUser.isRevoked()
|
||||||
else:
|
else:
|
||||||
pass # Todo: handle authenticated user revocation status
|
banned = checkUserBanned(guild_id)
|
||||||
|
if banned:
|
||||||
|
return revoked
|
||||||
|
member = discord_api.get_guild_member(guild_id, session['user_id'])
|
||||||
|
if member['code'] == 200:
|
||||||
|
revoked = True
|
||||||
return revoked
|
return revoked
|
||||||
|
|
||||||
def checkUserBanned(guild_id, ip_address=None):
|
def checkUserBanned(guild_id, ip_address=None):
|
||||||
@ -37,7 +42,7 @@ def checkUserBanned(guild_id, ip_address=None):
|
|||||||
banned = False
|
banned = False
|
||||||
else:
|
else:
|
||||||
banned = False
|
banned = False
|
||||||
bans = discord_api(guild_id)
|
bans = discord_api.get_guild_bans(guild_id)['content']
|
||||||
for user in bans:
|
for user in bans:
|
||||||
if session['user_id'] == user['id']:
|
if session['user_id'] == user['id']:
|
||||||
return True
|
return True
|
||||||
@ -47,7 +52,7 @@ def check_guild_existance(guild_id):
|
|||||||
dbGuild = Guilds.query.filter_by(guild_id=guild_id).first()
|
dbGuild = Guilds.query.filter_by(guild_id=guild_id).first()
|
||||||
if not dbGuild:
|
if not dbGuild:
|
||||||
return False
|
return False
|
||||||
guilds = discord_api.get_all_guilds()
|
guilds = discord_api.get_all_guilds()['content']
|
||||||
for guild in guilds:
|
for guild in guilds:
|
||||||
if guild_id == guild['id']:
|
if guild_id == guild['id']:
|
||||||
return True
|
return True
|
||||||
|
Loading…
Reference in New Issue
Block a user