[safetychecks] added thread error messages
Browse files
app.py
CHANGED
@@ -78,8 +78,10 @@ async def safetychecks(ctx):
|
|
78 |
offline_bot_role_id = 1103676632667017266
|
79 |
bot_member = ctx.guild.get_member(bot.user.id)
|
80 |
if any(role.id == offline_bot_role_id for role in bot_member.roles):
|
81 |
-
print(f"Error: {ctx.author} The bot is offline or under maintenance. (Remove the offline-bot role to bring it online)")
|
82 |
-
|
|
|
|
|
83 |
|
84 |
#β
β
check if the command is in the allowed channel(s)
|
85 |
bot_test = 1100458786826747945
|
@@ -87,6 +89,8 @@ async def safetychecks(ctx):
|
|
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)
|
@@ -103,6 +107,8 @@ async def safetychecks(ctx):
|
|
103 |
has_allowed_role = any(role.id in allowed_role_ids for role in user_roles)
|
104 |
if not has_allowed_role:
|
105 |
print(f"Error: {ctx.author} does not have any of the required roles to use that command.")
|
|
|
|
|
106 |
return False
|
107 |
|
108 |
|
|
|
78 |
offline_bot_role_id = 1103676632667017266
|
79 |
bot_member = ctx.guild.get_member(bot.user.id)
|
80 |
if any(role.id == offline_bot_role_id for role in bot_member.roles):
|
81 |
+
print(f"Error: {ctx.author} The bot is offline or under maintenance. (Remove the offline-bot role to bring it online)")
|
82 |
+
thread = await ctx.message.create_thread(name=f'{ctx.author} Offline Error')
|
83 |
+
await thread.send(f"Error: {ctx.author.mention} The bot is offline or under maintenance. (Remove the offline-bot role to bring it online)")
|
84 |
+
return False
|
85 |
|
86 |
#β
β
check if the command is in the allowed channel(s)
|
87 |
bot_test = 1100458786826747945
|
|
|
89 |
channel_ids = [bot_test, testing_the_bot]
|
90 |
if ctx.channel.id not in channel_ids:
|
91 |
print(f"{ctx.author}, commands are not permitted in {ctx.channel}")
|
92 |
+
thread = await ctx.message.create_thread(name=f'{ctx.author} Channel Error')
|
93 |
+
await thread.send(f"Error: {ctx.author.mention} commands are not permitted in {ctx.channel}")
|
94 |
return False
|
95 |
|
96 |
#β
β
check if the user has the required role(s)
|
|
|
107 |
has_allowed_role = any(role.id in allowed_role_ids for role in user_roles)
|
108 |
if not has_allowed_role:
|
109 |
print(f"Error: {ctx.author} does not have any of the required roles to use that command.")
|
110 |
+
thread = await ctx.message.create_thread(name=f'{ctx.author} Perms Error')
|
111 |
+
await thread.send(f"Error: {ctx.author.mention} does not have any of the required roles to use that command.")
|
112 |
return False
|
113 |
|
114 |
|