feat: unify set-home command naming across platforms

- Updated the command name from `/set-home` to `/sethome` in the GatewayRunner class for consistency.
- Added a new slash command `/sethome` in the Discord adapter to set the home channel.
- Registered the `/sethome` command in the Telegram adapter to align with the updated naming convention.
This commit is contained in:
teknium1 2026-02-23 15:01:22 -08:00
parent 79f8831738
commit 674a6f96d3
3 changed files with 15 additions and 4 deletions

View file

@ -513,6 +513,16 @@ 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="sethome", description="Set this chat as the home channel")
async def slash_sethome(interaction: discord.Interaction):
await interaction.response.defer(ephemeral=True)
event = self._build_slash_event(interaction, "/sethome")
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="stop", description="Stop the running Hermes agent") @tree.command(name="stop", description="Stop the running Hermes agent")
async def slash_stop(interaction: discord.Interaction): async def slash_stop(interaction: discord.Interaction):
await interaction.response.defer(ephemeral=True) await interaction.response.defer(ephemeral=True)

View file

@ -125,6 +125,7 @@ class TelegramAdapter(BasePlatformAdapter):
BotCommand("undo", "Remove the last exchange"), BotCommand("undo", "Remove the last exchange"),
BotCommand("status", "Show session info"), BotCommand("status", "Show session info"),
BotCommand("stop", "Stop the running agent"), BotCommand("stop", "Stop the running agent"),
BotCommand("sethome", "Set this chat as the home channel"),
BotCommand("help", "Show available commands"), BotCommand("help", "Show available commands"),
]) ])
except Exception as e: except Exception as e:

View file

@ -419,7 +419,7 @@ class GatewayRunner:
if command == "undo": if command == "undo":
return await self._handle_undo_command(event) return await self._handle_undo_command(event)
if command in ["set-home", "sethome"]: if command in ["sethome", "set-home"]:
return await self._handle_set_home_command(event) return await self._handle_set_home_command(event)
# Check for pending exec approval responses # Check for pending exec approval responses
@ -487,7 +487,7 @@ class GatewayRunner:
f"📬 No home channel is set for {platform_name.title()}. " f"📬 No home channel is set for {platform_name.title()}. "
f"A home channel is where Hermes delivers cron job results " f"A home channel is where Hermes delivers cron job results "
f"and cross-platform messages.\n\n" f"and cross-platform messages.\n\n"
f"Type /set-home to make this chat your home channel, " f"Type /sethome to make this chat your home channel, "
f"or ignore to skip." f"or ignore to skip."
) )
@ -754,7 +754,7 @@ class GatewayRunner:
"`/personality [name]` — Set a personality\n" "`/personality [name]` — Set a personality\n"
"`/retry` — Retry your last message\n" "`/retry` — Retry your last message\n"
"`/undo` — Remove the last exchange\n" "`/undo` — Remove the last exchange\n"
"`/set-home` — Set this chat as the home channel\n" "`/sethome` — Set this chat as the home channel\n"
"`/help` — Show this message" "`/help` — Show this message"
) )
@ -861,7 +861,7 @@ class GatewayRunner:
return f"↩️ Undid {removed_count} message(s).\nRemoved: \"{preview}\"" return f"↩️ Undid {removed_count} message(s).\nRemoved: \"{preview}\""
async def _handle_set_home_command(self, event: MessageEvent) -> str: async def _handle_set_home_command(self, event: MessageEvent) -> str:
"""Handle /set-home command -- set the current chat as the platform's home channel.""" """Handle /sethome command -- set the current chat as the platform's home channel."""
source = event.source source = event.source
platform_name = source.platform.value if source.platform else "unknown" platform_name = source.platform.value if source.platform else "unknown"
chat_id = source.chat_id chat_id = source.chat_id