fixed the message handler ignoring messages, there could still be a problem with commands not working properly

This commit is contained in:
Xargana 2025-05-08 21:09:27 +03:00
parent ff4418f834
commit 1a9863dc5e
2 changed files with 16 additions and 18 deletions

View file

@ -76,28 +76,25 @@ class MessageHandler:
# Skip bot messages # Skip bot messages
if message.author.bot: if message.author.bot:
return 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 # Look for and replace time patterns (only for non-command messages)
if modified_content != original_content: if not message.content.startswith('.'):
try: original_content = message.content
await message.edit(content=modified_content) modified_content = self.replace_time_patterns(original_content)
except Exception as e:
# If we don't have permission to edit, just ignore # If the content was modified, edit the original message
pass 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 # Handle special responses
for user_id, data in SPECIAL_RESPONSES.items(): for user_id, data in SPECIAL_RESPONSES.items():
if message.author.id == user_id and data["trigger"] in message.content: if message.author.id == user_id and data["trigger"] in message.content:
await message.reply(data["response"]) await message.reply(data["response"])
# Handle automatic reactions # Handle automatic reactions
if message.channel.id in self.bot.horsin: if message.channel.id in self.bot.horsin:
await message.add_reaction("🐴") await message.add_reaction("🐴")
@ -111,7 +108,7 @@ class MessageHandler:
await message.delete() await message.delete()
except: except:
pass pass
# Handle DM if in AFK mode # Handle DM if in AFK mode
if isinstance(message.channel, discord.DMChannel) and message.author != self.bot.user: if isinstance(message.channel, discord.DMChannel) and message.author != self.bot.user:
await self.afk_commands.handle_afk_dm(message) await self.afk_commands.handle_afk_dm(message)

1
tracked_channels.json Normal file
View file

@ -0,0 +1 @@
[]