From 41b36be7a33e4f89f0062efe40cccb3f2a823f0e Mon Sep 17 00:00:00 2001 From: Elmon11 Date: Thu, 7 Jan 2021 20:09:07 +0100 Subject: [PATCH] Update checks.py --- checks.py | 57 +++++++++++++++++-------------------------------------- 1 file changed, 17 insertions(+), 40 deletions(-) diff --git a/checks.py b/checks.py index 9153dce..ceedc03 100644 --- a/checks.py +++ b/checks.py @@ -1,30 +1,7 @@ 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 no_permission(commands.MissingPermissions): +class NoPermission(commands.MissingPermissions): pass @@ -32,10 +9,10 @@ def is_staff(): def predicate(ctx): user = ctx.message.author 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 else: - raise no_permission(['IS_STAFF_MEMBER']) + raise NoPermission(['IS_STAFF_MEMBER']) return commands.check(predicate) @@ -43,10 +20,10 @@ def is_staff(): def is_dev(): def predicate(ctx): user = ctx.message.author - if user.id in devs: + if user.id in ctx.bot.devs: return True else: - raise no_permission(['BOT_DEVELOPER']) + raise NoPermission(['BOT_DEVELOPER']) return commands.check(predicate) @@ -55,10 +32,10 @@ def is_mod_or_has_perms(**permissions): def predicate(ctx): user = ctx.message.author 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 else: - raise no_permission(['IS_MOD_OR_HAS_PERMS']) + raise NoPermission(['IS_MOD_OR_HAS_PERMS']) return commands.check(predicate) @@ -67,10 +44,10 @@ def is_executive(): def predicate(ctx): user = ctx.message.author 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 else: - raise no_permission(['IS_EXECUTIVE']) + raise NoPermission(['IS_EXECUTIVE']) return commands.check(predicate) @@ -79,10 +56,10 @@ def is_tf_developer(): def predicate(ctx): user = ctx.message.author for role in user.roles: - if role.id == developer: + if role.id == ctx.bot.developer: return True else: - raise no_permission(['IS_TOTALFREEDOM_DEVELOPER']) + raise NoPermission(['IS_TOTALFREEDOM_DEVELOPER']) return commands.check(predicate) @@ -91,10 +68,10 @@ def is_liaison(): def predicate(ctx): user = ctx.message.author for role in user.roles: - if role.id == server_liaison: + if role.id == ctx.bot.server_liaison: return True else: - raise no_permission(['IS_SERVER_LIAISON']) + raise NoPermission(['IS_SERVER_LIAISON']) return commands.check(predicate) @@ -103,10 +80,10 @@ def is_creative_designer(): def predicate(ctx): user = ctx.message.author for role in user.roles: - if role.id == creative_designer: + if role.id == ctx.bot.creative_designer: return True else: - raise no_permission(['IS_CREATIVE_DESIGNER']) + raise NoPermission(['IS_CREATIVE_DESIGNER']) return commands.check(predicate) @@ -115,9 +92,9 @@ def is_senior(): def predicate(ctx): user = ctx.message.author for role in user.roles: - if role.id == senior_admin: + if role.id == ctx.bot.senior_admin: return True else: - raise no_permission(['IS_SENIOR_ADMIN']) + raise NoPermission(['IS_SENIOR_ADMIN']) return commands.check(predicate)