@xbibzlibrary/telebibz 0.4.4 → 3.0.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 (258) hide show
  1. package/CHANGELOG.md +35 -138
  2. package/LICENSE +1 -1
  3. package/NOTICE.md +9 -4
  4. package/README.md +173 -242
  5. package/examples/01-quickstart.js +13 -0
  6. package/examples/02-menu-tombol.js +22 -0
  7. package/examples/03-wizard.js +29 -0
  8. package/examples/04-broadcast.js +25 -0
  9. package/examples/05-kirim-file.js +19 -0
  10. package/examples/06-menu.js +35 -0
  11. package/examples/07-inline-query.js +18 -0
  12. package/index.d.ts +81 -0
  13. package/index.js +42 -0
  14. package/lib/api.js +154 -0
  15. package/lib/broadcast.js +35 -0
  16. package/lib/composer.js +174 -0
  17. package/lib/context.js +190 -0
  18. package/lib/errors.js +35 -0
  19. package/lib/file.js +41 -0
  20. package/lib/inline-query.js +28 -0
  21. package/lib/keyboard.js +83 -0
  22. package/lib/logger.js +38 -0
  23. package/lib/menus.js +90 -0
  24. package/lib/net.js +115 -0
  25. package/lib/ratelimit.js +61 -0
  26. package/lib/runner.js +45 -0
  27. package/lib/session.js +36 -0
  28. package/lib/telebibz.js +190 -0
  29. package/lib/wizard.js +81 -0
  30. package/package.json +35 -97
  31. package/test/all.test.js +334 -0
  32. package/CODE_OF_CONDUCT.md +0 -37
  33. package/CONTRIBUTING.md +0 -59
  34. package/CONTRIBUTION_RULES.md +0 -41
  35. package/GOVERNANCE.md +0 -47
  36. package/README.id.md +0 -292
  37. package/README.zh-CN.md +0 -292
  38. package/RELEASE_AUTOMATION.md +0 -78
  39. package/RELEASE_POLICY.md +0 -32
  40. package/SECURITY.md +0 -47
  41. package/SHOWCASE.md +0 -29
  42. package/SUPPORT.md +0 -30
  43. package/assets/readme-preview.html +0 -75
  44. package/assets/telebibz-logo.png +0 -0
  45. package/assets/telebibz-readme-preview.png +0 -0
  46. package/bin/telebibz.mjs +0 -3
  47. package/dist/generated/api.d.ts +0 -13
  48. package/dist/generated/api.d.ts.map +0 -1
  49. package/dist/generated/api.js +0 -192
  50. package/dist/generated/api.js.map +0 -1
  51. package/dist/src/api/client.d.ts +0 -62
  52. package/dist/src/api/client.d.ts.map +0 -1
  53. package/dist/src/api/client.js +0 -104
  54. package/dist/src/api/client.js.map +0 -1
  55. package/dist/src/api/errors.d.ts +0 -45
  56. package/dist/src/api/errors.d.ts.map +0 -1
  57. package/dist/src/api/errors.js +0 -65
  58. package/dist/src/api/errors.js.map +0 -1
  59. package/dist/src/api/index.d.ts +0 -6
  60. package/dist/src/api/index.d.ts.map +0 -1
  61. package/dist/src/api/index.js +0 -6
  62. package/dist/src/api/index.js.map +0 -1
  63. package/dist/src/api/telegram-types/LICENSE +0 -21
  64. package/dist/src/api/telegram-types/api.d.ts +0 -22
  65. package/dist/src/api/telegram-types/checklist.d.ts +0 -72
  66. package/dist/src/api/telegram-types/inline.d.ts +0 -692
  67. package/dist/src/api/telegram-types/langs.d.ts +0 -193
  68. package/dist/src/api/telegram-types/manage.d.ts +0 -1144
  69. package/dist/src/api/telegram-types/markup.d.ts +0 -268
  70. package/dist/src/api/telegram-types/message.d.ts +0 -1537
  71. package/dist/src/api/telegram-types/methods.d.ts +0 -2870
  72. package/dist/src/api/telegram-types/mod.d.ts +0 -14
  73. package/dist/src/api/telegram-types/passport.d.ts +0 -163
  74. package/dist/src/api/telegram-types/payment.d.ts +0 -570
  75. package/dist/src/api/telegram-types/rich.d.ts +0 -1010
  76. package/dist/src/api/telegram-types/settings.d.ts +0 -120
  77. package/dist/src/api/telegram-types/story.d.ts +0 -89
  78. package/dist/src/api/telegram-types/update.d.ts +0 -84
  79. package/dist/src/api/telegram.d.ts +0 -7
  80. package/dist/src/api/telegram.d.ts.map +0 -1
  81. package/dist/src/api/telegram.js +0 -2
  82. package/dist/src/api/telegram.js.map +0 -1
  83. package/dist/src/api/transport.d.ts +0 -68
  84. package/dist/src/api/transport.d.ts.map +0 -1
  85. package/dist/src/api/transport.js +0 -264
  86. package/dist/src/api/transport.js.map +0 -1
  87. package/dist/src/api/types.d.ts +0 -466
  88. package/dist/src/api/types.d.ts.map +0 -1
  89. package/dist/src/api/types.js +0 -2
  90. package/dist/src/api/types.js.map +0 -1
  91. package/dist/src/branding/terminal.d.ts +0 -77
  92. package/dist/src/branding/terminal.d.ts.map +0 -1
  93. package/dist/src/branding/terminal.js +0 -328
  94. package/dist/src/branding/terminal.js.map +0 -1
  95. package/dist/src/broadcast/broadcast.d.ts +0 -50
  96. package/dist/src/broadcast/broadcast.d.ts.map +0 -1
  97. package/dist/src/broadcast/broadcast.js +0 -56
  98. package/dist/src/broadcast/broadcast.js.map +0 -1
  99. package/dist/src/cache/cache.d.ts +0 -34
  100. package/dist/src/cache/cache.d.ts.map +0 -1
  101. package/dist/src/cache/cache.js +0 -41
  102. package/dist/src/cache/cache.js.map +0 -1
  103. package/dist/src/cli.d.ts +0 -2
  104. package/dist/src/cli.d.ts.map +0 -1
  105. package/dist/src/cli.js +0 -84
  106. package/dist/src/cli.js.map +0 -1
  107. package/dist/src/context/context.d.ts +0 -124
  108. package/dist/src/context/context.d.ts.map +0 -1
  109. package/dist/src/context/context.js +0 -302
  110. package/dist/src/context/context.js.map +0 -1
  111. package/dist/src/core/bot.d.ts +0 -204
  112. package/dist/src/core/bot.d.ts.map +0 -1
  113. package/dist/src/core/bot.js +0 -506
  114. package/dist/src/core/bot.js.map +0 -1
  115. package/dist/src/core/events.d.ts +0 -75
  116. package/dist/src/core/events.d.ts.map +0 -1
  117. package/dist/src/core/events.js +0 -35
  118. package/dist/src/core/events.js.map +0 -1
  119. package/dist/src/core/webhook-reply.d.ts +0 -34
  120. package/dist/src/core/webhook-reply.d.ts.map +0 -1
  121. package/dist/src/core/webhook-reply.js +0 -37
  122. package/dist/src/core/webhook-reply.js.map +0 -1
  123. package/dist/src/index.d.ts +0 -24
  124. package/dist/src/index.d.ts.map +0 -1
  125. package/dist/src/index.js +0 -24
  126. package/dist/src/index.js.map +0 -1
  127. package/dist/src/keyboard/index.d.ts +0 -46
  128. package/dist/src/keyboard/index.d.ts.map +0 -1
  129. package/dist/src/keyboard/index.js +0 -55
  130. package/dist/src/keyboard/index.js.map +0 -1
  131. package/dist/src/middleware/compose.d.ts +0 -5
  132. package/dist/src/middleware/compose.d.ts.map +0 -1
  133. package/dist/src/middleware/compose.js +0 -17
  134. package/dist/src/middleware/compose.js.map +0 -1
  135. package/dist/src/observability/logger.d.ts +0 -78
  136. package/dist/src/observability/logger.d.ts.map +0 -1
  137. package/dist/src/observability/logger.js +0 -285
  138. package/dist/src/observability/logger.js.map +0 -1
  139. package/dist/src/plugins/plugin.d.ts +0 -38
  140. package/dist/src/plugins/plugin.d.ts.map +0 -1
  141. package/dist/src/plugins/plugin.js +0 -59
  142. package/dist/src/plugins/plugin.js.map +0 -1
  143. package/dist/src/queue/queue.d.ts +0 -77
  144. package/dist/src/queue/queue.d.ts.map +0 -1
  145. package/dist/src/queue/queue.js +0 -213
  146. package/dist/src/queue/queue.js.map +0 -1
  147. package/dist/src/router/router.d.ts +0 -61
  148. package/dist/src/router/router.d.ts.map +0 -1
  149. package/dist/src/router/router.js +0 -183
  150. package/dist/src/router/router.js.map +0 -1
  151. package/dist/src/state/conversation.d.ts +0 -56
  152. package/dist/src/state/conversation.d.ts.map +0 -1
  153. package/dist/src/state/conversation.js +0 -133
  154. package/dist/src/state/conversation.js.map +0 -1
  155. package/dist/src/state/forms.d.ts +0 -34
  156. package/dist/src/state/forms.d.ts.map +0 -1
  157. package/dist/src/state/forms.js +0 -44
  158. package/dist/src/state/forms.js.map +0 -1
  159. package/dist/src/state/menu.d.ts +0 -78
  160. package/dist/src/state/menu.d.ts.map +0 -1
  161. package/dist/src/state/menu.js +0 -127
  162. package/dist/src/state/menu.js.map +0 -1
  163. package/dist/src/storage/storage.d.ts +0 -146
  164. package/dist/src/storage/storage.d.ts.map +0 -1
  165. package/dist/src/storage/storage.js +0 -195
  166. package/dist/src/storage/storage.js.map +0 -1
  167. package/dist/src/telegram-features.d.ts +0 -33
  168. package/dist/src/telegram-features.d.ts.map +0 -1
  169. package/dist/src/telegram-features.js +0 -71
  170. package/dist/src/telegram-features.js.map +0 -1
  171. package/dist/src/testing.d.ts +0 -24
  172. package/dist/src/testing.d.ts.map +0 -1
  173. package/dist/src/testing.js +0 -38
  174. package/dist/src/testing.js.map +0 -1
  175. package/dist/src/utils/concurrency.d.ts +0 -25
  176. package/dist/src/utils/concurrency.d.ts.map +0 -1
  177. package/dist/src/utils/concurrency.js +0 -52
  178. package/dist/src/utils/concurrency.js.map +0 -1
  179. package/dist/src/utils/files.d.ts +0 -45
  180. package/dist/src/utils/files.d.ts.map +0 -1
  181. package/dist/src/utils/files.js +0 -53
  182. package/dist/src/utils/files.js.map +0 -1
  183. package/dist/src/utils/text.d.ts +0 -39
  184. package/dist/src/utils/text.d.ts.map +0 -1
  185. package/dist/src/utils/text.js +0 -56
  186. package/dist/src/utils/text.js.map +0 -1
  187. package/dist/src/webhook/handler.d.ts +0 -19
  188. package/dist/src/webhook/handler.d.ts.map +0 -1
  189. package/dist/src/webhook/handler.js +0 -141
  190. package/dist/src/webhook/handler.js.map +0 -1
  191. package/dist-cjs/generated/api.js +0 -194
  192. package/dist-cjs/package.json +0 -3
  193. package/dist-cjs/src/api/client.js +0 -107
  194. package/dist-cjs/src/api/errors.js +0 -74
  195. package/dist-cjs/src/api/index.js +0 -21
  196. package/dist-cjs/src/api/telegram-types/LICENSE +0 -21
  197. package/dist-cjs/src/api/telegram-types/api.d.ts +0 -22
  198. package/dist-cjs/src/api/telegram-types/checklist.d.ts +0 -72
  199. package/dist-cjs/src/api/telegram-types/inline.d.ts +0 -692
  200. package/dist-cjs/src/api/telegram-types/langs.d.ts +0 -193
  201. package/dist-cjs/src/api/telegram-types/manage.d.ts +0 -1144
  202. package/dist-cjs/src/api/telegram-types/markup.d.ts +0 -268
  203. package/dist-cjs/src/api/telegram-types/message.d.ts +0 -1537
  204. package/dist-cjs/src/api/telegram-types/methods.d.ts +0 -2870
  205. package/dist-cjs/src/api/telegram-types/mod.d.ts +0 -14
  206. package/dist-cjs/src/api/telegram-types/passport.d.ts +0 -163
  207. package/dist-cjs/src/api/telegram-types/payment.d.ts +0 -570
  208. package/dist-cjs/src/api/telegram-types/rich.d.ts +0 -1010
  209. package/dist-cjs/src/api/telegram-types/settings.d.ts +0 -120
  210. package/dist-cjs/src/api/telegram-types/story.d.ts +0 -89
  211. package/dist-cjs/src/api/telegram-types/update.d.ts +0 -84
  212. package/dist-cjs/src/api/telegram.js +0 -2
  213. package/dist-cjs/src/api/transport.js +0 -267
  214. package/dist-cjs/src/api/types.js +0 -2
  215. package/dist-cjs/src/branding/terminal.js +0 -338
  216. package/dist-cjs/src/broadcast/broadcast.js +0 -58
  217. package/dist-cjs/src/cache/cache.js +0 -45
  218. package/dist-cjs/src/cli.js +0 -86
  219. package/dist-cjs/src/context/context.js +0 -305
  220. package/dist-cjs/src/core/bot.js +0 -510
  221. package/dist-cjs/src/core/events.js +0 -38
  222. package/dist-cjs/src/core/webhook-reply.js +0 -42
  223. package/dist-cjs/src/index.js +0 -47
  224. package/dist-cjs/src/keyboard/index.js +0 -61
  225. package/dist-cjs/src/middleware/compose.js +0 -20
  226. package/dist-cjs/src/observability/logger.js +0 -293
  227. package/dist-cjs/src/plugins/plugin.js +0 -63
  228. package/dist-cjs/src/queue/queue.js +0 -219
  229. package/dist-cjs/src/router/router.js +0 -186
  230. package/dist-cjs/src/state/conversation.js +0 -139
  231. package/dist-cjs/src/state/forms.js +0 -47
  232. package/dist-cjs/src/state/menu.js +0 -133
  233. package/dist-cjs/src/storage/storage.js +0 -202
  234. package/dist-cjs/src/telegram-features.js +0 -76
  235. package/dist-cjs/src/testing.js +0 -45
  236. package/dist-cjs/src/utils/concurrency.js +0 -57
  237. package/dist-cjs/src/utils/files.js +0 -58
  238. package/dist-cjs/src/utils/text.js +0 -63
  239. package/dist-cjs/src/webhook/handler.js +0 -144
  240. package/docs/API.id.md +0 -1935
  241. package/docs/API.md +0 -1969
  242. package/docs/API.zh-CN.md +0 -1929
  243. package/docs/GETTING_STARTED.id.md +0 -85
  244. package/docs/GETTING_STARTED.md +0 -85
  245. package/docs/GETTING_STARTED.zh-CN.md +0 -85
  246. package/docs/GITHUB_PACKAGES.id.md +0 -82
  247. package/docs/GITHUB_PACKAGES.md +0 -82
  248. package/docs/GITHUB_PACKAGES.zh-CN.md +0 -82
  249. package/docs/README.md +0 -48
  250. package/docs/STORAGE.id.md +0 -105
  251. package/docs/STORAGE.md +0 -105
  252. package/docs/STORAGE.zh-CN.md +0 -105
  253. package/examples/README.md +0 -37
  254. package/examples/files.ts +0 -35
  255. package/examples/minimal.ts +0 -12
  256. package/examples/tsconfig.json +0 -9
  257. package/examples/webhook.ts +0 -42
  258. package/examples/wizard-registration.ts +0 -42
