Remove 'command Not Found' Error Discord.py
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: di
Solution 1:
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.eventasyncdefon_command_error(ctx, error):
ifisinstance(error, CommandNotFound):
returnraise error
Solution 2:
You can try this, just change the title and the description inside the "em" part.
@client.event asyncdefon_command_error(ctx, error):
ifisinstance(error, commands.CommandNotFound):
em = discord.Embed(title=f"Error!!!", description=f"Command not found.", color=ctx.author.color)
await ctx.send(embed=em)
Solution 3:
@client.eventasyncdefon_command_error(ctx, error):
ifisinstance(error, CommandNotFound):
return
Post a Comment for "Remove 'command Not Found' Error Discord.py"