Skip to content

Expose Telegram slash commands via setMyCommands#702

Open
yaroslavyaroslav wants to merge 1 commit intoRightNow-AI:mainfrom
yaroslavyaroslav:codex/tlg-chat-enhancements
Open

Expose Telegram slash commands via setMyCommands#702
yaroslavyaroslav wants to merge 1 commit intoRightNow-AI:mainfrom
yaroslavyaroslav:codex/tlg-chat-enhancements

Conversation

@yaroslavyaroslav
Copy link

Summary

Expose the existing Telegram bot commands through Telegram's native slash-command menu and unify command definitions across Telegram, /help, and /api/commands.

Fixes #700

Changes

  • register Telegram bot commands with setMyCommands when the Telegram adapter starts
  • add a shared channel command catalog and reuse it for Telegram command registration, /help, and /api/commands
  • include /agents and /agent in the shared command list
  • update /agent so calling it without an argument returns usage guidance plus the live list of available agents from the server
  • add default ChannelBridgeHandle methods for pending approvals and audio transcription so the current branch compiles with the existing bridge wiring

Testing

  • cargo clippy --workspace --all-targets -- -D warnings passes
  • cargo test --workspace passes
  • Live integration tested (if applicable)

Additional verification:

  • cargo check --workspace
  • cargo audit
  • cargo test -p openfang-channels test_handle_command_ -- --nocapture
  • cargo build -p openfang-api --lib
  • cargo build -p openfang-cli --bin openfang
  • verified live daemon startup with real Telegram config
  • verified GET /api/health
  • verified GET /api/commands returns the unified command list, including /agents and /agent
  • verified Telegram bot startup logs show webhook cleanup, polling mode activation, and bot command registration
  • verified getMyCommands returns the registered Telegram command list

Note: cargo fmt --check currently fails on unrelated pre-existing formatting drift elsewhere in this checkout, outside this PR diff.

Security

  • No new unsafe code
  • No secrets or API keys in diff
  • User input validated at boundaries

Telegram Bot API supports native command menus, but it does not support dynamic server-driven autocomplete for command arguments after /agent . This change uses the best available fallback by returning the live agent list when /agent is sent without an argument.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Expose Telegram bot commands in the native slash menu

1 participant