命令 discord.py 的参数不正确时如何显示消息?

How to make a display message when argument is incorrect for command discord.py?

我正在制作一个不和谐的机器人,我想知道如何制作一个事件处理程序,当用户调用一个不存在的命令时,机器人会发送一条消息说:"That's not a valid command" .任何帮助将不胜感激,谢谢!

这应该可以解决问题:


@bot.event
async def on_command_error(ctx, error):
    if isinstance(error, commands.CommandNotFound):
        await ctx.send("words i guess")