From 2ddf4ad55c73520e15ff48e677b21fb783b186f7 Mon Sep 17 00:00:00 2001 From: Choco <94597336+ChocoMeow@users.noreply.github.com> Date: Sun, 27 Oct 2024 21:47:43 +0800 Subject: [PATCH] Allowed owner to use the bot without a prefix --- main.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index 25647e9..38495a0 100644 --- a/main.py +++ b/main.py @@ -139,9 +139,15 @@ class CommandCheck(discord.app_commands.CommandTree): return True -async def get_prefix(bot, message: discord.Message): +async def get_prefix(bot: commands.Bot, message: discord.Message) -> str: settings = await func.get_settings(message.guild.id) - return settings.get("prefix", func.settings.bot_prefix) + prefix = settings.get("prefix", func.settings.bot_prefix) + + # Allow owner to use the bot without a prefix + if await bot.is_owner(message.author) and not message.content.startswith(prefix): + return "" + + return prefix # Loading settings and logger func.settings = Settings(func.open_json("settings.json"))