Skip to content

Commit df05a5b

Browse files
committed
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.
1 parent 8c68686 commit df05a5b

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

main.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,8 @@ async def interaction_check(self, interaction: discord.Interaction, /) -> bool:
198198

199199
async def get_prefix(bot: commands.Bot, message: discord.Message) -> str:
200200
settings = await MongoDBHandler.get_settings(message.guild.id)
201-
return settings.get("prefix", bot_config.bot_prefix)
201+
prefix = settings.get("prefix", bot_config.bot_prefix)
202+
return prefix if prefix is not None else ""
202203

203204
# Loading settings and logger
204205
bot_config = Config(func.open_json("settings.json"))

0 commit comments

Comments
 (0)