如何在Discord.py中使命令不区分大小写

Dex*_*ion 5 python python-3.x discord discord.py

如何使命令不区分大小写,而不为不同的大小写添加许多别名,例如:

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

Pat*_*ugh 19

在重写分支上,commands.Bot接受一个case_insensitive参数

bot = commands.Bot(command_prefix='!', case_insensitive=True)
Run Code Online (Sandbox Code Playgroud)

请注意,使用此功能会造成性能损失。