@llblab/pi-telegram 0.17.5 → 0.18.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/AGENTS.md +67 -32
  2. package/BACKLOG.md +59 -19
  3. package/CHANGELOG.md +42 -15
  4. package/README.md +63 -35
  5. package/docs/README.md +3 -1
  6. package/docs/architecture.md +55 -23
  7. package/docs/callback-namespaces.md +1 -1
  8. package/docs/inbound.md +1 -1
  9. package/docs/locks.md +0 -2
  10. package/docs/multi-instance-bus.md +410 -0
  11. package/docs/outbound.md +4 -3
  12. package/docs/public-api.md +12 -10
  13. package/docs/sections.md +2 -2
  14. package/docs/ui-style.md +76 -0
  15. package/index.ts +789 -32
  16. package/lib/bindings.ts +68 -12
  17. package/lib/bus-api.ts +314 -0
  18. package/lib/bus-follower.ts +853 -0
  19. package/lib/bus-leader.ts +915 -0
  20. package/lib/bus.ts +866 -0
  21. package/lib/command-templates.ts +9 -11
  22. package/lib/commands.ts +133 -47
  23. package/lib/config.ts +53 -5
  24. package/lib/lifecycle.ts +23 -7
  25. package/lib/locks.ts +230 -66
  26. package/lib/media.ts +30 -2
  27. package/lib/menu-model.ts +48 -17
  28. package/lib/menu-queue.ts +51 -20
  29. package/lib/menu-settings.ts +9 -5
  30. package/lib/menu-status.ts +3 -0
  31. package/lib/menu-thinking.ts +3 -0
  32. package/lib/menu.ts +67 -26
  33. package/lib/outbound-attachments.ts +102 -17
  34. package/lib/outbound-buttons.ts +6 -2
  35. package/lib/outbound-voice.ts +31 -11
  36. package/lib/outbound.ts +6 -4
  37. package/lib/ownership.ts +119 -0
  38. package/lib/pi.ts +26 -3
  39. package/lib/polling.ts +477 -7
  40. package/lib/preview.ts +141 -88
  41. package/lib/prompt-templates.ts +3 -3
  42. package/lib/prompts.ts +80 -30
  43. package/lib/queue.ts +193 -91
  44. package/lib/rendering.ts +0 -25
  45. package/lib/replies.ts +187 -55
  46. package/lib/routing.ts +1673 -9
  47. package/lib/runtime-log.ts +123 -0
  48. package/lib/runtime.ts +84 -12
  49. package/lib/sections.ts +28 -21
  50. package/lib/setup.ts +9 -2
  51. package/lib/status.ts +532 -9
  52. package/lib/sync.ts +618 -0
  53. package/lib/target.ts +49 -0
  54. package/lib/telegram-api.ts +409 -41
  55. package/lib/text-groups.ts +5 -1
  56. package/lib/thread-reconciler.ts +915 -0
  57. package/lib/threads.ts +2205 -0
  58. package/lib/turns.ts +48 -3
  59. package/lib/updates.ts +355 -32
  60. package/package.json +24 -2
  61. package/docs/telegram-bot-api-rich-messages.md +0 -890
