[safetychecks] channel_ids = [bot_test, testing_the_bot], allowed_role_ids = [huggingfolks_role_id, fellows_role_id, contentcreator_role_id]
Browse files
app.py
CHANGED
@@ -84,9 +84,9 @@ async def safetychecks(ctx):
|
|
84 |
#β
β
check if the command is in the allowed channel(s)
|
85 |
bot_test = 1100458786826747945
|
86 |
testing_the_bot = 1113182673859518514
|
87 |
-
|
88 |
-
if ctx.channel.id
|
89 |
-
print(f"{ctx.author} commands are not permitted in {ctx.channel}")
|
90 |
return False
|
91 |
|
92 |
#β
β
check if the user has the required role(s)
|
@@ -97,6 +97,22 @@ async def safetychecks(ctx):
|
|
97 |
if required_role not in ctx.author.roles:
|
98 |
print(f"Error: {ctx.author} does not have the required role to use that command. ({required_role} is the correct role)")
|
99 |
return False
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
100 |
|
101 |
return True
|
102 |
|
|
|
84 |
#β
β
check if the command is in the allowed channel(s)
|
85 |
bot_test = 1100458786826747945
|
86 |
testing_the_bot = 1113182673859518514
|
87 |
+
channel_ids = [bot_test, testing_the_bot]
|
88 |
+
if ctx.channel.id not in channel_ids:
|
89 |
+
print(f"{ctx.author}, commands are not permitted in {ctx.channel}")
|
90 |
return False
|
91 |
|
92 |
#β
β
check if the user has the required role(s)
|
|
|
97 |
if required_role not in ctx.author.roles:
|
98 |
print(f"Error: {ctx.author} does not have the required role to use that command. ({required_role} is the correct role)")
|
99 |
return False
|
100 |
+
|
101 |
+
|
102 |
+
guild_id = 879548962464493619
|
103 |
+
verified_role_id = 900063512829755413 # @verified = 900063512829755413, HF = 897376942817419265, fellows = 963431900825919498
|
104 |
+
huggingfolks_role_id = 897376942817419265
|
105 |
+
fellows_role_id = 963431900825919498
|
106 |
+
contentcreator_role_id = 928589475968323636
|
107 |
+
|
108 |
+
allowed_role_ids = [huggingfolks_role_id, fellows_role_id, contentcreator_role_id]
|
109 |
+
guild = bot.get_guild(guild_id)
|
110 |
+
user_roles = ctx.author.roles
|
111 |
+
has_allowed_role = any(role.id in allowed_role_ids for role in user_roles)
|
112 |
+
if not has_allowed_role:
|
113 |
+
print(f"Error: {ctx.author} does not have any of the required roles to use that command.")
|
114 |
+
return False
|
115 |
+
|
116 |
|
117 |
return True
|
118 |
|