Ver código fonte

added a print of errors to a log channel.

baumsplitter41 4 meses atrás
pai
commit
c6aecaf96a
1 arquivos alterados com 7 adições e 1 exclusões
  1. 7 1
      VPD_BOT/main.py

+ 7 - 1
VPD_BOT/main.py

@@ -105,7 +105,13 @@ async def load_extensions():
 class Admin(commands.Cog):
     def __init__(self, bot):
         self.bot = bot
-
+#------#
+#Print in Log if error occurs
+@bot.event
+async def on_command_error(ctx, error):
+    channel = discord.utils.get(bot.guilds[0].channels, id=int(channel_log))
+    if channel:
+        await channel.send(f"Error occurred: {str(error)}")
 
 #---------------------------------#
 #Bot Online Console