【发布时间】:2019-04-12 04:16:59
【问题描述】:
我对编码非常陌生,我想知道如何在此处实现自定义错误,例如“缺少开发角色”:
@bot.command()
@commands.has_any_role("Temp.", "Owner")
async def sh(ctx):
await ctx.message.add_reaction(':true:508022488093949973')
await ctx.send("<a:siren:507952050181636098> `Shutting down` <a:siren:507952050181636098>")
await bot.logout()
我有一个像这样的简单处理程序
@bot.event
async def on_command_error(ctx, error):
await ctx.message.add_reaction(':false:508021839981707304')
await ctx.send("<a:siren:507952050181636098> `Invalid command` <a:siren:507952050181636098>")
但它总是输出无效的命令
【问题讨论】:
标签: python python-3.x discord.py discord.py-rewrite