From a7f9721785afb8ab5f138de1934aeff0c86f5d17 Mon Sep 17 00:00:00 2001 From: teknium1 Date: Sun, 8 Mar 2026 17:13:45 -0700 Subject: [PATCH] feat: register remaining commands with platform menus Telegram: add /insights, /update, /reload_mcp (underscore variant since Telegram BotCommand names don't allow hyphens). Discord: add /insights (with days parameter), /reload-mcp. Also add reload_mcp as an alias for reload-mcp in the gateway command dispatcher so Telegram's underscore form works, and add resume/provider to the _known_commands set for hook emission. --- gateway/platforms/discord.py | 21 +++++++++++++++++++++ gateway/platforms/telegram.py | 3 +++ gateway/run.py | 6 +++--- 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/gateway/platforms/discord.py b/gateway/platforms/discord.py index d8d2b004..905e20d6 100644 --- a/gateway/platforms/discord.py +++ b/gateway/platforms/discord.py @@ -654,6 +654,27 @@ class DiscordAdapter(BasePlatformAdapter): except Exception as e: logger.debug("Discord followup failed: %s", e) + @tree.command(name="insights", description="Show usage insights and analytics") + @discord.app_commands.describe(days="Number of days to analyze (default: 7)") + async def slash_insights(interaction: discord.Interaction, days: int = 7): + await interaction.response.defer(ephemeral=True) + event = self._build_slash_event(interaction, f"/insights {days}") + await self.handle_message(event) + try: + await interaction.followup.send("Done~", ephemeral=True) + except Exception as e: + logger.debug("Discord followup failed: %s", e) + + @tree.command(name="reload-mcp", description="Reload MCP servers from config") + async def slash_reload_mcp(interaction: discord.Interaction): + await interaction.response.defer(ephemeral=True) + event = self._build_slash_event(interaction, "/reload-mcp") + await self.handle_message(event) + try: + await interaction.followup.send("Done~", ephemeral=True) + except Exception as e: + logger.debug("Discord followup failed: %s", e) + @tree.command(name="update", description="Update Hermes Agent to the latest version") async def slash_update(interaction: discord.Interaction): await interaction.response.defer(ephemeral=True) diff --git a/gateway/platforms/telegram.py b/gateway/platforms/telegram.py index 81d3e562..c49155d0 100644 --- a/gateway/platforms/telegram.py +++ b/gateway/platforms/telegram.py @@ -160,6 +160,9 @@ class TelegramAdapter(BasePlatformAdapter): BotCommand("resume", "Resume a previously-named session"), BotCommand("usage", "Show token usage for this session"), BotCommand("provider", "Show available providers"), + BotCommand("insights", "Show usage insights and analytics"), + BotCommand("update", "Update Hermes to the latest version"), + BotCommand("reload_mcp", "Reload MCP servers from config"), BotCommand("help", "Show available commands"), ]) except Exception as e: diff --git a/gateway/run.py b/gateway/run.py index 4423746c..b32f2d2d 100644 --- a/gateway/run.py +++ b/gateway/run.py @@ -710,8 +710,8 @@ class GatewayRunner: # Emit command:* hook for any recognized slash command _known_commands = {"new", "reset", "help", "status", "stop", "model", "personality", "retry", "undo", "sethome", "set-home", - "compress", "usage", "insights", "reload-mcp", "update", - "title"} + "compress", "usage", "insights", "reload-mcp", "reload_mcp", + "update", "title", "resume", "provider"} if command and command in _known_commands: await self.hooks.emit(f"command:{command}", { "platform": source.platform.value if source.platform else "", @@ -759,7 +759,7 @@ class GatewayRunner: if command == "insights": return await self._handle_insights_command(event) - if command == "reload-mcp": + if command in ("reload-mcp", "reload_mcp"): return await self._handle_reload_mcp_command(event) if command == "update":