This commit is contained in:
Slipstream 2025-05-13 11:59:59 -06:00
parent a0d13b643b
commit 9d13ff3850
Signed by: slipstream
GPG Key ID: 13E498CE010AC6FD
2 changed files with 17 additions and 4 deletions

View File

@ -53,7 +53,20 @@ class TetoCog(commands.Cog):
return return
# Check if the bot was mentioned or replied to # 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 channel = message.channel
convo_key = channel.id convo_key = channel.id
convo = _teto_conversations.get(convo_key, []) convo = _teto_conversations.get(convo_key, [])

View File

@ -47,14 +47,14 @@ CORE_COGS = {'SettingsCog', 'HelpCog'} # Cogs that cannot be disabled
# --- Dynamic Prefix Function --- # --- Dynamic Prefix Function ---
async def get_prefix(bot_instance, message): 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: if not message.guild:
# Use default prefix in DMs # 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) # Fetch prefix from settings manager (cache first, then DB)
prefix = await settings_manager.get_guild_prefix(message.guild.id, DEFAULT_PREFIX) 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 --- # --- Bot Setup ---
# Set up intents (permissions) # Set up intents (permissions)