From cf88638603593b4f7fb287b980575b636428fd00 Mon Sep 17 00:00:00 2001 From: AJ Isaacs Date: Fri, 27 Feb 2026 16:11:46 -0500 Subject: [PATCH] fix: add guild-specific command sync for instant slash command propagation Global sync can take up to an hour to propagate. Now also syncs commands per-guild in on_ready for immediate availability. Co-Authored-By: Claude Opus 4.6 --- bot.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/bot.py b/bot.py index b232f38..49c191f 100644 --- a/bot.py +++ b/bot.py @@ -139,8 +139,9 @@ class BCSBot(commands.Bot): await self.load_extension("cogs.commands") await self.load_extension("cogs.chat") + # Global sync as fallback; guild-specific sync happens in on_ready await self.tree.sync() - logger.info("Slash commands synced.") + logger.info("Slash commands synced (global).") # Quick connectivity check try: @@ -165,6 +166,15 @@ class BCSBot(commands.Bot): async def on_ready(self): logger.info("Logged in as %s (ID: %d)", self.user, self.user.id) + # Guild-specific command sync for instant propagation + for guild in self.guilds: + try: + self.tree.copy_global_to(guild=guild) + await self.tree.sync(guild=guild) + logger.info("Slash commands synced to guild %s.", guild.name) + except Exception: + logger.exception("Failed to sync commands to guild %s", guild.name) + # Set status based on active mode mode_config = self.get_mode_config() status_text = mode_config.get("description") or self.config.get("bot", {}).get(