Fixed the prefix checking logic to properly handle multiple prefixes

Commands will now work correctly during initialization
Video processing features still wait for full initialization
Properly handle both single string and list prefixes
This commit is contained in:
pacnpal
2024-11-16 00:42:31 +00:00
parent 18b5d305f3
commit 46250b14d0

View File

@@ -43,8 +43,13 @@ def setup_events(cog: "VideoArchiver") -> None:
if message.guild is None or message.author.bot: if message.guild is None or message.author.bot:
return return
# Check if this is a command - if so, let it process normally # Check if this is a command by checking against all possible prefixes
if message.content.startswith(await cog.bot.get_prefix(message)): prefixes = await cog.bot.get_prefix(message)
if isinstance(prefixes, str):
prefixes = [prefixes]
# Check if message starts with any of the prefixes
if any(message.content.startswith(prefix) for prefix in prefixes):
return return
# Only process videos if initialization is complete # Only process videos if initialization is complete