Support telegram rich messages as a hint part - #333
Draft
bomzheg wants to merge 2 commits into
Draft
Conversation
bomzheg
marked this pull request as ready for review
August 7, 2026 17:02
bomzheg
marked this pull request as draft
August 10, 2026 21:05
Bot API 10.1 added rich messages - a message built from blocks: headings, lists, tables, quotes, embedded media. A hint written that way says much more than the plain text hints authors have today, so the scenario now carries a hint part for it. - ``RichHint`` holds the markup itself plus the language it is written in (Rich HTML or Rich Markdown) and the files embedded into it, each bound to the id the markup refers to; - the files live under their usual guids, so they are packed into the scenario zip and validated like any other hint file; - both hint views build ``InputRichMessage``, so a rich hint goes out through ``sendRichMessage`` by file_id, and by content when a file was never uploaded to telegram; - the "can this be sent as a link" question moved onto the link view itself - a rich message has many files, and any one of them missing a file_id sends the whole message by content. aiogram is bumped to 3.30 for the new method; ``ChatMemberRestricted`` gained a required field in the meantime, hence the test fixture change. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HR7ByNGirgnXDGjqvKtXr7
The author docs list what a hint part can be, and the glossary names every concept the code has, so both learn about the new one - including the part authors need to know: a rich hint is assembled on the site, not in the bot. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HR7ByNGirgnXDGjqvKtXr7
bomzheg
force-pushed
the
claude/telegram-rich-messages-ogwk6c
branch
from
August 20, 2026 19:22
09ad882 to
ff6568d
Compare
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.
Closes #295.
Bot API 10.1 added rich messages — a message built from blocks: headings, lists, tables, quotes, embedded media. A hint written that way says much more than a single run of text, so the scenario now carries a hint part for it.
What changed
Domain (
core)HintType.richandhints.RichHint: the markup itself (text), the language it is written in (RichFormat.html/RichFormat.markdown), theis_rtl/skip_entity_detectionflags telegram accepts, andmedia— the files the markup embeds, each bound to the id the markup refers to ('<img src="pic">').get_guids()returns those file guids, so embedded files are packed into the scenario zip, validated on upload and copied with the game like any other hint file — no separate plumbing.Bot (
tgbot)RichHintLinkView/RichHintContentViewbuild anInputRichMessage, andHintSendersends it throughsendRichMessage— by file_id, and by content when a file was never uploaded to telegram.InputMediaPhoto/Video/Animation/Audioby the stored file's content type; anything else is rejected withUnsupportedFileFormatrather than sent as something it isn't.HintSendercould only ask about a singlefile_idattribute.API — no code change: hints are exposed as the core dataclasses and scenarios load straight into them, so
type: "rich"round-trips throughPUT /games/my/{id}/scenarioas it stands. There is an integration test pinning that down.Dependency — aiogram 3.26 → 3.30 for
send_rich_message(Bot API 9.5 → 10.2).ChatMemberRestrictedgained a required field in between, hence the one-line test fixture change;lock.txtis pinned to match.Tests
tests/unit/test_rich_hint_view.py— html vs markdown, the flags, media by file_id and by content, the fallback when a file_id is missing, unsupported media types.tests/unit/serialization— theall_typesscenario fixture now carries a rich hint, so deserialization and hint rendering cover it.tests/integration/bot_full/test_hint_sender.py— the foursendRichMessagepaths.tests/integration/api_full/test_game_edit.py— markup, format and embedded media survive the scenario API round trip.Unit tests,
ruffandmypypass locally; the integration suite needs docker, so it runs in CI.Not in this change
Generated by Claude Code