小编典典

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

python

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

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

阅读 190

收藏
2021-01-20

共1个答案

小编典典

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

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

请注意,使用此功能会降低性能。

2021-01-20