如何在不为不同的大写字母添加许多别名的情况下使命令不区分大小写,如下所示:
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
在重写分支上,commands.Bot
接受 case_insensitive
参数
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.
这篇关于如何在 discord.py 中使命令不区分大小写的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!