From 84c528b75163a59a13960c8736d77d0fa8117f76 Mon Sep 17 00:00:00 2001 From: The0Mikkel Date: Tue, 28 May 2024 01:09:52 +0200 Subject: [PATCH] fix(chat): do not respond with llm in private messages --- bot.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/bot.py b/bot.py index 5f04523..cac9fb3 100644 --- a/bot.py +++ b/bot.py @@ -89,7 +89,7 @@ class Bot: async def on_message(self, message): if not self.ready: return - + string_channel_id = str(message.channel.id) if self.discord.user == message.author: @@ -108,7 +108,14 @@ class Bot: content = message.content.replace(f'<@{self.discord.user.id}>', self.bot_name.title()).strip() if not content: return - + + # Do not respond with llm in private messages + if isinstance(message.channel, discord.DMChannel): + response = DiscordResponse(message) + await response.write(message, 'I am sorry, I am unable to respond in private messages.') + return + + # Admin commands if content == 'RESET' and str(message.author.id) == self.admin_id: await self.flush_channel(str(message.channel.id)) logging.info('Chat reset by admin in guild %s', message.channel.guild.name)