Remove 'command not found' error discord.py

前端 未结 1 740
终归单人心
终归单人心 2021-01-13 02:27

In a discord.py rewrite bot, if someone types the bots prefix and then any text after it, if the text is not found as a command you will get

Ignoring except         


        
相关标签:
1条回答
  • 2021-01-13 03:31

    Write an on_command_error error handler that checks if the error is an instance of CommandNotFound, and ignores it if it is

    from discord.ext.commands import CommandNotFound
    
    @bot.event
    async def on_command_error(ctx, error):
        if isinstance(error, CommandNotFound):
            return
        raise error
    
    0 讨论(0)
提交回复
热议问题