Add authencated user ban check

This commit is contained in:
Jeremy Zhang 2017-03-26 02:13:08 -07:00
parent 21bff1d6ac
commit 11996427fa
2 changed files with 10 additions and 1 deletions

View File

@ -36,7 +36,11 @@ def checkUserBanned(guild_id, ip_address=None):
if usr.lifter_id is not None: if usr.lifter_id is not None:
banned = False banned = False
else: else:
pass #todo: handle authenticated user banned status banned = False
bans = discord_api(guild_id)
for user in bans:
if session['user_id'] == user['id']:
return True
return banned return banned
def check_guild_existance(guild_id): def check_guild_existance(guild_id):

View File

@ -140,6 +140,11 @@ class DiscordREST:
r = self.request("PATCH", _endpoint, data=kwargs, json=True) r = self.request("PATCH", _endpoint, data=kwargs, json=True)
return r return r
def get_guild_bans(self, guild_id):
_endpoint = "/guilds/{guild_id}/embed".format(guild_id=guild_id)
r = self.request("GET", _endpoint)
return r
##################### #####################
# User # User
##################### #####################