Simplify bot prefix retrieval logic

Removed special handling for bot owner and access users in get_prefix. The function now always returns the configured prefix or the default.
This commit is contained in:
Choco
2025-09-26 13:26:02 +08:00
parent 44b4ba68d1
commit b0bf23ae2a

View File

@@ -207,13 +207,7 @@ class CommandCheck(discord.app_commands.CommandTree):
async def get_prefix(bot: commands.Bot, message: discord.Message) -> str:
settings = await func.get_settings(message.guild.id)
prefix = settings.get("prefix", func.settings.bot_prefix)
# Allow owner to use the bot without a prefix
if prefix and not message.content.startswith(prefix) and (await bot.is_owner(message.author) or message.author.id in func.settings.bot_access_user):
return ""
return prefix
return settings.get("prefix", func.settings.bot_prefix)
# Loading settings and logger
func.settings = Settings(func.open_json("settings.json"))