From 5d1add7554eba8b278c1273cd65967f69f79e8ad Mon Sep 17 00:00:00 2001 From: lifehackerhansol Date: Fri, 12 May 2023 09:15:43 -0700 Subject: [PATCH] events: ban commands from being sent in kurisu-development --- cogs/events.py | 7 +++++++ kurisu.py | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/cogs/events.py b/cogs/events.py index 15702b953..1b3772c34 100644 --- a/cogs/events.py +++ b/cogs/events.py @@ -424,6 +424,13 @@ async def on_message(self, message: discord.Message): self.bot.loop.create_task(self.user_ping_check(message)) self.bot.loop.create_task(self.user_spam_check(message)) self.bot.loop.create_task(self.channel_spam_check(message)) + # check if message is a command and/or if message was sent in kurisu-dev + ctx = await self.bot.get_context(message) + if ctx.valid and message.channel == self.bot.channels['kurisu-development']: + # if so, shut them up + await message.delete() + await message.channel.send(f"{message.author.mention} Please use {self.bot.channels['bot-cmds'].mention} for commands.", delete_after=10) + return @commands.Cog.listener() async def on_message_edit(self, message_before: discord.Message, message_after: discord.Message): diff --git a/kurisu.py b/kurisu.py index f59472ebd..411cac559 100644 --- a/kurisu.py +++ b/kurisu.py @@ -266,7 +266,7 @@ async def load_channels(self): 'switch-assistance-1', 'switch-assistance-2', 'helpers', 'watch-logs', 'message-logs', 'upload-logs', 'hacking-general', 'meta', 'appeals', 'legacy-systems', 'dev', 'off-topic', 'voice-and-music', 'bot-cmds', 'bot-talk', 'mods', 'mod-mail', 'mod-logs', 'server-logs', 'bot-err', - 'elsewhere', 'newcomers', 'nintendo-discussion', 'tech-talk', 'hardware', 'streaming-gamer'] + 'elsewhere', 'newcomers', 'nintendo-discussion', 'tech-talk', 'hardware', 'streaming-gamer', 'kurisu-development'] for n in channels: db_channel = await self.configuration.get_channel_by_name(n)