Update checks.py

This commit is contained in:
Elmon11 2021-01-07 20:09:07 +01:00 committed by GitHub
parent 5abf2c40c0
commit 41b36be7a3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,30 +1,7 @@
from discord.ext import commands from discord.ext import commands
server_liaison = 769659653096472634
event_host = 769659653096472629
server_banned = 769659653096472636
senior_admin = 769659653129896016
admin = 769659653121900553
master_builder = 769659653121900550
reports_channel_id = 769659654791233585
archived_reports_channel_id = 769659655033978900
guild_id = 769659653096472627
mentions_channel_id = 769659654027739151
discord_admin = 769659653129896025
discord_mod = 769659653129896023
devs = [114348811995840515, 147765181903011840]
bot_logs_channel_id = 771391406609662013
executive = 769659653129896019
asst_exec = 769659653129896018
developer = 769659653129896017
creative_designer = 771748500576141332
master_builder = 769659653121900550
server_chat = 769843495045169163
verification_role = 769925060412309524
server_chat_2 = 793632795598913546
class NoPermission(commands.MissingPermissions):
class no_permission(commands.MissingPermissions):
pass pass
@ -32,10 +9,10 @@ def is_staff():
def predicate(ctx): def predicate(ctx):
user = ctx.message.author user = ctx.message.author
for role in user.roles: for role in user.roles:
if role.id in [admin, senior_admin]: if role.id in [ctx.bot.admin, ctx.bot.senior_admin]:
return True return True
else: else:
raise no_permission(['IS_STAFF_MEMBER']) raise NoPermission(['IS_STAFF_MEMBER'])
return commands.check(predicate) return commands.check(predicate)
@ -43,10 +20,10 @@ def is_staff():
def is_dev(): def is_dev():
def predicate(ctx): def predicate(ctx):
user = ctx.message.author user = ctx.message.author
if user.id in devs: if user.id in ctx.bot.devs:
return True return True
else: else:
raise no_permission(['BOT_DEVELOPER']) raise NoPermission(['BOT_DEVELOPER'])
return commands.check(predicate) return commands.check(predicate)
@ -55,10 +32,10 @@ def is_mod_or_has_perms(**permissions):
def predicate(ctx): def predicate(ctx):
user = ctx.message.author user = ctx.message.author
for role in user.roles: for role in user.roles:
if role.id in [discord_mod, discord_admin] or permissions: if role.id in [ctx.bot.discord_mod, ctx.bot.discord_admin] or permissions:
return True return True
else: else:
raise no_permission(['IS_MOD_OR_HAS_PERMS']) raise NoPermission(['IS_MOD_OR_HAS_PERMS'])
return commands.check(predicate) return commands.check(predicate)
@ -67,10 +44,10 @@ def is_executive():
def predicate(ctx): def predicate(ctx):
user = ctx.message.author user = ctx.message.author
for role in user.roles: for role in user.roles:
if role.id in [executive, asst_exec]: if role.id in [ctx.bot.executive, ctx.bot.asst_exec]:
return True return True
else: else:
raise no_permission(['IS_EXECUTIVE']) raise NoPermission(['IS_EXECUTIVE'])
return commands.check(predicate) return commands.check(predicate)
@ -79,10 +56,10 @@ def is_tf_developer():
def predicate(ctx): def predicate(ctx):
user = ctx.message.author user = ctx.message.author
for role in user.roles: for role in user.roles:
if role.id == developer: if role.id == ctx.bot.developer:
return True return True
else: else:
raise no_permission(['IS_TOTALFREEDOM_DEVELOPER']) raise NoPermission(['IS_TOTALFREEDOM_DEVELOPER'])
return commands.check(predicate) return commands.check(predicate)
@ -91,10 +68,10 @@ def is_liaison():
def predicate(ctx): def predicate(ctx):
user = ctx.message.author user = ctx.message.author
for role in user.roles: for role in user.roles:
if role.id == server_liaison: if role.id == ctx.bot.server_liaison:
return True return True
else: else:
raise no_permission(['IS_SERVER_LIAISON']) raise NoPermission(['IS_SERVER_LIAISON'])
return commands.check(predicate) return commands.check(predicate)
@ -103,10 +80,10 @@ def is_creative_designer():
def predicate(ctx): def predicate(ctx):
user = ctx.message.author user = ctx.message.author
for role in user.roles: for role in user.roles:
if role.id == creative_designer: if role.id == ctx.bot.creative_designer:
return True return True
else: else:
raise no_permission(['IS_CREATIVE_DESIGNER']) raise NoPermission(['IS_CREATIVE_DESIGNER'])
return commands.check(predicate) return commands.check(predicate)
@ -115,9 +92,9 @@ def is_senior():
def predicate(ctx): def predicate(ctx):
user = ctx.message.author user = ctx.message.author
for role in user.roles: for role in user.roles:
if role.id == senior_admin: if role.id == ctx.bot.senior_admin:
return True return True
else: else:
raise no_permission(['IS_SENIOR_ADMIN']) raise NoPermission(['IS_SENIOR_ADMIN'])
return commands.check(predicate) return commands.check(predicate)