@@ -1,1010 +0,0 @@
1
- import type { User } from "./manage.js";
2
- import type { Animation, Audio, Location, PhotoSize, Video, Voice } from "./message.js";
3
- import type { InputMediaAnimation, InputMediaAudio, InputMediaPhoto, InputMediaVideo, InputMediaVoiceNote } from "./methods.js";
4
- /** Describes a rich message to be sent. Exactly one of the fields html, markdown, or blocks must be used.
5
- *
6
- * 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, or explicit blocks.
7
- *
8
- * 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).
9
- *
10
- * When Markdown-style or HTML-style formatting is used, you can use links in the form tg://photo?id=..., tg://video?id=..., and tg://audio?id=... instead of an HTTP URL to reuse previously uploaded files or upload a new file.
11
- *
12
- * #### Rich Message Limits
13
- *
14
- * Rich messages are subject to the following limits:
15
- *
16
- * - Up to 32768 UTF-8 characters in the rich message text, including custom emoji alternative text and formula source.
17
- * - Up to 500 blocks, including nested blocks, list items, ordered list items, table rows, quotation blocks, and details blocks.
18
- * - Up to 16 levels of nested formatting and blocks.
19
- * - Up to 50 media attachments in total, including photos, videos, and audio files.
20
- * - Up to 20 columns in a table.
21
- *
22
- * #### Rich Markdown style
23
- *
24
- * To use this mode, pass rich message content in the markdown field. Use the following syntax in your message:
25
- *
26
- * ````markdown
27
- * **bold text**
28
- * __bold text__
29
- * *italic text*
30
- * _italic text_
31
- * ~~strikethrough text~~
32
- * `inline fixed-width code`
33
- * ==marked text==
34
- * ||spoiler||
35
- *
36
- * [inline URL](https://t.me/)
37
- * [inline e-mail](mailto:user@example.com)
38
- * [inline phone number](tel:+123456789)
39
- * [inline mention of a user](tg://user?id=123456789)
40
- * ![👍](tg://emoji?id=5368324170671202286)
41
- * ![22:45 tomorrow](tg://time?unix=1647531900&format=wDT)
42
- * $x^2 + y^2$
43
- * \#hashtag $USD +12345678901, card: 4242 4242 4242 4242, https://t.me t.me a@t.me /command @username
44
- * all the text above was on the same line
45
- *
46
- * # Heading 1
47
- * ## Heading 2
48
- * ### Heading 3
49
- * #### Heading 4
50
- * ##### Heading 5
51
- * ###### Heading 6
52
- *
53
- * Paragraph text
54
- *
55
- * ```python
56
- * print('pre-formatted fixed-width code block written in the Python programming language')
57
- * ```
58
- *
59
- * ---
60
- *
61
- * - unordered list item
62
- * * unordered list item
63
- * + unordered list item
64
- *
65
- * 1. ordered list item
66
- * 2. ordered list item
67
- *
68
- * - [ ] task list item
69
- * - [x] completed task list item
70
- *
71
- * >Block quotation started
72
- * >
73
- * >Block quotation continued on the next line
74
- * >Block quotation continued on the same line
75
- * >
76
- * >The last line of the block quotation
77
- *
78
- * ![](https://telegram.org/example/photo.jpg)
79
- * ![](https://telegram.org/example/video.mp4)
80
- * ![](https://telegram.org/example/audio.mp3)
81
- * ![](https://telegram.org/example/audio.ogg)
82
- * ![](https://telegram.org/example/animation.gif)
83
- *
84
- * ![](https://telegram.org/example/photo.jpg "Photo caption")
85
- * ![](https://telegram.org/example/video.mp4 "Video caption")
86
- * ![](https://telegram.org/example/audio.mp3 "Audio caption")
87
- * ![](https://telegram.org/example/audio.ogg "Voice note caption")
88
- * ![](https://telegram.org/example/animation.gif "Animation caption")
89
- *
90
- * | Header 1 | Header 2 |
91
- * |:---------|:--------:|
92
- * | left | center |
93
- *
94
- * Text with a reference[^id1] and another one[^id2].
95
- *
96
- * [^id1]: Definition of the first footnote.
97
- * [^id2]: Definition of the second footnote.
98
- *
99
- * $$E = mc^2$$
100
- *
101
- * ```math
102
- * E = mc^2
103
- * ```
104
- *
105
- * ## Example Nested Syntax Report for _Q1_
106
- * Intro with <u>underlined text</u>, ==marked text==, and $x^2 + y^2$.
107
- * **Bold _italic <u>underlined italic bold</u> italic_ bold**
108
- * <u>In inline tags, nested **markdown** is parsed</u>
109
- * >Quote with **bold text, ~~strikethrough, and <tg-spoiler>spoiler</tg-spoiler>~~**, plus [a link](https://t.me/).
110
- *
111
- * - List item with `code`, <sup>superscript</sup>, <sub>subscript</sub>, and a footnote[^note]
112
- * - Another item with **bold <tg-spoiler><code>spoiler code</code></tg-spoiler>**
113
- * - Another item with ~~strikethrough and <ins>inserted text</ins>~~
114
- *
115
- * | Metric | Value |
116
- * |:-------|------:|
117
- * | Speed | **42** <sup>ms</sup> |
118
- * | Status | <tg-spoiler>ready</tg-spoiler> |
119
- *
120
- * [^note]: Footnote with _italic text_ and <u>HTML underline</u>.
121
- *
122
- * ---
123
- *
124
- * # Details blocks can contain Markdown content:
125
- *
126
- * <details open><summary>Summary with **bold text**</summary>
127
- *
128
- * ### Details heading
129
- * - List item with _italic text_
130
- * - List item with <tg-spoiler>spoiler</tg-spoiler>
131
- *
132
- * </details>
133
- *
134
- * # Collages and slideshows can contain Markdown media blocks:
135
- *
136
- * <tg-collage>
137
- *
138
- * ![](https://telegram.org/example/photo.jpg)
139
- * ![](https://telegram.org/example/video.mp4)
140
- *
141
- * </tg-collage>
142
- *
143
- * <tg-slideshow>
144
- *
145
- * ![](https://telegram.org/example/photo.jpg)
146
- * ![](https://telegram.org/example/video.mp4)
147
- *
148
- * </tg-slideshow>
149
- * ````
150
- *
151
- * For formatting features that don't have Markdown syntax, use HTML tags:
152
- *
153
- * ```html
154
- * <u>underlined text</u>, <ins>underlined text</ins>
155
- * <sub>subscript text</sub>
156
- * <sup>superscript text</sup>
157
- * <a name="chapter-1"></a>
158
- * <aside>Pull quote<cite>The Author</cite></aside>
159
- * <details open><summary>Title</summary>Content</details>
160
- * <tg-map lat="41.9" long="12.5" zoom="14"/>
161
- * <tg-collage><img src="https://telegram.org/example/photo.jpg"/><figcaption>Caption<cite>The Author</cite></figcaption></tg-collage>
162
- * <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>
163
- * ```
164
- *
165
- * Please note:
166
- *
167
- * - 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.
168
- * - Media can be specified only as a separate block.
169
- * - Media blocks support only HTTP and HTTPS URLs.
170
- * - Media type is determined by the MIME type and the URL of the media.
171
- * - In media syntax, the optional title after the URL is used as the caption; for example, displays “Photo caption” under the media.
172
- * - Table cells can contain only inline formatting.
173
- * - Formula source is treated as raw LaTeX.
174
- * - See date-time entity formatting for more details about supported date-time formats.
175
- *
176
- * #### Rich HTML style
177
- *
178
- * To use this mode, pass rich message content in the html field. The following tags are currently supported:
179
- *
180
- * ```html
181
- * <a name="chapter-0"></a>
182
- * <b>bold text</b>, <strong>bold text</strong>
183
- * <i>italic text</i>, <em>italic text</em>
184
- * <u>underlined text</u>, <ins>underlined text</ins>
185
- * <s>strikethrough text</s>, <strike>strikethrough text</strike>, <del>strikethrough text</del>
186
- * <code>inline fixed-width code</code>
187
- * <mark>marked text</mark>
188
- * <sub>subscript text</sub>
189
- * <sup>superscript text</sup>
190
- * <tg-spoiler>spoiler</tg-spoiler>
191
- *
192
- * <a href="#note-1">Reference</a>
193
- * <a href="https://t.me/">inline URL</a>
194
- * <a href="mailto:user@example.com">inline e-mail</a>
195
- * <a href="tel:+123456789">inline phone number</a>
196
- * <a href="tg://user?id=123456789">inline mention of a user</a>
197
- * <a href="#chapter-1">in-document link</a>
198
- * <a name="chapter-1"></a>
199
- *
200
- * <tg-reference name="note-1">Referenced text</tg-reference>
201
- * <tg-emoji emoji-id="5368324170671202286">👍</tg-emoji>
202
- * <img src="tg://emoji?id=5368324170671202286" alt="👍"/>
203
- * <tg-time unix="1647531900" format="wDT">22:45 tomorrow</tg-time>
204
- * <tg-math>x^2 + y^2</tg-math>
205
- *
206
- * #hashtag $USD +12345678901, card: 4242 4242 4242 4242, https://t.me t.me a@t.me /command @username
207
- *
208
- * all the text above was on the same line
209
- *
210
- * <h1>Heading 1</h1>
211
- * <h2>Heading 2</h2>
212
- * <h3>Heading 3</h3>
213
- * <h4>Heading 4</h4>
214
- * <h5>Heading 5</h5>
215
- * <h6>Heading 6</h6>
216
- *
217
- * <a name="chapter-2"></a>
218
- *
219
- * <p>Paragraph text</p>
220
- * <pre>pre-formatted fixed-width code block</pre>
221
- * <pre><code class="language-python"> print('pre-formatted fixed-width code block written in the Python programming language')</code></pre>
222
- * <footer>Footer text</footer>
223
- * <hr/>
224
- * <ul><li>unordered list item</li></ul>
225
- * <ol><li>ordered list item</li></ol>
226
- * <ol start="3" type="a" reversed><li>ordered list item</li></ol>
227
- * <ol><li value="7" type="i">ordered list item with explicit number</li></ol>
228
- * <ul>
229
- * <li><input type="checkbox" checked>Checked checkbox</li>
230
- * <li><input type="checkbox">Unchecked checkbox</li>
231
- * </ul>
232
- *
233
- * <blockquote>Block quotation started<br>Block quotation continued<br>The last line of the block quotation<cite>The Author</cite></blockquote>
234
- * <aside>Pull quote<cite>The Author</cite></aside>
235
- *
236
- * <img src="https://telegram.org/example/photo.jpg"/>
237
- * <video src="https://telegram.org/example/video.mp4"></video>
238
- * <audio src="https://telegram.org/example/audio.mp3"></audio>
239
- * <audio src="https://telegram.org/example/audio.ogg"></audio>
240
- * <video src="https://telegram.org/example/animation.gif"></video>
241
- *
242
- * <figure><img src="https://telegram.org/example/photo.jpg" tg-spoiler/><figcaption>Photo caption<cite>Photo credit</cite></figcaption></figure>
243
- * <figure><video src="https://telegram.org/example/video.mp4" tg-spoiler></video><figcaption>Video caption</figcaption></figure>
244
- * <figure><audio src="https://telegram.org/example/audio.mp3"></audio><figcaption>Audio caption</figcaption></figure>
245
- * <figure><audio src="https://telegram.org/example/audio.ogg"></audio><figcaption>Voice note caption</figcaption></figure>
246
- * <figure><video src="https://telegram.org/example/animation.gif" tg-spoiler></video><figcaption>Animation caption</figcaption></figure>
247
- *
248
- * <tg-map lat="41.9" long="12.5" zoom="14"/>
249
- * <figure><tg-map lat="41.9" long="12.5" zoom="14"/><figcaption>Map caption</figcaption></figure>
250
- *
251
- * <tg-collage><img src="https://telegram.org/example/photo.jpg"/><video src="https://telegram.org/example/video.mp4"/></tg-collage>
252
- * <tg-collage><video src="https://telegram.org/example/video.mp4"/><img src="https://telegram.org/example/photo.jpg"/><figcaption>Collage caption</figcaption></tg-collage>
253
- * <tg-slideshow><img src="https://telegram.org/example/photo.jpg"/><video src="https://telegram.org/example/video.mp4"/></tg-slideshow>
254
- * <tg-slideshow><video src="https://telegram.org/example/video.mp4"/><img src="https://telegram.org/example/photo.jpg"/><figcaption>Slideshow caption</figcaption></tg-slideshow>
255
- *
256
- * <table><tr><th>Header 1</th><th>Header 2</th></tr><tr><td>Value 1</td><td>Value 2</td></tr></table>
257
- * <table bordered striped><caption>Table caption</caption>
258
- * <tr><td colspan="2" rowspan="2" align="left">Value</td><td align="center">Value2</td><td align="right">Value3</td></tr>
259
- * <tr><td valign="top">Value4</td><td valign="middle">Value5</td><td valign="bottom">Value6</td></tr>
260
- * <tr><td>Value7</td></tr></table>
261
- *
262
- * <details><summary>Title</summary>Content</details>
263
- * <details open><summary>Title</summary>Content</details>
264
- * <tg-math-block>E = mc^2</tg-math-block>
265
- * ```
266
- *
267
- * Please note:
268
- *
269
- * - Only the tags mentioned above are currently supported.
270
- * - All numerical HTML entities are supported.
271
- * - The API currently supports only the following named HTML entities: &lt;, &gt;, &amp;, &quot;, &apos;, &nbsp;, &hellip;, &mdash;, &ndash;, &lsquo;, &rsquo;, &ldquo; and &rdquo;.
272
- * - Use nested pre and code tags to define the programming language for a pre-formatted block.
273
- * - Programming language can't be specified for standalone code tags.
274
- * - 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.
275
- * - Images, videos, and audio files can be specified only as separate media blocks.
276
- * - Media blocks support only HTTP and HTTPS URLs.
277
- * - An empty \<a name="..."></a> on its own creates an anchor that can be linked to with \<a href="#...">...</a>.
278
- * - In \<figcaption>, you can use \<cite> tags to specify caption credit.
279
- * - Use \<tg-reference name="...">...</tg-reference> to define referenced text that can be linked to with \<a href="#...">...</a>.
280
- * - The body of a \<details> tag can contain rich message content. If the open attribute is specified, the block is expanded by default.
281
- * - Formula source is treated as raw LaTeX.
282
- * - See date-time entity formatting for more details about supported date-time formats. */
283
- export interface InputRichMessage<F> {
284
- /** Content of the rich message to send described as a list of blocks */
285
- blocks?: InputRichBlock<F>[];
286
- /** Content of the rich message to send described using HTML formatting. See rich message formatting options for more details. Use media field to specify the media used in the message. */
287
- html?: string;
288
- /** Content of the rich message to send described using Markdown formatting. See rich message formatting options for more details. Use media field to specify the media used in the message. */
289
- markdown?: string;
290
- /** List of media that are specified in the markdown or html fields using tg://photo?id=, tg://video?id=, and tg://audio?id= links */
291
- media?: InputRichMessageMedia<F>[];
292
- /** Pass True if the rich message must be shown right-to-left */
293
- is_rtl?: boolean;
294
- /** 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 */
295
- skip_entity_detection?: boolean;
296
- }
297
- /** Describes a media element embedded in an outgoing rich message. */
298
- export interface InputRichMessageMedia<F> {
299
- /** Unique identifier of the media used in a tg://photo?id=, tg://video?id=, or tg://audio?id= link. 1-64 characters, only A-Z, a-z, 0-9, _ and - are allowed. */
300
- id: string;
301
- /** The media to be sent. Everything except the media itself and its properties is ignored. */
302
- media: InputMediaAnimation<F> | InputMediaAudio<F> | InputMediaPhoto<F> | InputMediaVideo<F> | InputMediaVoiceNote<F>;
303
- }
304
- /** 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:
305
-
306
- - RichTextBold
307
- - RichTextItalic
308
- - RichTextUnderline
309
- - RichTextStrikethrough
310
- - RichTextSpoiler
311
- - RichTextDateTime
312
- - RichTextTextMention
313
- - RichTextSubscript
314
- - RichTextSuperscript
315
- - RichTextMarked
316
- - RichTextCode
317
- - RichTextCustomEmoji
318
- - RichTextMathematicalExpression
319
- - RichTextUrl
320
- - RichTextEmailAddress
321
- - RichTextPhoneNumber
322
- - RichTextBankCardNumber
323
- - RichTextMention
324
- - RichTextHashtag
325
- - RichTextCashtag
326
- - RichTextBotCommand
327
- - RichTextAnchor
328
- - RichTextAnchorLink
329
- - RichTextReference
330
- - RichTextReferenceLink */
331
- export type RichText = string | RichText[] | RichTextBold | RichTextItalic | RichTextUnderline | RichTextStrikethrough | RichTextSpoiler | RichTextDateTime | RichTextTextMention | RichTextSubscript | RichTextSuperscript | RichTextMarked | RichTextCode | RichTextCustomEmoji | RichTextMathematicalExpression | RichTextUrl | RichTextEmailAddress | RichTextPhoneNumber | RichTextBankCardNumber | RichTextMention | RichTextHashtag | RichTextCashtag | RichTextBotCommand | RichTextAnchor | RichTextAnchorLink | RichTextReference | RichTextReferenceLink;
332
- /** A bold text. */
333
- export interface RichTextBold {
334
- /** Type of the rich text, always “bold” */
335
- type: "bold";
336
- /** The text */
337
- text: RichText;
338
- }
339
- /** An italicized text. */
340
- export interface RichTextItalic {
341
- /** Type of the rich text, always “italic” */
342
- type: "italic";
343
- /** The text */
344
- text: RichText;
345
- }
346
- /** An underlined text. */
347
- export interface RichTextUnderline {
348
- /** Type of the rich text, always “underline” */
349
- type: "underline";
350
- /** The text */
351
- text: RichText;
352
- }
353
- /** A strikethrough text. */
354
- export interface RichTextStrikethrough {
355
- /** Type of the rich text, always “strikethrough” */
356
- type: "strikethrough";
357
- /** The text */
358
- text: RichText;
359
- }
360
- /** A text covered by a spoiler. */
361
- export interface RichTextSpoiler {
362
- /** Type of the rich text, always “spoiler” */
363
- type: "spoiler";
364
- /** The text */
365
- text: RichText;
366
- }
367
- /** Formatted date and time. */
368
- export interface RichTextDateTime {
369
- /** Type of the rich text, always “date_time” */
370
- type: "date_time";
371
- /** The text */
372
- text: RichText;
373
- /** The Unix time associated with the entity */
374
- unix_time: number;
375
- /** The string that defines the formatting of the date and time. See date-time entity formatting for more details. */
376
- date_time_format: "r" | `${"w" | ""}${"d" | "D" | ""}${"t" | "T" | ""}`;
377
- }
378
- /** A mention of a Telegram user by their identifier. */
379
- export interface RichTextTextMention {
380
- /** Type of the rich text, always “text_mention” */
381
- type: "text_mention";
382
- /** The text */
383
- text: RichText;
384
- /** The mentioned user */
385
- user: User;
386
- }
387
- /** A subscript text. */
388
- export interface RichTextSubscript {
389
- /** Type of the rich text, always “subscript” */
390
- type: "subscript";
391
- /** The text */
392
- text: RichText;
393
- }
394
- /** A superscript text. */
395
- export interface RichTextSuperscript {
396
- /** Type of the rich text, always “superscript” */
397
- type: "superscript";
398
- /** The text */
399
- text: RichText;
400
- }
401
- /** A marked text. */
402
- export interface RichTextMarked {
403
- /** Type of the rich text, always “marked” */
404
- type: "marked";
405
- /** The text */
406
- text: RichText;
407
- }
408
- /** A monowidth text. */
409
- export interface RichTextCode {
410
- /** Type of the rich text, always “code” */
411
- type: "code";
412
- /** The text */
413
- text: RichText;
414
- }
415
- /** A custom emoji. */
416
- export interface RichTextCustomEmoji {
417
- /** Type of the rich text, always “custom_emoji” */
418
- type: "custom_emoji";
419
- /** Unique identifier of the custom emoji. Use getCustomEmojiStickers to get full information about the sticker. */
420
- custom_emoji_id: string;
421
- /** Alternative emoji for the custom emoji */
422
- alternative_text: string;
423
- }
424
- /** A mathematical expression. */
425
- export interface RichTextMathematicalExpression {
426
- /** Type of the rich text, always “mathematical_expression” */
427
- type: "mathematical_expression";
428
- /** The expression in LaTeX format */
429
- expression: string;
430
- }
431
- /** A text with a link. */
432
- export interface RichTextUrl {
433
- /** Type of the rich text, always “url” */
434
- type: "url";
435
- /** The text */
436
- text: RichText;
437
- /** URL of the link */
438
- url: string;
439
- }
440
- /** A text with an email address. */
441
- export interface RichTextEmailAddress {
442
- /** Type of the rich text, always “email_address” */
443
- type: "email_address";
444
- /** The text */
445
- text: RichText;
446
- /** The email address */
447
- email_address: string;
448
- }
449
- /** A text with a phone number. */
450
- export interface RichTextPhoneNumber {
451
- /** Type of the rich text, always “phone_number” */
452
- type: "phone_number";
453
- /** The text */
454
- text: RichText;
455
- /** The phone number */
456
- phone_number: string;
457
- }
458
- /** A text with a bank card number. */
459
- export interface RichTextBankCardNumber {
460
- /** Type of the rich text, always “bank_card_number” */
461
- type: "bank_card_number";
462
- /** The text */
463
- text: RichText;
464
- /** The bank card number */
465
- bank_card_number: string;
466
- }
467
- /** A mention by a username. */
468
- export interface RichTextMention {
469
- /** Type of the rich text, always “mention” */
470
- type: "mention";
471
- /** The text */
472
- text: RichText;
473
- /** The mentioned user */
474
- username: string;
475
- }
476
- /** A hashtag. */
477
- export interface RichTextHashtag {
478
- /** Type of the rich text, always “hashtag” */
479
- type: "hashtag";
480
- /** The text */
481
- text: RichText;
482
- /** The hashtag */
483
- hashtag: string;
484
- }
485
- /** A cashtag. */
486
- export interface RichTextCashtag {
487
- /** Type of the rich text, always “cashtag” */
488
- type: "cashtag";
489
- /** The text */
490
- text: RichText;
491
- /** The cashtag */
492
- cashtag: string;
493
- }
494
- /** A bot command. */
495
- export interface RichTextBotCommand {
496
- /** Type of the rich text, always “bot_command” */
497
- type: "bot_command";
498
- /** The text */
499
- text: RichText;
500
- /** The bot command */
501
- bot_command: string;
502
- }
503
- /** An anchor. */
504
- export interface RichTextAnchor {
505
- /** Type of the rich text, always “anchor” */
506
- type: "anchor";
507
- /** The name of the anchor */
508
- name: string;
509
- }
510
- /** A link to an anchor. */
511
- export interface RichTextAnchorLink {
512
- /** Type of the rich text, always “anchor_link” */
513
- type: "anchor_link";
514
- /** The link text */
515
- text: RichText;
516
- /** The name of the anchor. If the name is empty, then the link brings back to the top of the message. */
517
- anchor_name: string;
518
- }
519
- /** A reference. */
520
- export interface RichTextReference {
521
- /** Type of the rich text, always “reference” */
522
- type: "reference";
523
- /** Text of the reference */
524
- text: RichText;
525
- /** The name of the reference */
526
- name: string;
527
- }
528
- /** A link to a reference. */
529
- export interface RichTextReferenceLink {
530
- /** Type of the rich text, always “reference_link” */
531
- type: "reference_link";
532
- /** The link text */
533
- text: RichText;
534
- /** The name of the reference */
535
- reference_name: string;
536
- }
537
- /** Caption of a rich formatted block. */
538
- export interface RichBlockCaption {
539
- /** Block caption */
540
- text: RichText;
541
- /** Block credit which corresponds to the HTML tag \<cite> */
542
- credit?: RichText;
543
- }
544
- /** Cell in a table. */
545
- export interface RichBlockTableCell {
546
- /** Text in the cell. If omitted, then the cell is invisible. */
547
- text?: RichText;
548
- /** True, if the cell is a header cell */
549
- is_header?: true;
550
- /** The number of columns the cell spans if it is bigger than 1 */
551
- colspan?: number;
552
- /** The number of rows the cell spans if it is bigger than 1 */
553
- rowspan?: number;
554
- /** Horizontal cell content alignment. Currently, must be one of “left”, “center”, or “right”. */
555
- align: "left" | "center" | "right";
556
- /** Vertical cell content alignment. Currently, must be one of “top”, “middle”, or “bottom”. */
557
- valign: "top" | "middle" | "bottom";
558
- }
559
- /** An item of a list. */
560
- export interface RichBlockListItem {
561
- /** Label of the item */
562
- label: string;
563
- /** The content of the item */
564
- blocks: RichBlock[];
565
- /** True, if the item has a checkbox */
566
- has_checkbox?: true;
567
- /** True, if the item has a checked checkbox */
568
- is_checked?: true;
569
- /** For ordered lists, the numeric value of the item label */
570
- value?: number;
571
- /** 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 */
572
- type?: "a" | "A" | "i" | "I" | "1";
573
- }
574
- /** This object represents a block in a rich formatted message. Currently, it can be any of the following types:
575
-
576
- - RichBlockParagraph
577
- - RichBlockSectionHeading
578
- - RichBlockPreformatted
579
- - RichBlockFooter
580
- - RichBlockDivider
581
- - RichBlockMathematicalExpression
582
- - RichBlockAnchor
583
- - RichBlockList
584
- - RichBlockBlockQuotation
585
- - RichBlockPullQuotation
586
- - RichBlockCollage
587
- - RichBlockSlideshow
588
- - RichBlockTable
589
- - RichBlockDetails
590
- - RichBlockMap
591
- - RichBlockAnimation
592
- - RichBlockAudio
593
- - RichBlockPhoto
594
- - RichBlockVideo
595
- - RichBlockVoiceNote
596
- - RichBlockThinking */
597
- export type RichBlock = RichBlockParagraph | RichBlockSectionHeading | RichBlockPreformatted | RichBlockFooter | RichBlockDivider | RichBlockMathematicalExpression | RichBlockAnchor | RichBlockList | RichBlockBlockQuotation | RichBlockPullQuotation | RichBlockCollage | RichBlockSlideshow | RichBlockTable | RichBlockDetails | RichBlockMap | RichBlockAnimation | RichBlockAudio | RichBlockPhoto | RichBlockVideo | RichBlockVoiceNote | RichBlockThinking;
598
- /** A text paragraph, corresponding to the HTML tag \<p>. */
599
- export interface RichBlockParagraph {
600
- /** Type of the block, always “paragraph” */
601
- type: "paragraph";
602
- /** Text of the block */
603
- text: RichText;
604
- }
605
- /** A section heading, corresponding to the HTML tags \<h1>, \<h2>, \<h3>, \<h4>, \<h5>, or \<h6>. */
606
- export interface RichBlockSectionHeading {
607
- /** Type of the block, always “heading” */
608
- type: "heading";
609
- /** Text of the block */
610
- text: RichText;
611
- /** Relative size of the text font; 1-6, 1 is the largest, 6 is the smallest */
612
- size: 1 | 2 | 3 | 4 | 5 | 6;
613
- }
614
- /** A preformatted text block, corresponding to the nested HTML tags \<pre> and \<code>. */
615
- export interface RichBlockPreformatted {
616
- /** Type of the block, always “pre” */
617
- type: "pre";
618
- /** Text of the block */
619
- text: RichText;
620
- /** The programming language of the text */
621
- language?: string;
622
- }
623
- /** A footer, corresponding to the HTML tag \<footer>. */
624
- export interface RichBlockFooter {
625
- /** Type of the block, always “footer” */
626
- type: "footer";
627
- /** Text of the block */
628
- text: RichText;
629
- }
630
- /** A divider, corresponding to the HTML tag \<hr/>. */
631
- export interface RichBlockDivider {
632
- /** Type of the block, always “divider” */
633
- type: "divider";
634
- }
635
- /** A block with a mathematical expression in LaTeX format, corresponding to the custom HTML tag \<tg-math-block>. */
636
- export interface RichBlockMathematicalExpression {
637
- /** Type of the block, always “mathematical_expression” */
638
- type: "mathematical_expression";
639
- /** The mathematical expression in LaTeX format */
640
- expression: string;
641
- }
642
- /** A block with an anchor, corresponding to the HTML tag \<a> with the attribute name. */
643
- export interface RichBlockAnchor {
644
- /** Type of the block, always “anchor” */
645
- type: "anchor";
646
- /** The name of the anchor */
647
- name: string;
648
- }
649
- /** A list of blocks, corresponding to the HTML tag \<ul> or \<ol> with multiple nested tags \<li>. */
650
- export interface RichBlockList {
651
- /** Type of the block, always “list” */
652
- type: "list";
653
- /** Items of the list */
654
- items: RichBlockListItem[];
655
- }
656
- /** A block quotation, corresponding to the HTML tag \<blockquote>. */
657
- export interface RichBlockBlockQuotation {
658
- /** Type of the block, always “blockquote” */
659
- type: "blockquote";
660
- /** Content of the block */
661
- blocks: RichBlock[];
662
- /** Credit of the block */
663
- credit?: RichText;
664
- }
665
- /** A quotation with centered text, loosely corresponding to the HTML tag \<aside>. */
666
- export interface RichBlockPullQuotation {
667
- /** Type of the block, always “pullquote” */
668
- type: "pullquote";
669
- /** Text of the block */
670
- text: RichText;
671
- /** Credit of the block */
672
- credit?: RichText;
673
- }
674
- /** A collage, corresponding to the custom HTML tag \<tg-collage>. */
675
- export interface RichBlockCollage {
676
- /** Type of the block, always “collage” */
677
- type: "collage";
678
- /** Elements of the collage */
679
- blocks: RichBlock[];
680
- /** Caption of the block */
681
- caption?: RichBlockCaption;
682
- }
683
- /** A slideshow, corresponding to the custom HTML tag \<tg-slideshow>. */
684
- export interface RichBlockSlideshow {
685
- /** Type of the block, always “slideshow” */
686
- type: "slideshow";
687
- /** Elements of the slideshow */
688
- blocks: RichBlock[];
689
- /** Caption of the block */
690
- caption?: RichBlockCaption;
691
- }
692
- /** A table, corresponding to the HTML tag \<table>. */
693
- export interface RichBlockTable {
694
- /** Type of the block, always “table” */
695
- type: "table";
696
- /** Cells of the table */
697
- cells: RichBlockTableCell[][];
698
- /** True, if the table has borders */
699
- is_bordered?: true;
700
- /** True, if the table is striped */
701
- is_striped?: true;
702
- /** Caption of the table */
703
- caption?: RichText;
704
- }
705
- /** An expandable block for details disclosure, corresponding to the HTML tag \<details>. */
706
- export interface RichBlockDetails {
707
- /** Type of the block, always “details” */
708
- type: "details";
709
- /** Always shown summary of the block */
710
- summary: RichText;
711
- /** Content of the block */
712
- blocks: RichBlock[];
713
- /** True, if the content of the block is visible by default */
714
- is_open?: true;
715
- }
716
- /** A block with a map, corresponding to the custom HTML tag \<tg-map>. */
717
- export interface RichBlockMap {
718
- /** Type of the block, always “map” */
719
- type: "map";
720
- /** Location of the center of the map */
721
- location: Location;
722
- /** Map zoom level; 13-20 */
723
- zoom: 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20;
724
- /** Expected width of the map */
725
- width: number;
726
- /** Expected height of the map */
727
- height: number;
728
- /** Caption of the block */
729
- caption?: RichBlockCaption;
730
- }
731
- /** A block with an animation, corresponding to the HTML tag \<video>. */
732
- export interface RichBlockAnimation {
733
- /** Type of the block, always “animation” */
734
- type: "animation";
735
- /** The animation */
736
- animation: Animation;
737
- /** True, if the media preview is covered by a spoiler animation */
738
- has_spoiler?: true;
739
- /** Caption of the block */
740
- caption?: RichBlockCaption;
741
- }
742
- /** A block with a music file, corresponding to the HTML tag \<audio>. */
743
- export interface RichBlockAudio {
744
- /** Type of the block, always “audio” */
745
- type: "audio";
746
- /** The audio */
747
- audio: Audio;
748
- /** Caption of the block */
749
- caption?: RichBlockCaption;
750
- }
751
- /** A block with a photo, corresponding to the HTML tag \<photo>. */
752
- export interface RichBlockPhoto {
753
- /** Type of the block, always “photo” */
754
- type: "photo";
755
- /** Available sizes of the photo */
756
- photo: PhotoSize[];
757
- /** True, if the media preview is covered by a spoiler animation */
758
- has_spoiler?: true;
759
- /** Caption of the block */
760
- caption?: RichBlockCaption;
761
- }
762
- /** A block with a video, corresponding to the HTML tag \<video>. */
763
- export interface RichBlockVideo {
764
- /** Type of the block, always “video” */
765
- type: "video";
766
- /** The video */
767
- video: Video;
768
- /** True, if the media preview is covered by a spoiler animation */
769
- has_spoiler?: true;
770
- /** Caption of the block */
771
- caption?: RichBlockCaption;
772
- }
773
- /** A block with a voice note, corresponding to the HTML tag \<audio>. */
774
- export interface RichBlockVoiceNote {
775
- /** Type of the block, always “voice_note” */
776
- type: "voice_note";
777
- /** The voice note */
778
- voice_note: Voice;
779
- /** Caption of the block */
780
- caption?: RichBlockCaption;
781
- }
782
- /** 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 that are recommended for usage in the block. */
783
- export interface RichBlockThinking {
784
- /** Type of the block, always “thinking” */
785
- type: "thinking";
786
- /** Text of the block. See https://t.me/addemoji/AIActions for examples of custom emoji that are recommended for usage in the block. */
787
- text: RichText;
788
- }
789
- /** An item of a list to be sent. */
790
- export interface InputRichBlockListItem<F> {
791
- /** The content of the item */
792
- blocks: InputRichBlock<F>[];
793
- /** Pass True if the item has a checkbox */
794
- has_checkbox?: true;
795
- /** Pass True if the item has a checked checkbox */
796
- is_checked?: true;
797
- /** For ordered lists, the numeric value of the item label */
798
- value?: number;
799
- /** 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 */
800
- type?: "a" | "A" | "i" | "I" | "1";
801
- }
802
- /** This object represents a block in a rich formatted message to be sent. Currently, it can be any of the following types:
803
-
804
- - InputRichBlockParagraph
805
- - InputRichBlockSectionHeading
806
- - InputRichBlockPreformatted
807
- - InputRichBlockFooter
808
- - InputRichBlockDivider
809
- - InputRichBlockMathematicalExpression
810
- - InputRichBlockAnchor
811
- - InputRichBlockList
812
- - InputRichBlockBlockQuotation
813
- - InputRichBlockPullQuotation
814
- - InputRichBlockCollage
815
- - InputRichBlockSlideshow
816
- - InputRichBlockTable
817
- - InputRichBlockDetails
818
- - InputRichBlockMap
819
- - InputRichBlockAnimation
820
- - InputRichBlockAudio
821
- - InputRichBlockPhoto
822
- - InputRichBlockVideo
823
- - InputRichBlockVoiceNote
824
- - InputRichBlockThinking */
825
- export type InputRichBlock<F> = InputRichBlockParagraph | InputRichBlockSectionHeading | InputRichBlockPreformatted | InputRichBlockFooter | InputRichBlockDivider | InputRichBlockMathematicalExpression | InputRichBlockAnchor | InputRichBlockList<F> | InputRichBlockBlockQuotation<F> | InputRichBlockPullQuotation | InputRichBlockCollage<F> | InputRichBlockSlideshow<F> | InputRichBlockTable | InputRichBlockDetails<F> | InputRichBlockMap | InputRichBlockAnimation<F> | InputRichBlockAudio<F> | InputRichBlockPhoto<F> | InputRichBlockVideo<F> | InputRichBlockVoiceNote<F> | InputRichBlockThinking;
826
- /** A text paragraph, corresponding to the HTML tag \<p>. */
827
- export interface InputRichBlockParagraph {
828
- /** Type of the block, always “paragraph” */
829
- type: "paragraph";
830
- /** Text of the block */
831
- text: RichText;
832
- }
833
- /** A section heading, corresponding to the HTML tags \<h1>, \<h2>, \<h3>, \<h4>, \<h5>, or \<h6>. */
834
- export interface InputRichBlockSectionHeading {
835
- /** Type of the block, always “heading” */
836
- type: "heading";
837
- /** Text of the block */
838
- text: RichText;
839
- /** Relative size of the text font; 1-6, 1 is the largest, 6 is the smallest */
840
- size: 1 | 2 | 3 | 4 | 5 | 6;
841
- }
842
- /** A preformatted text block, corresponding to the nested HTML tags \<pre> and \<code>. */
843
- export interface InputRichBlockPreformatted {
844
- /** Type of the block, always “pre” */
845
- type: "pre";
846
- /** Text of the block */
847
- text: RichText;
848
- /** The programming language of the text */
849
- language?: string;
850
- }
851
- /** A footer, corresponding to the HTML tag \<footer>. */
852
- export interface InputRichBlockFooter {
853
- /** Type of the block, always “footer” */
854
- type: "footer";
855
- /** Text of the block */
856
- text: RichText;
857
- }
858
- /** A divider, corresponding to the HTML tag \<hr/>. */
859
- export interface InputRichBlockDivider {
860
- /** Type of the block, always “divider” */
861
- type: "divider";
862
- }
863
- /** A block with a mathematical expression in LaTeX format, corresponding to the custom HTML tag \<tg-math-block>. */
864
- export interface InputRichBlockMathematicalExpression {
865
- /** Type of the block, always “mathematical_expression” */
866
- type: "mathematical_expression";
867
- /** The mathematical expression in LaTeX format */
868
- expression: string;
869
- }
870
- /** A block with an anchor, corresponding to the HTML tag \<a> with the attribute name. */
871
- export interface InputRichBlockAnchor {
872
- /** Type of the block, always “anchor” */
873
- type: "anchor";
874
- /** The name of the anchor */
875
- name: string;
876
- }
877
- /** A list of blocks, corresponding to the HTML tag \<ul> or \<ol> with multiple nested tags \<li>. */
878
- export interface InputRichBlockList<F> {
879
- /** Type of the block, always “list” */
880
- type: "list";
881
- /** Items of the list */
882
- items: InputRichBlockListItem<F>[];
883
- }
884
- /** A block quotation, corresponding to the HTML tag \<blockquote>. */
885
- export interface InputRichBlockBlockQuotation<F> {
886
- /** Type of the block, always “blockquote” */
887
- type: "blockquote";
888
- /** Content of the block */
889
- blocks: InputRichBlock<F>[];
890
- /** Credit of the block */
891
- credit?: RichText;
892
- }
893
- /** A quotation with centered text, loosely corresponding to the HTML tag \<aside>. */
894
- export interface InputRichBlockPullQuotation {
895
- /** Type of the block, always “pullquote” */
896
- type: "pullquote";
897
- /** Text of the block */
898
- text: RichText;
899
- /** Credit of the block */
900
- credit?: RichText;
901
- }
902
- /** A collage, corresponding to the custom HTML tag \<tg-collage>. */
903
- export interface InputRichBlockCollage<F> {
904
- /** Type of the block, always “collage” */
905
- type: "collage";
906
- /** Elements of the collage */
907
- blocks: InputRichBlock<F>[];
908
- /** Caption of the block */
909
- caption?: RichBlockCaption;
910
- }
911
- /** A slideshow, corresponding to the custom HTML tag \<tg-slideshow>. */
912
- export interface InputRichBlockSlideshow<F> {
913
- /** Type of the block, always “slideshow” */
914
- type: "slideshow";
915
- /** Elements of the slideshow */
916
- blocks: InputRichBlock<F>[];
917
- /** Caption of the block */
918
- caption?: RichBlockCaption;
919
- }
920
- /** A table, corresponding to the HTML tag \<table>. */
921
- export interface InputRichBlockTable {
922
- /** Type of the block, always “table” */
923
- type: "table";
924
- /** Cells of the table */
925
- cells: RichBlockTableCell[][];
926
- /** Pass True if the table has borders */
927
- is_bordered?: true;
928
- /** Pass True if the table is striped */
929
- is_striped?: true;
930
- /** Caption of the table */
931
- caption?: RichText;
932
- }
933
- /** An expandable block for details disclosure, corresponding to the HTML tag \<details>. */
934
- export interface InputRichBlockDetails<F> {
935
- /** Type of the block, always “details” */
936
- type: "details";
937
- /** Always shown summary of the block */
938
- summary: RichText;
939
- /** Content of the block */
940
- blocks: InputRichBlock<F>[];
941
- /** Pass True if the content of the block is visible by default */
942
- is_open?: true;
943
- }
944
- /** A block with a map, corresponding to the custom HTML tag \<tg-map>. The map's width and height must not exceed 10000 in total. The width and height ratio must be at most 20. */
945
- export interface InputRichBlockMap {
946
- /** Type of the block, always “map” */
947
- type: "map";
948
- /** Location of the center of the map */
949
- location: Location;
950
- /** Map zoom level; 0-24 */
951
- zoom: number;
952
- /** Map width; 0-10000 */
953
- width: number;
954
- /** Map height; 0-10000 */
955
- height: number;
956
- /** Caption of the block */
957
- caption?: RichBlockCaption;
958
- }
959
- /** A block with an animation, corresponding to the HTML tag \<video>. */
960
- export interface InputRichBlockAnimation<F> {
961
- /** Type of the block, always “animation” */
962
- type: "animation";
963
- /** The animation. Caption is ignored. */
964
- animation: InputMediaAnimation<F>;
965
- /** Caption of the block */
966
- caption?: RichBlockCaption;
967
- }
968
- /** A block with a music file, corresponding to the HTML tag \<audio>. */
969
- export interface InputRichBlockAudio<F> {
970
- /** Type of the block, always “audio” */
971
- type: "audio";
972
- /** The audio. Caption is ignored. */
973
- audio: InputMediaAudio<F>;
974
- /** Caption of the block */
975
- caption?: RichBlockCaption;
976
- }
977
- /** A block with a photo, corresponding to the HTML tag \<img>. */
978
- export interface InputRichBlockPhoto<F> {
979
- /** Type of the block, always “photo” */
980
- type: "photo";
981
- /** The photo. Caption is ignored. */
982
- photo: InputMediaPhoto<F>;
983
- /** Caption of the block */
984
- caption?: RichBlockCaption;
985
- }
986
- /** A block with a video, corresponding to the HTML tag \<video>. */
987
- export interface InputRichBlockVideo<F> {
988
- /** Type of the block, always “video” */
989
- type: "video";
990
- /** The video. Caption is ignored. */
991
- video: InputMediaVideo<F>;
992
- /** Caption of the block */
993
- caption?: RichBlockCaption;
994
- }
995
- /** A block with a voice note, corresponding to the HTML tag \<audio>. */
996
- export interface InputRichBlockVoiceNote<F> {
997
- /** Type of the block, always “voice_note” */
998
- type: "voice_note";
999
- /** The voice note. Caption is ignored. */
1000
- voice_note: InputMediaVoiceNote<F>;
1001
- /** Caption of the block */
1002
- caption?: RichBlockCaption;
1003
- }
1004
- /** 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 that are recommended for usage in the block. */
1005
- export interface InputRichBlockThinking {
1006
- /** Type of the block, always “thinking” */
1007
- type: "thinking";
1008
- /** Text of the block. See https://t.me/addemoji/AIActions for examples of custom emoji that are recommended for usage in the block. */
1009
- text: RichText;
1010
- }