Add command error logging
This commit is contained in:
parent
6d805e11be
commit
4dea852995
|
@ -14,7 +14,9 @@ class ErrorHandler(commands.Cog):
|
|||
|
||||
@commands.Cog.listener()
|
||||
async def on_command_error(self, ctx: commands.Context, error: commands.CommandError):
|
||||
command_name = ctx.command.name
|
||||
if isinstance(error, commands.CommandNotFound):
|
||||
self.logger.error(error)
|
||||
return
|
||||
if isinstance(error, commands.MissingPermissions):
|
||||
message = "You are missing the required permissions to run this command!"
|
||||
|
@ -25,6 +27,7 @@ class ErrorHandler(commands.Cog):
|
|||
else:
|
||||
message = "Oh no! Something went wrong while running the command!"
|
||||
|
||||
self.logger.error('Error during command "%s": %s', command_name, message)
|
||||
embed = ErrorMessage(message)
|
||||
await ctx.send(embed=embed)
|
||||
|
||||
|
|
Loading…
Reference in New Issue