Skip to content

feat(dump): migrate /dump status message to Bot API 10.1 rich messages#48

Open
akhilnarang wants to merge 2 commits into
masterfrom
claude/dump-rich-text-migration-yh9p30
Open

feat(dump): migrate /dump status message to Bot API 10.1 rich messages#48
akhilnarang wants to merge 2 commits into
masterfrom
claude/dump-rich-text-migration-yh9p30

Conversation

@akhilnarang

Copy link
Copy Markdown
Contributor

The /dump status message (the initial "Firmware Dump Queued" post plus every
progress/completion/failure edit the worker makes to it) now uses the Bot API
10.1 rich-text endpoints — sendRichMessage and editMessageText(rich_message) —
instead of the legacy send_message/edit_message_text + parse_mode path.

python-telegram-bot 22.7 (pinned <23.0) does not yet expose these methods, so
they are called via the raw Bot API over httpx. Telegram error responses are
translated back into the same telegram.error exceptions PTB raises (RetryAfter,
BadRequest, Forbidden, TelegramError, NetworkError), so the queue's existing
retry / dead-letter / "message is not modified" handling and the
verify_telegram_context probe all keep working unchanged.

InputRichMessage carries the content as a single Rich Markdown string. Rich
Markdown reuses the legacy syntax with one breaking difference: x now means
italic and bold needs x. Rather than rewrite every status builder (and its
tests), a small pure converter, legacy_markdown_to_rich_markdown(), rewrites the
already-rendered legacy text at the send boundary — doubling bold asterisks
while leaving italics, code spans, fenced blocks, links and backslash escapes
intact.

A per-job _rich_status flag scopes this to the direct /dump message: the
parallel moderated-request flow and all other legacy-Markdown messages are
untouched.

Co-Authored-By: Claude Opus 4.8 noreply@anthropic.com
Claude-Session: https://claude.ai/code/session_015VNyKjukMtUni9gjcKoeLN

claude added 2 commits June 29, 2026 17:27
The /dump status message (the initial "Firmware Dump Queued" post plus every
progress/completion/failure edit the worker makes to it) now uses the Bot API
10.1 rich-text endpoints — sendRichMessage and editMessageText(rich_message) —
instead of the legacy send_message/edit_message_text + parse_mode path.

python-telegram-bot 22.7 (pinned <23.0) does not yet expose these methods, so
they are called via the raw Bot API over httpx. Telegram error responses are
translated back into the same telegram.error exceptions PTB raises (RetryAfter,
BadRequest, Forbidden, TelegramError, NetworkError), so the queue's existing
retry / dead-letter / "message is not modified" handling and the
verify_telegram_context probe all keep working unchanged.

InputRichMessage carries the content as a single Rich Markdown string. Rich
Markdown reuses the legacy syntax with one breaking difference: *x* now means
italic and bold needs **x**. Rather than rewrite every status builder (and its
tests), a small pure converter, legacy_markdown_to_rich_markdown(), rewrites the
already-rendered legacy text at the send boundary — doubling bold asterisks
while leaving italics, code spans, fenced blocks, links and backslash escapes
intact.

A per-job _rich_status flag scopes this to the direct /dump message: the
parallel moderated-request flow and all other legacy-Markdown messages are
untouched.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015VNyKjukMtUni9gjcKoeLN
Moves to the latest PTB within the existing >=22.7,<23.0 pin, bringing Bot
API 10.0 typed support to the rest of the bot.

Note: this does NOT remove the raw Bot API calls used for the /dump rich-message
migration. Rich Messages are a Bot API 10.1 feature and no released PTB exposes
them yet (22.8 only reaches Bot API 10.0; upstream support is tracked in
python-telegram-bot#5261). The raw sendRichMessage / editMessageText(rich_message)
calls remain until PTB ships 10.1, with a TODO marking the swap.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015VNyKjukMtUni9gjcKoeLN
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.

2 participants