feat(telegram): add new slash commands and update regex for command handling
This commit is contained in:
@@ -261,12 +261,21 @@ class TelegramChannel(BaseChannel):
|
||||
BotCommand("restart", "Restart the bot"),
|
||||
BotCommand("status", "Show bot status"),
|
||||
BotCommand("history", "Show recent conversation messages"),
|
||||
BotCommand("goal", "Start a sustained objective (long-running task)"),
|
||||
BotCommand("pairing", "Manage DM pairing (approve/deny/list)"),
|
||||
BotCommand("model", "Switch runtime model preset"),
|
||||
BotCommand("dream", "Run Dream memory consolidation now"),
|
||||
BotCommand("dream_log", "Show the latest Dream memory change"),
|
||||
BotCommand("dream_restore", "Restore Dream memory to an earlier version"),
|
||||
BotCommand("help", "Show available commands"),
|
||||
]
|
||||
|
||||
# Regex for slash commands routed to AgentLoop via ``_forward_command``.
|
||||
# Hyphenated ``dream-*`` commands stay on a separate handler (below).
|
||||
TELEGRAM_BUS_SLASH_COMMAND_RE = re.compile(
|
||||
r"^/(?:new|stop|restart|status|dream|history|goal|pairing|model)(?:@\w+)?(?:\s+.*)?$"
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def default_config(cls) -> dict[str, Any]:
|
||||
return TelegramConfig().model_dump(by_alias=True)
|
||||
@@ -354,7 +363,7 @@ class TelegramChannel(BaseChannel):
|
||||
self._app.add_handler(MessageHandler(filters.Regex(r"^/start(?:@\w+)?$"), self._on_start))
|
||||
self._app.add_handler(
|
||||
MessageHandler(
|
||||
filters.Regex(r"^/(new|stop|restart|status|dream)(?:@\w+)?(?:\s+.*)?$"),
|
||||
filters.Regex(TelegramChannel.TELEGRAM_BUS_SLASH_COMMAND_RE),
|
||||
self._forward_command,
|
||||
)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user