From 9b1fd2f315faebeb872c61081f7d168c38a7a47a Mon Sep 17 00:00:00 2001 From: Uwe Pfeifer Date: Wed, 7 May 2025 10:03:58 +0200 Subject: [PATCH] Added possibility to define multiple prefixes --- pybot-f.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/pybot-f.py b/pybot-f.py index ca639c0..c073fe5 100644 --- a/pybot-f.py +++ b/pybot-f.py @@ -45,11 +45,20 @@ config.read('bot.ini') bottoken = config['General']['bottoken'] -botprefix = config['General']['botprefix'] +botprefixes = config['General']['botprefixes'] + + +def get_prefixes(bot, message): + """ + For setting the bots prefixes in addition to mentions. + """ + + prefixes = botprefixes # Can be a list of strings + return commands.when_mentioned_or(*prefixes)(bot, message) # Setting up commands.Bot -bot = commands.Bot(command_prefix=botprefix, description=description, intents=intents) +bot = commands.Bot(command_prefix=get_prefixes, description=description, intents=intents) @bot.event