@mtkruto/node 0.148.0 → 0.150.0
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.
- package/esm/3_types.d.ts +3 -0
- package/esm/3_types.d.ts.map +1 -1
- package/esm/3_types.js +3 -0
- package/esm/client/0_params.d.ts +8 -0
- package/esm/client/0_params.d.ts.map +1 -1
- package/esm/client/0_utilities.d.ts +1 -1
- package/esm/client/0_utilities.d.ts.map +1 -1
- package/esm/client/1_client_generic.d.ts +20 -2
- package/esm/client/1_client_generic.d.ts.map +1 -1
- package/esm/client/3_filters.d.ts.map +1 -1
- package/esm/client/3_filters.js +4 -1
- package/esm/client/3_message_manager.d.ts +4 -2
- package/esm/client/3_message_manager.d.ts.map +1 -1
- package/esm/client/3_message_manager.js +84 -1
- package/esm/client/6_client.d.ts +20 -2
- package/esm/client/6_client.d.ts.map +1 -1
- package/esm/client/6_client.js +22 -0
- package/esm/client/6_client_dispatcher.d.ts +20 -2
- package/esm/client/6_client_dispatcher.d.ts.map +1 -1
- package/esm/client/6_client_dispatcher.js +22 -0
- package/esm/tl/1_telegram_api.d.ts +120 -29
- package/esm/tl/1_telegram_api.d.ts.map +1 -1
- package/esm/tl/1_telegram_api.js +124 -26
- package/esm/types/2_message_entity.d.ts +16 -0
- package/esm/types/2_message_entity.d.ts.map +1 -1
- package/esm/types/2_message_entity.js +51 -45
- package/esm/types/3_rich_text_component.d.ts +268 -0
- package/esm/types/3_rich_text_component.d.ts.map +1 -0
- package/esm/types/3_rich_text_component.js +161 -0
- package/esm/types/4_page_block.d.ts +479 -0
- package/esm/types/4_page_block.d.ts.map +1 -0
- package/esm/types/4_page_block.js +552 -0
- package/esm/types/5_input_rich_text.d.ts +38 -0
- package/esm/types/5_input_rich_text.d.ts.map +1 -0
- package/esm/types/5_input_rich_text.js +20 -0
- package/esm/types/6_message.d.ts +20 -1
- package/esm/types/6_message.d.ts.map +1 -1
- package/esm/types/6_message.js +26 -0
- package/package.json +1 -1
- package/script/3_types.d.ts +3 -0
- package/script/3_types.d.ts.map +1 -1
- package/script/3_types.js +3 -0
- package/script/client/0_params.d.ts +8 -0
- package/script/client/0_params.d.ts.map +1 -1
- package/script/client/0_utilities.d.ts +1 -1
- package/script/client/0_utilities.d.ts.map +1 -1
- package/script/client/1_client_generic.d.ts +20 -2
- package/script/client/1_client_generic.d.ts.map +1 -1
- package/script/client/3_filters.d.ts.map +1 -1
- package/script/client/3_filters.js +4 -1
- package/script/client/3_message_manager.d.ts +4 -2
- package/script/client/3_message_manager.d.ts.map +1 -1
- package/script/client/3_message_manager.js +83 -0
- package/script/client/6_client.d.ts +20 -2
- package/script/client/6_client.d.ts.map +1 -1
- package/script/client/6_client.js +22 -0
- package/script/client/6_client_dispatcher.d.ts +20 -2
- package/script/client/6_client_dispatcher.d.ts.map +1 -1
- package/script/client/6_client_dispatcher.js +22 -0
- package/script/tl/1_telegram_api.d.ts +120 -29
- package/script/tl/1_telegram_api.d.ts.map +1 -1
- package/script/tl/1_telegram_api.js +124 -26
- package/script/types/2_message_entity.d.ts +16 -0
- package/script/types/2_message_entity.d.ts.map +1 -1
- package/script/types/2_message_entity.js +53 -45
- package/script/types/3_rich_text_component.d.ts +268 -0
- package/script/types/3_rich_text_component.d.ts.map +1 -0
- package/script/types/3_rich_text_component.js +165 -0
- package/script/types/4_page_block.d.ts +479 -0
- package/script/types/4_page_block.d.ts.map +1 -0
- package/script/types/4_page_block.js +569 -0
- package/script/types/5_input_rich_text.d.ts +38 -0
- package/script/types/5_input_rich_text.d.ts.map +1 -0
- package/script/types/5_input_rich_text.js +21 -0
- package/script/types/6_message.d.ts +20 -1
- package/script/types/6_message.d.ts.map +1 -1
- package/script/types/6_message.js +26 -0
|
@@ -0,0 +1,552 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MTKruto - Cross-runtime JavaScript library for building Telegram clients
|
|
3
|
+
* Copyright (C) 2023-2026 Roj <https://roj.im/>
|
|
4
|
+
*
|
|
5
|
+
* This file is part of MTKruto.
|
|
6
|
+
*
|
|
7
|
+
* This program is free software: you can redistribute it and/or modify
|
|
8
|
+
* it under the terms of the GNU Lesser General Public License as published by
|
|
9
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
10
|
+
* (at your option) any later version.
|
|
11
|
+
*
|
|
12
|
+
* This program is distributed in the hope that it will be useful,
|
|
13
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
15
|
+
* GNU Lesser General Public License for more details.
|
|
16
|
+
*
|
|
17
|
+
* You should have received a copy of the GNU Lesser General Public License
|
|
18
|
+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
19
|
+
*/
|
|
20
|
+
import { unreachable } from "../0_deps.js";
|
|
21
|
+
import { cleanObject } from "../1_utilities.js";
|
|
22
|
+
import { Api } from "../2_tl.js";
|
|
23
|
+
import { deserializeFileId, FileType, serializeFileId } from "./_file_id.js";
|
|
24
|
+
import { constructLocation } from "./0_location.js";
|
|
25
|
+
import { constructChatP } from "./1_chat_p.js";
|
|
26
|
+
import { constructPhoto } from "./1_photo.js";
|
|
27
|
+
import { constructRichTextComponent, richTextComponentToTlObject } from "./3_rich_text_component.js";
|
|
28
|
+
export function constructPageBlockListItem(pli, photos, documents) {
|
|
29
|
+
switch (pli._) {
|
|
30
|
+
case "pageListItemText":
|
|
31
|
+
return { type: "text", isCheckbox: !!pli.checkbox, isChecked: !!pli.checked, text: constructRichTextComponent(pli.text, photos) };
|
|
32
|
+
case "pageListItemBlocks":
|
|
33
|
+
return { type: "blockList", isCheckbox: !!pli.checkbox, isChecked: !!pli.checked, blocks: pli.blocks.map((v) => constructPageBlock(v, photos, documents)) };
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
export function pageBlockListItemToTlObject(pbli) {
|
|
37
|
+
switch (pbli.type) {
|
|
38
|
+
case "text":
|
|
39
|
+
return { _: "pageListItemText", checkbox: pbli.isCheckbox || undefined, checked: pbli.isChecked || undefined, text: richTextComponentToTlObject(pbli.text) };
|
|
40
|
+
case "blockList":
|
|
41
|
+
return { _: "pageListItemBlocks", checkbox: pbli.isCheckbox || undefined, checked: pbli.isChecked || undefined, blocks: pbli.blocks.map(pageBlockToTlObject) };
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
export function constructPageBlockCaption(pc, photos) {
|
|
45
|
+
return {
|
|
46
|
+
text: constructRichTextComponent(pc.text, photos),
|
|
47
|
+
credit: constructRichTextComponent(pc.credit, photos),
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
export function pageBlockCaptionToTlObject(pbc) {
|
|
51
|
+
return {
|
|
52
|
+
_: "pageCaption",
|
|
53
|
+
text: richTextComponentToTlObject(pbc.text),
|
|
54
|
+
credit: richTextComponentToTlObject(pbc.credit),
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
export function constructPageBlockTableCell(ptc, photos) {
|
|
58
|
+
return cleanObject({
|
|
59
|
+
isHeader: !!ptc.header,
|
|
60
|
+
isCenterAligned: !!ptc.align_center,
|
|
61
|
+
isRightAligned: !!ptc.align_right,
|
|
62
|
+
isMiddleVerticallyAligned: !!ptc.valign_middle,
|
|
63
|
+
isBottomVerticallyAligned: !!ptc.valign_bottom,
|
|
64
|
+
text: ptc.text ? constructRichTextComponent(ptc.text, photos) : undefined,
|
|
65
|
+
colspan: ptc.colspan,
|
|
66
|
+
rowspan: ptc.rowspan,
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
export function pageBlockTableCellToTlObject(pbtc) {
|
|
70
|
+
return {
|
|
71
|
+
_: "pageTableCell",
|
|
72
|
+
header: pbtc.isHeader || undefined,
|
|
73
|
+
align_center: pbtc.isCenterAligned || undefined,
|
|
74
|
+
align_right: pbtc.isRightAligned || undefined,
|
|
75
|
+
valign_middle: pbtc.isMiddleVerticallyAligned || undefined,
|
|
76
|
+
valign_bottom: pbtc.isBottomVerticallyAligned || undefined,
|
|
77
|
+
text: pbtc.text ? richTextComponentToTlObject(pbtc.text) : undefined,
|
|
78
|
+
colspan: pbtc.colspan,
|
|
79
|
+
rowspan: pbtc.rowspan,
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
export function constructPageBlockTableRow(ptr, photos) {
|
|
83
|
+
return {
|
|
84
|
+
cells: ptr.cells.map((v) => constructPageBlockTableCell(v, photos)),
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
export function pageBlockTableRowToTlObject(pbtr) {
|
|
88
|
+
return {
|
|
89
|
+
_: "pageTableRow",
|
|
90
|
+
cells: pbtr.cells.map(pageBlockTableCellToTlObject),
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
export function constructPageBlockOrderedListItem(ploi, photos, documents) {
|
|
94
|
+
switch (ploi._) {
|
|
95
|
+
case "pageListOrderedItemText":
|
|
96
|
+
return cleanObject({ type: "text", isCheckbox: !!ploi.checkbox, isChecked: !!ploi.checked, number: ploi.num, value: ploi.value, itemType: ploi.type, text: constructRichTextComponent(ploi.text, photos) });
|
|
97
|
+
case "pageListOrderedItemBlocks":
|
|
98
|
+
return cleanObject({ type: "blockList", isCheckbox: !!ploi.checkbox, isChecked: !!ploi.checked, number: ploi.num, value: ploi.value, itemType: ploi.type, blocks: ploi.blocks.map((v) => constructPageBlock(v, photos, documents)) });
|
|
99
|
+
}
|
|
100
|
+
unreachable();
|
|
101
|
+
}
|
|
102
|
+
export function pageBlockOrderedListItemToTlObject(pboli) {
|
|
103
|
+
switch (pboli.type) {
|
|
104
|
+
case "text":
|
|
105
|
+
return { _: "pageListOrderedItemText", checkbox: pboli.isCheckbox || undefined, checked: pboli.isCheckbox || undefined, text: richTextComponentToTlObject(pboli.text), num: pboli.number, type: pboli.itemType, value: pboli.value };
|
|
106
|
+
case "blockList":
|
|
107
|
+
return { _: "pageListOrderedItemBlocks", checkbox: pboli.isCheckbox || undefined, checked: pboli.isCheckbox || undefined, blocks: pboli.blocks.map(pageBlockToTlObject), num: pboli.number, type: pboli.itemType, value: pboli.value };
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
export function constructPageBlockRelatedArticle(pra) {
|
|
111
|
+
return cleanObject({
|
|
112
|
+
url: pra.url,
|
|
113
|
+
linkPreviewId: String(pra.webpage_id),
|
|
114
|
+
title: pra.title,
|
|
115
|
+
description: pra.description,
|
|
116
|
+
photoId: pra.photo_id ? String(pra.photo_id) : undefined,
|
|
117
|
+
author: pra.author,
|
|
118
|
+
date: pra.published_date,
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
export function pageBlockRelatedArticleToTlObject(pbra) {
|
|
122
|
+
return { _: "pageRelatedArticle", url: pbra.url, webpage_id: BigInt(pbra.linkPreviewId), title: pbra.title, description: pbra.description, photo_id: pbra.photoId ? BigInt(pbra.photoId) : undefined, author: pbra.author, published_date: pbra.date };
|
|
123
|
+
}
|
|
124
|
+
export function constructPageBlock(pb, photos, documents) {
|
|
125
|
+
switch (pb._) {
|
|
126
|
+
case "pageBlockUnsupported":
|
|
127
|
+
return { type: "unsupported" };
|
|
128
|
+
case "pageBlockTitle":
|
|
129
|
+
return { type: "title", text: constructRichTextComponent(pb.text, photos) };
|
|
130
|
+
case "pageBlockSubtitle":
|
|
131
|
+
return { type: "subtitle", text: constructRichTextComponent(pb.text, photos) };
|
|
132
|
+
case "pageBlockAuthorDate":
|
|
133
|
+
return { type: "authorDate", author: constructRichTextComponent(pb.author, photos), date: pb.published_date };
|
|
134
|
+
case "pageBlockHeader":
|
|
135
|
+
return { type: "header", text: constructRichTextComponent(pb.text, photos) };
|
|
136
|
+
case "pageBlockSubheader":
|
|
137
|
+
return { type: "subheader", text: constructRichTextComponent(pb.text, photos) };
|
|
138
|
+
case "pageBlockParagraph":
|
|
139
|
+
return { type: "paragraph", text: constructRichTextComponent(pb.text, photos) };
|
|
140
|
+
case "pageBlockPreformatted":
|
|
141
|
+
return cleanObject({ type: "pre", text: constructRichTextComponent(pb.text, photos), language: pb.language || undefined });
|
|
142
|
+
case "pageBlockFooter":
|
|
143
|
+
return { type: "footer", text: constructRichTextComponent(pb.text, photos) };
|
|
144
|
+
case "pageBlockDivider":
|
|
145
|
+
return { type: "divider" };
|
|
146
|
+
case "pageBlockAnchor":
|
|
147
|
+
return { type: "anchor", name: pb.name };
|
|
148
|
+
case "pageBlockList":
|
|
149
|
+
return { type: "list", items: pb.items.map((v) => constructPageBlockListItem(v, photos, documents)) };
|
|
150
|
+
case "pageBlockBlockquote":
|
|
151
|
+
return { type: "blockQuote", text: constructRichTextComponent(pb.text, photos), caption: constructRichTextComponent(pb.caption, photos) };
|
|
152
|
+
case "pageBlockPullquote":
|
|
153
|
+
return { type: "blockQuote", text: constructRichTextComponent(pb.text, photos), caption: constructRichTextComponent(pb.caption, photos) };
|
|
154
|
+
case "pageBlockPhoto": {
|
|
155
|
+
const fileId = constructPhoto(Api.as("photo", photos.find((v) => v.id === pb.photo_id))).fileId;
|
|
156
|
+
return cleanObject({ type: "photo", fileId, caption: constructPageBlockCaption(pb.caption, photos), isSpoiler: !!pb.spoiler, linkPreviewId: pb.webpage_id ? String(pb.webpage_id) : undefined, url: pb.url });
|
|
157
|
+
}
|
|
158
|
+
case "pageBlockVideo": {
|
|
159
|
+
const document = Api.as("document", documents.find((v) => v.id === pb.video_id));
|
|
160
|
+
const isAnimated = !!document.attributes.find((v) => Api.is("documentAttributeAnimated", v));
|
|
161
|
+
const fileId = {
|
|
162
|
+
type: FileType.Video,
|
|
163
|
+
dcId: document.dc_id,
|
|
164
|
+
location: { type: "common", id: document.id, accessHash: document.access_hash },
|
|
165
|
+
fileReference: document.file_reference,
|
|
166
|
+
};
|
|
167
|
+
return { type: isAnimated ? "animation" : "video", fileId: serializeFileId(fileId), caption: constructPageBlockCaption(pb.caption, photos), isSpoiler: !!pb.spoiler, isAutoplay: !!pb.autoplay, isLoop: !!pb.loop };
|
|
168
|
+
}
|
|
169
|
+
case "pageBlockCover":
|
|
170
|
+
return { type: "cover", cover: constructPageBlock(pb.cover, photos, documents) };
|
|
171
|
+
case "pageBlockEmbed":
|
|
172
|
+
return cleanObject({ type: "embed", caption: constructPageBlockCaption(pb.caption, photos), isFullWidth: !!pb.full_width, isScrollingAllowed: !!pb.allow_scrolling, width: pb.w, height: pb.h, html: pb.html, url: pb.url, posterPhotoId: pb.poster_photo_id ? String(pb.poster_photo_id) : undefined });
|
|
173
|
+
case "pageBlockEmbedPost":
|
|
174
|
+
return cleanObject({ type: "embedPost", caption: constructPageBlockCaption(pb.caption, photos), author: pb.author, authorPhotoId: String(pb.author_photo_id), blocks: pb.blocks.map((v) => constructPageBlock(v, photos, documents)), date: pb.date, linkPreviewId: String(pb.webpage_id), url: pb.url });
|
|
175
|
+
case "pageBlockCollage":
|
|
176
|
+
return cleanObject({ type: "collage", caption: constructPageBlockCaption(pb.caption, photos), items: pb.items.map((v) => constructPageBlock(v, photos, documents)) });
|
|
177
|
+
case "pageBlockSlideshow":
|
|
178
|
+
return cleanObject({ type: "slideshow", caption: constructPageBlockCaption(pb.caption, photos), items: pb.items.map((v) => constructPageBlock(v, photos, documents)) });
|
|
179
|
+
case "pageBlockChannel":
|
|
180
|
+
return cleanObject({ type: "channel", chat: constructChatP(pb.channel) });
|
|
181
|
+
case "pageBlockAudio": {
|
|
182
|
+
const document = Api.as("document", documents.find((v) => v.id === pb.audio_id));
|
|
183
|
+
const audioAttribute = document.attributes.find((v) => Api.is("documentAttributeAudio", v));
|
|
184
|
+
if (!audioAttribute) {
|
|
185
|
+
unreachable();
|
|
186
|
+
}
|
|
187
|
+
const fileId = {
|
|
188
|
+
type: FileType.Video,
|
|
189
|
+
dcId: document.dc_id,
|
|
190
|
+
location: { type: "common", id: document.id, accessHash: document.access_hash },
|
|
191
|
+
fileReference: document.file_reference,
|
|
192
|
+
};
|
|
193
|
+
return cleanObject({ type: audioAttribute.voice ? "voice" : "audio", fileId: serializeFileId(fileId), caption: constructPageBlockCaption(pb.caption, photos) });
|
|
194
|
+
}
|
|
195
|
+
case "pageBlockKicker":
|
|
196
|
+
return cleanObject({ type: "kicker", text: constructRichTextComponent(pb.text, photos) });
|
|
197
|
+
case "pageBlockTable":
|
|
198
|
+
return cleanObject({ type: "table", isBordered: !!pb.bordered, isStriped: !!pb.striped, title: constructRichTextComponent(pb.title, photos), rows: pb.rows.map((v) => constructPageBlockTableRow(v, photos)) });
|
|
199
|
+
case "pageBlockOrderedList":
|
|
200
|
+
return cleanObject({
|
|
201
|
+
type: "orderedList",
|
|
202
|
+
isReversed: !!pb.reversed,
|
|
203
|
+
items: pb.items.map((v) => constructPageBlockOrderedListItem(v, photos, documents)),
|
|
204
|
+
itemsType: pb.type,
|
|
205
|
+
start: pb.start,
|
|
206
|
+
});
|
|
207
|
+
case "pageBlockDetails":
|
|
208
|
+
return { type: "details", isOpen: !!pb.open, title: constructRichTextComponent(pb.title, photos), blocks: pb.blocks.map((v) => constructPageBlock(v, photos, documents)) };
|
|
209
|
+
case "pageBlockRelatedArticles":
|
|
210
|
+
return {
|
|
211
|
+
type: "relatedArticles",
|
|
212
|
+
title: constructRichTextComponent(pb.title, photos),
|
|
213
|
+
articles: pb.articles.map(constructPageBlockRelatedArticle),
|
|
214
|
+
};
|
|
215
|
+
case "pageBlockMap":
|
|
216
|
+
return {
|
|
217
|
+
type: "map",
|
|
218
|
+
caption: constructPageBlockCaption(pb.caption, photos),
|
|
219
|
+
width: pb.w,
|
|
220
|
+
height: pb.h,
|
|
221
|
+
zoom: pb.zoom,
|
|
222
|
+
location: constructLocation(Api.as("geoPoint", pb.geo)),
|
|
223
|
+
};
|
|
224
|
+
case "pageBlockHeading1":
|
|
225
|
+
return { type: "heading1", text: constructRichTextComponent(pb.text, photos) };
|
|
226
|
+
case "pageBlockHeading2":
|
|
227
|
+
return { type: "heading2", text: constructRichTextComponent(pb.text, photos) };
|
|
228
|
+
case "pageBlockHeading3":
|
|
229
|
+
return { type: "heading3", text: constructRichTextComponent(pb.text, photos) };
|
|
230
|
+
case "pageBlockHeading4":
|
|
231
|
+
return { type: "heading4", text: constructRichTextComponent(pb.text, photos) };
|
|
232
|
+
case "pageBlockHeading5":
|
|
233
|
+
return { type: "heading5", text: constructRichTextComponent(pb.text, photos) };
|
|
234
|
+
case "pageBlockHeading6":
|
|
235
|
+
return { type: "heading6", text: constructRichTextComponent(pb.text, photos) };
|
|
236
|
+
case "pageBlockMath":
|
|
237
|
+
return { type: "math", code: pb.source };
|
|
238
|
+
case "pageBlockThinking":
|
|
239
|
+
return { type: "thinking", text: constructRichTextComponent(pb.text, photos) };
|
|
240
|
+
case "inputPageBlockMap":
|
|
241
|
+
unreachable();
|
|
242
|
+
break;
|
|
243
|
+
case "pageBlockBlockquoteBlocks":
|
|
244
|
+
return { type: "blockQuoteBlocks", blocks: pb.blocks.map((v) => constructPageBlock(v, photos, documents)), caption: constructRichTextComponent(pb.caption, photos) };
|
|
245
|
+
}
|
|
246
|
+
unreachable();
|
|
247
|
+
}
|
|
248
|
+
export function pageBlockToTlObject(pb) {
|
|
249
|
+
switch (pb.type) {
|
|
250
|
+
case "unsupported":
|
|
251
|
+
return { _: "pageBlockUnsupported" };
|
|
252
|
+
case "title":
|
|
253
|
+
return { _: "pageBlockTitle", text: richTextComponentToTlObject(pb.text) };
|
|
254
|
+
case "subtitle":
|
|
255
|
+
return { _: "pageBlockSubtitle", text: richTextComponentToTlObject(pb.text) };
|
|
256
|
+
case "authorDate":
|
|
257
|
+
return { _: "pageBlockAuthorDate", author: richTextComponentToTlObject(pb.author), published_date: pb.date };
|
|
258
|
+
case "header":
|
|
259
|
+
return { _: "pageBlockHeader", text: richTextComponentToTlObject(pb.text) };
|
|
260
|
+
case "subheader":
|
|
261
|
+
return { _: "pageBlockSubheader", text: richTextComponentToTlObject(pb.text) };
|
|
262
|
+
case "paragraph":
|
|
263
|
+
return { _: "pageBlockParagraph", text: richTextComponentToTlObject(pb.text) };
|
|
264
|
+
case "pre":
|
|
265
|
+
return { _: "pageBlockPreformatted", text: richTextComponentToTlObject(pb.text), language: pb.language ?? "" };
|
|
266
|
+
case "footer":
|
|
267
|
+
return { _: "pageBlockFooter", text: richTextComponentToTlObject(pb.text) };
|
|
268
|
+
case "divider":
|
|
269
|
+
return { _: "pageBlockDivider" };
|
|
270
|
+
case "anchor":
|
|
271
|
+
return { _: "pageBlockAnchor", name: pb.name };
|
|
272
|
+
case "list":
|
|
273
|
+
return { _: "pageBlockList", items: pb.items.map(pageBlockListItemToTlObject) };
|
|
274
|
+
case "blockQuote":
|
|
275
|
+
return { _: "pageBlockBlockquote", text: richTextComponentToTlObject(pb.text), caption: richTextComponentToTlObject(pb.caption) };
|
|
276
|
+
case "pullQuote":
|
|
277
|
+
return { _: "pageBlockPullquote", text: richTextComponentToTlObject(pb.text), caption: richTextComponentToTlObject(pb.caption) };
|
|
278
|
+
case "photo": {
|
|
279
|
+
const location = deserializeFileId(pb.fileId).location;
|
|
280
|
+
if (!("id" in location)) {
|
|
281
|
+
unreachable();
|
|
282
|
+
}
|
|
283
|
+
return { _: "pageBlockPhoto", photo_id: location.id, caption: pageBlockCaptionToTlObject(pb.caption), spoiler: pb.isSpoiler || undefined, url: pb.url, webpage_id: pb.linkPreviewId ? BigInt(pb.linkPreviewId) : undefined };
|
|
284
|
+
}
|
|
285
|
+
case "video":
|
|
286
|
+
case "animation": {
|
|
287
|
+
const location = deserializeFileId(pb.fileId).location;
|
|
288
|
+
if (!("id" in location)) {
|
|
289
|
+
unreachable();
|
|
290
|
+
}
|
|
291
|
+
return { _: "pageBlockVideo", video_id: location.id, caption: pageBlockCaptionToTlObject(pb.caption), spoiler: pb.isSpoiler || undefined, autoplay: pb.isAutoplay || undefined, loop: pb.isLoop || undefined };
|
|
292
|
+
}
|
|
293
|
+
case "cover":
|
|
294
|
+
return { _: "pageBlockCover", cover: pageBlockToTlObject(pb.cover) };
|
|
295
|
+
case "embed":
|
|
296
|
+
return { _: "pageBlockEmbed", caption: pageBlockCaptionToTlObject(pb.caption), allow_scrolling: pb.isScrollingAllowed || undefined, full_width: pb.isFullWidth || undefined, w: pb.width, h: pb.height, html: pb.html, url: pb.url, poster_photo_id: pb.posterPhotoId ? BigInt(pb.posterPhotoId) : undefined };
|
|
297
|
+
case "embedPost":
|
|
298
|
+
return { _: "pageBlockEmbedPost", caption: pageBlockCaptionToTlObject(pb.caption), url: pb.url, author: pb.author, author_photo_id: BigInt(pb.authorPhotoId), blocks: pb.blocks.map(pageBlockToTlObject), date: pb.date, webpage_id: BigInt(pb.linkPreviewId) };
|
|
299
|
+
case "collage":
|
|
300
|
+
return { _: "pageBlockCollage", caption: pageBlockCaptionToTlObject(pb.caption), items: pb.items.map(pageBlockToTlObject) };
|
|
301
|
+
case "slideshow":
|
|
302
|
+
return { _: "pageBlockSlideshow", caption: pageBlockCaptionToTlObject(pb.caption), items: pb.items.map(pageBlockToTlObject) };
|
|
303
|
+
case "channel":
|
|
304
|
+
unreachable();
|
|
305
|
+
break;
|
|
306
|
+
case "audio":
|
|
307
|
+
case "voice": {
|
|
308
|
+
const location = deserializeFileId(pb.fileId).location;
|
|
309
|
+
if (!("id" in location)) {
|
|
310
|
+
unreachable();
|
|
311
|
+
}
|
|
312
|
+
return { _: "pageBlockAudio", audio_id: location.id, caption: pageBlockCaptionToTlObject(pb.caption) };
|
|
313
|
+
}
|
|
314
|
+
case "kicker":
|
|
315
|
+
return { _: "pageBlockKicker", text: richTextComponentToTlObject(pb.text) };
|
|
316
|
+
case "math":
|
|
317
|
+
return { _: "pageBlockMath", source: pb.code };
|
|
318
|
+
case "table":
|
|
319
|
+
return { _: "pageBlockTable", title: richTextComponentToTlObject(pb.title), rows: pb.rows.map(pageBlockTableRowToTlObject), bordered: pb.isBordered || undefined, striped: pb.isStriped || undefined };
|
|
320
|
+
case "orderedList":
|
|
321
|
+
return { _: "pageBlockOrderedList", items: pb.items.map(pageBlockOrderedListItemToTlObject), reversed: pb.isReversed || undefined, start: pb.start, type: pb.itemsType };
|
|
322
|
+
case "details":
|
|
323
|
+
return { _: "pageBlockDetails", title: richTextComponentToTlObject(pb.title), blocks: pb.blocks.map(pageBlockToTlObject), open: pb.isOpen || undefined };
|
|
324
|
+
case "relatedArticles":
|
|
325
|
+
return { _: "pageBlockRelatedArticles", title: richTextComponentToTlObject(pb.title), articles: pb.articles.map(pageBlockRelatedArticleToTlObject) };
|
|
326
|
+
case "map":
|
|
327
|
+
return { _: "inputPageBlockMap", geo: { _: "inputGeoPoint", lat: pb.location.latitude, long: pb.location.longitude, accuracy_radius: pb.location.horizontalAccuracy }, caption: pageBlockCaptionToTlObject(pb.caption), w: pb.width, h: pb.height, zoom: pb.zoom };
|
|
328
|
+
case "heading1":
|
|
329
|
+
return { _: "pageBlockHeading1", text: richTextComponentToTlObject(pb.text) };
|
|
330
|
+
case "heading2":
|
|
331
|
+
return { _: "pageBlockHeading2", text: richTextComponentToTlObject(pb.text) };
|
|
332
|
+
case "heading3":
|
|
333
|
+
return { _: "pageBlockHeading3", text: richTextComponentToTlObject(pb.text) };
|
|
334
|
+
case "heading4":
|
|
335
|
+
return { _: "pageBlockHeading4", text: richTextComponentToTlObject(pb.text) };
|
|
336
|
+
case "heading5":
|
|
337
|
+
return { _: "pageBlockHeading5", text: richTextComponentToTlObject(pb.text) };
|
|
338
|
+
case "heading6":
|
|
339
|
+
return { _: "pageBlockHeading6", text: richTextComponentToTlObject(pb.text) };
|
|
340
|
+
case "thinking":
|
|
341
|
+
return { _: "pageBlockThinking", text: richTextComponentToTlObject(pb.text) };
|
|
342
|
+
case "blockQuoteBlocks":
|
|
343
|
+
return { _: "pageBlockBlockquoteBlocks", caption: richTextComponentToTlObject(pb.caption), blocks: pb.blocks.map(pageBlockToTlObject) };
|
|
344
|
+
}
|
|
345
|
+
unreachable();
|
|
346
|
+
}
|
|
347
|
+
export function collectMediaFileIds(pageBlocks) {
|
|
348
|
+
const fileIds = new Array();
|
|
349
|
+
for (const m of collectPageBlockMedia(pageBlocks)) {
|
|
350
|
+
fileIds.push({ type: m.type, fileId: m.fileId });
|
|
351
|
+
}
|
|
352
|
+
for (const photo of collectRichTextComponentPhoto(collectRichTextComponents(pageBlocks))) {
|
|
353
|
+
fileIds.push({ type: "photo", fileId: photo.fileId });
|
|
354
|
+
}
|
|
355
|
+
return fileIds;
|
|
356
|
+
}
|
|
357
|
+
function collectRichTextComponentPhoto(components) {
|
|
358
|
+
const photos = new Array();
|
|
359
|
+
for (const component of components) {
|
|
360
|
+
for (const c of flattenRichTextComponent(component)) {
|
|
361
|
+
if (c.type === "photo") {
|
|
362
|
+
photos.push(c);
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
return photos;
|
|
367
|
+
}
|
|
368
|
+
function flattenRichTextComponent(component) {
|
|
369
|
+
const items = new Array();
|
|
370
|
+
switch (component.type) {
|
|
371
|
+
case "anchor":
|
|
372
|
+
case "dateTime":
|
|
373
|
+
case "bold":
|
|
374
|
+
case "italic":
|
|
375
|
+
case "underline":
|
|
376
|
+
case "strikethrough":
|
|
377
|
+
case "fixed":
|
|
378
|
+
case "link":
|
|
379
|
+
case "emailLink":
|
|
380
|
+
case "subscript":
|
|
381
|
+
case "superscript":
|
|
382
|
+
case "marked":
|
|
383
|
+
case "phoneNumberLink":
|
|
384
|
+
case "spoiler":
|
|
385
|
+
case "mention":
|
|
386
|
+
case "hashtag":
|
|
387
|
+
case "botCommand":
|
|
388
|
+
case "cashtag":
|
|
389
|
+
case "url":
|
|
390
|
+
case "email":
|
|
391
|
+
case "phoneNumber":
|
|
392
|
+
case "bankCard":
|
|
393
|
+
case "textMention":
|
|
394
|
+
for (const item of flattenRichTextComponent(component.text)) {
|
|
395
|
+
items.push(item);
|
|
396
|
+
}
|
|
397
|
+
break;
|
|
398
|
+
case "concatenate":
|
|
399
|
+
for (const c of component.components) {
|
|
400
|
+
for (const i of flattenRichTextComponent(c)) {
|
|
401
|
+
items.push(i);
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
return items;
|
|
406
|
+
}
|
|
407
|
+
function collectRichTextComponents(pageBlocks) {
|
|
408
|
+
const components = new Array();
|
|
409
|
+
for (const pb of pageBlocks) {
|
|
410
|
+
switch (pb.type) {
|
|
411
|
+
case "title":
|
|
412
|
+
case "subtitle":
|
|
413
|
+
case "header":
|
|
414
|
+
case "subheader":
|
|
415
|
+
case "paragraph":
|
|
416
|
+
case "pre":
|
|
417
|
+
case "footer":
|
|
418
|
+
case "kicker":
|
|
419
|
+
case "heading1":
|
|
420
|
+
case "heading2":
|
|
421
|
+
case "heading3":
|
|
422
|
+
case "heading4":
|
|
423
|
+
case "heading5":
|
|
424
|
+
case "heading6":
|
|
425
|
+
case "thinking":
|
|
426
|
+
components.push(pb.text);
|
|
427
|
+
break;
|
|
428
|
+
case "authorDate":
|
|
429
|
+
components.push(pb.author);
|
|
430
|
+
break;
|
|
431
|
+
case "list":
|
|
432
|
+
case "orderedList":
|
|
433
|
+
for (const item of pb.items) {
|
|
434
|
+
if (item.type === "text") {
|
|
435
|
+
components.push(item.text);
|
|
436
|
+
}
|
|
437
|
+
else {
|
|
438
|
+
for (const c of collectRichTextComponents(item.blocks)) {
|
|
439
|
+
components.push(c);
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
break;
|
|
444
|
+
case "blockQuote":
|
|
445
|
+
case "pullQuote":
|
|
446
|
+
components.push(pb.text);
|
|
447
|
+
components.push(pb.caption);
|
|
448
|
+
break;
|
|
449
|
+
case "photo":
|
|
450
|
+
case "video":
|
|
451
|
+
case "embed":
|
|
452
|
+
case "audio":
|
|
453
|
+
case "map":
|
|
454
|
+
components.push(pb.caption.text);
|
|
455
|
+
components.push(pb.caption.credit);
|
|
456
|
+
break;
|
|
457
|
+
case "cover":
|
|
458
|
+
for (const c of collectRichTextComponents([pb.cover])) {
|
|
459
|
+
components.push(c);
|
|
460
|
+
}
|
|
461
|
+
break;
|
|
462
|
+
case "collage":
|
|
463
|
+
case "slideshow":
|
|
464
|
+
components.push(pb.caption.text);
|
|
465
|
+
components.push(pb.caption.credit);
|
|
466
|
+
for (const c of collectRichTextComponents(pb.items)) {
|
|
467
|
+
components.push(c);
|
|
468
|
+
}
|
|
469
|
+
break;
|
|
470
|
+
case "embedPost":
|
|
471
|
+
components.push(pb.caption.text);
|
|
472
|
+
components.push(pb.caption.credit);
|
|
473
|
+
for (const c of collectRichTextComponents(pb.blocks)) {
|
|
474
|
+
components.push(c);
|
|
475
|
+
}
|
|
476
|
+
break;
|
|
477
|
+
case "math":
|
|
478
|
+
break;
|
|
479
|
+
case "table":
|
|
480
|
+
components.push(pb.title);
|
|
481
|
+
for (const row of pb.rows) {
|
|
482
|
+
for (const cell of row.cells) {
|
|
483
|
+
if (cell.text) {
|
|
484
|
+
components.push(cell.text);
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
break;
|
|
489
|
+
case "details":
|
|
490
|
+
components.push(pb.title);
|
|
491
|
+
for (const c of collectRichTextComponents(pb.blocks)) {
|
|
492
|
+
components.push(c);
|
|
493
|
+
}
|
|
494
|
+
break;
|
|
495
|
+
case "blockQuoteBlocks":
|
|
496
|
+
components.push(pb.caption);
|
|
497
|
+
for (const c of collectRichTextComponents(pb.blocks)) {
|
|
498
|
+
components.push(c);
|
|
499
|
+
}
|
|
500
|
+
break;
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
return components;
|
|
504
|
+
}
|
|
505
|
+
function collectPageBlockMedia(pageBlocks) {
|
|
506
|
+
const media = new Array();
|
|
507
|
+
for (const pb of pageBlocks) {
|
|
508
|
+
if (pb.type === "photo" || pb.type === "video" || pb.type === "audio" || pb.type === "voice" || pb.type === "animation") {
|
|
509
|
+
media.push(pb);
|
|
510
|
+
}
|
|
511
|
+
else {
|
|
512
|
+
switch (pb.type) {
|
|
513
|
+
case "list":
|
|
514
|
+
for (const item of pb.items) {
|
|
515
|
+
if (item.type === "blockList") {
|
|
516
|
+
for (const m of collectPageBlockMedia(item.blocks)) {
|
|
517
|
+
media.push(m);
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
break;
|
|
522
|
+
case "embedPost":
|
|
523
|
+
for (const m of collectPageBlockMedia(pb.blocks)) {
|
|
524
|
+
media.push(m);
|
|
525
|
+
}
|
|
526
|
+
break;
|
|
527
|
+
case "collage":
|
|
528
|
+
case "slideshow":
|
|
529
|
+
for (const m of collectPageBlockMedia(pb.items)) {
|
|
530
|
+
media.push(m);
|
|
531
|
+
}
|
|
532
|
+
break;
|
|
533
|
+
case "orderedList":
|
|
534
|
+
for (const item of pb.items) {
|
|
535
|
+
if (item.type === "blockList") {
|
|
536
|
+
for (const m of collectPageBlockMedia(item.blocks)) {
|
|
537
|
+
media.push(m);
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
break;
|
|
542
|
+
case "details":
|
|
543
|
+
case "blockQuoteBlocks":
|
|
544
|
+
for (const m of collectPageBlockMedia(pb.blocks)) {
|
|
545
|
+
media.push(m);
|
|
546
|
+
}
|
|
547
|
+
break;
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
return media;
|
|
552
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MTKruto - Cross-runtime JavaScript library for building Telegram clients
|
|
3
|
+
* Copyright (C) 2023-2026 Roj <https://roj.im/>
|
|
4
|
+
*
|
|
5
|
+
* This file is part of MTKruto.
|
|
6
|
+
*
|
|
7
|
+
* This program is free software: you can redistribute it and/or modify
|
|
8
|
+
* it under the terms of the GNU Lesser General Public License as published by
|
|
9
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
10
|
+
* (at your option) any later version.
|
|
11
|
+
*
|
|
12
|
+
* This program is distributed in the hope that it will be useful,
|
|
13
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
15
|
+
* GNU Lesser General Public License for more details.
|
|
16
|
+
*
|
|
17
|
+
* You should have received a copy of the GNU Lesser General Public License
|
|
18
|
+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
19
|
+
*/
|
|
20
|
+
import type { PageBlock } from "./4_page_block.js";
|
|
21
|
+
/** @unlisted */
|
|
22
|
+
export interface InputRichTextBlocks {
|
|
23
|
+
type: "blocks";
|
|
24
|
+
blocks: PageBlock[];
|
|
25
|
+
}
|
|
26
|
+
/** @unlisted */
|
|
27
|
+
export interface InputRichTextMarkdown {
|
|
28
|
+
type: "markdown";
|
|
29
|
+
markdown: string;
|
|
30
|
+
}
|
|
31
|
+
/** @unlisted */
|
|
32
|
+
export interface InputRichTextHtml {
|
|
33
|
+
type: "html";
|
|
34
|
+
html: string;
|
|
35
|
+
}
|
|
36
|
+
/** Any type of input rich text. */
|
|
37
|
+
export type InputRichText = InputRichTextBlocks | InputRichTextMarkdown | InputRichTextHtml;
|
|
38
|
+
//# sourceMappingURL=5_input_rich_text.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"5_input_rich_text.d.ts","sourceRoot":"","sources":["../../src/types/5_input_rich_text.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD,gBAAgB;AAChB,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,QAAQ,CAAC;IACf,MAAM,EAAE,SAAS,EAAE,CAAC;CACrB;AAED,gBAAgB;AAChB,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,UAAU,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,gBAAgB;AAChB,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED,mCAAmC;AACnC,MAAM,MAAM,aAAa,GAAG,mBAAmB,GAAG,qBAAqB,GAAG,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MTKruto - Cross-runtime JavaScript library for building Telegram clients
|
|
3
|
+
* Copyright (C) 2023-2026 Roj <https://roj.im/>
|
|
4
|
+
*
|
|
5
|
+
* This file is part of MTKruto.
|
|
6
|
+
*
|
|
7
|
+
* This program is free software: you can redistribute it and/or modify
|
|
8
|
+
* it under the terms of the GNU Lesser General Public License as published by
|
|
9
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
10
|
+
* (at your option) any later version.
|
|
11
|
+
*
|
|
12
|
+
* This program is distributed in the hope that it will be useful,
|
|
13
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
15
|
+
* GNU Lesser General Public License for more details.
|
|
16
|
+
*
|
|
17
|
+
* You should have received a copy of the GNU Lesser General Public License
|
|
18
|
+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
19
|
+
*/
|
|
20
|
+
export {};
|
package/esm/types/6_message.d.ts
CHANGED
|
@@ -48,6 +48,7 @@ import { type Game } from "./3_game.js";
|
|
|
48
48
|
import { type PollOption } from "./3_poll_option.js";
|
|
49
49
|
import { type ReplyQuote } from "./3_reply_quote.js";
|
|
50
50
|
import { type Checklist } from "./4_checklist.js";
|
|
51
|
+
import { type PageBlock } from "./4_page_block.js";
|
|
51
52
|
import { type Poll } from "./4_poll.js";
|
|
52
53
|
import { type GiftNonUpgradedInformation } from "./5_gift_non_upgraded_information.js";
|
|
53
54
|
import { type GiftUpgradedInformation } from "./5_gift_upgraded_information.js";
|
|
@@ -581,6 +582,23 @@ export interface MessagePollOptionRemoved extends _MessageBase {
|
|
|
581
582
|
/** The option that was added. */
|
|
582
583
|
pollOptionRemoved: PollOption;
|
|
583
584
|
}
|
|
585
|
+
/**
|
|
586
|
+
* A message with rich text.
|
|
587
|
+
* @unlisted
|
|
588
|
+
*/
|
|
589
|
+
export interface MessageRichText extends _MessageBase {
|
|
590
|
+
type: "richText";
|
|
591
|
+
/** The blocks of the rich text. */
|
|
592
|
+
blocks: PageBlock[];
|
|
593
|
+
/** Whether the rich text is right-to-left. */
|
|
594
|
+
isRtl: boolean;
|
|
595
|
+
/** Whether the rich text is partial. */
|
|
596
|
+
isPartial: boolean;
|
|
597
|
+
/** The photos included in the rich text. */
|
|
598
|
+
photos: Photo[];
|
|
599
|
+
/** The documents included in the rich text. */
|
|
600
|
+
documents: Document[];
|
|
601
|
+
}
|
|
584
602
|
/** @unlisted */
|
|
585
603
|
export interface MessageTypes {
|
|
586
604
|
text: MessageText;
|
|
@@ -633,11 +651,12 @@ export interface MessageTypes {
|
|
|
633
651
|
giftUpgraded: MessageGiftUpgraded;
|
|
634
652
|
pollOptionAdded: MessagePollOptionAdded;
|
|
635
653
|
pollOptionRemoved: MessagePollOptionRemoved;
|
|
654
|
+
richText: MessageRichText;
|
|
636
655
|
}
|
|
637
656
|
export declare const messageTypes: (keyof MessageTypes)[];
|
|
638
657
|
export declare function assertMessageType<T extends keyof MessageTypes>(message: Message, type: T): MessageTypes[T];
|
|
639
658
|
/** Any type of message. */
|
|
640
|
-
export type Message = MessageText | MessageLink | MessagePhoto | MessageLivePhoto | MessageDocument | MessageVideo | MessageSticker | MessageAnimation | MessageVoice | MessageAudio | MessageDice | MessageVideoNote | MessageContact | MessageGame | MessagePoll | MessageChecklist | MessageInvoice | MessageVenue | MessageLocation | MessageNewChatMembers | MessageLeftChatMember | MessageNewChatTitle | MessageNewChatPhoto | MessageDeletedChatPhoto | MessageGroupCreated | MessageSupergroupCreated | MessageChannelCreated | MessageAutoDeleteTimerChanged | MessageChatMigratedTo | MessageChatMigratedFrom | MessagePinnedMessage | MessageUserShared | MessageWriteAccessAllowed | MessageForumTopicCreated | MessageForumTopicEdited | MessageForumTopicClosed | MessageForumTopicReopened | MessageVideoChatScheduled | MessageVideoChatStarted | MessageVideoChatEnded | MessageGiveaway | MessageUnsupported | MessageSuccessfulPayment | MessageRefundedPayment | MessageChecklistChanged | MessageChecklistExtended | MessageGiftNonUpgraded | MessageGiftUpgraded | MessagePollOptionAdded | MessagePollOptionRemoved;
|
|
659
|
+
export type Message = MessageText | MessageLink | MessagePhoto | MessageLivePhoto | MessageDocument | MessageVideo | MessageSticker | MessageAnimation | MessageVoice | MessageAudio | MessageDice | MessageVideoNote | MessageContact | MessageGame | MessagePoll | MessageChecklist | MessageInvoice | MessageVenue | MessageLocation | MessageNewChatMembers | MessageLeftChatMember | MessageNewChatTitle | MessageNewChatPhoto | MessageDeletedChatPhoto | MessageGroupCreated | MessageSupergroupCreated | MessageChannelCreated | MessageAutoDeleteTimerChanged | MessageChatMigratedTo | MessageChatMigratedFrom | MessagePinnedMessage | MessageUserShared | MessageWriteAccessAllowed | MessageForumTopicCreated | MessageForumTopicEdited | MessageForumTopicClosed | MessageForumTopicReopened | MessageVideoChatScheduled | MessageVideoChatStarted | MessageVideoChatEnded | MessageGiveaway | MessageUnsupported | MessageSuccessfulPayment | MessageRefundedPayment | MessageChecklistChanged | MessageChecklistExtended | MessageGiftNonUpgraded | MessageGiftUpgraded | MessagePollOptionAdded | MessagePollOptionRemoved | MessageRichText;
|
|
641
660
|
/** @unlisted */
|
|
642
661
|
export interface MessageGetter {
|
|
643
662
|
(chatId: number, messageId: number): MaybePromise<Message | null>;
|