Преглед изворни кода

Fixing Error, deleting the print of the loaded cogs in log channel

BaumSplitter41 пре 4 месеци
родитељ
комит
b59483141e
1 измењених фајлова са 7 додато и 10 уклоњено
  1. 7 10
      VPD_BOT/main.py

+ 7 - 10
VPD_BOT/main.py

@@ -130,7 +130,7 @@ bot = commands.Bot(
 )
 
 #Loading Cogs
-async def load_extensions():
+def load_extensions():
     cogs_dir = "./cogs"
     if bot.guilds:
         channel = discord.utils.get(bot.guilds[0].channels, id=int(channel_log))
@@ -143,12 +143,10 @@ async def load_extensions():
             try:
                 bot.load_extension(f"cogs.{cog_list}")
                 print(f"Loaded cog: {cog_list}")
-                if bot.guilds and channel:
-                    await channel.send(f"Loaded Cogs: {cog_list}")
+                channel.send(f"Loaded Cogs:{cog_list}")
             except Exception as e:
                 print(f"Failed to load cog {cog_list}: {e}")
-                if bot.guilds and channel:
-                    await channel.send(f"Failed to load cog {cog_list}: {e}")
+                channel.send(f"Failed to load cog {cog_list}: {e}")
 
 class Admin(commands.Cog):
     def __init__(self, bot):
@@ -173,14 +171,13 @@ async def on_ready():
         if channel:
             await channel.send(f"{bot.user} is online")
     bot.add_view(PersistentRoleView()) #loading reactionrole memory
-    await load_extensions()
-    print("Registered Slash-Commands:")
+    print("Registrierte Slash-Commands:")
+    await channel.send("Registered Slash-Commands:")
     for command in bot.pending_application_commands:
         print(f" - {command.name}")
-        if bot.guilds and channel:
-            await channel.send("Registered Slash-Commands:")
-            await channel.send(f"- {command.name}")
+        await channel.send(f"- {command.name}")
         
+
 #---------------------------------------------------------------------------------------#
 #DONT Touch anything above this line, unless you know what you are doing!#
 #---------------------------------------------------------------------------------------#