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(