From 4dea852995c2ca1b16d09e0f04be13d5328af5ea Mon Sep 17 00:00:00 2001 From: ekzyis Date: Thu, 4 Nov 2021 01:29:13 +0100 Subject: [PATCH] Add command error logging --- src/error.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/error.py b/src/error.py index 8f6526a..7bca386 100644 --- a/src/error.py +++ b/src/error.py @@ -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)