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.
This commit is contained in:
teknium1 2026-03-08 17:13:45 -07:00
parent a5461e07bf
commit a7f9721785
3 changed files with 27 additions and 3 deletions

View file

@ -654,6 +654,27 @@ class DiscordAdapter(BasePlatformAdapter):
except Exception as e: except Exception as e:
logger.debug("Discord followup failed: %s", 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") @tree.command(name="update", description="Update Hermes Agent to the latest version")
async def slash_update(interaction: discord.Interaction): async def slash_update(interaction: discord.Interaction):
await interaction.response.defer(ephemeral=True) await interaction.response.defer(ephemeral=True)

View file

@ -160,6 +160,9 @@ class TelegramAdapter(BasePlatformAdapter):
BotCommand("resume", "Resume a previously-named session"), BotCommand("resume", "Resume a previously-named session"),
BotCommand("usage", "Show token usage for this session"), BotCommand("usage", "Show token usage for this session"),
BotCommand("provider", "Show available providers"), 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"), BotCommand("help", "Show available commands"),
]) ])
except Exception as e: except Exception as e:

View file

@ -710,8 +710,8 @@ class GatewayRunner:
# Emit command:* hook for any recognized slash command # Emit command:* hook for any recognized slash command
_known_commands = {"new", "reset", "help", "status", "stop", "model", _known_commands = {"new", "reset", "help", "status", "stop", "model",
"personality", "retry", "undo", "sethome", "set-home", "personality", "retry", "undo", "sethome", "set-home",
"compress", "usage", "insights", "reload-mcp", "update", "compress", "usage", "insights", "reload-mcp", "reload_mcp",
"title"} "update", "title", "resume", "provider"}
if command and command in _known_commands: if command and command in _known_commands:
await self.hooks.emit(f"command:{command}", { await self.hooks.emit(f"command:{command}", {
"platform": source.platform.value if source.platform else "", "platform": source.platform.value if source.platform else "",
@ -759,7 +759,7 @@ class GatewayRunner:
if command == "insights": if command == "insights":
return await self._handle_insights_command(event) 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) return await self._handle_reload_mcp_command(event)
if command == "update": if command == "update":