From 1a9863dc5ed43254a9acb9e1c0127f629d4156d6 Mon Sep 17 00:00:00 2001 From: Xargana Date: Thu, 8 May 2025 21:09:27 +0300 Subject: [PATCH] fixed the message handler ignoring messages, there could still be a problem with commands not working properly --- bot/handlers/message_handler.py | 33 +++++++++++++++------------------ tracked_channels.json | 1 + 2 files changed, 16 insertions(+), 18 deletions(-) create mode 100644 tracked_channels.json diff --git a/bot/handlers/message_handler.py b/bot/handlers/message_handler.py index 0f906cf..1beee69 100644 --- a/bot/handlers/message_handler.py +++ b/bot/handlers/message_handler.py @@ -76,28 +76,25 @@ class MessageHandler: # Skip bot messages if message.author.bot: return - - # Skip command messages (they start with . usually) - if message.content.startswith('.'): - return - - # Look for and replace time patterns - original_content = message.content - modified_content = self.replace_time_patterns(original_content) - # If the content was modified, edit the original message - if modified_content != original_content: - try: - await message.edit(content=modified_content) - except Exception as e: - # If we don't have permission to edit, just ignore - pass - + # Look for and replace time patterns (only for non-command messages) + if not message.content.startswith('.'): + original_content = message.content + modified_content = self.replace_time_patterns(original_content) + + # If the content was modified, edit the original message + if modified_content != original_content: + try: + await message.edit(content=modified_content) + except Exception as e: + # If we don't have permission to edit, just ignore + pass + # Handle special responses for user_id, data in SPECIAL_RESPONSES.items(): if message.author.id == user_id and data["trigger"] in message.content: await message.reply(data["response"]) - + # Handle automatic reactions if message.channel.id in self.bot.horsin: await message.add_reaction("🐴") @@ -111,7 +108,7 @@ class MessageHandler: await message.delete() except: pass - + # Handle DM if in AFK mode if isinstance(message.channel, discord.DMChannel) and message.author != self.bot.user: await self.afk_commands.handle_afk_dm(message) diff --git a/tracked_channels.json b/tracked_channels.json new file mode 100644 index 0000000..0637a08 --- /dev/null +++ b/tracked_channels.json @@ -0,0 +1 @@ +[] \ No newline at end of file