discord.py冷却错误不存在';不允许出现其他错误

discord.py冷却错误不存在';不允许出现其他错误,discord,discord.py,discord.py-rewrite,Discord,Discord.py,Discord.py Rewrite,我有这个代码用于冷却,并将错误发送给用户。这是我的代码: @bot.event async def on_command_error(ctx, error): if isinstance(error, commands.CommandOnCooldown): if error.retry_after>3600: embed=discord.Embed(title='Cooldown!', description=f"This c

我有这个代码用于冷却,并将错误发送给用户。这是我的代码:


@bot.event
async def on_command_error(ctx, error):
    if isinstance(error, commands.CommandOnCooldown):

        if error.retry_after>3600:
            embed=discord.Embed(title='Cooldown!', description=f"This command can be used in **{round(error.retry_after/3600)}h**   !".format(error.retry_after))
            await ctx.send(embed=embed)
            return


        if error.retry_after>60:
            embed=discord.Embed(title='Cooldown!', description=f"This command can be used in **{round(error.retry_after/60)}m**!".format(error.retry_after))
            await ctx.send(embed=embed)
            return

        else:
            embed=discord.Embed(title='Cooldown!', description=f"This command can be used in **{round(error.retry_after)}s**!".format(error.retry_after))
            await ctx.send(embed=embed)

但是,当我添加此代码时,其他错误(如MissingRequirements)不会在VisualStudio代码的终端中出现。有人知道为什么或者如何解决这个问题吗?

错误处理程序会检查错误是否是CommandOnColdOwn错误。如果不是,错误将被忽略。添加另一条else语句:

@bot.event
async def on_command_error(ctx, error):
    if isinstance(error, commands.CommandOnCooldown):

         if error.retry_after>3600:
         ....

         else:
         ....
    else:
         Stuff the bot should do on a different error come here