Add command error logging

This commit is contained in:
ekzyis 2021-11-04 01:29:13 +01:00
parent 6d805e11be
commit 4dea852995
1 changed files with 3 additions and 0 deletions

View File

@ -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)