Bläddra i källkod

Changing that commands are one message instead of multiple messages

baumsplitter41 4 månader sedan
förälder
incheckning
c377187623
1 ändrade filer med 3 tillägg och 2 borttagningar
  1. 3 2
      VPD_BOT/main.py

+ 3 - 2
VPD_BOT/main.py

@@ -182,10 +182,11 @@ async def on_ready():
             await channel.send(f"{bot.user} is online")
     bot.add_view(PersistentRoleView()) #loading reactionrole memory
     print("Registrierte Slash-Commands:")
-    await channel.send("Registered Slash-Commands:")
+    command_list = "\n".join([f"- /{command.name}" for command in bot.pending_application_commands])
     for command in bot.pending_application_commands:
         print(f" - {command.name}")
-        await channel.send(f"- /{command.name}")
+    if channel and command_list:
+        await channel.send(f"Registered Slash-Commands:\n{command_list}")
     bot.loop.create_task(update_users_periodically())