为了账号安全,请及时绑定邮箱和手机立即绑定

如何获取所有 on_command_error 错误事件的列表

如何获取所有 on_command_error 错误事件的列表

动漫人物 2024-01-24 15:23:20
我试图为每种错误类型创建专门的错误,但我只能找到下面使用的 2 个错误。有谁知道命令中的所有错误事件类型@client.eventasync def on_command_error(ctx, error):    if isinstance(error, commands.CommandOnCooldown):        await ctx.message.delete()        embed = discord.Embed(title="Slow Down!! :timer:", description='This command can be used again in %.2f seconds' % error.retry_after, color=0xE74C3C)        message = await ctx.message.channel.send(embed=embed, delete_after=10)        await asyncio.sleep(5)        await message.delete()    elif isinstance(error, commands.CommandNotFound):        await ctx.message.delete()        embed = discord.Embed(title="Uh oh!", description=f"Uh oh, {ctx.author.mention} what are you trying to do?? {error}!", color=0xE74C3C)        message = await ctx.message.channel.send(embed=embed, delete_after=10)        await asyncio.sleep(2)commandNotFound 和 CommandOnCooldown 是我能找到并工作的唯一类型,有人知道所有类型的列表吗?我目前使用 on_command_error 但它不会具体向用户解决问题是什么。谢谢,非常感谢
查看完整描述

1 回答

?
慕村225694

TA贡献1880条经验 获得超4个赞

通过一些研究,您可以轻松地从 API 参考中找到所有错误。是所有命令错误异常。



查看完整回答
反对 回复 2024-01-24
  • 1 回答
  • 0 关注
  • 23 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信