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 exception in command None:
discord.ext.commands.errors.CommandNotFound: Command "sd" is not found

Is there anyway to stop the bot from logging this?


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

You can try this, just change the title and the description inside the "em" part.

@client.event 
async def on_command_error(ctx, error): 
    if isinstance(error, commands.CommandNotFound): 
        em = discord.Embed(title=f"Error!!!", description=f"Command not found.", color=ctx.author.color) 
        await ctx.send(embed=em)