Added possibility to define multiple prefixes

This commit is contained in:
Uwe Pfeifer 2025-05-07 10:03:58 +02:00
parent 212e10d9a7
commit 9b1fd2f315

View file

@ -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