@mtkruto/node 0.148.0 → 0.151.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 +4 -0
- package/esm/3_types.d.ts.map +1 -1
- package/esm/3_types.js +4 -0
- package/esm/client/0_params.d.ts +18 -4
- 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 +34 -6
- package/esm/client/1_client_generic.d.ts.map +1 -1
- package/esm/client/2_file_manager.d.ts.map +1 -1
- package/esm/client/2_file_manager.js +20 -0
- 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 +5 -2
- package/esm/client/3_message_manager.d.ts.map +1 -1
- package/esm/client/3_message_manager.js +326 -76
- package/esm/client/4_context.d.ts.map +1 -1
- package/esm/client/4_context.js +5 -1
- package/esm/client/6_client.d.ts +34 -6
- package/esm/client/6_client.d.ts.map +1 -1
- package/esm/client/6_client.js +43 -5
- package/esm/client/6_client_dispatcher.d.ts +34 -6
- package/esm/client/6_client_dispatcher.d.ts.map +1 -1
- package/esm/client/6_client_dispatcher.js +38 -4
- 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/0_message_counters.d.ts +1 -1
- package/esm/types/0_message_counters.d.ts.map +1 -1
- package/esm/types/0_upload_progress.d.ts +2 -0
- package/esm/types/0_upload_progress.d.ts.map +1 -1
- package/esm/types/1_chat_p.d.ts +2 -0
- package/esm/types/1_chat_p.d.ts.map +1 -1
- package/esm/types/1_chat_p.js +3 -2
- package/esm/types/1_input_poll_media.d.ts +128 -0
- package/esm/types/1_input_poll_media.d.ts.map +1 -0
- package/esm/types/1_input_poll_media.js +20 -0
- 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_checklist_item.d.ts +1 -1
- package/esm/types/3_checklist_item.d.ts.map +1 -1
- package/esm/types/3_input_poll_option.d.ts +3 -0
- package/esm/types/3_input_poll_option.d.ts.map +1 -1
- package/esm/types/3_message_reactions.d.ts +1 -1
- package/esm/types/3_message_reactions.d.ts.map +1 -1
- 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_gift.d.ts +1 -1
- 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/4_poll.d.ts +1 -1
- package/esm/types/4_poll.d.ts.map +1 -1
- package/esm/types/4_reply_to.d.ts +4 -0
- package/esm/types/4_reply_to.d.ts.map +1 -1
- 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 +22 -1
- package/esm/types/6_message.d.ts.map +1 -1
- package/esm/types/6_message.js +30 -0
- package/esm/utilities/0_misc.d.ts +1 -0
- package/esm/utilities/0_misc.d.ts.map +1 -1
- package/esm/utilities/0_misc.js +1 -0
- package/package.json +1 -1
- package/script/3_types.d.ts +4 -0
- package/script/3_types.d.ts.map +1 -1
- package/script/3_types.js +4 -0
- package/script/client/0_params.d.ts +18 -4
- 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 +34 -6
- package/script/client/1_client_generic.d.ts.map +1 -1
- package/script/client/2_file_manager.d.ts.map +1 -1
- package/script/client/2_file_manager.js +20 -0
- 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 +5 -2
- package/script/client/3_message_manager.d.ts.map +1 -1
- package/script/client/3_message_manager.js +325 -75
- package/script/client/4_context.d.ts.map +1 -1
- package/script/client/4_context.js +5 -1
- package/script/client/6_client.d.ts +34 -6
- package/script/client/6_client.d.ts.map +1 -1
- package/script/client/6_client.js +42 -4
- package/script/client/6_client_dispatcher.d.ts +34 -6
- package/script/client/6_client_dispatcher.d.ts.map +1 -1
- package/script/client/6_client_dispatcher.js +38 -4
- 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/0_message_counters.d.ts +1 -1
- package/script/types/0_message_counters.d.ts.map +1 -1
- package/script/types/0_upload_progress.d.ts +2 -0
- package/script/types/0_upload_progress.d.ts.map +1 -1
- package/script/types/1_chat_p.d.ts +2 -0
- package/script/types/1_chat_p.d.ts.map +1 -1
- package/script/types/1_chat_p.js +3 -2
- package/script/types/1_input_poll_media.d.ts +128 -0
- package/script/types/1_input_poll_media.d.ts.map +1 -0
- package/script/types/1_input_poll_media.js +21 -0
- 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_checklist_item.d.ts +1 -1
- package/script/types/3_checklist_item.d.ts.map +1 -1
- package/script/types/3_input_poll_option.d.ts +3 -0
- package/script/types/3_input_poll_option.d.ts.map +1 -1
- package/script/types/3_message_reactions.d.ts +1 -1
- package/script/types/3_message_reactions.d.ts.map +1 -1
- 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_gift.d.ts +1 -1
- 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/4_poll.d.ts +1 -1
- package/script/types/4_poll.d.ts.map +1 -1
- package/script/types/4_reply_to.d.ts +4 -0
- package/script/types/4_reply_to.d.ts.map +1 -1
- 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 +22 -1
- package/script/types/6_message.d.ts.map +1 -1
- package/script/types/6_message.js +30 -0
- package/script/utilities/0_misc.d.ts +1 -0
- package/script/utilities/0_misc.d.ts.map +1 -1
- package/script/utilities/0_misc.js +2 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"3_message_reactions.d.ts","sourceRoot":"","sources":["../../src/types/3_message_reactions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAqB,KAAK,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AACnE,OAAO,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAkB,KAAK,IAAI,EAAE,MAAM,aAAa,CAAC;AAExD,
|
|
1
|
+
{"version":3,"file":"3_message_reactions.d.ts","sourceRoot":"","sources":["../../src/types/3_message_reactions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAqB,KAAK,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AACnE,OAAO,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAkB,KAAK,IAAI,EAAE,MAAM,aAAa,CAAC;AAExD,uDAAuD;AACvD,MAAM,WAAW,gBAAgB;IAC/B,2DAA2D;IAC3D,IAAI,EAAE,KAAK,CAAC;IACZ,gCAAgC;IAChC,SAAS,EAAE,MAAM,CAAC;IAClB,8FAA8F;IAC9F,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,6FAA6F;IAC7F,SAAS,CAAC,EAAE,KAAK,CAAC;IAClB,kDAAkD;IAClD,IAAI,EAAE,MAAM,CAAC;IACb,8BAA8B;IAC9B,YAAY,EAAE,QAAQ,EAAE,CAAC;IACzB,6BAA6B;IAC7B,YAAY,EAAE,QAAQ,EAAE,CAAC;CAC1B;AAED,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,GAAG,CAAC,wBAAwB,EAAE,OAAO,EAAE,UAAU,GAAG,gBAAgB,GAAG,IAAI,CAkC5H"}
|
|
@@ -0,0 +1,268 @@
|
|
|
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 { Api } from "../2_tl.js";
|
|
21
|
+
/**
|
|
22
|
+
* An empty rich text component.
|
|
23
|
+
* @unlisted
|
|
24
|
+
*/
|
|
25
|
+
export interface RichTextComponentEmpty {
|
|
26
|
+
type: "empty";
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* An plain rich text component.
|
|
30
|
+
* @unlisted
|
|
31
|
+
*/
|
|
32
|
+
export interface RichTextComponentPlain {
|
|
33
|
+
type: "plain";
|
|
34
|
+
text: string;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* A rich text component that has its child bold.
|
|
38
|
+
* @unlisted
|
|
39
|
+
*/
|
|
40
|
+
export interface RichTextComponentBold {
|
|
41
|
+
type: "bold";
|
|
42
|
+
text: RichTextComponent;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* A rich text component that has its child italic.
|
|
46
|
+
* @unlisted
|
|
47
|
+
*/
|
|
48
|
+
export interface RichTextComponentItalic {
|
|
49
|
+
type: "italic";
|
|
50
|
+
text: RichTextComponent;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* A rich text component that has its child underlined.
|
|
54
|
+
* @unlisted
|
|
55
|
+
*/
|
|
56
|
+
export interface RichTextComponentUnderline {
|
|
57
|
+
type: "underline";
|
|
58
|
+
text: RichTextComponent;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* A rich text component that has its child striked through.
|
|
62
|
+
* @unlisted
|
|
63
|
+
*/
|
|
64
|
+
export interface RichTextComponentStrikethrough {
|
|
65
|
+
type: "strikethrough";
|
|
66
|
+
text: RichTextComponent;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* A fixed rich text component.
|
|
70
|
+
* @unlisted
|
|
71
|
+
*/
|
|
72
|
+
export interface RichTextComponentFixed {
|
|
73
|
+
type: "fixed";
|
|
74
|
+
text: RichTextComponent;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* A rich text component that opens a URL when clicked.
|
|
78
|
+
* @unlisted
|
|
79
|
+
*/
|
|
80
|
+
export interface RichTextComponentLink {
|
|
81
|
+
type: "link";
|
|
82
|
+
url: string;
|
|
83
|
+
linkPreviewId: string;
|
|
84
|
+
text: RichTextComponent;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* A rich text component that opens the email address represented by its child when clicked.
|
|
88
|
+
* @unlisted
|
|
89
|
+
*/
|
|
90
|
+
export interface RichTextComponentEmail {
|
|
91
|
+
type: "email";
|
|
92
|
+
text: RichTextComponent;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* A rich text component for concatenating other rich text components.
|
|
96
|
+
* @unlisted
|
|
97
|
+
*/
|
|
98
|
+
export interface RichTextComponentConcatenate {
|
|
99
|
+
type: "concatenate";
|
|
100
|
+
components: RichTextComponent[];
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* A rich text component that has its child in the subscript.
|
|
104
|
+
* @unlisted
|
|
105
|
+
*/
|
|
106
|
+
export interface RichTextComponentSubscript {
|
|
107
|
+
type: "subscript";
|
|
108
|
+
text: RichTextComponent;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* A rich text component that has its child in the superscript.
|
|
112
|
+
* @unlisted
|
|
113
|
+
*/
|
|
114
|
+
export interface RichTextComponentSuperscript {
|
|
115
|
+
type: "superscript";
|
|
116
|
+
text: RichTextComponent;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* A rich text component that has its child marked.
|
|
120
|
+
* @unlisted
|
|
121
|
+
*/
|
|
122
|
+
export interface RichTextComponentMarked {
|
|
123
|
+
type: "marked";
|
|
124
|
+
text: RichTextComponent;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* A rich text component that links to a phone number.
|
|
128
|
+
* @unlisted
|
|
129
|
+
*/
|
|
130
|
+
export interface RichTextComponentPhoneNumberLink {
|
|
131
|
+
type: "phoneNumberLink";
|
|
132
|
+
phoneNumber: string;
|
|
133
|
+
text: RichTextComponent;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* A rich text component that displays an inline photo.
|
|
137
|
+
* @unlisted
|
|
138
|
+
*/
|
|
139
|
+
export interface RichTextComponentPhoto {
|
|
140
|
+
type: "photo";
|
|
141
|
+
fileId: string;
|
|
142
|
+
width: number;
|
|
143
|
+
height: number;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* An anchor rich text component.
|
|
147
|
+
* @unlisted
|
|
148
|
+
*/
|
|
149
|
+
export interface RichTextComponentAnchor {
|
|
150
|
+
type: "anchor";
|
|
151
|
+
name: string;
|
|
152
|
+
text: RichTextComponent;
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* An rich text component that displays a mathematical expression.
|
|
156
|
+
* @unlisted
|
|
157
|
+
*/
|
|
158
|
+
export interface RichTextComponentMath {
|
|
159
|
+
type: "math";
|
|
160
|
+
code: string;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* An rich text component that displays a custom emoji.
|
|
164
|
+
* @unlisted
|
|
165
|
+
*/
|
|
166
|
+
export interface RichTextComponentCustomEmoji {
|
|
167
|
+
type: "customEmoji";
|
|
168
|
+
customEmojiId: string;
|
|
169
|
+
alt: string;
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* An rich text component that displays a spoiler.
|
|
173
|
+
* @unlisted
|
|
174
|
+
*/
|
|
175
|
+
export interface RichTextComponentSpoiler {
|
|
176
|
+
type: "spoiler";
|
|
177
|
+
text: RichTextComponent;
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* An rich text component that mentions a username.
|
|
181
|
+
* @unlisted
|
|
182
|
+
*/
|
|
183
|
+
export interface RichTextComponentMention {
|
|
184
|
+
type: "mention";
|
|
185
|
+
text: RichTextComponent;
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* A hashtag rich text component.
|
|
189
|
+
* @unlisted
|
|
190
|
+
*/
|
|
191
|
+
export interface RichTextComponentHashtag {
|
|
192
|
+
type: "hashtag";
|
|
193
|
+
text: RichTextComponent;
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* A bot command rich text component.
|
|
197
|
+
* @unlisted
|
|
198
|
+
*/
|
|
199
|
+
export interface RichTextComponentBotCommand {
|
|
200
|
+
type: "botCommand";
|
|
201
|
+
text: RichTextComponent;
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* A cashtag rich text component.
|
|
205
|
+
* @unlisted
|
|
206
|
+
*/
|
|
207
|
+
export interface RichTextComponentCashtag {
|
|
208
|
+
type: "cashtag";
|
|
209
|
+
text: RichTextComponent;
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* A rich text component that opens the URL represented by its child when clicked.
|
|
213
|
+
* @unlisted
|
|
214
|
+
*/
|
|
215
|
+
export interface RichTextComponentUrl {
|
|
216
|
+
type: "url";
|
|
217
|
+
text: RichTextComponent;
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* A rich text component that links to an email address.
|
|
221
|
+
* @unlisted
|
|
222
|
+
*/
|
|
223
|
+
export interface RichTextComponentEmailLink {
|
|
224
|
+
type: "emailLink";
|
|
225
|
+
email: string;
|
|
226
|
+
text: RichTextComponent;
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* A rich text component that opens the phone number represented by its child when clicked.
|
|
230
|
+
* @unlisted
|
|
231
|
+
*/
|
|
232
|
+
export interface RichTextComponentPhone {
|
|
233
|
+
type: "phoneNumber";
|
|
234
|
+
text: RichTextComponent;
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* A bank card rich text component.
|
|
238
|
+
* @unlisted
|
|
239
|
+
*/
|
|
240
|
+
export interface RichTextComponentBankCard {
|
|
241
|
+
type: "bankCard";
|
|
242
|
+
text: RichTextComponent;
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* A rich text component that mentions a user with a custom text.
|
|
246
|
+
* @unlisted
|
|
247
|
+
*/
|
|
248
|
+
export interface RichTextComponentTextMention {
|
|
249
|
+
type: "textMention";
|
|
250
|
+
userId: number;
|
|
251
|
+
text: RichTextComponent;
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* A datetime text component.
|
|
255
|
+
* @unlisted
|
|
256
|
+
*/
|
|
257
|
+
export interface RichTextComponentDateTime {
|
|
258
|
+
type: "dateTime";
|
|
259
|
+
isRelative: boolean;
|
|
260
|
+
format?: string;
|
|
261
|
+
date: number;
|
|
262
|
+
text: RichTextComponent;
|
|
263
|
+
}
|
|
264
|
+
/** Any type of rich text component. */
|
|
265
|
+
export type RichTextComponent = RichTextComponentEmpty | RichTextComponentPlain | RichTextComponentBold | RichTextComponentItalic | RichTextComponentUnderline | RichTextComponentStrikethrough | RichTextComponentFixed | RichTextComponentLink | RichTextComponentEmailLink | RichTextComponentConcatenate | RichTextComponentSubscript | RichTextComponentSuperscript | RichTextComponentMarked | RichTextComponentPhoneNumberLink | RichTextComponentPhoto | RichTextComponentAnchor | RichTextComponentMath | RichTextComponentCustomEmoji | RichTextComponentSpoiler | RichTextComponentMention | RichTextComponentHashtag | RichTextComponentBotCommand | RichTextComponentCashtag | RichTextComponentUrl | RichTextComponentEmail | RichTextComponentPhone | RichTextComponentBankCard | RichTextComponentTextMention | RichTextComponentDateTime;
|
|
266
|
+
export declare function constructRichTextComponent(rt: Api.RichText, photos: Api.Photo[]): RichTextComponent;
|
|
267
|
+
export declare function richTextComponentToTlObject(rtc: RichTextComponent): Api.RichText;
|
|
268
|
+
//# sourceMappingURL=3_rich_text_component.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"3_rich_text_component.d.ts","sourceRoot":"","sources":["../../src/types/3_rich_text_component.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAIH,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAKjC;;;GAGG;AACH,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,OAAO,CAAC;CACf;AAED;;;GAGG;AACH,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,OAAO,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;GAGG;AACH,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,iBAAiB,CAAC;CACzB;AAED;;;GAGG;AACH,MAAM,WAAW,uBA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AkEnG;AAED,wBAAgB,2BAA2B,CAAC,GAAG,EAAE,iBAAiB,GAAG,GAAG,CAAC,QAAQ,CAqEhF"}
|
|
@@ -0,0 +1,161 @@
|
|
|
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 } from "./_file_id.js";
|
|
24
|
+
import { constructPhoto } from "./1_photo.js";
|
|
25
|
+
import { constructDateTimeFormat, timeFormatToTlObject } from "./2_message_entity.js";
|
|
26
|
+
export function constructRichTextComponent(rt, photos) {
|
|
27
|
+
switch (rt._) {
|
|
28
|
+
case "textMention":
|
|
29
|
+
return { type: "mention", text: constructRichTextComponent(rt.text, photos) };
|
|
30
|
+
case "textEmpty":
|
|
31
|
+
return { type: "empty" };
|
|
32
|
+
case "textPlain":
|
|
33
|
+
return { type: "plain", text: rt.text };
|
|
34
|
+
case "textBold":
|
|
35
|
+
return { type: "bold", text: constructRichTextComponent(rt.text, photos) };
|
|
36
|
+
case "textItalic":
|
|
37
|
+
return { type: "italic", text: constructRichTextComponent(rt.text, photos) };
|
|
38
|
+
case "textUnderline":
|
|
39
|
+
return { type: "underline", text: constructRichTextComponent(rt.text, photos) };
|
|
40
|
+
case "textStrike":
|
|
41
|
+
return { type: "strikethrough", text: constructRichTextComponent(rt.text, photos) };
|
|
42
|
+
case "textFixed":
|
|
43
|
+
return { type: "fixed", text: constructRichTextComponent(rt.text, photos) };
|
|
44
|
+
case "textUrl":
|
|
45
|
+
return { type: "link", url: rt.url, linkPreviewId: String(rt.webpage_id), text: constructRichTextComponent(rt.text, photos) };
|
|
46
|
+
case "textEmail":
|
|
47
|
+
return { type: "emailLink", email: rt.email, text: constructRichTextComponent(rt.text, photos) };
|
|
48
|
+
case "textConcat":
|
|
49
|
+
return { type: "concatenate", components: rt.texts.map((v) => constructRichTextComponent(v, photos)) };
|
|
50
|
+
case "textSubscript":
|
|
51
|
+
return { type: "subscript", text: constructRichTextComponent(rt.text, photos) };
|
|
52
|
+
case "textSuperscript":
|
|
53
|
+
return { type: "superscript", text: constructRichTextComponent(rt.text, photos) };
|
|
54
|
+
case "textMarked":
|
|
55
|
+
return { type: "marked", text: constructRichTextComponent(rt.text, photos) };
|
|
56
|
+
case "textPhone":
|
|
57
|
+
return { type: "phoneNumberLink", phoneNumber: rt.phone, text: constructRichTextComponent(rt.text, photos) };
|
|
58
|
+
case "textImage": {
|
|
59
|
+
const photo = Api.as("photo", photos.find((v) => v.id === rt.document_id));
|
|
60
|
+
const fileId = constructPhoto(photo).fileId;
|
|
61
|
+
return { type: "photo", fileId, width: rt.w, height: rt.h };
|
|
62
|
+
}
|
|
63
|
+
case "textAnchor":
|
|
64
|
+
return { type: "anchor", name: rt.name, text: constructRichTextComponent(rt.text, photos) };
|
|
65
|
+
case "textMath":
|
|
66
|
+
return { type: "math", code: rt.source };
|
|
67
|
+
case "textCustomEmoji":
|
|
68
|
+
return { type: "customEmoji", customEmojiId: String(rt.document_id), alt: rt.alt };
|
|
69
|
+
case "textSpoiler":
|
|
70
|
+
return { type: "spoiler", text: constructRichTextComponent(rt.text, photos) };
|
|
71
|
+
case "textHashtag":
|
|
72
|
+
return { type: "hashtag", text: constructRichTextComponent(rt.text, photos) };
|
|
73
|
+
case "textBotCommand":
|
|
74
|
+
return { type: "botCommand", text: constructRichTextComponent(rt.text, photos) };
|
|
75
|
+
case "textCashtag":
|
|
76
|
+
return { type: "cashtag", text: constructRichTextComponent(rt.text, photos) };
|
|
77
|
+
case "textAutoUrl":
|
|
78
|
+
return { type: "url", text: constructRichTextComponent(rt.text, photos) };
|
|
79
|
+
case "textAutoEmail":
|
|
80
|
+
return { type: "email", text: constructRichTextComponent(rt.text, photos) };
|
|
81
|
+
case "textAutoPhone":
|
|
82
|
+
return { type: "phoneNumber", text: constructRichTextComponent(rt.text, photos) };
|
|
83
|
+
case "textBankCard":
|
|
84
|
+
return { type: "bankCard", text: constructRichTextComponent(rt.text, photos) };
|
|
85
|
+
case "textMentionName":
|
|
86
|
+
return { type: "textMention", userId: Number(rt.user_id), text: constructRichTextComponent(rt.text, photos) };
|
|
87
|
+
case "textDate":
|
|
88
|
+
return cleanObject({ type: "dateTime", isRelative: !!rt.relative, format: constructDateTimeFormat(rt) || undefined, date: rt.date, text: constructRichTextComponent(rt.text, photos) });
|
|
89
|
+
}
|
|
90
|
+
unreachable();
|
|
91
|
+
}
|
|
92
|
+
export function richTextComponentToTlObject(rtc) {
|
|
93
|
+
switch (rtc.type) {
|
|
94
|
+
case "empty":
|
|
95
|
+
return { _: "textEmpty" };
|
|
96
|
+
case "plain":
|
|
97
|
+
return { _: "textPlain", text: rtc.text };
|
|
98
|
+
case "bold":
|
|
99
|
+
return { _: "textBold", text: richTextComponentToTlObject(rtc.text) };
|
|
100
|
+
case "italic":
|
|
101
|
+
return { _: "textItalic", text: richTextComponentToTlObject(rtc.text) };
|
|
102
|
+
case "underline":
|
|
103
|
+
return { _: "textUnderline", text: richTextComponentToTlObject(rtc.text) };
|
|
104
|
+
case "strikethrough":
|
|
105
|
+
return { _: "textStrike", text: richTextComponentToTlObject(rtc.text) };
|
|
106
|
+
case "fixed":
|
|
107
|
+
return { _: "textFixed", text: richTextComponentToTlObject(rtc.text) };
|
|
108
|
+
case "link":
|
|
109
|
+
return { _: "textUrl", url: rtc.url, webpage_id: BigInt(rtc.linkPreviewId), text: richTextComponentToTlObject(rtc.text) };
|
|
110
|
+
case "emailLink":
|
|
111
|
+
return { _: "textEmail", email: rtc.email, text: richTextComponentToTlObject(rtc.text) };
|
|
112
|
+
case "concatenate":
|
|
113
|
+
return { _: "textConcat", texts: rtc.components.map(richTextComponentToTlObject) };
|
|
114
|
+
case "subscript":
|
|
115
|
+
return { _: "textSubscript", text: richTextComponentToTlObject(rtc.text) };
|
|
116
|
+
case "superscript":
|
|
117
|
+
return { _: "textSuperscript", text: richTextComponentToTlObject(rtc.text) };
|
|
118
|
+
case "marked":
|
|
119
|
+
return { _: "textMarked", text: richTextComponentToTlObject(rtc.text) };
|
|
120
|
+
case "phoneNumberLink":
|
|
121
|
+
return { _: "textPhone", phone: rtc.phoneNumber, text: richTextComponentToTlObject(rtc.text) };
|
|
122
|
+
case "photo": {
|
|
123
|
+
const fileId = deserializeFileId(rtc.fileId);
|
|
124
|
+
if (!("id" in fileId.location)) {
|
|
125
|
+
unreachable();
|
|
126
|
+
}
|
|
127
|
+
return { _: "textImage", document_id: fileId.location.id, w: rtc.width, h: rtc.height };
|
|
128
|
+
}
|
|
129
|
+
case "anchor":
|
|
130
|
+
return { _: "textAnchor", name: rtc.name, text: richTextComponentToTlObject(rtc.text) };
|
|
131
|
+
case "math":
|
|
132
|
+
return { _: "textMath", source: rtc.code };
|
|
133
|
+
case "customEmoji":
|
|
134
|
+
return { _: "textCustomEmoji", document_id: BigInt(rtc.customEmojiId), alt: rtc.alt };
|
|
135
|
+
case "spoiler":
|
|
136
|
+
return { _: "textSpoiler", text: richTextComponentToTlObject(rtc.text) };
|
|
137
|
+
case "mention":
|
|
138
|
+
return { _: "textMention", text: richTextComponentToTlObject(rtc.text) };
|
|
139
|
+
case "hashtag":
|
|
140
|
+
return { _: "textHashtag", text: richTextComponentToTlObject(rtc.text) };
|
|
141
|
+
case "botCommand":
|
|
142
|
+
return { _: "textBotCommand", text: richTextComponentToTlObject(rtc.text) };
|
|
143
|
+
case "cashtag":
|
|
144
|
+
return { _: "textCashtag", text: richTextComponentToTlObject(rtc.text) };
|
|
145
|
+
case "url":
|
|
146
|
+
return { _: "textAutoUrl", text: richTextComponentToTlObject(rtc.text) };
|
|
147
|
+
case "email":
|
|
148
|
+
return { _: "textAutoEmail", text: richTextComponentToTlObject(rtc.text) };
|
|
149
|
+
case "phoneNumber":
|
|
150
|
+
return { _: "textAutoPhone", text: richTextComponentToTlObject(rtc.text) };
|
|
151
|
+
case "bankCard":
|
|
152
|
+
return { _: "textBankCard", text: richTextComponentToTlObject(rtc.text) };
|
|
153
|
+
case "textMention":
|
|
154
|
+
return { _: "textMentionName", text: richTextComponentToTlObject(rtc.text), user_id: BigInt(rtc.userId) };
|
|
155
|
+
case "dateTime": {
|
|
156
|
+
const obj = { _: "textDate", text: richTextComponentToTlObject(rtc.text), date: rtc.date };
|
|
157
|
+
timeFormatToTlObject(rtc.format ?? "", obj);
|
|
158
|
+
return obj;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
package/esm/types/4_gift.d.ts
CHANGED
|
@@ -79,7 +79,7 @@ export interface GiftUpgraded {
|
|
|
79
79
|
maxUpgrades: number;
|
|
80
80
|
/** The components of the gift. */
|
|
81
81
|
components: GiftUpgradedComponent[];
|
|
82
|
-
/** The address of the gift
|
|
82
|
+
/** The address of the gift on TON blockchain. */
|
|
83
83
|
address?: string;
|
|
84
84
|
/** The amount of stars that can be used to buy the gift. */
|
|
85
85
|
price?: number;
|