Skip to content
Advertisement

How to make a command case insensitive in discord.py

How would one make a command case-insensitive without adding many aliases for different capitalizations like this:

@bot.command(pass_context = True, name = 'test', aliases=['Test', 'tEst', 'teSt', 'tesT', 'TEst', 'TeSt', 'TesT', 'tESt', 'tEsT'])
async def test(self, ctx):
    #do stuff      

Advertisement

Answer

On the rewrite branch, commands.Bot accepts a case_insensitive parameter

bot = commands.Bot(command_prefix='!', case_insensitive=True)

Note that there is a performance loss when using this feature.

Advertisement