From c0f11b96e6f3cc0f651ec5ef2021899ae196bfec Mon Sep 17 00:00:00 2001 From: Sweetbread Date: Mon, 15 May 2023 20:19:03 +0300 Subject: [PATCH] [fix]: Disable commands in channels w/o permissions --- bot.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/bot.py b/bot.py index 1f49216..21af984 100644 --- a/bot.py +++ b/bot.py @@ -451,4 +451,12 @@ async def change_prefix(ctx, prefix): dump(prefs, f) +async def check(itr: discord.Interaction): + if not itr.channel.permissions_for(itr.guild.me).send_messages: + await itr.response.send_message("Commands are not allowed here", ephemeral=True) + return False + return True + +bot.tree.interaction_check = check + bot.run(TOKEN)