@mtkruto/node 0.191.0 → 0.193.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/README.md +5 -5
- package/esm/3_types.d.ts +8 -3
- package/esm/3_types.d.ts.map +1 -1
- package/esm/3_types.js +8 -3
- package/esm/client/0_html.d.ts +2 -1
- package/esm/client/0_html.d.ts.map +1 -1
- package/esm/client/0_html.js +18 -16
- package/esm/client/0_markdown.d.ts +3 -2
- package/esm/client/0_markdown.d.ts.map +1 -1
- package/esm/client/0_markdown.js +6 -4
- package/esm/client/0_params.d.ts +54 -0
- package/esm/client/0_params.d.ts.map +1 -1
- package/esm/client/1_client_generic.d.ts +154 -14
- package/esm/client/1_client_generic.d.ts.map +1 -1
- package/esm/client/3_account_manager.d.ts +5 -1
- package/esm/client/3_account_manager.d.ts.map +1 -1
- package/esm/client/3_account_manager.js +40 -2
- package/esm/client/3_message_manager.js +1 -1
- package/esm/client/3_secret_chat_manager.d.ts +10 -4
- package/esm/client/3_secret_chat_manager.d.ts.map +1 -1
- package/esm/client/3_secret_chat_manager.js +82 -76
- package/esm/client/3_sticker_set_manager.d.ts +5 -0
- package/esm/client/3_sticker_set_manager.d.ts.map +1 -1
- package/esm/client/3_sticker_set_manager.js +40 -9
- package/esm/client/4_chat_manager.d.ts +5 -1
- package/esm/client/4_chat_manager.d.ts.map +1 -1
- package/esm/client/4_chat_manager.js +59 -1
- package/esm/client/4_checklist_manager.js +1 -1
- package/esm/client/4_context.d.ts +16 -4
- package/esm/client/4_context.d.ts.map +1 -1
- package/esm/client/4_context.js +38 -5
- package/esm/client/4_forum_manager.d.ts +5 -1
- package/esm/client/4_forum_manager.d.ts.map +1 -1
- package/esm/client/4_forum_manager.js +38 -1
- package/esm/client/6_client.d.ts +152 -12
- package/esm/client/6_client.d.ts.map +1 -1
- package/esm/client/6_client.js +191 -11
- package/esm/client/6_client_dispatcher.d.ts +152 -12
- package/esm/client/6_client_dispatcher.d.ts.map +1 -1
- package/esm/client/6_client_dispatcher.js +191 -11
- package/esm/types/0_report_reason.d.ts +1 -0
- package/esm/types/0_report_reason.d.ts.map +1 -1
- package/esm/types/0_story_report_option.d.ts +3 -0
- package/esm/types/0_story_report_option.d.ts.map +1 -1
- package/esm/types/1_available_reactions.d.ts +3 -2
- package/esm/types/1_available_reactions.d.ts.map +1 -1
- package/esm/types/1_available_reactions.js +18 -1
- package/esm/types/1_channel_location.d.ts +8 -0
- package/esm/types/1_channel_location.d.ts.map +1 -0
- package/esm/types/1_channel_location.js +11 -0
- package/esm/types/1_sticker_set_p.d.ts +48 -0
- package/esm/types/1_sticker_set_p.d.ts.map +1 -0
- package/esm/types/1_sticker_set_p.js +73 -0
- package/esm/types/1_story_report_result.d.ts +17 -3
- package/esm/types/1_story_report_result.d.ts.map +1 -1
- package/esm/types/2_poll_voter.d.ts +19 -0
- package/esm/types/2_poll_voter.d.ts.map +1 -1
- package/esm/types/2_poll_voter.js +19 -0
- package/esm/types/2_secret_message.d.ts +1 -0
- package/esm/types/2_secret_message.d.ts.map +1 -1
- package/esm/types/3_bot_access_settings.d.ts +3 -0
- package/esm/types/3_bot_access_settings.d.ts.map +1 -1
- package/esm/types/3_connected_website.d.ts +10 -0
- package/esm/types/3_connected_website.d.ts.map +1 -1
- package/esm/types/3_poll_voter_list.d.ts +1 -0
- package/esm/types/3_poll_voter_list.d.ts.map +1 -1
- package/esm/types/3_rich_text_component.d.ts +24 -0
- package/esm/types/3_rich_text_component.d.ts.map +1 -1
- package/esm/types/3_text_to_translate.d.ts +3 -0
- package/esm/types/3_text_to_translate.d.ts.map +1 -1
- package/esm/types/3_translated_text.d.ts +3 -0
- package/esm/types/3_translated_text.d.ts.map +1 -1
- package/esm/types/4_page_block.d.ts +45 -1
- package/esm/types/4_page_block.d.ts.map +1 -1
- package/esm/types/A_topic.d.ts +20 -3
- package/esm/types/A_topic.d.ts.map +1 -1
- package/esm/types/A_topic.js +37 -0
- package/esm/types/B_recent_action.d.ts +225 -0
- package/esm/types/B_recent_action.d.ts.map +1 -0
- package/esm/types/B_recent_action.js +303 -0
- package/esm/types/{1_secret_chat_action.js → B_topic_list_item.d.ts} +9 -8
- package/esm/types/B_topic_list_item.d.ts.map +1 -0
- package/esm/types/B_topic_list_item.js +20 -0
- package/esm/types/B_update.d.ts +16 -16
- package/esm/types/B_update.d.ts.map +1 -1
- package/esm/types/C_recent_actions_entry.d.ts +13 -0
- package/esm/types/C_recent_actions_entry.d.ts.map +1 -0
- package/esm/types/C_recent_actions_entry.js +13 -0
- package/esm/types/C_topic_list.d.ts +34 -0
- package/esm/types/C_topic_list.d.ts.map +1 -0
- package/esm/types/{1_secret_chat_action.d.ts → C_topic_list.js} +8 -10
- package/package.json +1 -1
- package/script/3_types.d.ts +8 -3
- package/script/3_types.d.ts.map +1 -1
- package/script/3_types.js +8 -3
- package/script/client/0_html.d.ts +2 -1
- package/script/client/0_html.d.ts.map +1 -1
- package/script/client/0_html.js +17 -15
- package/script/client/0_markdown.d.ts +3 -2
- package/script/client/0_markdown.d.ts.map +1 -1
- package/script/client/0_markdown.js +5 -3
- package/script/client/0_params.d.ts +54 -0
- package/script/client/0_params.d.ts.map +1 -1
- package/script/client/1_client_generic.d.ts +154 -14
- package/script/client/1_client_generic.d.ts.map +1 -1
- package/script/client/3_account_manager.d.ts +5 -1
- package/script/client/3_account_manager.d.ts.map +1 -1
- package/script/client/3_account_manager.js +40 -2
- package/script/client/3_message_manager.js +1 -1
- package/script/client/3_secret_chat_manager.d.ts +10 -4
- package/script/client/3_secret_chat_manager.d.ts.map +1 -1
- package/script/client/3_secret_chat_manager.js +81 -75
- package/script/client/3_sticker_set_manager.d.ts +5 -0
- package/script/client/3_sticker_set_manager.d.ts.map +1 -1
- package/script/client/3_sticker_set_manager.js +39 -8
- package/script/client/4_chat_manager.d.ts +5 -1
- package/script/client/4_chat_manager.d.ts.map +1 -1
- package/script/client/4_chat_manager.js +58 -0
- package/script/client/4_checklist_manager.js +1 -1
- package/script/client/4_context.d.ts +16 -4
- package/script/client/4_context.d.ts.map +1 -1
- package/script/client/4_context.js +38 -5
- package/script/client/4_forum_manager.d.ts +5 -1
- package/script/client/4_forum_manager.d.ts.map +1 -1
- package/script/client/4_forum_manager.js +37 -0
- package/script/client/6_client.d.ts +152 -12
- package/script/client/6_client.d.ts.map +1 -1
- package/script/client/6_client.js +191 -11
- package/script/client/6_client_dispatcher.d.ts +152 -12
- package/script/client/6_client_dispatcher.d.ts.map +1 -1
- package/script/client/6_client_dispatcher.js +191 -11
- package/script/types/0_report_reason.d.ts +1 -0
- package/script/types/0_report_reason.d.ts.map +1 -1
- package/script/types/0_story_report_option.d.ts +3 -0
- package/script/types/0_story_report_option.d.ts.map +1 -1
- package/script/types/1_available_reactions.d.ts +3 -2
- package/script/types/1_available_reactions.d.ts.map +1 -1
- package/script/types/1_available_reactions.js +18 -0
- package/script/types/1_channel_location.d.ts +8 -0
- package/script/types/1_channel_location.d.ts.map +1 -0
- package/script/types/1_channel_location.js +14 -0
- package/script/types/1_sticker_set_p.d.ts +48 -0
- package/script/types/1_sticker_set_p.d.ts.map +1 -0
- package/script/types/1_sticker_set_p.js +76 -0
- package/script/types/1_story_report_result.d.ts +17 -3
- package/script/types/1_story_report_result.d.ts.map +1 -1
- package/script/types/2_poll_voter.d.ts +19 -0
- package/script/types/2_poll_voter.d.ts.map +1 -1
- package/script/types/2_poll_voter.js +19 -0
- package/script/types/2_secret_message.d.ts +1 -0
- package/script/types/2_secret_message.d.ts.map +1 -1
- package/script/types/3_bot_access_settings.d.ts +3 -0
- package/script/types/3_bot_access_settings.d.ts.map +1 -1
- package/script/types/3_connected_website.d.ts +10 -0
- package/script/types/3_connected_website.d.ts.map +1 -1
- package/script/types/3_poll_voter_list.d.ts +1 -0
- package/script/types/3_poll_voter_list.d.ts.map +1 -1
- package/script/types/3_rich_text_component.d.ts +24 -0
- package/script/types/3_rich_text_component.d.ts.map +1 -1
- package/script/types/3_text_to_translate.d.ts +3 -0
- package/script/types/3_text_to_translate.d.ts.map +1 -1
- package/script/types/3_translated_text.d.ts +3 -0
- package/script/types/3_translated_text.d.ts.map +1 -1
- package/script/types/4_page_block.d.ts +45 -1
- package/script/types/4_page_block.d.ts.map +1 -1
- package/script/types/A_topic.d.ts +20 -3
- package/script/types/A_topic.d.ts.map +1 -1
- package/script/types/A_topic.js +38 -0
- package/script/types/B_recent_action.d.ts +225 -0
- package/script/types/B_recent_action.d.ts.map +1 -0
- package/script/types/B_recent_action.js +306 -0
- package/script/types/{1_secret_chat_action.d.ts → B_topic_list_item.d.ts} +9 -10
- package/script/types/B_topic_list_item.d.ts.map +1 -0
- package/script/types/{1_secret_chat_action.js → B_topic_list_item.js} +0 -10
- package/script/types/B_update.d.ts +16 -16
- package/script/types/B_update.d.ts.map +1 -1
- package/script/types/C_recent_actions_entry.d.ts +13 -0
- package/script/types/C_recent_actions_entry.d.ts.map +1 -0
- package/script/types/C_recent_actions_entry.js +16 -0
- package/script/types/C_topic_list.d.ts +34 -0
- package/script/types/C_topic_list.d.ts.map +1 -0
- package/script/types/C_topic_list.js +31 -0
- package/esm/types/1_secret_chat_action.d.ts.map +0 -1
- package/script/types/1_secret_chat_action.d.ts.map +0 -1
|
@@ -62,12 +62,15 @@ const _2_tl_js_1 = require("../2_tl.js");
|
|
|
62
62
|
const _3_types_js_1 = require("../3_types.js");
|
|
63
63
|
const _0_secret_chat_js_1 = require("../types/0_secret_chat.js");
|
|
64
64
|
const _2_secret_message_js_1 = require("../types/2_secret_message.js");
|
|
65
|
+
const _0_html_js_1 = require("./0_html.js");
|
|
66
|
+
const _0_markdown_js_1 = require("./0_markdown.js");
|
|
65
67
|
const _0_password_js_1 = require("./0_password.js");
|
|
66
68
|
const _0_secret_chat_state_js_1 = require("./0_secret_chat_state.js");
|
|
67
69
|
const _0_utilities_js_1 = require("./0_utilities.js");
|
|
68
70
|
const secretChatManagerUpdates = [
|
|
69
71
|
"updateEncryption",
|
|
70
72
|
"updateNewEncryptedMessage",
|
|
73
|
+
"updateEncryptedChatTyping",
|
|
71
74
|
];
|
|
72
75
|
class SecretChatManager {
|
|
73
76
|
#c;
|
|
@@ -160,6 +163,45 @@ class SecretChatManager {
|
|
|
160
163
|
state.pendingExponent = a;
|
|
161
164
|
return (0, _0_secret_chat_js_1.constructSecretChat)(result);
|
|
162
165
|
}
|
|
166
|
+
static parseText(text, entities, parseMode, isEmptyAllowed = false) {
|
|
167
|
+
switch (parseMode) {
|
|
168
|
+
case null:
|
|
169
|
+
break;
|
|
170
|
+
case "HTML": {
|
|
171
|
+
const [newText, entitiesToPush] = (0, _0_html_js_1.parseHtml)(text, true);
|
|
172
|
+
text = newText;
|
|
173
|
+
for (const entity of entitiesToPush) {
|
|
174
|
+
entities.push(entity);
|
|
175
|
+
}
|
|
176
|
+
break;
|
|
177
|
+
}
|
|
178
|
+
case "Markdown": {
|
|
179
|
+
const [newText, entitiesToPush] = (0, _0_markdown_js_1.parseMarkdown)(text, true);
|
|
180
|
+
text = newText;
|
|
181
|
+
for (const entity of entitiesToPush) {
|
|
182
|
+
entities.push(entity);
|
|
183
|
+
}
|
|
184
|
+
break;
|
|
185
|
+
}
|
|
186
|
+
default:
|
|
187
|
+
(0, _0_deps_js_1.unreachable)();
|
|
188
|
+
}
|
|
189
|
+
text = text.trimEnd();
|
|
190
|
+
for (const entity of entities) {
|
|
191
|
+
while (text[entity.offset + (entity.length - 1)] === undefined) {
|
|
192
|
+
--entity.length;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
if (!isEmptyAllowed && !text.length) {
|
|
196
|
+
throw new _0_errors_js_1.InputError("Text must not be empty.");
|
|
197
|
+
}
|
|
198
|
+
return [text, entities];
|
|
199
|
+
}
|
|
200
|
+
parseText(text_, params, isEmptyAllowed) {
|
|
201
|
+
const [text, entities_] = _a.parseText(text_, params?.entities ?? [], params?.parseMode === null ? null : params?.parseMode ?? this.#c.parseMode, isEmptyAllowed);
|
|
202
|
+
const entities = entities_?.length > 0 ? entities_.map(_3_types_js_1.secretMessageEntityToTlObject) : undefined;
|
|
203
|
+
return [text, entities];
|
|
204
|
+
}
|
|
163
205
|
async acceptSecretChat(id) {
|
|
164
206
|
const state = this.#getSecretChatState(id);
|
|
165
207
|
if (!_2_tl_js_1.Api.is("encryptedChatRequested", state.encryptedChat)) {
|
|
@@ -237,15 +279,16 @@ class SecretChatManager {
|
|
|
237
279
|
async sendSecretMessage(id, text, params) {
|
|
238
280
|
this.#c.storage.assertUser("sendSecretMessage");
|
|
239
281
|
const state = this.#mustGetEncryptedChat(id);
|
|
282
|
+
const [message, entities] = this.parseText(text, params);
|
|
240
283
|
const random_id = (0, _1_utilities_js_1.getRandomId)();
|
|
241
284
|
const decryptedMessage = {
|
|
242
285
|
_: "decryptedMessage",
|
|
243
|
-
message
|
|
286
|
+
message,
|
|
244
287
|
random_id,
|
|
245
288
|
ttl: params?.ttl ?? 0,
|
|
246
289
|
silent: params?.isSilent || undefined,
|
|
247
290
|
reply_to_random_id: params?.replyToMessageId ? BigInt(params.replyToMessageId) : undefined,
|
|
248
|
-
entities
|
|
291
|
+
entities,
|
|
249
292
|
via_bot_name: params?.viaBot,
|
|
250
293
|
};
|
|
251
294
|
await this.#sendMessage(decryptedMessage, state.encryptedChat, state.authKey, state.authKeyId_);
|
|
@@ -310,13 +353,14 @@ class SecretChatManager {
|
|
|
310
353
|
async sendSecretDocument(id, document, params) {
|
|
311
354
|
this.#c.storage.assertUser("sendSecretDocument");
|
|
312
355
|
const state = this.#mustGetEncryptedChat(id);
|
|
356
|
+
const [message, entities] = this.parseText(params?.caption ?? "", params);
|
|
313
357
|
const [key, iv] = this.#generateKeyIv();
|
|
314
358
|
const { inputEncryptedFile, fileSize } = await this.#c.fileManager.upload(document, params, null, true, { key, iv });
|
|
315
359
|
const random_id = (0, _1_utilities_js_1.getRandomId)();
|
|
316
360
|
const decryptedMessage = {
|
|
317
361
|
_: "decryptedMessage",
|
|
318
|
-
message
|
|
319
|
-
entities
|
|
362
|
+
message,
|
|
363
|
+
entities,
|
|
320
364
|
random_id,
|
|
321
365
|
ttl: params?.ttl ?? 0,
|
|
322
366
|
silent: params?.isSilent || undefined,
|
|
@@ -341,13 +385,14 @@ class SecretChatManager {
|
|
|
341
385
|
async sendSecretVideo(id, video, params) {
|
|
342
386
|
this.#c.storage.assertUser("sendSecretVideo");
|
|
343
387
|
const state = this.#mustGetEncryptedChat(id);
|
|
388
|
+
const [message, entities] = this.parseText(params?.caption ?? "", params);
|
|
344
389
|
const [key, iv] = this.#generateKeyIv();
|
|
345
390
|
const { inputEncryptedFile, fileSize } = await this.#c.fileManager.upload(video, params, null, true, { key, iv });
|
|
346
391
|
const random_id = (0, _1_utilities_js_1.getRandomId)();
|
|
347
392
|
const decryptedMessage = {
|
|
348
393
|
_: "decryptedMessage",
|
|
349
|
-
message
|
|
350
|
-
entities
|
|
394
|
+
message,
|
|
395
|
+
entities,
|
|
351
396
|
random_id,
|
|
352
397
|
ttl: params?.ttl ?? 0,
|
|
353
398
|
silent: params?.isSilent || undefined,
|
|
@@ -375,13 +420,14 @@ class SecretChatManager {
|
|
|
375
420
|
async sendSecretVideoNote(id, videoNote, params) {
|
|
376
421
|
this.#c.storage.assertUser("sendSecretVideoNote");
|
|
377
422
|
const state = this.#mustGetEncryptedChat(id);
|
|
423
|
+
const [message, entities] = this.parseText(params?.caption ?? "", params);
|
|
378
424
|
const [key, iv] = this.#generateKeyIv();
|
|
379
425
|
const { inputEncryptedFile, fileSize } = await this.#c.fileManager.upload(videoNote, params, null, true, { key, iv });
|
|
380
426
|
const random_id = (0, _1_utilities_js_1.getRandomId)();
|
|
381
427
|
const decryptedMessage = {
|
|
382
428
|
_: "decryptedMessage",
|
|
383
|
-
message
|
|
384
|
-
entities
|
|
429
|
+
message,
|
|
430
|
+
entities,
|
|
385
431
|
random_id,
|
|
386
432
|
ttl: params?.ttl ?? 0,
|
|
387
433
|
silent: params?.isSilent || undefined,
|
|
@@ -409,13 +455,14 @@ class SecretChatManager {
|
|
|
409
455
|
async sendSecretAudio(id, audio, params) {
|
|
410
456
|
this.#c.storage.assertUser("sendSecretAudio");
|
|
411
457
|
const state = this.#mustGetEncryptedChat(id);
|
|
458
|
+
const [message, entities] = this.parseText(params?.caption ?? "", params);
|
|
412
459
|
const [key, iv] = this.#generateKeyIv();
|
|
413
460
|
const { inputEncryptedFile, fileSize } = await this.#c.fileManager.upload(audio, params, null, true, { key, iv });
|
|
414
461
|
const random_id = (0, _1_utilities_js_1.getRandomId)();
|
|
415
462
|
const decryptedMessage = {
|
|
416
463
|
_: "decryptedMessage",
|
|
417
|
-
message
|
|
418
|
-
entities
|
|
464
|
+
message,
|
|
465
|
+
entities,
|
|
419
466
|
random_id,
|
|
420
467
|
ttl: params?.ttl ?? 0,
|
|
421
468
|
silent: params?.isSilent || undefined,
|
|
@@ -443,13 +490,14 @@ class SecretChatManager {
|
|
|
443
490
|
async sendSecretVoice(id, voice, params) {
|
|
444
491
|
this.#c.storage.assertUser("sendSecretVoice");
|
|
445
492
|
const state = this.#mustGetEncryptedChat(id);
|
|
493
|
+
const [message, entities] = this.parseText(params?.caption ?? "", params);
|
|
446
494
|
const [key, iv] = this.#generateKeyIv();
|
|
447
495
|
const { inputEncryptedFile, fileSize } = await this.#c.fileManager.upload(voice, params, null, true, { key, iv });
|
|
448
496
|
const random_id = (0, _1_utilities_js_1.getRandomId)();
|
|
449
497
|
const decryptedMessage = {
|
|
450
498
|
_: "decryptedMessage",
|
|
451
|
-
message
|
|
452
|
-
entities
|
|
499
|
+
message,
|
|
500
|
+
entities,
|
|
453
501
|
random_id,
|
|
454
502
|
ttl: params?.ttl ?? 0,
|
|
455
503
|
silent: params?.isSilent || undefined,
|
|
@@ -477,13 +525,14 @@ class SecretChatManager {
|
|
|
477
525
|
async sendSecretAnimation(id, animation, params) {
|
|
478
526
|
this.#c.storage.assertUser("sendSecretAnimation");
|
|
479
527
|
const state = this.#mustGetEncryptedChat(id);
|
|
528
|
+
const [message, entities] = this.parseText(params?.caption ?? "", params);
|
|
480
529
|
const [key, iv] = this.#generateKeyIv();
|
|
481
530
|
const { inputEncryptedFile, fileSize } = await this.#c.fileManager.upload(animation, params, null, true, { key, iv });
|
|
482
531
|
const random_id = (0, _1_utilities_js_1.getRandomId)();
|
|
483
532
|
const decryptedMessage = {
|
|
484
533
|
_: "decryptedMessage",
|
|
485
|
-
message
|
|
486
|
-
entities
|
|
534
|
+
message,
|
|
535
|
+
entities,
|
|
487
536
|
random_id,
|
|
488
537
|
ttl: params?.ttl ?? 0,
|
|
489
538
|
silent: params?.isSilent || undefined,
|
|
@@ -509,59 +558,6 @@ class SecretChatManager {
|
|
|
509
558
|
await this.#sendMessage(decryptedMessage, state.encryptedChat, state.authKey, state.authKeyId_, inputEncryptedFile);
|
|
510
559
|
await this.#postSendMessage(state);
|
|
511
560
|
}
|
|
512
|
-
async sendSecretChatAction(id, action) {
|
|
513
|
-
this.#c.storage.assertUser("sendSecretChatAction");
|
|
514
|
-
const state = this.#mustGetEncryptedChat(id);
|
|
515
|
-
const random_id = (0, _1_utilities_js_1.getRandomId)();
|
|
516
|
-
let action_;
|
|
517
|
-
switch (action.type) {
|
|
518
|
-
case "typing":
|
|
519
|
-
action_ = { _: "sendMessageTypingAction" };
|
|
520
|
-
break;
|
|
521
|
-
case "uploadingPhoto":
|
|
522
|
-
action_ = { _: "sendMessageUploadPhotoAction" };
|
|
523
|
-
break;
|
|
524
|
-
case "recordingVideo":
|
|
525
|
-
action_ = { _: "sendMessageRecordVideoAction" };
|
|
526
|
-
break;
|
|
527
|
-
case "uploadingVideo":
|
|
528
|
-
action_ = { _: "sendMessageUploadVideoAction" };
|
|
529
|
-
break;
|
|
530
|
-
case "recordingVoice":
|
|
531
|
-
action_ = { _: "sendMessageRecordAudioAction" };
|
|
532
|
-
break;
|
|
533
|
-
case "uploadingAudio":
|
|
534
|
-
action_ = { _: "sendMessageUploadAudioAction" };
|
|
535
|
-
break;
|
|
536
|
-
case "uploadingDocument":
|
|
537
|
-
action_ = { _: "sendMessageUploadDocumentAction" };
|
|
538
|
-
break;
|
|
539
|
-
case "choosingLocation":
|
|
540
|
-
action_ = { _: "sendMessageGeoLocationAction" };
|
|
541
|
-
break;
|
|
542
|
-
case "recordingVideoNote":
|
|
543
|
-
action_ = { _: "sendMessageRecordRoundAction" };
|
|
544
|
-
break;
|
|
545
|
-
case "uploadingVideoNote":
|
|
546
|
-
action_ = { _: "sendMessageUploadRoundAction" };
|
|
547
|
-
break;
|
|
548
|
-
case "cancel":
|
|
549
|
-
action_ = { _: "sendMessageCancelAction" };
|
|
550
|
-
break;
|
|
551
|
-
default:
|
|
552
|
-
(0, _0_deps_js_1.unreachable)();
|
|
553
|
-
}
|
|
554
|
-
const decryptedMessageService = {
|
|
555
|
-
_: "decryptedMessageService",
|
|
556
|
-
action: {
|
|
557
|
-
_: "decryptedMessageActionTyping",
|
|
558
|
-
action: action_,
|
|
559
|
-
},
|
|
560
|
-
random_id,
|
|
561
|
-
};
|
|
562
|
-
await this.#sendMessage(decryptedMessageService, state.encryptedChat, state.authKey, state.authKeyId_);
|
|
563
|
-
await this.#postSendMessage(state);
|
|
564
|
-
}
|
|
565
561
|
async sendSecretScreenshotNotification(id, messageIds) {
|
|
566
562
|
this.#c.storage.assertUser("sendSecretScreenshotNotification");
|
|
567
563
|
const state = this.#mustGetEncryptedChat(id);
|
|
@@ -580,13 +576,14 @@ class SecretChatManager {
|
|
|
580
576
|
async sendSecretPhoto(id, photo, params) {
|
|
581
577
|
this.#c.storage.assertUser("sendSecretPhoto");
|
|
582
578
|
const state = this.#mustGetEncryptedChat(id);
|
|
579
|
+
const [message, entities] = this.parseText(params?.caption ?? "", params);
|
|
583
580
|
const [key, iv] = this.#generateKeyIv();
|
|
584
581
|
const { inputEncryptedFile, fileSize } = await this.#c.fileManager.upload(photo, params, (0, _0_utilities_js_1.checkPhotoName)(params), true, { key, iv });
|
|
585
582
|
const random_id = (0, _1_utilities_js_1.getRandomId)();
|
|
586
583
|
const decryptedMessage = {
|
|
587
584
|
_: "decryptedMessage",
|
|
588
|
-
message
|
|
589
|
-
entities
|
|
585
|
+
message,
|
|
586
|
+
entities,
|
|
590
587
|
random_id,
|
|
591
588
|
ttl: params?.ttl ?? 0,
|
|
592
589
|
silent: params?.isSilent || undefined,
|
|
@@ -647,6 +644,18 @@ class SecretChatManager {
|
|
|
647
644
|
await this.#sendMessage(decryptedMessage, state.encryptedChat, state.authKey, state.authKeyId_, inputEncryptedFile);
|
|
648
645
|
await this.#postSendMessage(state);
|
|
649
646
|
}
|
|
647
|
+
async sendSecretTypingAction(id) {
|
|
648
|
+
this.#c.storage.assertUser("sendSecretTypingAction");
|
|
649
|
+
const { encryptedChat } = this.#mustGetEncryptedChat(id);
|
|
650
|
+
const peer = { _: "inputEncryptedChat", chat_id: encryptedChat.id, access_hash: encryptedChat.access_hash };
|
|
651
|
+
await this.#c.invoke({ _: "messages.setEncryptedTyping", peer, typing: true });
|
|
652
|
+
}
|
|
653
|
+
async sendSecretCancelTypingAction(id) {
|
|
654
|
+
this.#c.storage.assertUser("sendSecretCancelTypingAction");
|
|
655
|
+
const { encryptedChat } = this.#mustGetEncryptedChat(id);
|
|
656
|
+
const peer = { _: "inputEncryptedChat", chat_id: encryptedChat.id, access_hash: encryptedChat.access_hash };
|
|
657
|
+
await this.#c.invoke({ _: "messages.setEncryptedTyping", peer, typing: false });
|
|
658
|
+
}
|
|
650
659
|
#sendTails = new Map();
|
|
651
660
|
async #sendMessage(message, encryptedChat, authKey, authKeyId, file) {
|
|
652
661
|
try {
|
|
@@ -1029,12 +1038,6 @@ class SecretChatManager {
|
|
|
1029
1038
|
}
|
|
1030
1039
|
break;
|
|
1031
1040
|
}
|
|
1032
|
-
case "decryptedMessageActionTyping": {
|
|
1033
|
-
const secretChatAction = (0, _3_types_js_1.constructSecretChatAction)(chatId, message.action);
|
|
1034
|
-
if (secretChatAction !== null) {
|
|
1035
|
-
this.#c.handleUpdate({ type: "secretChatAction", secretChatAction });
|
|
1036
|
-
}
|
|
1037
|
-
}
|
|
1038
1041
|
}
|
|
1039
1042
|
}
|
|
1040
1043
|
async #processUpdateNewMessageEncrypted(update) {
|
|
@@ -1100,6 +1103,9 @@ class SecretChatManager {
|
|
|
1100
1103
|
return _2_tl_js_1.Api.isOneOf(secretChatManagerUpdates, update);
|
|
1101
1104
|
}
|
|
1102
1105
|
async handleUpdate(update) {
|
|
1106
|
+
if (_2_tl_js_1.Api.is("updateEncryptedChatTyping", update)) {
|
|
1107
|
+
return { type: "secretTyping", chatId: update.chat_id };
|
|
1108
|
+
}
|
|
1103
1109
|
if (_2_tl_js_1.Api.is("updateNewEncryptedMessage", update)) {
|
|
1104
1110
|
return await this.#processUpdateNewMessageEncrypted(update);
|
|
1105
1111
|
}
|
|
@@ -41,6 +41,11 @@ export declare class StickerSetManager {
|
|
|
41
41
|
setCustomEmojiAsStickerSetThumbnail(slug: string, customEmojiId: string): Promise<void>;
|
|
42
42
|
getStickerSet(slug: string): Promise<import("../3_types.js").StickerSet>;
|
|
43
43
|
getDiceStickerSet(emoji: string): Promise<import("../3_types.js").StickerSet>;
|
|
44
|
+
addStickerSet(slug: string): Promise<void>;
|
|
45
|
+
removeStickerSet(slug: string): Promise<void>;
|
|
46
|
+
archiveStickerSet(slug: string): Promise<void>;
|
|
47
|
+
unarchiveStickerSet(slug: string): Promise<void>;
|
|
48
|
+
getAddedStickerSets(): Promise<import("../3_types.js").StickerSetP[]>;
|
|
44
49
|
}
|
|
45
50
|
export {};
|
|
46
51
|
//# sourceMappingURL=3_sticker_set_manager.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"3_sticker_set_manager.d.ts","sourceRoot":"","sources":["../../src/client/3_sticker_set_manager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAKH,OAAO,
|
|
1
|
+
{"version":3,"file":"3_sticker_set_manager.d.ts","sourceRoot":"","sources":["../../src/client/3_sticker_set_manager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;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EAAE,MAAM,EAAE,aAAa,EAAE,MAAM;IAKvE,aAAa,CAAC,IAAI,EAAE,MAAM;IAM1B,iBAAiB,CAAC,KAAK,EAAE,MAAM;IAY/B,aAAa,CAAC,IAAI,EAAE,MAAM;IAK1B,gBAAgB,CAAC,IAAI,EAAE,MAAM;IAQ7B,iBAAiB,CAAC,IAAI,EAAE,MAAM;IAK9B,mBAAmB,CAAC,IAAI,EAAE,MAAM;IAKhC,mBAAmB;CAI1B"}
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
* You should have received a copy of the GNU Lesser General Public License
|
|
19
19
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
20
20
|
*/
|
|
21
|
+
var _a;
|
|
21
22
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
23
|
exports.StickerSetManager = void 0;
|
|
23
24
|
const _0_deps_js_1 = require("../0_deps.js");
|
|
@@ -85,7 +86,7 @@ class StickerSetManager {
|
|
|
85
86
|
};
|
|
86
87
|
}
|
|
87
88
|
async createStickerSet(name, slug, stickers, params) {
|
|
88
|
-
slug =
|
|
89
|
+
slug = _a.#getSlug(slug);
|
|
89
90
|
if (this.#c.storage.isBot && !params?.userId) {
|
|
90
91
|
throw new _0_errors_js_1.InputError("The parameter userId is required.");
|
|
91
92
|
}
|
|
@@ -114,7 +115,7 @@ class StickerSetManager {
|
|
|
114
115
|
return (0, _3_types_js_1.constructStickerSet)(result);
|
|
115
116
|
}
|
|
116
117
|
async checkStickerSetSlug(slug) {
|
|
117
|
-
slug =
|
|
118
|
+
slug = _a.#getSlug(slug);
|
|
118
119
|
return await this.#c.invoke({ _: "stickers.checkShortName", short_name: slug });
|
|
119
120
|
}
|
|
120
121
|
async suggestStickerSetSlug(name) {
|
|
@@ -122,7 +123,7 @@ class StickerSetManager {
|
|
|
122
123
|
return result.short_name;
|
|
123
124
|
}
|
|
124
125
|
async addStickerToStickerSet(slug, sticker, params) {
|
|
125
|
-
slug =
|
|
126
|
+
slug = _a.#getSlug(slug);
|
|
126
127
|
if (this.#c.storage.isBot && !params?.userId) {
|
|
127
128
|
throw new _0_errors_js_1.InputError("The parameter userId is required.");
|
|
128
129
|
}
|
|
@@ -169,18 +170,18 @@ class StickerSetManager {
|
|
|
169
170
|
await this.#c.invoke({ _: "stickers.replaceSticker", sticker, new_sticker });
|
|
170
171
|
}
|
|
171
172
|
async deleteStickerSet(slug) {
|
|
172
|
-
slug =
|
|
173
|
+
slug = _a.#getSlug(slug);
|
|
173
174
|
await this.#c.invoke({ _: "stickers.deleteStickerSet", stickerset: { _: "inputStickerSetShortName", short_name: slug } });
|
|
174
175
|
}
|
|
175
176
|
async setStickerSetTitle(slug, title) {
|
|
176
|
-
slug =
|
|
177
|
+
slug = _a.#getSlug(slug);
|
|
177
178
|
await this.#c.invoke({ _: "stickers.renameStickerSet", stickerset: { _: "inputStickerSetShortName", short_name: slug }, title });
|
|
178
179
|
}
|
|
179
180
|
async changeStickerPositionInStickerSet(fileId, position) {
|
|
180
181
|
await this.#c.invoke({ _: "stickers.changeStickerPosition", sticker: this.#getStickerInputDocument(fileId), position });
|
|
181
182
|
}
|
|
182
183
|
async setStickerSetThumbnail(slug, thumbnail, params) {
|
|
183
|
-
slug =
|
|
184
|
+
slug = _a.#getSlug(slug);
|
|
184
185
|
if (this.#c.storage.isBot && !params?.userId) {
|
|
185
186
|
throw new _0_errors_js_1.InputError("The parameter userId is required.");
|
|
186
187
|
}
|
|
@@ -189,11 +190,11 @@ class StickerSetManager {
|
|
|
189
190
|
await this.#c.invoke({ _: "stickers.setStickerSetThumb", stickerset: { _: "inputStickerSetShortName", short_name: slug }, thumb });
|
|
190
191
|
}
|
|
191
192
|
async setCustomEmojiAsStickerSetThumbnail(slug, customEmojiId) {
|
|
192
|
-
slug =
|
|
193
|
+
slug = _a.#getSlug(slug);
|
|
193
194
|
await this.#c.invoke({ _: "stickers.setStickerSetThumb", stickerset: { _: "inputStickerSetShortName", short_name: slug }, thumb_document_id: BigInt(customEmojiId) });
|
|
194
195
|
}
|
|
195
196
|
async getStickerSet(slug) {
|
|
196
|
-
slug =
|
|
197
|
+
slug = _a.#getSlug(slug);
|
|
197
198
|
const result = await this.#c.invoke({ _: "messages.getStickerSet", hash: 0, stickerset: { _: "inputStickerSetShortName", short_name: slug } });
|
|
198
199
|
return (0, _3_types_js_1.constructStickerSet)(result);
|
|
199
200
|
}
|
|
@@ -201,5 +202,35 @@ class StickerSetManager {
|
|
|
201
202
|
const result = await this.#c.invoke({ _: "messages.getStickerSet", hash: 0, stickerset: { _: "inputStickerSetDice", emoticon: emoji } });
|
|
202
203
|
return (0, _3_types_js_1.constructStickerSet)(result);
|
|
203
204
|
}
|
|
205
|
+
async #installStickerSet(slug, archived) {
|
|
206
|
+
slug = _a.#getSlug(slug);
|
|
207
|
+
const short_name = slug;
|
|
208
|
+
const stickerset = { _: "inputStickerSetShortName", short_name };
|
|
209
|
+
await this.#c.invoke({ _: "messages.installStickerSet", stickerset, archived });
|
|
210
|
+
}
|
|
211
|
+
async addStickerSet(slug) {
|
|
212
|
+
this.#c.storage.assertUser("addStickerSet");
|
|
213
|
+
await this.#installStickerSet(slug, false);
|
|
214
|
+
}
|
|
215
|
+
async removeStickerSet(slug) {
|
|
216
|
+
this.#c.storage.assertUser("removeStickerSet");
|
|
217
|
+
slug = _a.#getSlug(slug);
|
|
218
|
+
const short_name = slug;
|
|
219
|
+
const stickerset = { _: "inputStickerSetShortName", short_name };
|
|
220
|
+
await this.#c.invoke({ _: "messages.uninstallStickerSet", stickerset });
|
|
221
|
+
}
|
|
222
|
+
async archiveStickerSet(slug) {
|
|
223
|
+
this.#c.storage.assertUser("archiveStickerSet");
|
|
224
|
+
await this.#installStickerSet(slug, true);
|
|
225
|
+
}
|
|
226
|
+
async unarchiveStickerSet(slug) {
|
|
227
|
+
this.#c.storage.assertUser("unarchiveStickerSet");
|
|
228
|
+
await this.#installStickerSet(slug, true);
|
|
229
|
+
}
|
|
230
|
+
async getAddedStickerSets() {
|
|
231
|
+
const result = _2_tl_js_1.Api.as("messages.allStickers", await this.#c.invoke({ _: "messages.getAllStickers", hash: 0n }));
|
|
232
|
+
return result.sets.map(_3_types_js_1.constructStickerSetP);
|
|
233
|
+
}
|
|
204
234
|
}
|
|
205
235
|
exports.StickerSetManager = StickerSetManager;
|
|
236
|
+
_a = StickerSetManager;
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
import { Api } from "../2_tl.js";
|
|
21
21
|
import { type AvailableReactions, type ChatP, type SlowModeDuration } from "../3_types.js";
|
|
22
22
|
import { type FileSource, type ID, type ReportReason, type Update } from "../3_types.js";
|
|
23
|
-
import type { AddChatMemberParams, ApproveJoinRequestsParams, BanChatMemberParams, CreateInviteLinkParams, DeclineJoinRequestsParams, EnableSignaturesParams, GetCreatedInviteLinksParams, GetJoinRequestsParams, MarkAllMentionsAsReadParams, PromoteChatMemberParams, ReportChatParams, SetChatMemberRightsParams, SetChatMemberTagParams, SetChatPhotoParams } from "./0_params.js";
|
|
23
|
+
import type { AddChatMemberParams, ApproveJoinRequestsParams, BanChatMemberParams, BoostChatParams, CreateInviteLinkParams, DeclineJoinRequestsParams, EnableSignaturesParams, GetAdministeredChatsParams, GetCreatedInviteLinksParams, GetJoinRequestsParams, GetRecentActionsParams, MarkAllMentionsAsReadParams, PromoteChatMemberParams, ReportChatParams, SetChatMemberRightsParams, SetChatMemberTagParams, SetChatPhotoParams } from "./0_params.js";
|
|
24
24
|
import type { UpdateProcessor } from "./0_update_processor.js";
|
|
25
25
|
import type { C as C_ } from "./1_types.js";
|
|
26
26
|
import type { FileManager } from "./2_file_manager.js";
|
|
@@ -89,6 +89,10 @@ export declare class ChatManager implements UpdateProcessor<ChatManagerUpdate, t
|
|
|
89
89
|
markChatAsUnread(chatId: ID): Promise<void>;
|
|
90
90
|
markChatAsRead(chatId: ID): Promise<void>;
|
|
91
91
|
markAllMentionsAsRead(chatId: ID, params?: MarkAllMentionsAsReadParams): Promise<void>;
|
|
92
|
+
getAdministeredChats(params?: GetAdministeredChatsParams): Promise<ChatP[]>;
|
|
93
|
+
getRecentActions(chatId: ID, params?: GetRecentActionsParams): Promise<import("../3_types.js").RecentActionsEntry[]>;
|
|
94
|
+
deleteRevokedInviteLinks(chatId: ID, userId: ID): Promise<void>;
|
|
95
|
+
boostChat(chatId: ID, params?: BoostChatParams): Promise<void>;
|
|
92
96
|
}
|
|
93
97
|
export {};
|
|
94
98
|
//# sourceMappingURL=4_chat_manager.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"4_chat_manager.d.ts","sourceRoot":"","sources":["../../src/client/4_chat_manager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAIH,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AACjC,OAAO,EAAE,KAAK,kBAAkB,EAAmE,KAAK,KAAK,
|
|
1
|
+
{"version":3,"file":"4_chat_manager.d.ts","sourceRoot":"","sources":["../../src/client/4_chat_manager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAIH,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AACjC,OAAO,EAAE,KAAK,kBAAkB,EAAmE,KAAK,KAAK,EAAgM,KAAK,gBAAgB,EAA6B,MAAM,eAAe,CAAC;AACrX,OAAO,EAA8B,KAAK,UAAU,EAAE,KAAK,EAAE,EAAE,KAAK,YAAY,EAAE,KAAK,MAAM,EAAE,MAAM,eAAe,CAAC;AACrH,OAAO,KAAK,EAA8E,mBAAmB,EAAE,yBAAyB,EAAE,mBAAmB,EAAE,eAAe,EAAE,sBAAsB,EAAE,yBAAyB,EAAE,sBAAsB,EAAE,0BAA0B,EAAE,2BAA2B,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,2BAA2B,EAAE,uBAAuB,EAAE,gBAAgB,EAAE,yBAAyB,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAExgB,OAAO,KAAK,EAAE,eAAe,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AE,EAAE,EAAE,MAAM,CAAC,EAAE,2BAA2B;IAOtE,oBAAoB,CAAC,MAAM,CAAC,EAAE,0BAA0B;IAOxD,gBAAgB,CAAC,MAAM,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,sBAAsB;IAyC5D,wBAAwB,CAAC,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE;IAO/C,SAAS,CAAC,MAAM,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,eAAe;CAMrD"}
|
|
@@ -528,5 +528,63 @@ class ChatManager {
|
|
|
528
528
|
const top_msg_id = params?.topicId;
|
|
529
529
|
await this.#c.invoke({ _: "messages.readMentions", peer, top_msg_id });
|
|
530
530
|
}
|
|
531
|
+
async getAdministeredChats(params) {
|
|
532
|
+
this.#c.storage.assertUser("getAdministeredChats");
|
|
533
|
+
const for_personal = params?.isForPersonalChannel || undefined;
|
|
534
|
+
const result = await this.#c.invoke({ _: "channels.getAdminedPublicChannels", for_personal });
|
|
535
|
+
return result.chats.map(_3_types_js_1.constructChatP);
|
|
536
|
+
}
|
|
537
|
+
async getRecentActions(chatId, params) {
|
|
538
|
+
this.#c.storage.assertUser("getRecentActions");
|
|
539
|
+
const channel = await this.#c.getInputChannel(chatId);
|
|
540
|
+
const limit = (0, _0_utilities_js_1.getLimit)(params?.limit);
|
|
541
|
+
const events_filter = {
|
|
542
|
+
_: "channelAdminLogEventsFilter",
|
|
543
|
+
ban: params?.isRestrict || undefined,
|
|
544
|
+
delete: params?.isDelete || undefined,
|
|
545
|
+
demote: params?.isRestrict || undefined,
|
|
546
|
+
edit_rank: params?.isMemberTag || undefined,
|
|
547
|
+
edit: params?.isEdit || undefined,
|
|
548
|
+
forums: params?.isForum || undefined,
|
|
549
|
+
group_call: params?.isVideoChat || undefined,
|
|
550
|
+
info: params?.isChatSettings || undefined,
|
|
551
|
+
invite: params?.isInvite || undefined,
|
|
552
|
+
invites: params?.isInvite || undefined,
|
|
553
|
+
join: params?.isJoin || undefined,
|
|
554
|
+
kick: params?.isRestrict || undefined,
|
|
555
|
+
leave: params?.isLeave || undefined,
|
|
556
|
+
pinned: params?.isPin || undefined,
|
|
557
|
+
promote: params?.isRestrict || undefined,
|
|
558
|
+
send: params?.isNewMessage || undefined,
|
|
559
|
+
settings: params?.isChatSettings || undefined,
|
|
560
|
+
unban: params?.isRestrict || undefined,
|
|
561
|
+
unkick: params?.isRestrict || undefined,
|
|
562
|
+
};
|
|
563
|
+
const max_id = params?.offsetId ? BigInt(params.offsetId) : 0n;
|
|
564
|
+
const result = await this.#c.invoke({
|
|
565
|
+
_: "channels.getAdminLog",
|
|
566
|
+
channel,
|
|
567
|
+
limit,
|
|
568
|
+
max_id,
|
|
569
|
+
min_id: 0n,
|
|
570
|
+
q: "",
|
|
571
|
+
admins: [],
|
|
572
|
+
events_filter,
|
|
573
|
+
});
|
|
574
|
+
const entries = result.events.map((v) => (0, _3_types_js_1.constructRecentActionsEntry)(v, this.#c.getPeer, this.#c.messageManager.getMessage.bind(this.#c.messageManager), this.#c.fileManager.getStickerSetName.bind(this.#c.fileManager)));
|
|
575
|
+
return await Promise.all(entries);
|
|
576
|
+
}
|
|
577
|
+
async deleteRevokedInviteLinks(chatId, userId) {
|
|
578
|
+
this.#c.storage.assertUser("deleteRevokedInviteLinks");
|
|
579
|
+
const peer = await this.#c.getInputPeer(chatId);
|
|
580
|
+
const admin_id = await this.#c.getInputUser(userId);
|
|
581
|
+
await this.#c.invoke({ _: "messages.deleteRevokedExportedChatInvites", peer, admin_id });
|
|
582
|
+
}
|
|
583
|
+
async boostChat(chatId, params) {
|
|
584
|
+
this.#c.storage.assertUser("boostChat");
|
|
585
|
+
const peer = await this.#c.getInputPeer(chatId);
|
|
586
|
+
const slots = params?.slots;
|
|
587
|
+
await this.#c.invoke({ _: "premium.applyBoost", peer, slots });
|
|
588
|
+
}
|
|
531
589
|
}
|
|
532
590
|
exports.ChatManager = ChatManager;
|
|
@@ -40,7 +40,7 @@ class ChecklistManager {
|
|
|
40
40
|
}
|
|
41
41
|
async #updateChecklistInner(chatId, messageId, params) {
|
|
42
42
|
if (!params?.itemsToCheck?.length && !params?.itemsToUncheck?.length) {
|
|
43
|
-
throw new _0_errors_js_1.InputError("Both itemsToCheck and itemsToUncheck
|
|
43
|
+
throw new _0_errors_js_1.InputError("Both itemsToCheck and itemsToUncheck must not be empty.");
|
|
44
44
|
}
|
|
45
45
|
const peer = await this.#c.getInputPeer(chatId);
|
|
46
46
|
const msg_id = messageId;
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
19
19
|
*/
|
|
20
20
|
import { type Api } from "../2_tl.js";
|
|
21
|
-
import type { AlbumStoryList, AvailableReactions, BusinessConnection, CallbackQuery, Chat, ChatActionType, ChatMember, ChatP, ChatPChannel, ChatPGroup, ChatPPrivate, ChatPSupergroup, ChatSettings, ChosenInlineResult, ClaimedGifts, FailedInvitation, FileSource, GuestQuery, ID, InlineQuery, InlineQueryResult, InputChecklistItem, InputGift, InputMedia, InputPollOption, InputRichText, InputStoryContent, InviteLink, JoinRequest, Message, MessageAnimation, MessageAudio, MessageChecklist, MessageContact, MessageCounters, MessageDice, MessageDocument, MessageInvoice, MessageList, MessageLivePhoto, MessageLocation, MessagePhoto, MessagePoll, MessageReactionList, MessageRichText, MessageSticker, MessageText, MessageVenue, MessageVideo, MessageVideoNote, MessageVoice, Poll, PollVoterList, PriceTag, Reaction, ReportReason, RichText, SecretChat,
|
|
22
|
-
import type { AddChatMemberParams, AddContactParams, AddReactionParams, AnswerCallbackQueryParams, AnswerInlineQueryParams, AnswerPreCheckoutQueryParams, ApproveJoinRequestsParams, BanChatMemberParams, CreateInviteLinkParams, CreateStoryParams, CreateTopicParams, DeclineJoinRequestsParams, DeleteMessagesParams, EditInlineMessageCaptionParams, EditInlineMessageMediaParams, EditInlineMessageRichTextParams, EditInlineMessageTextParams, EditMessageCaptionParams, EditMessageLiveLocationParams, EditMessageMediaParams, EditMessageReplyMarkupParams, EditMessageRichTextParams, EditMessageTextParams, EditTopicParams, EnableSignaturesParams, EndSecretChatParams, ForwardMessagesParams, GetChatMembersParams, GetClaimedGiftsParams, GetCreatedInviteLinksParams, GetHistoryParams, GetJoinRequestsParams, GetPollVotersParams, GetSavedMessagesParams, GetStarTransactionsParams, PinMessageParams, PromoteChatMemberParams, ReplyParams, ReportChatParams, ReportStoryParams, ScheduleVideoChatParams, SearchMessagesParams, SendAnimationParams, SendAudioParams, SendChecklistParams, SendContactParams, SendDiceParams, SendDocumentParams, SendGiftParams, SendInvoiceParams, SendLivePhotoParams, SendLocationParams, SendMediaGroupParams, SendMessageDraftParams, SendMessageParams, SendPhotoParams, SendPollParams, SendRichTextDraftParams, SendSecretAnimationParams, SendSecretContactParams, SendSecretDocumentParams, SendSecretLocationParams, SendSecretMessageParams, SendSecretPhotoParams, SendSecretStickerParams, SendSecretVenueParams, SendSecretVideoParams, SendStickerParams, SendVenueParams, SendVideoNoteParams, SendVideoParams, SendVoiceParams, SetChatMemberRightsParams, SetChatMemberTagParams, SetChatPhotoParams, SetReactionsParams, StartVideoChatParams, StopPollParams, SummarizeTextParams, TranslateTextParams, UpdateChecklistParams } from "./0_params.js";
|
|
21
|
+
import type { AlbumStoryList, AvailableReactions, BusinessConnection, CallbackQuery, Chat, ChatActionType, ChatMember, ChatP, ChatPChannel, ChatPGroup, ChatPPrivate, ChatPSupergroup, ChatSettings, ChosenInlineResult, ClaimedGifts, FailedInvitation, FileSource, GuestQuery, ID, InlineQuery, InlineQueryResult, InputChecklistItem, InputGift, InputMedia, InputPollOption, InputRichText, InputStoryContent, InviteLink, JoinRequest, Message, MessageAnimation, MessageAudio, MessageChecklist, MessageContact, MessageCounters, MessageDice, MessageDocument, MessageInvoice, MessageList, MessageLivePhoto, MessageLocation, MessagePhoto, MessagePoll, MessageReactionList, MessageRichText, MessageSticker, MessageText, MessageVenue, MessageVideo, MessageVideoNote, MessageVoice, Poll, PollVoterList, PriceTag, Reaction, RecentActionsEntry, ReportReason, RichText, SecretChat, SecretMessage, SlowModeDuration, StarAmount, StarTransactionList, Sticker, Story, StoryAlbum, StoryReportResult, Topic, TopicList, TopicListItem, TranslatedText, Update, User, VideoChatActive, VideoChatScheduled, VoiceTranscription } from "../3_types.js";
|
|
22
|
+
import type { AddChatMemberParams, AddContactParams, AddReactionParams, AnswerCallbackQueryParams, AnswerInlineQueryParams, AnswerPreCheckoutQueryParams, ApproveJoinRequestsParams, BanChatMemberParams, BoostChatParams, CreateInviteLinkParams, CreateStoryParams, CreateTopicParams, DeclineJoinRequestsParams, DeleteMessagesParams, EditInlineMessageCaptionParams, EditInlineMessageMediaParams, EditInlineMessageRichTextParams, EditInlineMessageTextParams, EditMessageCaptionParams, EditMessageLiveLocationParams, EditMessageMediaParams, EditMessageReplyMarkupParams, EditMessageRichTextParams, EditMessageTextParams, EditTopicParams, EnableSignaturesParams, EndSecretChatParams, ForwardMessagesParams, GetChatMembersParams, GetClaimedGiftsParams, GetCreatedInviteLinksParams, GetHistoryParams, GetJoinRequestsParams, GetPollVotersParams, GetRecentActionsParams, GetSavedMessagesParams, GetStarTransactionsParams, GetTopicsParams, PinMessageParams, PromoteChatMemberParams, ReplyParams, ReportChatParams, ReportStoryParams, ScheduleVideoChatParams, SearchMessagesParams, SendAnimationParams, SendAudioParams, SendChecklistParams, SendContactParams, SendDiceParams, SendDocumentParams, SendGiftParams, SendInvoiceParams, SendLivePhotoParams, SendLocationParams, SendMediaGroupParams, SendMessageDraftParams, SendMessageParams, SendPhotoParams, SendPollParams, SendRichTextDraftParams, SendSecretAnimationParams, SendSecretContactParams, SendSecretDocumentParams, SendSecretLocationParams, SendSecretMessageParams, SendSecretPhotoParams, SendSecretStickerParams, SendSecretVenueParams, SendSecretVideoParams, SendStickerParams, SendVenueParams, SendVideoNoteParams, SendVideoParams, SendVoiceParams, SetChatMemberRightsParams, SetChatMemberTagParams, SetChatPhotoParams, SetReactionsParams, StartVideoChatParams, StopPollParams, SummarizeTextParams, TranslateTextParams, UpdateChecklistParams } from "./0_params.js";
|
|
23
23
|
import type { ClientGeneric } from "./1_client_generic.js";
|
|
24
24
|
import { type FilterQuery, type WithChatType, type WithFilter } from "./3_filters.js";
|
|
25
25
|
export type ContextCommands = string | RegExp | (string | RegExp)[] | {
|
|
@@ -115,6 +115,8 @@ export declare class Context {
|
|
|
115
115
|
banSender(params?: BanChatMemberParams): Promise<void>;
|
|
116
116
|
/** Context-aware alias for {@link Client.blockUser}. */
|
|
117
117
|
blockUser(): Promise<void>;
|
|
118
|
+
/** Context-aware alias for {@link Client.boostChat}. */
|
|
119
|
+
boostChat(params?: BoostChatParams): Promise<void>;
|
|
118
120
|
/** Context-aware alias for {@link Client.checkChecklistItem}. */
|
|
119
121
|
checkChecklistItem(messageId: number, item: number): Promise<void>;
|
|
120
122
|
/** Context-aware alias for {@link Client.checkChecklistItems}. */
|
|
@@ -149,6 +151,8 @@ export declare class Context {
|
|
|
149
151
|
deleteMessage(messageId: number, params?: DeleteMessagesParams): Promise<void>;
|
|
150
152
|
/** Context-aware alias for {@link Client.deleteMessages}. */
|
|
151
153
|
deleteMessages(messageIds: number[], params?: DeleteMessagesParams): Promise<void>;
|
|
154
|
+
/** Context-aware alias for {@link Client.deleteRevokedInviteLinks}. */
|
|
155
|
+
deleteRevokedInviteLinks(userId: ID): Promise<void>;
|
|
152
156
|
/** Context-aware alias for {@link Client.deleteScheduledMessage}. */
|
|
153
157
|
deleteScheduledMessage(messageId: number): Promise<void>;
|
|
154
158
|
/** Context-aware alias for {@link Client.deleteScheduledMessages}. */
|
|
@@ -157,6 +161,8 @@ export declare class Context {
|
|
|
157
161
|
deleteStories(storyIds: number[]): Promise<void>;
|
|
158
162
|
/** Context-aware alias for {@link Client.deleteStory}. */
|
|
159
163
|
deleteStory(storyId: number): Promise<void>;
|
|
164
|
+
/** Context-aware alias for {@link Client.deleteTopic}. */
|
|
165
|
+
deleteTopic(topicId: number): Promise<void>;
|
|
160
166
|
/** Context-aware alias for {@link Client.disableAntispam}. */
|
|
161
167
|
disableAntispam(): Promise<void>;
|
|
162
168
|
/** Context-aware alias for {@link Client.disableBusinessBots}. */
|
|
@@ -259,6 +265,8 @@ export declare class Context {
|
|
|
259
265
|
getOnlineCount(): Promise<number>;
|
|
260
266
|
/** Context-aware alias for {@link Client.getPollVoters}. */
|
|
261
267
|
getPollVoters(messageId: number, params?: GetPollVotersParams): Promise<PollVoterList>;
|
|
268
|
+
/** Context-aware alias for {@link Client.getRecentActions}. */
|
|
269
|
+
getRecentActions(params?: GetRecentActionsParams): Promise<RecentActionsEntry[]>;
|
|
262
270
|
/** Context-aware alias for {@link Client.getRichText}. */
|
|
263
271
|
getRichText(messageId: number): Promise<RichText | null>;
|
|
264
272
|
/** Context-aware alias for {@link Client.getSavedMessages}. */
|
|
@@ -283,6 +291,12 @@ export declare class Context {
|
|
|
283
291
|
getStoryAlbums(): Promise<StoryAlbum[]>;
|
|
284
292
|
/** Context-aware alias for {@link Client.getTonBalance}. */
|
|
285
293
|
getTonBalance(): Promise<number>;
|
|
294
|
+
/** Context-aware alias for {@link Client.topicId}. */
|
|
295
|
+
getTopic(topicId: number): Promise<TopicListItem | null>;
|
|
296
|
+
/** Context-aware alias for {@link Client.getTopics}. */
|
|
297
|
+
getTopics(params?: GetTopicsParams): Promise<TopicList>;
|
|
298
|
+
/** Context-aware alias for {@link Client.getTopicsById}. */
|
|
299
|
+
getTopicsById(topicIds: number[]): Promise<TopicList>;
|
|
286
300
|
/** Context-aware alias for {@link Client.sendGift}. */
|
|
287
301
|
gift(giftId: string, params?: SendGiftParams): Promise<void>;
|
|
288
302
|
/** Context-aware alias for {@link Client.hideGeneralTopic}. */
|
|
@@ -433,8 +447,6 @@ export declare class Context {
|
|
|
433
447
|
sendScheduledMessages(messageIds: number[]): Promise<Message[]>;
|
|
434
448
|
/** Context-aware alias for {@link Client.sendScreenshotNotification}. */
|
|
435
449
|
sendScreenshotNotification(replyToMessageId: number): Promise<void>;
|
|
436
|
-
/** Context-aware alias for {@link Client.sendSecretChatAction}. */
|
|
437
|
-
sendSecretChatAction(action: SecretChatActionType): Promise<void>;
|
|
438
450
|
/** Context-aware alias for {@link Client.sendSecretScreenshotNotification}. */
|
|
439
451
|
sendSecretScreenshotNotification(messageIds: string[]): Promise<void>;
|
|
440
452
|
/** Context-aware alias for {@link Client.setAvailableReactions}. */
|