feat(dump): migrate /dump status message to Bot API 10.1 rich messages#48
Open
akhilnarang wants to merge 2 commits into
Open
feat(dump): migrate /dump status message to Bot API 10.1 rich messages#48akhilnarang wants to merge 2 commits into
akhilnarang wants to merge 2 commits into
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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