vanilla
vanilla

Reputation: 79

How to make a discord bot accept multiple prefixes

I am making a bot with multiple commands and for the sake of relevancy I want one command to be used with a + prefix and another one to be used with a ! prefix.

I have a config file with a dictionary that I imported so I could use those to define my prefix.

Here is what my prefix bot thing is:

bot = commands.Bot(command_prefix=BOT['DEFAULT_PREFIX'])

I tried making another prefix in the config file so it has two of them:

'DEFAULT_PREFIX': '+',
'SPECIAL_PREFIX': '!',

I could add a second variable such as client = command.Bot... but I already tried that and the default prefix (+) worked fine being used in my cogs.py but the special prefix (!) didn't work with my report command.

Is it possible to somehow have two available prefixes for commands to use? Or even better, to assign a custom prefix to one decorator? (I have tried doing bot.command(command_prefix='!') but had no luck).

Thanks!

Upvotes: 2

Views: 2578

Answers (1)

BlueBeret
BlueBeret

Reputation: 607

bot = commands.Bot(command_prefix=['first prefix','second prefix'])

Upvotes: 2

Related Questions