Documentation
¶
Overview ¶
Command rich is a showcase of Telegram rich messages (Bot API 10.1) built with github.com/gotd/td/telegram/message/rich. Each command sends a rich message exercising a category of the allowed rich-text and page-block constructors:
/headings headings 1-6 and a footer /text every allowed inline text style (bold, italic, spoiler, math, …) /lists bullet, checklist and ordered lists (incl. block items) /blocks paragraph, anchor, code, quotes, math, details, thinking, divider /table a table with header and data cells /map a map block /media photo/audio/image/custom-emoji/collage/slideshow (need real ids)
Not every constructor is valid in a bot-sent rich message. Per the official Bot API server (telegram-bot-api, td/td/telegram/WebPageBlock.cpp), these are Instant-View-page-only: the server reduces them to plain text or drops them, and Telegram rejects them raw with RICH_VALIDATE_CTOR_NOT_ALLOWED, so they are intentionally not used here. Page blocks: Title, Subtitle, Header, Subheader, Kicker, AuthorDate, Cover, RelatedArticles. Inline text: Mention, Hashtag, Cashtag, BotCommand, BankCard and the auto-link styles AutoURL/AutoEmail/ AutoPhone (MentionName and Date are allowed). Video is omitted too.
Run it with an MTProto app identity (https://my.telegram.org) and a BotFather token. To exercise /media's media-by-id blocks, also set any of PHOTO_ID, AUDIO_ID, DOCUMENT_ID, EMOJI_ID to real Telegram resource ids:
APP_ID=12345 APP_HASH=abcdef BOT_TOKEN=123:abc go run ./examples/rich