Discord.py 更改命令名称而不更改函数名称

时间:2021-06-24 20:06:04

标签: python discord.py

我有这个,有点用

@commands.command(aliases=['8ball'])
    async def _8ball(self, ctx):
        foo()

除了当我运行 help 命令时,它会告诉函数名称 (_8ball)

所以我想要的是用“8ball”而不是“_8ball”来称呼它,并在帮助中显示“8ball”而不是“_8ball”

1 个答案:

答案 0 :(得分:0)

name 关键字参数传递给装饰器

@bot.command(name="8ball")
async def _8ball(self, ctx):
    ...