Skip to content

feat(rpc): discover and invoke Telegram methods at runtime - #311

Open
skyzer wants to merge 3 commits into
gotd:mainfrom
skyzer:codex/upstream-telegram-runtime-rpc
Open

skyzer wants to merge 3 commits into
gotd:mainfrom
skyzer:codex/upstream-telegram-runtime-rpc

Conversation

@skyzer

@skyzer skyzer commented Nov 28, 2026

Copy link
Copy Markdown

Summary

Add tg rpc list, describe, and invoke for Telegram methods that do not have a dedicated CLI command.

  • Use the compiled gotd schema by default. Pass --schema-cache to refresh Telegram Desktop's published TL schema on demand and use its advertised API layer.
  • Keep the last valid cached schema through temporary fetch failures. Newly published methods use the same commands when Telegram supports their layer.
  • Use the existing user session and require --yes for invocation. The command preserves exact 64-bit values passed as decimal strings and rejects overflowing 32-bit TL fields before sending.

Example

tg rpc --schema-cache ~/.cache/tg/api.tl describe help.getConfig -o json
tg rpc --schema-cache ~/.cache/tg/api.tl invoke --yes help.getConfig '{}' -o json

Verification

  • go test -race ./..., go mod tidy -diff, and the repository's golangci-lint v2.12.1 checks targeting Linux.
  • Tests cover runtime schema refresh, last-good cache behavior, TL flag groups, nested queries, exact integer encoding, and 1 MiB payloads with framing.
  • Ran read-only RPCs with the latest upstream dependencies and an existing linked session.
  • Reviewed with Claude Opus 5.5 and re-reviewed the fixes.

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.

1 participant