Skip to content

feat(telegram): /commands shows inline keyboard button picker with Use/Cancel#13494

Open
SoRcKwYo wants to merge 3 commits intoNousResearch:mainfrom
SoRcKwYo:feat/telegram-commands-picker
Open

feat(telegram): /commands shows inline keyboard button picker with Use/Cancel#13494
SoRcKwYo wants to merge 3 commits intoNousResearch:mainfrom
SoRcKwYo:feat/telegram-commands-picker

Conversation

@SoRcKwYo
Copy link
Copy Markdown

What does this PR do?

On Telegram, /commands now shows an interactive inline keyboard instead of a plain-text list. Each command appears as a tappable button. Tapping a button shows its description with ▶ Use and ✗ Cancel options — tapping Use dispatches the command directly; tapping Cancel returns to the picker. Pagination (◄ Prev / Next ►) edits the original message in-place rather than sending new messages.

Non-Telegram platforms (Discord, CLI) retain the existing text-based paginated output.

Type of Change

  • ✨ New feature (non-breaking change that adds functionality)

Changes Made

  • gateway/platforms/telegram.py: add send_commands_picker() with inline keyboard and in-place pagination via edit_message_text; add _handle_commands_picker_callback() handling mc: (show description + Use/Cancel), cu: (dispatch synthetic command event), cc: (back to picker), cp: (page flip); route new callbacks in _handle_callback_query; add _commands_picker_state dict to __init__.
  • gateway/run.py: _handle_commands_command() detects Telegram platform and delegates to send_commands_picker() instead of returning a text response.

How to Test

  1. Start the gateway with a configured Telegram bot token.
  2. Send /commands to the bot.
  3. Verify: an inline keyboard appears with up to 8 command buttons per page (2 per row).
  4. Tap any button → same message updates to show description + ▶ Use and ✗ Cancel buttons.
  5. Tap ▶ Use → message shows "▶ Running /cmd…" and the command executes.
  6. Tap ✗ Cancel → returns to the command list page.
  7. Tap Next ► / ◄ Prev → same message updates in-place (no new message sent).
  8. On a non-Telegram platform (e.g. hermes -q /commands), verify the text list still works.

Checklist

  • My commit messages follow Conventional Commits
  • My PR contains only changes related to this fix/feature
  • I've tested on my platform: macOS

@SoRcKwYo SoRcKwYo force-pushed the feat/telegram-commands-picker branch 2 times, most recently from cb94233 to 4de17fb Compare April 22, 2026 00:30
@alt-glitch alt-glitch added type/feature New feature or request comp/gateway Gateway runner, session dispatch, delivery platform/telegram Telegram bot adapter labels Apr 22, 2026
@SoRcKwYo SoRcKwYo force-pushed the feat/telegram-commands-picker branch from 4de17fb to aa8fc86 Compare April 22, 2026 04:12
…icker PR

This code was accidentally included via cherry-pick and has no relation
to the /commands inline keyboard picker feature.
@SoRcKwYo SoRcKwYo force-pushed the feat/telegram-commands-picker branch from aa8fc86 to 493ef90 Compare April 22, 2026 06:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/gateway Gateway runner, session dispatch, delivery platform/telegram Telegram bot adapter type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants