python - 如何给命令多个名称?
问题描述
我有一个命令:
@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
不可调用。
有谁知道如何做到这一点?
解决方案
@client.command(pass_context = True , aliases=['purge', 'clean', 'delete'])
只需更改别名。
推荐阅读
- angular - 将 ui_locales 传递给 Msal Angular Guard
- php - {"code":29000,"message":"签名不匹配"}
- android-drawable - 弯曲带有高度的圆形可绘制矩形
- javascript - 在类上使用对象字面量会浪费多少内存?
- unix - 如何检查用户输入是否等于文件中的值?
- typescript - 属性可以是字符串或对象数组,如何在 VS Code 中告诉打字稿当前变量正在使用数组
- sql - 在 SQL Server 16 的 sql 查询中拆分超过 4 个值的字符串值
- lighthouse - Lighthouse 修改 HTML 报告 - 添加截图
- electron - 在 Electron 应用程序中保存数据结构的最佳方法
- arm - 如何为 arm gcc 构建 mbedtls