fhefueh
This commit is contained in:
parent
a0d13b643b
commit
9d13ff3850
@ -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, [])
|
||||
|
6
main.py
6
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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user