Answer the question
In order to leave comments, you need to log in
discord.py error handler not working?
I wanted to display errors in the chat and used such code as usual, but it does not work.
import discord
from discord.ext import commands
from discord.ext.commands import *
@bot.event
async def on_command_eror(ctx, error):
if isinstance(error, DisabledCommand):
e = discord.Embed(description=f"<:err:847921820598534216> `{ctx.command}` is disabled.", color=colour)
e.set_author(name="Warning")
elif isinstance(error, CommandNotFound):
e = discord.Embed(description=f"<:err:847921820598534216> Command `{ctx.command}` does not exist.", color=colour)
e.set_author(name="Warning")
elif isinstance(error, MemberNotFound):
e = discord.Embed(description=f"<:err:847921820598534216> Member does not exist.", color=colour)
e.set_author(name="Warning")
elif isinstance(error, CommandInvokeError):
e = discord.Embed(description=f"<:err:847921820598534216> Command occurred error.", color=colour)
e.set_author(name="Warning")
elif isinstance(error, MissingPermissions):
e = discord.Embed(description=f"<:err:847921820598534216> Missing permissions for use this command.", color=colour)
e.set_author(name="Warning")
elif isinstance(error, BotMissingPermissions):
e = discord.Embed(description=f"<:err:847921820598534216> I am missing permissions for use this command.", color=colour)
e.set_author(name="Warning")
elif isinstance(error, MissingRequiredArgument):
e = discord.Embed(description=f"<:err:847921820598534216> Missing required argument: `{error.param}` in `{ctx.command}`.", color=colour)
e.set_author(name="Warning")
elif isinstance(error, CommandOnCooldown):
e = discord.Embed(description=f"<:err:847921820598534216> Command `{ctx.command}` has cooldown. Retry in {round(error.retry_after, 1)} seconds", color=colour)
e.set_author(name="Warning")
await ctx.reply(embed=e, mention_author=False)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question