@@ -1,890 +0,0 @@
1
- #### June 11, 2026
2
-
3
- **Bot API 10.1**
4
-
5
- **Rich Messages**
6
-
7
- - Added support for Rich Messages, allowing bots to send highly structured text and stream AI-generated replies with seamless rich formatting.
8
- - Added the classes RichTextBold, RichTextItalic, RichTextUnderline, RichTextStrikethrough, RichTextSpoiler, RichTextDateTime, RichTextTextMention, RichTextSubscript, RichTextSuperscript, RichTextMarked, RichTextCode, RichTextCustomEmoji, RichTextMathematicalExpression, RichTextUrl, RichTextEmailAddress, RichTextPhoneNumber, RichTextBankCardNumber, RichTextMention, RichTextHashtag, RichTextCashtag, RichTextBotCommand, RichTextAnchor, RichTextAnchorLink, RichTextReference and RichTextReferenceLink, which represent different types of rich formatted text.
9
- - Added the class RichText, which represents rich formatted text.
10
- - Added the class RichBlockCaption, which represents the caption of a rich formatted text.
11
- - Added the class RichBlockTableCell, which represents a cell in a table.
12
- - Added the class RichBlockListItem, which represents an item in a list.
13
- - Added the classes RichBlockParagraph, RichBlockSectionHeading, RichBlockPreformatted, RichBlockFooter, RichBlockDivider, RichBlockMathematicalExpression, RichBlockAnchor, RichBlockList, RichBlockBlockQuotation, RichBlockPullQuotation, RichBlockCollage, RichBlockSlideshow, RichBlockTable, RichBlockDetails, RichBlockMap, RichBlockAnimation, RichBlockAudio, RichBlockPhoto, RichBlockVideo, RichBlockVoiceNote and RichBlockThinking, which represent different types of blocks in a rich formatted message.
14
- - Added the class RichBlock, which represents a block in a rich formatted message.
15
- - Added the class RichMessage, which represents a rich formatted message.
16
- - Added the field _rich\_message_ to the class Message.
17
- - Added the class InputRichMessage, describing a rich message to send.
18
- - Added the class InputRichMessageContent and allowed it to be used as InputMessageContent in results of inline, guest, and Web App queries.
19
- - Added the method sendRichMessage, allowing bots to send rich messages.
20
- - Added the method sendRichMessageDraft, allowing bots to stream partial rich messages.
21
- - Added the parameter _rich\_message_ to the method editMessageText, allowing bots to edit rich messages.
22
-
23
- **Join Request Queries**
24
-
25
- - Added the field _supports\_join\_request\_queries_ to the class User.
26
- - Added the field _guard\_bot_ to the class ChatFullInfo.
27
- - Added the field _query\_id_ to the class ChatJoinRequest.
28
- - Added the method answerChatJoinRequestQuery.
29
- - Added the method sendChatJoinRequestWebApp.
30
-
31
- **Polls**
32
-
33
- - Added the class Link and the field _link_ to the class PollMedia.
34
- - Added the class InputMediaLink and allowed it to be used as InputPollOptionMedia.
35
-
36
- ### Rich messages
37
-
38
- The following methods and objects allow your bot to handle and send rich messages.
39
-
40
- #### Rich Message Formatting Options
41
-
42
- Rich messages support advanced structured formatting options like headings, lists, tables, media, block quotations, collapsible blocks, footnotes, and formulas. Telegram clients will render them accordingly. You can specify rich message content using Markdown-style or HTML-style formatting.
43
-
44
- Plain URLs, e-mail addresses, username mentions, hashtags, cashtags, bot commands, phone numbers, and bank card numbers are detected automatically. To disable automatic entity detection, pass _True_ in the _skip\_entity\_detection_ field. Note that Telegram clients will display an alert to the user before opening an inline link ('Open this link?' together with the full URL).
45
-
46
- ###### Rich Message Limits
47
-
48
- Rich messages are subject to the following limits:
49
-
50
- - Up to **32768 UTF-8 characters** in the rich message text, including custom emoji alternative text and formula source.
51
- - Up to **500 blocks**, including nested blocks, list items, ordered list items, table rows, quotation blocks, and details blocks.
52
- - Up to **16 levels** of nested formatting and blocks.
53
- - Up to **50 media attachments** in total, including photos, videos, and audio files.
54
- - Up to **20 columns** in a table.
55
-
56
- ###### Rich Markdown style
57
-
58
- To use this mode, pass rich message content in the _markdown_ field. Use the following syntax in your message:
59
-
60
- ~~~
61
- **bold text**
62
- __bold text__
63
- *italic text*
64
- _italic text_
65
- ~~strikethrough text~~
66
- `inline fixed-width code`
67
- ==marked text==
68
- ||spoiler||
69
-
70
- [inline URL](https://t.me/)
71
- [inline e-mail](mailto:user@example.com)
72
- inline phone number
73
- inline mention of a user
74
-
75
- 22:45 tomorrow
76
- $x^2 + y^2$
77
- \#hashtag $USD +12345678901, card: 4242 4242 4242 4242, https://t.me t.me a@t.me /command @username
78
- all the text above was on the same line
79
-
80
- # Heading 1
81
- ## Heading 2
82
- ### Heading 3
83
- #### Heading 4
84
- ##### Heading 5
85
- ###### Heading 6
86
-
87
- Paragraph text
88
-
89
- ```python
90
- print('pre-formatted fixed-width code block written in the Python programming language')
91
- ```
92
-
93
- ---
94
-
95
- - unordered list item
96
- * unordered list item
97
- + unordered list item
98
-
99
- 1. ordered list item
100
- 2. ordered list item
101
-
102
- - [ ] task list item
103
- - [x] completed task list item
104
-
105
- >Block quotation started
106
- >
107
- >Block quotation continued on the next line
108
- >Block quotation continued on the same line
109
- >
110
- >The last line of the block quotation
111
-
112
- | Header 1 | Header 2 |
113
- |:---------|:--------:|
114
- | left | center |
115
-
116
- Text with a reference[^id1] and another one[^id2].
117
-
118
- [^id1]: Definition of the first footnote.
119
- [^id2]: Definition of the second footnote.
120
-
121
- $$E = mc^2$$
122
-
123
- ```math
124
- E = mc^2
125
- ```
126
-
127
- ## Example Nested Syntax Report for _Q1_
128
- Intro with <u>underlined text</u>, ==marked text==, and $x^2 + y^2$.
129
- **Bold _italic <u>underlined italic bold</u> italic_ bold**
130
- <u>In inline tags, nested **markdown** is parsed</u>
131
- >Quote with **bold text, ~~strikethrough, and <tg-spoiler>spoiler</tg-spoiler>~~**, plus [a link](https://t.me/).
132
-
133
- - List item with `code`, <sup>superscript</sup>, <sub>subscript</sub>, and a footnote[^note]
134
- - Another item with **bold <tg-spoiler><code>spoiler code</code></tg-spoiler>**
135
- - Another item with ~~strikethrough and <ins>inserted text</ins>~~
136
-
137
- | Metric | Value |
138
- |:-------|------:|
139
- | Speed | **42** <sup>ms</sup> |
140
- | Status | <tg-spoiler>ready</tg-spoiler> |
141
-
142
- [^note]: Footnote with _italic text_ and <u>HTML underline</u>.
143
-
144
- ---
145
-
146
- # Details blocks can contain Markdown content:
147
-
148
- <details open><summary>Summary with **bold text**</summary>
149
-
150
- ### Details heading
151
- - List item with _italic text_
152
- - List item with <tg-spoiler>spoiler</tg-spoiler>
153
-
154
- </details>
155
-
156
- # Collages and slideshows can contain Markdown media blocks:
157
-
158
- <tg-collage>
159
-
160
- </tg-collage>
161
-
162
- <tg-slideshow>
163
-
164
- </tg-slideshow>
165
- ~~~
166
-
167
- For formatting features that don't have Markdown syntax, use HTML tags:
168
-
169
- ~~~
170
- <u>underlined text</u>, <ins>underlined text</ins>
171
- <sub>subscript text</sub>
172
- <sup>superscript text</sup>
173
- <a name="chapter-1"></a>
174
- <aside>Pull quote<cite>The Author</cite></aside>
175
- <details open><summary>Title</summary>Content</details>
176
- <tg-map lat="41.9" long="12.5" zoom="14"/>
177
- <tg-collage><img src="https://telegram.org/example/photo.jpg"/><figcaption>Caption<cite>The Author</cite></figcaption></tg-collage>
178
- <tg-slideshow><img src="https://telegram.org/example/photo.jpg"/><video src="https://telegram.org/example/video.mp4"/><figcaption>Slideshow caption<cite>The Author</cite></figcaption></tg-slideshow>
179
- ~~~
180
-
181
- Please note:
182
-
183
- - Rich Markdown is compatible with GitHub Flavored Markdown where possible and can contain arbitrary HTML. Supported rich message HTML tags are parsed as described in Rich HTML style.
184
- - Media can be specified only as a separate block.
185
- - Media blocks support only HTTP and HTTPS URLs.
186
- - Media type is determined by the MIME type and the URL of the media.
187
- - In media syntax, the optional title after the URL is used as the caption; for example, displays "Photo caption" under the media.
188
- - Table cells can contain only inline formatting.
189
- - Formula source is treated as raw LaTeX.
190
- - See date-time entity formatting for more details about supported date-time formats.
191
-
192
- ###### Rich HTML style
193
-
194
- To use this mode, pass rich message content in the _html_ field. The following tags are currently supported:
195
-
196
- ~~~
197
- <a name="chapter-0"></a>
198
- <b>bold text</b>, <strong>bold text</strong>
199
- <i>italic text</i>, <em>italic text</em>
200
- <u>underlined text</u>, <ins>underlined text</ins>
201
- <s>strikethrough text</s>, <strike>strikethrough text</strike>, <del>strikethrough text</del>
202
- <code>inline fixed-width code</code>
203
- <mark>marked text</mark>
204
- <sub>subscript text</sub>
205
- <sup>superscript text</sup>
206
- <tg-spoiler>spoiler</tg-spoiler>
207
-
208
- <a href="#note-1">Reference</a>
209
- <a href="https://t.me/">inline URL</a>
210
- <a href="mailto:user@example.com">inline e-mail</a>
211
- <a href="tel:+123456789">inline phone number</a>
212
- <a href="tg://user?id=123456789">inline mention of a user</a>
213
- <a href="#chapter-1">in-document link</a>
214
- <a name="chapter-1"></a>
215
-
216
- <tg-reference name="note-1">Referenced text</tg-reference>
217
- <tg-emoji emoji-id="5368324170671202286"></tg-emoji>
218
- <img src="tg://emoji?id=5368324170671202286" alt=""/>
219
- <tg-time unix="1647531900" format="wDT">22:45 tomorrow</tg-time>
220
- <tg-math>x^2 + y^2</tg-math>
221
-
222
- #hashtag $USD +12345678901, card: 4242 4242 4242 4242, https://t.me t.me a@t.me /command @username
223
-
224
- all the text above was on the same line
225
-
226
- <h1>Heading 1</h1>
227
- <h2>Heading 2</h2>
228
- <h3>Heading 3</h3>
229
- <h4>Heading 4</h4>
230
- <h5>Heading 5</h5>
231
- <h6>Heading 6</h6>
232
-
233
- <a name="chapter-2"></a>
234
-
235
- <p>Paragraph text</p>
236
- <pre>pre-formatted fixed-width code block</pre>
237
- <pre><code class="language-python"> print('pre-formatted fixed-width code block written in the Python programming language')</code></pre>
238
- <footer>Footer text</footer>
239
- <hr/>
240
- <ul><li>unordered list item</li></ul>
241
- <ol><li>ordered list item</li></ol>
242
- <ol start="3" type="a" reversed><li>ordered list item</li></ol>
243
- <ol><li value="7" type="i">ordered list item with explicit number</li></ol>
244
- <ul>
245
- <li><input type="checkbox" checked>Checked checkbox</li>
246
- <li><input type="checkbox">Unchecked checkbox</li>
247
- </ul>
248
-
249
- <blockquote>Block quotation started<br>Block quotation continued<br>The last line of the block quotation<cite>The Author</cite></blockquote>
250
- <aside>Pull quote<cite>The Author</cite></aside>
251
-
252
- <img src="https://telegram.org/example/photo.jpg"/>
253
- <video src="https://telegram.org/example/video.mp4"></video>
254
- <audio src="https://telegram.org/example/audio.mp3"></audio>
255
- <audio src="https://telegram.org/example/audio.ogg"></audio>
256
- <video src="https://telegram.org/example/animation.gif"></video>
257
-
258
- <figure><img src="https://telegram.org/example/photo.jpg" tg-spoiler/><figcaption>Photo caption<cite>Photo credit</cite></figcaption></figure>
259
- <figure><video src="https://telegram.org/example/video.mp4" tg-spoiler></video><figcaption>Video caption</figcaption></figure>
260
- <figure><audio src="https://telegram.org/example/audio.mp3"></audio><figcaption>Audio caption</figcaption></figure>
261
- <figure><audio src="https://telegram.org/example/audio.ogg"></audio><figcaption>Voice note caption</figcaption></figure>
262
- <figure><video src="https://telegram.org/example/animation.gif" tg-spoiler></video><figcaption>Animation caption</figcaption></figure>
263
-
264
- <tg-map lat="41.9" long="12.5" zoom="14"/>
265
- <figure><tg-map lat="41.9" long="12.5" zoom="14"/><figcaption>Map caption</figcaption></figure>
266
-
267
- <tg-collage><img src="https://telegram.org/example/photo.jpg"/><video src="https://telegram.org/example/video.mp4"/></tg-collage>
268
- <tg-collage><video src="https://telegram.org/example/video.mp4"/><img src="https://telegram.org/example/photo.jpg"/><figcaption>Collage caption</figcaption></tg-collage>
269
- <tg-slideshow><img src="https://telegram.org/example/photo.jpg"/><video src="https://telegram.org/example/video.mp4"/></tg-slideshow>
270
- <tg-slideshow><video src="https://telegram.org/example/video.mp4"/><img src="https://telegram.org/example/photo.jpg"/><figcaption>Slideshow caption</figcaption></tg-slideshow>
271
-
272
- <table><tr><th>Header 1</th><th>Header 2</th></tr><tr><td>Value 1</td><td>Value 2</td></tr></table>
273
- <table bordered striped><caption>Table caption</caption>
274
- <tr><td colspan="2" rowspan="2" align="left">Value</td><td align="center">Value2</td><td align="right">Value3</td></tr>
275
- <tr><td valign="top">Value4</td><td valign="middle">Value5</td><td valign="bottom">Value6</td></tr>
276
- <tr><td>Value7</td></tr></table>
277
-
278
- <details><summary>Title</summary>Content</details>
279
- <details open><summary>Title</summary>Content</details>
280
- <tg-math-block>E = mc^2</tg-math-block>
281
- ~~~
282
-
283
- Please note:
284
-
285
- - Only the tags mentioned above are currently supported.
286
- - All numerical HTML entities are supported.
287
- - The API currently supports only the following named HTML entities: `&lt;`, `&gt;`, `&amp;`, `&quot;`, `&apos;`, `&nbsp;`, `&hellip;`, `&mdash;`, `&ndash;`, `&lsquo;`, `&rsquo;`, `&ldquo;` and `&rdquo;`.
288
- - Use nested `pre` and `code` tags to define the programming language for a pre-formatted block.
289
- - Programming language can't be specified for standalone `code` tags.
290
- - Links `mailto:...`, `tel:...`, and `tg://user?id=...` are rendered as e-mail links, phone links, and inline mentions respectively. Other supported links are rendered as regular inline links.
291
- - Images, videos, and audio files can be specified only as separate media blocks.
292
- - Media blocks support only HTTP and HTTPS URLs.
293
- - An empty `<a name="..."></a>` on its own creates an anchor that can be linked to with `<a href="#...">...</a>`.
294
- - In `<figcaption>`, you can use `<cite>` tags to specify caption credit.
295
- - Use `<tg-reference name="...">...</tg-reference>` to define referenced text that can be linked to with `<a href="#...">...</a>`.
296
- - The body of a `<details>` tag can contain rich message content. If the `open` attribute is specified, the block is expanded by default.
297
- - Formula source is treated as raw LaTeX.
298
- - See date-time entity formatting for more details about supported date-time formats.
299
-
300
- #### RichMessage
301
-
302
- Rich formatted message.
303
-
304
- | Field | Type | Description |
305
- | --- | --- | --- |
306
- | blocks | Array of RichBlock | Content of the message |
307
- | is\_rtl | Boolean | _Optional_. _True_, if the rich message must be shown right-to-left |
308
-
309
- #### InputRichMessage
310
-
311
- Describes a rich message to be sent. Exactly **one** of the fields _html_ or _markdown_ must be used.
312
-
313
- | Field | Type | Description |
314
- | --- | --- | --- |
315
- | html | String | _Optional_. Content of the rich message to send described using HTML formatting. See rich message formatting options for more details. |
316
- | markdown | String | _Optional_. Content of the rich message to send described using Markdown formatting. See rich message formatting options for more details. |
317
- | is\_rtl | Boolean | _Optional_. Pass _True_ if the rich message must be shown right-to-left |
318
- | skip\_entity\_detection | Boolean | _Optional_. Pass _True_ to skip automatic detection of entities (e.g., URLs, email addresses, username mentions, hashtags, cashtags, bot commands, or phone numbers) in the text |
319
-
320
- #### sendRichMessage
321
-
322
- Use this method to send rich messages. If the message contains a block with a media element, then the bot must have the right to send the media to the chat. On success, the sent Message is returned.
323
-
324
- | Parameter | Type | Required | Description |
325
- | --- | --- | --- | --- |
326
- | business\_connection\_id | String | Optional | Unique identifier of the business connection on behalf of which the message will be sent |
327
- | chat\_id | Integer or String | Yes | Unique identifier for the target chat or username of the target bot, supergroup or channel in the format `@username` |
328
- | message\_thread\_id | Integer | Optional | Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only |
329
- | direct\_messages\_topic\_id | Integer | Optional | Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat |
330
- | rich\_message | InputRichMessage | Yes | The message to be sent |
331
- | disable\_notification | Boolean | Optional | Sends the message silently. Users will receive a notification with no sound. |
332
- | protect\_content | Boolean | Optional | Protects the contents of the sent message from forwarding and saving |
333
- | allow\_paid\_broadcast | Boolean | Optional | Pass _True_ to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance. |
334
- | message\_effect\_id | String | Optional | Unique identifier of the message effect to be added to the message; for private chats only |
335
- | suggested\_post\_parameters | SuggestedPostParameters | Optional | A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined. |
336
- | reply\_parameters | ReplyParameters | Optional | Description of the message to reply to |
337
- | reply\_markup | InlineKeyboardMarkup or ReplyKeyboardMarkup or ReplyKeyboardRemove or ForceReply | Optional | Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user. |
338
-
339
- #### sendRichMessageDraft
340
-
341
- Use this method to stream a partial rich message to a user while the message is being generated. Note that the streamed draft is ephemeral and acts as a temporary 30-second preview - once the output is finalized, you **must** call sendRichMessage with the complete message to persist it in the user's chat. Returns _True_ on success.
342
-
343
- | Parameter | Type | Required | Description |
344
- | --- | --- | --- | --- |
345
- | chat\_id | Integer | Yes | Unique identifier for the target private chat |
346
- | message\_thread\_id | Integer | Optional | Unique identifier for the target message thread |
347
- | draft\_id | Integer | Yes | Unique identifier of the message draft; must be non-zero. Changes to drafts with the same identifier are animated. |
348
- | rich\_message | InputRichMessage | Yes | The partial message to be streamed |
349
-
350
- #### RichText
351
-
352
- This object represents a rich formatted text. Currently, it can be either a String for plain text, an Array of RichText, or any of the following types:
353
-
354
- - RichTextBold
355
- - RichTextItalic
356
- - RichTextUnderline
357
- - RichTextStrikethrough
358
- - RichTextSpoiler
359
- - RichTextDateTime
360
- - RichTextTextMention
361
- - RichTextSubscript
362
- - RichTextSuperscript
363
- - RichTextMarked
364
- - RichTextCode
365
- - RichTextCustomEmoji
366
- - RichTextMathematicalExpression
367
- - RichTextUrl
368
- - RichTextEmailAddress
369
- - RichTextPhoneNumber
370
- - RichTextBankCardNumber
371
- - RichTextMention
372
- - RichTextHashtag
373
- - RichTextCashtag
374
- - RichTextBotCommand
375
- - RichTextAnchor
376
- - RichTextAnchorLink
377
- - RichTextReference
378
- - RichTextReferenceLink
379
-
380
- #### RichTextBold
381
-
382
- A bold text.
383
-
384
- | Field | Type | Description |
385
- | --- | --- | --- |
386
- | type | String | Type of the rich text, always "bold" |
387
- | text | RichText | The text |
388
-
389
- #### RichTextItalic
390
-
391
- An italicized text.
392
-
393
- | Field | Type | Description |
394
- | --- | --- | --- |
395
- | type | String | Type of the rich text, always "italic" |
396
- | text | RichText | The text |
397
-
398
- #### RichTextUnderline
399
-
400
- An underlined text.
401
-
402
- | Field | Type | Description |
403
- | --- | --- | --- |
404
- | type | String | Type of the rich text, always "underline" |
405
- | text | RichText | The text |
406
-
407
- #### RichTextStrikethrough
408
-
409
- A strikethrough text.
410
-
411
- | Field | Type | Description |
412
- | --- | --- | --- |
413
- | type | String | Type of the rich text, always "strikethrough" |
414
- | text | RichText | The text |
415
-
416
- #### RichTextSpoiler
417
-
418
- A text covered by a spoiler.
419
-
420
- | Field | Type | Description |
421
- | --- | --- | --- |
422
- | type | String | Type of the rich text, always "spoiler" |
423
- | text | RichText | The text |
424
-
425
- #### RichTextDateTime
426
-
427
- Formatted date and time.
428
-
429
- | Field | Type | Description |
430
- | --- | --- | --- |
431
- | type | String | Type of the rich text, always "date\_time" |
432
- | text | RichText | The text |
433
- | unix\_time | Integer | The Unix time associated with the entity |
434
- | date\_time\_format | String | The string that defines the formatting of the date and time. See date-time entity formatting for more details. |
435
-
436
- #### RichTextTextMention
437
-
438
- A mention of a Telegram user by their identifier.
439
-
440
- | Field | Type | Description |
441
- | --- | --- | --- |
442
- | type | String | Type of the rich text, always "text\_mention" |
443
- | text | RichText | The text |
444
- | user | User | The mentioned user |
445
-
446
- #### RichTextSubscript
447
-
448
- A subscript text.
449
-
450
- | Field | Type | Description |
451
- | --- | --- | --- |
452
- | type | String | Type of the rich text, always "subscript" |
453
- | text | RichText | The text |
454
-
455
- #### RichTextSuperscript
456
-
457
- A superscript text.
458
-
459
- | Field | Type | Description |
460
- | --- | --- | --- |
461
- | type | String | Type of the rich text, always "superscript" |
462
- | text | RichText | The text |
463
-
464
- #### RichTextMarked
465
-
466
- A marked text.
467
-
468
- | Field | Type | Description |
469
- | --- | --- | --- |
470
- | type | String | Type of the rich text, always "marked" |
471
- | text | RichText | The text |
472
-
473
- #### RichTextCode
474
-
475
- A monowidth text.
476
-
477
- | Field | Type | Description |
478
- | --- | --- | --- |
479
- | type | String | Type of the rich text, always "code" |
480
- | text | RichText | The text |
481
-
482
- #### RichTextCustomEmoji
483
-
484
- A custom emoji.
485
-
486
- | Field | Type | Description |
487
- | --- | --- | --- |
488
- | type | String | Type of the rich text, always "custom\_emoji" |
489
- | custom\_emoji\_id | String | Unique identifier of the custom emoji. Use getCustomEmojiStickers to get full information about the sticker. |
490
- | alternative\_text | String | Alternative emoji for the custom emoji |
491
-
492
- #### RichTextMathematicalExpression
493
-
494
- A mathematical expression.
495
-
496
- | Field | Type | Description |
497
- | --- | --- | --- |
498
- | type | String | Type of the rich text, always "mathematical\_expression" |
499
- | expression | String | The expression in LaTeX format |
500
-
501
- #### RichTextUrl
502
-
503
- A text with a link.
504
-
505
- | Field | Type | Description |
506
- | --- | --- | --- |
507
- | type | String | Type of the rich text, always "url" |
508
- | text | RichText | The text |
509
- | url | String | URL of the link |
510
-
511
- #### RichTextEmailAddress
512
-
513
- A text with an email address.
514
-
515
- | Field | Type | Description |
516
- | --- | --- | --- |
517
- | type | String | Type of the rich text, always "email\_address" |
518
- | text | RichText | The text |
519
- | email\_address | String | The email address |
520
-
521
- #### RichTextPhoneNumber
522
-
523
- A text with a phone number.
524
-
525
- | Field | Type | Description |
526
- | --- | --- | --- |
527
- | type | String | Type of the rich text, always "phone\_number" |
528
- | text | RichText | The text |
529
- | phone\_number | String | The phone number |
530
-
531
- #### RichTextBankCardNumber
532
-
533
- A text with a bank card number.
534
-
535
- | Field | Type | Description |
536
- | --- | --- | --- |
537
- | type | String | Type of the rich text, always "bank\_card\_number" |
538
- | text | RichText | The text |
539
- | bank\_card\_number | String | The bank card number |
540
-
541
- #### RichTextMention
542
-
543
- A mention by a username.
544
-
545
- | Field | Type | Description |
546
- | --- | --- | --- |
547
- | type | String | Type of the rich text, always "mention" |
548
- | text | RichText | The text |
549
- | username | String | The username |
550
-
551
- #### RichTextHashtag
552
-
553
- A hashtag.
554
-
555
- | Field | Type | Description |
556
- | --- | --- | --- |
557
- | type | String | Type of the rich text, always "hashtag" |
558
- | text | RichText | The text |
559
- | hashtag | String | The hashtag |
560
-
561
- #### RichTextCashtag
562
-
563
- A cashtag.
564
-
565
- | Field | Type | Description |
566
- | --- | --- | --- |
567
- | type | String | Type of the rich text, always "cashtag" |
568
- | text | RichText | The text |
569
- | cashtag | String | The cashtag |
570
-
571
- #### RichTextBotCommand
572
-
573
- A bot command.
574
-
575
- | Field | Type | Description |
576
- | --- | --- | --- |
577
- | type | String | Type of the rich text, always "bot\_command" |
578
- | text | RichText | The text |
579
- | bot\_command | String | The bot command |
580
-
581
- #### RichTextAnchor
582
-
583
- An anchor.
584
-
585
- | Field | Type | Description |
586
- | --- | --- | --- |
587
- | type | String | Type of the rich text, always "anchor" |
588
- | name | String | The name of the anchor |
589
-
590
- #### RichTextAnchorLink
591
-
592
- A link to an anchor.
593
-
594
- | Field | Type | Description |
595
- | --- | --- | --- |
596
- | type | String | Type of the rich text, always "anchor\_link" |
597
- | text | RichText | The link text |
598
- | anchor\_name | String | The name of the anchor. If the name is empty, then the link brings back to the top of the message. |
599
-
600
- #### RichTextReference
601
-
602
- A reference.
603
-
604
- | Field | Type | Description |
605
- | --- | --- | --- |
606
- | type | String | Type of the rich text, always "reference" |
607
- | text | RichText | Text of the reference |
608
- | name | String | The name of the reference |
609
-
610
- #### RichTextReferenceLink
611
-
612
- A link to a reference.
613
-
614
- | Field | Type | Description |
615
- | --- | --- | --- |
616
- | type | String | Type of the rich text, always "reference\_link" |
617
- | text | RichText | The link text |
618
- | reference\_name | String | The name of the reference |
619
-
620
- #### RichBlockCaption
621
-
622
- Caption of a rich formatted block.
623
-
624
- | Field | Type | Description |
625
- | --- | --- | --- |
626
- | text | RichText | Block caption |
627
- | credit | RichText | _Optional_. Block credit which corresponds to the HTML tag <cite> |
628
-
629
- #### RichBlockTableCell
630
-
631
- Cell in a table.
632
-
633
- | Field | Type | Description |
634
- | --- | --- | --- |
635
- | text | RichText | _Optional_. Text in the cell. If omitted, then the cell is invisible. |
636
- | is\_header | True | _Optional_. _True_, if the cell is a header cell |
637
- | colspan | Integer | _Optional_. The number of columns the cell spans if it is bigger than 1 |
638
- | rowspan | Integer | _Optional_. The number of rows the cell spans if it is bigger than 1 |
639
- | align | String | Horizontal cell content alignment. Currently, must be one of "left", "center", or "right". |
640
- | valign | String | Vertical cell content alignment. Currently, must be one of "top", "middle", or "bottom". |
641
-
642
- #### RichBlockListItem
643
-
644
- An item of a list.
645
-
646
- | Field | Type | Description |
647
- | --- | --- | --- |
648
- | label | String | Label of the item |
649
- | blocks | Array of RichBlock | The content of the item |
650
- | has\_checkbox | True | _Optional_. _True_, if the item has a checkbox |
651
- | is\_checked | True | _Optional_. _True_, if the item has a checked checkbox |
652
- | value | Integer | _Optional_. For ordered lists, the numeric value of the item label |
653
- | type | String | _Optional_. For ordered lists, the type of the item label; must be one of "a" for lowercase letters, "A" for uppercase letters, "i" for lowercase Roman numerals, "I" for uppercase Roman numerals, or "1" for decimal numbers |
654
-
655
- #### RichBlock
656
-
657
- This object represents a block in a rich formatted message. Currently, it can be any of the following types:
658
-
659
- - RichBlockParagraph
660
- - RichBlockSectionHeading
661
- - RichBlockPreformatted
662
- - RichBlockFooter
663
- - RichBlockDivider
664
- - RichBlockMathematicalExpression
665
- - RichBlockAnchor
666
- - RichBlockList
667
- - RichBlockBlockQuotation
668
- - RichBlockPullQuotation
669
- - RichBlockCollage
670
- - RichBlockSlideshow
671
- - RichBlockTable
672
- - RichBlockDetails
673
- - RichBlockMap
674
- - RichBlockAnimation
675
- - RichBlockAudio
676
- - RichBlockPhoto
677
- - RichBlockVideo
678
- - RichBlockVoiceNote
679
- - RichBlockThinking
680
-
681
- #### RichBlockParagraph
682
-
683
- A text paragraph, corresponding to the HTML tag `<p>`.
684
-
685
- | Field | Type | Description |
686
- | --- | --- | --- |
687
- | type | String | Type of the block, always "paragraph" |
688
- | text | RichText | Text of the block |
689
-
690
- #### RichBlockSectionHeading
691
-
692
- A section heading, corresponding to the HTML tags `<h1>`, `<h2>`, `<h3>`, `<h4>`, `<h5>`, or `<h6>`.
693
-
694
- | Field | Type | Description |
695
- | --- | --- | --- |
696
- | type | String | Type of the block, always "heading" |
697
- | text | RichText | Text of the block |
698
- | size | Integer | Relative size of the text font; 1-6, 1 is the largest, 6 is the smallest |
699
-
700
- #### RichBlockPreformatted
701
-
702
- A preformatted text block, corresponding to the nested HTML tags `<pre>` and `<code>`.
703
-
704
- | Field | Type | Description |
705
- | --- | --- | --- |
706
- | type | String | Type of the block, always "pre" |
707
- | text | RichText | Text of the block |
708
- | language | String | _Optional_. The programming language of the text |
709
-
710
- #### RichBlockFooter
711
-
712
- A footer, corresponding to the HTML tag `<footer>`.
713
-
714
- | Field | Type | Description |
715
- | --- | --- | --- |
716
- | type | String | Type of the block, always "footer" |
717
- | text | RichText | Text of the block |
718
-
719
- #### RichBlockDivider
720
-
721
- A divider, corresponding to the HTML tag `<hr/>`.
722
-
723
- | Field | Type | Description |
724
- | --- | --- | --- |
725
- | type | String | Type of the block, always "divider" |
726
-
727
- #### RichBlockMathematicalExpression
728
-
729
- A block with a mathematical expression in LaTeX format, corresponding to the custom HTML tag `<tg-math-block>`.
730
-
731
- | Field | Type | Description |
732
- | --- | --- | --- |
733
- | type | String | Type of the block, always "mathematical\_expression" |
734
- | expression | String | The mathematical expression in LaTeX format |
735
-
736
- #### RichBlockAnchor
737
-
738
- A block with an anchor, corresponding to the HTML tag `<a>` with the attribute `name`.
739
-
740
- | Field | Type | Description |
741
- | --- | --- | --- |
742
- | type | String | Type of the block, always "anchor" |
743
- | name | String | The name of the anchor |
744
-
745
- #### RichBlockList
746
-
747
- A list of blocks, corresponding to the HTML tag `<ul>` or `<ol>` with multiple nested tags `<li>`.
748
-
749
- | Field | Type | Description |
750
- | --- | --- | --- |
751
- | type | String | Type of the block, always "list" |
752
- | items | Array of RichBlockListItem | Items of the list |
753
-
754
- #### RichBlockBlockQuotation
755
-
756
- A block quotation, corresponding to the HTML tag `<blockquote>`.
757
-
758
- | Field | Type | Description |
759
- | --- | --- | --- |
760
- | type | String | Type of the block, always "blockquote" |
761
- | blocks | Array of RichBlock | Content of the block |
762
- | credit | RichText | _Optional_. Credit of the block |
763
-
764
- #### RichBlockPullQuotation
765
-
766
- A quotation with centered text, loosely corresponding to the HTML tag `<aside>`.
767
-
768
- | Field | Type | Description |
769
- | --- | --- | --- |
770
- | type | String | Type of the block, always "pullquote" |
771
- | text | RichText | Text of the block |
772
- | credit | RichText | _Optional_. Credit of the block |
773
-
774
- #### RichBlockCollage
775
-
776
- A collage, corresponding to the custom HTML tag `<tg-collage>`.
777
-
778
- | Field | Type | Description |
779
- | --- | --- | --- |
780
- | type | String | Type of the block, always "collage" |
781
- | blocks | Array of RichBlock | Elements of the collage |
782
- | caption | RichBlockCaption | _Optional_. Caption of the block |
783
-
784
- #### RichBlockSlideshow
785
-
786
- A slideshow, corresponding to the custom HTML tag `<tg-slideshow>`.
787
-
788
- | Field | Type | Description |
789
- | --- | --- | --- |
790
- | type | String | Type of the block, always "slideshow" |
791
- | blocks | Array of RichBlock | Elements of the slideshow |
792
- | caption | RichBlockCaption | _Optional_. Caption of the block |
793
-
794
- #### RichBlockTable
795
-
796
- A table, corresponding to the HTML tag `<table>`.
797
-
798
- | Field | Type | Description |
799
- | --- | --- | --- |
800
- | type | String | Type of the block, always "table" |
801
- | cells | Array of Array of RichBlockTableCell | Cells of the table |
802
- | is\_bordered | True | _Optional_. _True_, if the table has borders |
803
- | is\_striped | True | _Optional_. _True_, if the table is striped |
804
- | caption | RichText | _Optional_. Caption of the table |
805
-
806
- #### RichBlockDetails
807
-
808
- An expandable block for details disclosure, corresponding to the HTML tag `<details>`.
809
-
810
- | Field | Type | Description |
811
- | --- | --- | --- |
812
- | type | String | Type of the block, always "details" |
813
- | summary | RichText | Always shown summary of the block |
814
- | blocks | Array of RichBlock | Content of the block |
815
- | is\_open | True | _Optional_. _True_, if the content of the block is visible by default |
816
-
817
- #### RichBlockMap
818
-
819
- A block with a map, corresponding to the custom HTML tag `<tg-map>`.
820
-
821
- | Field | Type | Description |
822
- | --- | --- | --- |
823
- | type | String | Type of the block, always "map" |
824
- | location | Location | Location of the center of the map |
825
- | zoom | Integer | Map zoom level; 13-20 |
826
- | width | Integer | Expected width of the map |
827
- | height | Integer | Expected height of the map |
828
- | caption | RichBlockCaption | _Optional_. Caption of the block |
829
-
830
- #### RichBlockAnimation
831
-
832
- A block with an animation, corresponding to the HTML tag `<video>`.
833
-
834
- | Field | Type | Description |
835
- | --- | --- | --- |
836
- | type | String | Type of the block, always "animation" |
837
- | animation | Animation | The animation |
838
- | has\_spoiler | True | _Optional_. _True_, if the media preview is covered by a spoiler animation |
839
- | caption | RichBlockCaption | _Optional_. Caption of the block |
840
-
841
- #### RichBlockAudio
842
-
843
- A block with a music file, corresponding to the HTML tag `<audio>`.
844
-
845
- | Field | Type | Description |
846
- | --- | --- | --- |
847
- | type | String | Type of the block, always "audio" |
848
- | audio | Audio | The audio |
849
- | caption | RichBlockCaption | _Optional_. Caption of the block |
850
-
851
- #### RichBlockPhoto
852
-
853
- A block with a photo, corresponding to the HTML tag `<photo>`.
854
-
855
- | Field | Type | Description |
856
- | --- | --- | --- |
857
- | type | String | Type of the block, always "photo" |
858
- | photo | Array of PhotoSize | Available sizes of the photo |
859
- | has\_spoiler | True | _Optional_. _True_, if the media preview is covered by a spoiler animation |
860
- | caption | RichBlockCaption | _Optional_. Caption of the block |
861
-
862
- #### RichBlockVideo
863
-
864
- A block with a video, corresponding to the HTML tag `<video>`.
865
-
866
- | Field | Type | Description |
867
- | --- | --- | --- |
868
- | type | String | Type of the block, always "video" |
869
- | video | Video | The video |
870
- | has\_spoiler | True | _Optional_. _True_, if the media preview is covered by a spoiler animation |
871
- | caption | RichBlockCaption | _Optional_. Caption of the block |
872
-
873
- #### RichBlockVoiceNote
874
-
875
- A block with a voice note, corresponding to the HTML tag `<audio>`.
876
-
877
- | Field | Type | Description |
878
- | --- | --- | --- |
879
- | type | String | Type of the block, always "voice\_note" |
880
- | voice\_note | Voice | The voice note |
881
- | caption | RichBlockCaption | _Optional_. Caption of the block |
882
-
883
- #### RichBlockThinking
884
-
885
- A block with a "Thinking…" placeholder, corresponding to the custom HTML tag `<tg-thinking>`. The block may be used only in sendRichMessageDraft, therefore it can't be received in messages. See https://t.me/addemoji/AIActions for examples of custom emoji, which are recommended for usage in the block.
886
-
887
- | Field | Type | Description |
888
- | --- | --- | --- |
889
- | type | String | Type of the block, always "thinking" |
890
- | text | RichText | Text of the block. See https://t.me/addemoji/AIActions for examples of custom emoji, which are recommended for usage in the block. |