首页 > 解决方案 > 如何给命令多个名称?

问题描述

我有一个命令:

@bot.command(pass_context=True)
async def hellothere(ctx):
   await Bot.say("Hello {}".format(ctx.message.author))

我想复制这个更短的命令。

我试过了:

@bot.command(pass_context=True)
async def hello(ctx):
   hellothere(ctx)

但我收到一个错误,指出Command不可调用。

有谁知道如何做到这一点?

标签: pythondiscorddiscord.py

解决方案


@client.command(pass_context = True , aliases=['purge', 'clean', 'delete'])

只需更改别名。


推荐阅读