Commit 883500c
committed
feat(telegram): rich-message wire types for Bot API 10.1 (chat@4.31 4662309 — TG1/4)
Port the Telegram rich-message wire types added upstream in chat@4.31.0
(commit 4662309, "native rich message formatting + streaming for Bot
API 10.1"), faithfully mirroring adapter-telegram/src/types.ts. Types only;
the runtime rich.py consumer lands in TG2.
New named media interfaces (extend TelegramFile):
TelegramAnimation, TelegramAudio, TelegramVideoQuality,
TelegramVideo (widened), TelegramVoice, plus TelegramLocation.
Recursive rich-text structures:
TelegramRichText, TelegramRichCaption, TelegramRichCell,
TelegramRichItem, TelegramRichBlock, TelegramRichMessage. The
recursive unions (TelegramRichText / TelegramRichBlock) are expressed as
quoted forward-ref TypeAlias strings so they resolve statically under
pyrefly without evaluating `|` against a not-yet-defined name at runtime.
TelegramMessage gains an optional rich_message payload, and its video
field is widened from the old inline shape to the named TelegramVideo
(the now-redundant TelegramVideoFile is dropped; it had no external refs).
Wire keys stay snake_case: the Telegram Bot API is natively snake_case,
so there is no camelCase serialization boundary here. Optional fields use
total=False with `# required` markers, matching the existing file style.
pyrefly: 0 errors. New structural tests build the representative recursive
rich_message payloads from upstream rich.test.ts.1 parent d3b8f3f commit 883500c
2 files changed
Lines changed: 686 additions & 15 deletions
0 commit comments