Handle None prefix in get_prefix function

Ensures that get_prefix returns an empty string if the prefix is None, preventing potential issues with command parsing when no prefix is set in the settings.
This commit is contained in:
Choco
2025-10-04 22:48:14 +08:00
parent 8c68686497
commit df05a5b1bd

View File

@@ -198,7 +198,8 @@ class CommandCheck(discord.app_commands.CommandTree):
async def get_prefix(bot: commands.Bot, message: discord.Message) -> str:
settings = await MongoDBHandler.get_settings(message.guild.id)
return settings.get("prefix", bot_config.bot_prefix)
prefix = settings.get("prefix", bot_config.bot_prefix)
return prefix if prefix is not None else ""
# Loading settings and logger
bot_config = Config(func.open_json("settings.json"))