From 9d13ff3850f48581b4bc1ed17a50681f1dd25304 Mon Sep 17 00:00:00 2001 From: Slipstream Date: Tue, 13 May 2025 11:59:59 -0600 Subject: [PATCH] fhefueh --- cogs/teto_cog.py | 15 ++++++++++++++- main.py | 6 +++--- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/cogs/teto_cog.py b/cogs/teto_cog.py index bdbb359..0979600 100644 --- a/cogs/teto_cog.py +++ b/cogs/teto_cog.py @@ -53,7 +53,20 @@ class TetoCog(commands.Cog): return # Check if the bot was mentioned or replied to - if (self.bot.user in message.mentions) or (message.reference and getattr(message.reference.resolved, "author", None) == self.bot.user): + # Remove all bot mention prefixes from the message content for prefix check + content_wo_mentions = message.content + for mention in message.mentions: + mention_str = f"<@{mention.id}>" + mention_nick_str = f"<@!{mention.id}>" + content_wo_mentions = content_wo_mentions.replace(mention_str, "").replace(mention_nick_str, "") + content_wo_mentions = content_wo_mentions.strip() + + if ( + self.bot.user in message.mentions + and not content_wo_mentions.startswith(tuple(self.bot.command_prefix)) + ) or ( + message.reference and getattr(message.reference.resolved, "author", None) == self.bot.user + ): channel = message.channel convo_key = channel.id convo = _teto_conversations.get(convo_key, []) diff --git a/main.py b/main.py index 357b698..cd00f9d 100644 --- a/main.py +++ b/main.py @@ -47,14 +47,14 @@ CORE_COGS = {'SettingsCog', 'HelpCog'} # Cogs that cannot be disabled # --- Dynamic Prefix Function --- async def get_prefix(bot_instance, message): - """Determines the command prefix based on guild settings or default.""" + """Determines the command prefix based on guild settings or default, but disables mention as prefix.""" if not message.guild: # Use default prefix in DMs - return commands.when_mentioned_or(DEFAULT_PREFIX)(bot_instance, message) + return DEFAULT_PREFIX # Fetch prefix from settings manager (cache first, then DB) prefix = await settings_manager.get_guild_prefix(message.guild.id, DEFAULT_PREFIX) - return commands.when_mentioned_or(prefix)(bot_instance, message) + return prefix # --- Bot Setup --- # Set up intents (permissions)