@mtkruto/node 0.192.0 → 0.194.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/0_errors.d.ts +6 -0
- package/esm/0_errors.d.ts.map +1 -1
- package/esm/0_errors.js +12 -0
- package/esm/3_types.d.ts +8 -2
- package/esm/3_types.d.ts.map +1 -1
- package/esm/3_types.js +8 -2
- 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 +9 -7
- package/esm/client/0_params.d.ts +51 -0
- package/esm/client/0_params.d.ts.map +1 -1
- package/esm/client/0_password.js +5 -5
- package/esm/client/0_storage_operations.d.ts +9 -0
- package/esm/client/0_storage_operations.d.ts.map +1 -1
- package/esm/client/0_storage_operations.js +40 -51
- package/esm/client/1_client_generic.d.ts +161 -13
- package/esm/client/1_client_generic.d.ts.map +1 -1
- package/esm/client/1_client_plain.d.ts.map +1 -1
- package/esm/client/1_client_plain.js +2 -1
- package/esm/client/2_client_encrypted.d.ts.map +1 -1
- package/esm/client/2_client_encrypted.js +2 -4
- package/esm/client/2_reaction_manager.d.ts +2 -1
- package/esm/client/2_reaction_manager.d.ts.map +1 -1
- package/esm/client/2_reaction_manager.js +7 -0
- package/esm/client/2_update_manager.d.ts +1 -1
- package/esm/client/2_update_manager.d.ts.map +1 -1
- package/esm/client/2_update_manager.js +13 -12
- package/esm/client/3_account_manager.d.ts +8 -2
- package/esm/client/3_account_manager.d.ts.map +1 -1
- package/esm/client/3_account_manager.js +54 -2
- package/esm/client/3_message_manager.js +6 -6
- package/esm/client/3_secret_chat_manager.d.ts +7 -2
- package/esm/client/3_secret_chat_manager.d.ts.map +1 -1
- package/esm/client/3_secret_chat_manager.js +65 -16
- 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 +9 -3
- package/esm/client/4_chat_manager.d.ts.map +1 -1
- package/esm/client/4_chat_manager.js +102 -3
- package/esm/client/4_checklist_manager.js +1 -1
- package/esm/client/4_context.d.ts +17 -3
- package/esm/client/4_context.d.ts.map +1 -1
- package/esm/client/4_context.js +38 -0
- package/esm/client/4_forum_manager.d.ts +1 -0
- package/esm/client/4_forum_manager.d.ts.map +1 -1
- package/esm/client/4_forum_manager.js +5 -0
- package/esm/client/6_client.d.ts +159 -11
- package/esm/client/6_client.d.ts.map +1 -1
- package/esm/client/6_client.js +223 -25
- package/esm/client/6_client_dispatcher.d.ts +160 -12
- package/esm/client/6_client_dispatcher.d.ts.map +1 -1
- package/esm/client/6_client_dispatcher.js +198 -8
- package/esm/storage/2_storage_indexed_db.js +5 -5
- package/esm/storage/2_storage_session_storage.js +2 -2
- package/esm/tl/0_utilities.d.ts +1 -1
- package/esm/tl/0_utilities.d.ts.map +1 -1
- package/esm/tl/0_utilities.js +3 -2
- package/esm/tl/1_tl_reader.js +1 -1
- package/esm/tl/1_tl_writer.js +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 +27 -0
- package/esm/types/1_channel_location.d.ts.map +1 -0
- package/esm/types/1_channel_location.js +30 -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/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/3_chat_join_result.d.ts +40 -0
- package/esm/types/3_chat_join_result.d.ts.map +1 -0
- package/esm/types/3_chat_join_result.js +45 -0
- package/esm/types/3_resolved_invite_link.d.ts +63 -0
- package/esm/types/3_resolved_invite_link.d.ts.map +1 -0
- package/esm/types/3_resolved_invite_link.js +45 -0
- 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/4_page_block.d.ts +45 -1
- package/esm/types/4_page_block.d.ts.map +1 -1
- package/esm/types/B_recent_action.d.ts +244 -0
- package/esm/types/B_recent_action.d.ts.map +1 -0
- package/esm/types/B_recent_action.js +322 -0
- package/esm/types/B_topic_list_item.d.ts +22 -0
- package/esm/types/B_topic_list_item.d.ts.map +1 -1
- package/esm/types/B_topic_list_item.js +19 -0
- package/esm/types/C_recent_actions_entry.d.ts +32 -0
- package/esm/types/C_recent_actions_entry.d.ts.map +1 -0
- package/esm/types/C_recent_actions_entry.js +32 -0
- package/esm/types/C_topic_list.d.ts +20 -0
- package/esm/types/C_topic_list.d.ts.map +1 -1
- package/esm/types/C_topic_list.js +19 -0
- package/esm/utilities/1_auth.d.ts.map +1 -1
- package/esm/utilities/1_auth.js +2 -1
- package/package.json +1 -1
- package/script/0_errors.d.ts +6 -0
- package/script/0_errors.d.ts.map +1 -1
- package/script/0_errors.js +15 -1
- package/script/3_types.d.ts +8 -2
- package/script/3_types.d.ts.map +1 -1
- package/script/3_types.js +8 -2
- 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 +8 -6
- package/script/client/0_params.d.ts +51 -0
- package/script/client/0_params.d.ts.map +1 -1
- package/script/client/0_password.js +5 -5
- package/script/client/0_storage_operations.d.ts +9 -0
- package/script/client/0_storage_operations.d.ts.map +1 -1
- package/script/client/0_storage_operations.js +42 -53
- package/script/client/1_client_generic.d.ts +161 -13
- package/script/client/1_client_generic.d.ts.map +1 -1
- package/script/client/1_client_plain.d.ts.map +1 -1
- package/script/client/1_client_plain.js +2 -1
- package/script/client/2_client_encrypted.d.ts.map +1 -1
- package/script/client/2_client_encrypted.js +4 -6
- package/script/client/2_reaction_manager.d.ts +2 -1
- package/script/client/2_reaction_manager.d.ts.map +1 -1
- package/script/client/2_reaction_manager.js +7 -0
- package/script/client/2_update_manager.d.ts +1 -1
- package/script/client/2_update_manager.d.ts.map +1 -1
- package/script/client/2_update_manager.js +13 -12
- package/script/client/3_account_manager.d.ts +8 -2
- package/script/client/3_account_manager.d.ts.map +1 -1
- package/script/client/3_account_manager.js +54 -2
- package/script/client/3_message_manager.js +6 -6
- package/script/client/3_secret_chat_manager.d.ts +7 -2
- package/script/client/3_secret_chat_manager.d.ts.map +1 -1
- package/script/client/3_secret_chat_manager.js +65 -16
- 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 +9 -3
- package/script/client/4_chat_manager.d.ts.map +1 -1
- package/script/client/4_chat_manager.js +101 -2
- package/script/client/4_checklist_manager.js +1 -1
- package/script/client/4_context.d.ts +17 -3
- package/script/client/4_context.d.ts.map +1 -1
- package/script/client/4_context.js +38 -0
- package/script/client/4_forum_manager.d.ts +1 -0
- package/script/client/4_forum_manager.d.ts.map +1 -1
- package/script/client/4_forum_manager.js +5 -0
- package/script/client/6_client.d.ts +159 -11
- package/script/client/6_client.d.ts.map +1 -1
- package/script/client/6_client.js +223 -25
- package/script/client/6_client_dispatcher.d.ts +160 -12
- package/script/client/6_client_dispatcher.d.ts.map +1 -1
- package/script/client/6_client_dispatcher.js +198 -8
- package/script/storage/2_storage_indexed_db.js +5 -5
- package/script/storage/2_storage_session_storage.js +2 -2
- package/script/tl/0_utilities.d.ts +1 -1
- package/script/tl/0_utilities.d.ts.map +1 -1
- package/script/tl/0_utilities.js +3 -2
- package/script/tl/1_tl_reader.js +1 -1
- package/script/tl/1_tl_writer.js +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 +27 -0
- package/script/types/1_channel_location.d.ts.map +1 -0
- package/script/types/1_channel_location.js +33 -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/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/3_chat_join_result.d.ts +40 -0
- package/script/types/3_chat_join_result.d.ts.map +1 -0
- package/script/types/3_chat_join_result.js +48 -0
- package/script/types/3_resolved_invite_link.d.ts +63 -0
- package/script/types/3_resolved_invite_link.d.ts.map +1 -0
- package/script/types/3_resolved_invite_link.js +48 -0
- 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/4_page_block.d.ts +45 -1
- package/script/types/4_page_block.d.ts.map +1 -1
- package/script/types/B_recent_action.d.ts +244 -0
- package/script/types/B_recent_action.d.ts.map +1 -0
- package/script/types/B_recent_action.js +325 -0
- package/script/types/B_topic_list_item.d.ts +22 -0
- package/script/types/B_topic_list_item.d.ts.map +1 -1
- package/script/types/B_topic_list_item.js +19 -0
- package/script/types/C_recent_actions_entry.d.ts +32 -0
- package/script/types/C_recent_actions_entry.d.ts.map +1 -0
- package/script/types/C_recent_actions_entry.js +35 -0
- package/script/types/C_topic_list.d.ts +20 -0
- package/script/types/C_topic_list.d.ts.map +1 -1
- package/script/types/C_topic_list.js +19 -0
- package/script/utilities/1_auth.d.ts.map +1 -1
- package/script/utilities/1_auth.js +2 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Api } from "../2_tl.js";
|
|
2
|
-
import { type FileSource, type ID, type Sticker, type Update } from "../3_types.js";
|
|
1
|
+
import { Api, SecretChats } from "../2_tl.js";
|
|
2
|
+
import { type FileSource, type ID, type ParseMode, type SecretMessageEntity, type Sticker, type Update } from "../3_types.js";
|
|
3
3
|
import type { EndSecretChatParams, SendSecretAnimationParams, SendSecretAudioParams, SendSecretContactParams, SendSecretDocumentParams, SendSecretLocationParams, SendSecretMessageParams, SendSecretPhotoParams, SendSecretStickerParams, SendSecretVenueParams, SendSecretVideoNoteParams, SendSecretVideoParams, SendSecretVoiceParams } from "./0_params.js";
|
|
4
4
|
import type { UpdateProcessor } from "./0_update_processor.js";
|
|
5
5
|
import type { C as C_ } from "./1_types.js";
|
|
@@ -14,6 +14,11 @@ export declare class SecretChatManager implements UpdateProcessor<SecretChatMana
|
|
|
14
14
|
constructor(c: C);
|
|
15
15
|
loadSecretChats(): Promise<void>;
|
|
16
16
|
requestSecretChat(chatId: ID): Promise<import("../3_types.js").SecretChat>;
|
|
17
|
+
static parseText(text: string, entities: SecretMessageEntity[], parseMode: ParseMode, isEmptyAllowed?: boolean): [string, SecretMessageEntity[]];
|
|
18
|
+
parseText(text_: string, params?: {
|
|
19
|
+
parseMode?: ParseMode;
|
|
20
|
+
entities?: SecretMessageEntity[];
|
|
21
|
+
}, isEmptyAllowed?: boolean): readonly [string, SecretChats.MessageEntity[] | undefined];
|
|
17
22
|
acceptSecretChat(id: number): Promise<import("../3_types.js").SecretChat>;
|
|
18
23
|
endSecretChat(id: number, params?: EndSecretChatParams): Promise<import("../3_types.js").SecretChat>;
|
|
19
24
|
sendSecretMessage(id: number, text: string, params?: SendSecretMessageParams): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"3_secret_chat_manager.d.ts","sourceRoot":"","sources":["../../src/client/3_secret_chat_manager.ts"],"names":[],"mappings":"AAyBA,OAAO,EAAE,GAAG,
|
|
1
|
+
{"version":3,"file":"3_secret_chat_manager.d.ts","sourceRoot":"","sources":["../../src/client/3_secret_chat_manager.ts"],"names":[],"mappings":"AAyBA,OAAO,EAAE,GAAG,EAAQ,WAAW,EAAyB,MAAM,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E,MAAM,CAAC,EAAE,yBAAyB;IAyCzF,gCAAgC,CAAC,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE;IAkBjE,eAAe,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,CAAC,EAAE,qBAAqB;IAqC7E,iBAAiB,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,uBAAuB;IA6ChF,sBAAsB,CAAC,EAAE,EAAE,MAAM;IAOjC,4BAA4B,CAAC,EAAE,EAAE,MAAM;IAse7C,eAAe,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,GAAG,MAAM,IAAI,uBAAuB;IAIhE,YAAY,CAAC,MAAM,EAAE,uBAAuB,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;CA2G5E"}
|
|
@@ -62,6 +62,8 @@ 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");
|
|
@@ -161,6 +163,45 @@ class SecretChatManager {
|
|
|
161
163
|
state.pendingExponent = a;
|
|
162
164
|
return (0, _0_secret_chat_js_1.constructSecretChat)(result);
|
|
163
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
|
+
}
|
|
164
205
|
async acceptSecretChat(id) {
|
|
165
206
|
const state = this.#getSecretChatState(id);
|
|
166
207
|
if (!_2_tl_js_1.Api.is("encryptedChatRequested", state.encryptedChat)) {
|
|
@@ -238,15 +279,16 @@ class SecretChatManager {
|
|
|
238
279
|
async sendSecretMessage(id, text, params) {
|
|
239
280
|
this.#c.storage.assertUser("sendSecretMessage");
|
|
240
281
|
const state = this.#mustGetEncryptedChat(id);
|
|
282
|
+
const [message, entities] = this.parseText(text, params);
|
|
241
283
|
const random_id = (0, _1_utilities_js_1.getRandomId)();
|
|
242
284
|
const decryptedMessage = {
|
|
243
285
|
_: "decryptedMessage",
|
|
244
|
-
message
|
|
286
|
+
message,
|
|
245
287
|
random_id,
|
|
246
288
|
ttl: params?.ttl ?? 0,
|
|
247
289
|
silent: params?.isSilent || undefined,
|
|
248
290
|
reply_to_random_id: params?.replyToMessageId ? BigInt(params.replyToMessageId) : undefined,
|
|
249
|
-
entities
|
|
291
|
+
entities,
|
|
250
292
|
via_bot_name: params?.viaBot,
|
|
251
293
|
};
|
|
252
294
|
await this.#sendMessage(decryptedMessage, state.encryptedChat, state.authKey, state.authKeyId_);
|
|
@@ -311,13 +353,14 @@ class SecretChatManager {
|
|
|
311
353
|
async sendSecretDocument(id, document, params) {
|
|
312
354
|
this.#c.storage.assertUser("sendSecretDocument");
|
|
313
355
|
const state = this.#mustGetEncryptedChat(id);
|
|
356
|
+
const [message, entities] = this.parseText(params?.caption ?? "", params);
|
|
314
357
|
const [key, iv] = this.#generateKeyIv();
|
|
315
358
|
const { inputEncryptedFile, fileSize } = await this.#c.fileManager.upload(document, params, null, true, { key, iv });
|
|
316
359
|
const random_id = (0, _1_utilities_js_1.getRandomId)();
|
|
317
360
|
const decryptedMessage = {
|
|
318
361
|
_: "decryptedMessage",
|
|
319
|
-
message
|
|
320
|
-
entities
|
|
362
|
+
message,
|
|
363
|
+
entities,
|
|
321
364
|
random_id,
|
|
322
365
|
ttl: params?.ttl ?? 0,
|
|
323
366
|
silent: params?.isSilent || undefined,
|
|
@@ -342,13 +385,14 @@ class SecretChatManager {
|
|
|
342
385
|
async sendSecretVideo(id, video, params) {
|
|
343
386
|
this.#c.storage.assertUser("sendSecretVideo");
|
|
344
387
|
const state = this.#mustGetEncryptedChat(id);
|
|
388
|
+
const [message, entities] = this.parseText(params?.caption ?? "", params);
|
|
345
389
|
const [key, iv] = this.#generateKeyIv();
|
|
346
390
|
const { inputEncryptedFile, fileSize } = await this.#c.fileManager.upload(video, params, null, true, { key, iv });
|
|
347
391
|
const random_id = (0, _1_utilities_js_1.getRandomId)();
|
|
348
392
|
const decryptedMessage = {
|
|
349
393
|
_: "decryptedMessage",
|
|
350
|
-
message
|
|
351
|
-
entities
|
|
394
|
+
message,
|
|
395
|
+
entities,
|
|
352
396
|
random_id,
|
|
353
397
|
ttl: params?.ttl ?? 0,
|
|
354
398
|
silent: params?.isSilent || undefined,
|
|
@@ -376,13 +420,14 @@ class SecretChatManager {
|
|
|
376
420
|
async sendSecretVideoNote(id, videoNote, params) {
|
|
377
421
|
this.#c.storage.assertUser("sendSecretVideoNote");
|
|
378
422
|
const state = this.#mustGetEncryptedChat(id);
|
|
423
|
+
const [message, entities] = this.parseText(params?.caption ?? "", params);
|
|
379
424
|
const [key, iv] = this.#generateKeyIv();
|
|
380
425
|
const { inputEncryptedFile, fileSize } = await this.#c.fileManager.upload(videoNote, params, null, true, { key, iv });
|
|
381
426
|
const random_id = (0, _1_utilities_js_1.getRandomId)();
|
|
382
427
|
const decryptedMessage = {
|
|
383
428
|
_: "decryptedMessage",
|
|
384
|
-
message
|
|
385
|
-
entities
|
|
429
|
+
message,
|
|
430
|
+
entities,
|
|
386
431
|
random_id,
|
|
387
432
|
ttl: params?.ttl ?? 0,
|
|
388
433
|
silent: params?.isSilent || undefined,
|
|
@@ -410,13 +455,14 @@ class SecretChatManager {
|
|
|
410
455
|
async sendSecretAudio(id, audio, params) {
|
|
411
456
|
this.#c.storage.assertUser("sendSecretAudio");
|
|
412
457
|
const state = this.#mustGetEncryptedChat(id);
|
|
458
|
+
const [message, entities] = this.parseText(params?.caption ?? "", params);
|
|
413
459
|
const [key, iv] = this.#generateKeyIv();
|
|
414
460
|
const { inputEncryptedFile, fileSize } = await this.#c.fileManager.upload(audio, params, null, true, { key, iv });
|
|
415
461
|
const random_id = (0, _1_utilities_js_1.getRandomId)();
|
|
416
462
|
const decryptedMessage = {
|
|
417
463
|
_: "decryptedMessage",
|
|
418
|
-
message
|
|
419
|
-
entities
|
|
464
|
+
message,
|
|
465
|
+
entities,
|
|
420
466
|
random_id,
|
|
421
467
|
ttl: params?.ttl ?? 0,
|
|
422
468
|
silent: params?.isSilent || undefined,
|
|
@@ -444,13 +490,14 @@ class SecretChatManager {
|
|
|
444
490
|
async sendSecretVoice(id, voice, params) {
|
|
445
491
|
this.#c.storage.assertUser("sendSecretVoice");
|
|
446
492
|
const state = this.#mustGetEncryptedChat(id);
|
|
493
|
+
const [message, entities] = this.parseText(params?.caption ?? "", params);
|
|
447
494
|
const [key, iv] = this.#generateKeyIv();
|
|
448
495
|
const { inputEncryptedFile, fileSize } = await this.#c.fileManager.upload(voice, params, null, true, { key, iv });
|
|
449
496
|
const random_id = (0, _1_utilities_js_1.getRandomId)();
|
|
450
497
|
const decryptedMessage = {
|
|
451
498
|
_: "decryptedMessage",
|
|
452
|
-
message
|
|
453
|
-
entities
|
|
499
|
+
message,
|
|
500
|
+
entities,
|
|
454
501
|
random_id,
|
|
455
502
|
ttl: params?.ttl ?? 0,
|
|
456
503
|
silent: params?.isSilent || undefined,
|
|
@@ -478,13 +525,14 @@ class SecretChatManager {
|
|
|
478
525
|
async sendSecretAnimation(id, animation, params) {
|
|
479
526
|
this.#c.storage.assertUser("sendSecretAnimation");
|
|
480
527
|
const state = this.#mustGetEncryptedChat(id);
|
|
528
|
+
const [message, entities] = this.parseText(params?.caption ?? "", params);
|
|
481
529
|
const [key, iv] = this.#generateKeyIv();
|
|
482
530
|
const { inputEncryptedFile, fileSize } = await this.#c.fileManager.upload(animation, params, null, true, { key, iv });
|
|
483
531
|
const random_id = (0, _1_utilities_js_1.getRandomId)();
|
|
484
532
|
const decryptedMessage = {
|
|
485
533
|
_: "decryptedMessage",
|
|
486
|
-
message
|
|
487
|
-
entities
|
|
534
|
+
message,
|
|
535
|
+
entities,
|
|
488
536
|
random_id,
|
|
489
537
|
ttl: params?.ttl ?? 0,
|
|
490
538
|
silent: params?.isSilent || undefined,
|
|
@@ -528,13 +576,14 @@ class SecretChatManager {
|
|
|
528
576
|
async sendSecretPhoto(id, photo, params) {
|
|
529
577
|
this.#c.storage.assertUser("sendSecretPhoto");
|
|
530
578
|
const state = this.#mustGetEncryptedChat(id);
|
|
579
|
+
const [message, entities] = this.parseText(params?.caption ?? "", params);
|
|
531
580
|
const [key, iv] = this.#generateKeyIv();
|
|
532
581
|
const { inputEncryptedFile, fileSize } = await this.#c.fileManager.upload(photo, params, (0, _0_utilities_js_1.checkPhotoName)(params), true, { key, iv });
|
|
533
582
|
const random_id = (0, _1_utilities_js_1.getRandomId)();
|
|
534
583
|
const decryptedMessage = {
|
|
535
584
|
_: "decryptedMessage",
|
|
536
|
-
message
|
|
537
|
-
entities
|
|
585
|
+
message,
|
|
586
|
+
entities,
|
|
538
587
|
random_id,
|
|
539
588
|
ttl: params?.ttl ?? 0,
|
|
540
589
|
silent: params?.isSilent || undefined,
|
|
@@ -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":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AE,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,CAAC,EAAE,4BAA4B;IAWjG,mCAAmC,CAAC,IAAI,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;
|
|
@@ -18,9 +18,9 @@
|
|
|
18
18
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
19
19
|
*/
|
|
20
20
|
import { Api } from "../2_tl.js";
|
|
21
|
-
import { type AvailableReactions, type ChatP, type SlowModeDuration } from "../3_types.js";
|
|
21
|
+
import { type AvailableReactions, type ChatJoinResult, 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";
|
|
@@ -43,7 +43,8 @@ export declare class ChatManager implements UpdateProcessor<ChatManagerUpdate, t
|
|
|
43
43
|
getJoinRequests(chatId: ID, params?: GetJoinRequestsParams): Promise<import("../3_types.js").JoinRequest[]>;
|
|
44
44
|
createInviteLink(chatId: ID, params?: CreateInviteLinkParams): Promise<import("../3_types.js").InviteLink>;
|
|
45
45
|
getCreatedInviteLinks(chatId: ID, params?: GetCreatedInviteLinksParams): Promise<import("../3_types.js").InviteLink[]>;
|
|
46
|
-
joinChat(chatId: ID): Promise<
|
|
46
|
+
joinChat(chatId: ID): Promise<ChatJoinResult>;
|
|
47
|
+
joinChatByInviteLink(inviteLink: string): Promise<ChatJoinResult>;
|
|
47
48
|
leaveChat(chatId: ID): Promise<void>;
|
|
48
49
|
banChatMember(chatId: ID, memberId: ID, params?: BanChatMemberParams): Promise<void>;
|
|
49
50
|
unbanChatMember(chatId: ID, memberId: ID): Promise<void>;
|
|
@@ -89,6 +90,11 @@ export declare class ChatManager implements UpdateProcessor<ChatManagerUpdate, t
|
|
|
89
90
|
markChatAsUnread(chatId: ID): Promise<void>;
|
|
90
91
|
markChatAsRead(chatId: ID): Promise<void>;
|
|
91
92
|
markAllMentionsAsRead(chatId: ID, params?: MarkAllMentionsAsReadParams): Promise<void>;
|
|
93
|
+
getAdministeredChats(params?: GetAdministeredChatsParams): Promise<ChatP[]>;
|
|
94
|
+
getRecentActions(chatId: ID, params?: GetRecentActionsParams): Promise<import("../3_types.js").RecentActionsEntry[]>;
|
|
95
|
+
deleteRevokedInviteLinks(chatId: ID, userId: ID): Promise<void>;
|
|
96
|
+
boostChat(chatId: ID, params?: BoostChatParams): Promise<void>;
|
|
97
|
+
resolveInviteLink(inviteLink: string): Promise<ChatP | import("../3_types.js").ResolvedInviteLink>;
|
|
92
98
|
}
|
|
93
99
|
export {};
|
|
94
100
|
//# 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,cAAc,EAAE,KAAK,KAAK,EAAsP,KAAK,gBAAgB,EAA6B,MAAM,eAAe,CAAC;AAChc,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,EAAE,MAAM,yBAAyB,CAAC;AAE/D,OAAO,KAAK,EAAE,CAAC,IAAI,EAAE,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAE7D,UAAU,CAAE,SAAQ,EAAE;IACpB,WAAW,EAAE,WAAW,CAAC;IACzB,cAAc,EAAE,cAAc,CAAC;CAChC;AAED,QAAA,MAAM,kBAAkB,gGAId,CAAC;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AM,CAAC,EAAE,eAAe;IA0B9C,iBAAiB,CAAC,UAAU,EAAE,MAAM;CAY3C"}
|
|
@@ -135,15 +135,23 @@ class ChatManager {
|
|
|
135
135
|
throw new _0_errors_js_1.InputError("Cannot join private chats.");
|
|
136
136
|
}
|
|
137
137
|
else if ((0, _0_utilities_js_1.canBeInputChannel)(peer)) {
|
|
138
|
-
await this.#c.invoke({ _: "channels.joinChannel", channel: (0, _0_utilities_js_1.toInputChannel)(peer) });
|
|
138
|
+
const result = await this.#c.invoke({ _: "channels.joinChannel", channel: (0, _0_utilities_js_1.toInputChannel)(peer) });
|
|
139
|
+
return (0, _3_types_js_1.constructChatJoinResult)(result, this.#c.getPeer);
|
|
139
140
|
}
|
|
140
141
|
else if (_2_tl_js_1.Api.is("inputPeerChat", peer)) {
|
|
141
142
|
await this.#c.invoke({ _: "messages.addChatUser", chat_id: peer.chat_id, user_id: { _: "inputUserSelf" }, fwd_limit: 0 }); // TODO: use potential high-level method for adding participants to chats
|
|
143
|
+
return { type: "joined" };
|
|
142
144
|
}
|
|
143
145
|
else {
|
|
144
146
|
(0, _0_deps_js_1.unreachable)();
|
|
145
147
|
}
|
|
146
148
|
}
|
|
149
|
+
async joinChatByInviteLink(inviteLink) {
|
|
150
|
+
this.#c.storage.assertUser("joinChatByInviteLink");
|
|
151
|
+
const hash = ChatManager.#getInviteLinkHash(inviteLink);
|
|
152
|
+
const result = await this.#c.invoke({ _: "messages.importChatInvite", hash });
|
|
153
|
+
return (0, _3_types_js_1.constructChatJoinResult)(result, this.#c.getPeer);
|
|
154
|
+
}
|
|
147
155
|
async leaveChat(chatId) {
|
|
148
156
|
const peer = await this.#c.getInputPeer(chatId);
|
|
149
157
|
if ((0, _0_utilities_js_1.canBeInputUser)(peer)) {
|
|
@@ -508,7 +516,7 @@ class ChatManager {
|
|
|
508
516
|
const peer = await this.#c.getInputPeer(chatId);
|
|
509
517
|
const reason = (0, _3_types_js_1.reportReasonToTlObject)(reason_);
|
|
510
518
|
const message = params?.text ?? "";
|
|
511
|
-
this.#c.invoke({ _: "account.reportPeer", peer, reason, message });
|
|
519
|
+
await this.#c.invoke({ _: "account.reportPeer", peer, reason, message });
|
|
512
520
|
}
|
|
513
521
|
async #setIsChatUnread(chatId, isUnread) {
|
|
514
522
|
const peer = await this.#c.getInputPeer(chatId);
|
|
@@ -528,5 +536,96 @@ class ChatManager {
|
|
|
528
536
|
const top_msg_id = params?.topicId;
|
|
529
537
|
await this.#c.invoke({ _: "messages.readMentions", peer, top_msg_id });
|
|
530
538
|
}
|
|
539
|
+
async getAdministeredChats(params) {
|
|
540
|
+
this.#c.storage.assertUser("getAdministeredChats");
|
|
541
|
+
const for_personal = params?.isForPersonalChannel || undefined;
|
|
542
|
+
const result = await this.#c.invoke({ _: "channels.getAdminedPublicChannels", for_personal });
|
|
543
|
+
return result.chats.map(_3_types_js_1.constructChatP);
|
|
544
|
+
}
|
|
545
|
+
async getRecentActions(chatId, params) {
|
|
546
|
+
this.#c.storage.assertUser("getRecentActions");
|
|
547
|
+
const channel = await this.#c.getInputChannel(chatId);
|
|
548
|
+
const limit = (0, _0_utilities_js_1.getLimit)(params?.limit);
|
|
549
|
+
const events_filter = {
|
|
550
|
+
_: "channelAdminLogEventsFilter",
|
|
551
|
+
ban: params?.isRestrict || undefined,
|
|
552
|
+
delete: params?.isDelete || undefined,
|
|
553
|
+
demote: params?.isRestrict || undefined,
|
|
554
|
+
edit_rank: params?.isMemberTag || undefined,
|
|
555
|
+
edit: params?.isEdit || undefined,
|
|
556
|
+
forums: params?.isForum || undefined,
|
|
557
|
+
group_call: params?.isVideoChat || undefined,
|
|
558
|
+
info: params?.isChatSettings || undefined,
|
|
559
|
+
invite: params?.isInvite || undefined,
|
|
560
|
+
invites: params?.isInvite || undefined,
|
|
561
|
+
join: params?.isJoin || undefined,
|
|
562
|
+
kick: params?.isRestrict || undefined,
|
|
563
|
+
leave: params?.isLeave || undefined,
|
|
564
|
+
pinned: params?.isPin || undefined,
|
|
565
|
+
promote: params?.isRestrict || undefined,
|
|
566
|
+
send: params?.isNewMessage || undefined,
|
|
567
|
+
settings: params?.isChatSettings || undefined,
|
|
568
|
+
unban: params?.isRestrict || undefined,
|
|
569
|
+
unkick: params?.isRestrict || undefined,
|
|
570
|
+
};
|
|
571
|
+
const max_id = params?.offsetId ? BigInt(params.offsetId) : 0n;
|
|
572
|
+
const result = await this.#c.invoke({
|
|
573
|
+
_: "channels.getAdminLog",
|
|
574
|
+
channel,
|
|
575
|
+
limit,
|
|
576
|
+
max_id,
|
|
577
|
+
min_id: 0n,
|
|
578
|
+
q: "",
|
|
579
|
+
admins: [],
|
|
580
|
+
events_filter,
|
|
581
|
+
});
|
|
582
|
+
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)));
|
|
583
|
+
return await Promise.all(entries);
|
|
584
|
+
}
|
|
585
|
+
async deleteRevokedInviteLinks(chatId, userId) {
|
|
586
|
+
this.#c.storage.assertUser("deleteRevokedInviteLinks");
|
|
587
|
+
const peer = await this.#c.getInputPeer(chatId);
|
|
588
|
+
const admin_id = await this.#c.getInputUser(userId);
|
|
589
|
+
await this.#c.invoke({ _: "messages.deleteRevokedExportedChatInvites", peer, admin_id });
|
|
590
|
+
}
|
|
591
|
+
async boostChat(chatId, params) {
|
|
592
|
+
this.#c.storage.assertUser("boostChat");
|
|
593
|
+
const peer = await this.#c.getInputPeer(chatId);
|
|
594
|
+
const slots = params?.slots;
|
|
595
|
+
await this.#c.invoke({ _: "premium.applyBoost", peer, slots });
|
|
596
|
+
}
|
|
597
|
+
static #getInviteLinkHash(inviteLink) {
|
|
598
|
+
try {
|
|
599
|
+
const result = new URL(inviteLink);
|
|
600
|
+
const parts = result.pathname.split("/").slice(1);
|
|
601
|
+
if (parts.length > 1) {
|
|
602
|
+
return parts[1];
|
|
603
|
+
}
|
|
604
|
+
else {
|
|
605
|
+
const part = parts[0];
|
|
606
|
+
if (part.startsWith("+")) {
|
|
607
|
+
return part.slice(1);
|
|
608
|
+
}
|
|
609
|
+
else {
|
|
610
|
+
return part;
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
catch {
|
|
615
|
+
return inviteLink;
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
async resolveInviteLink(inviteLink) {
|
|
619
|
+
this.#c.storage.assertUser("resolveInviteLink");
|
|
620
|
+
const hash = ChatManager.#getInviteLinkHash(inviteLink);
|
|
621
|
+
const result = await this.#c.invoke({ _: "messages.checkChatInvite", hash });
|
|
622
|
+
switch (result._) {
|
|
623
|
+
case "chatInviteAlready":
|
|
624
|
+
case "chatInvitePeek":
|
|
625
|
+
return (0, _3_types_js_1.constructChatP)(result.chat);
|
|
626
|
+
case "chatInvite":
|
|
627
|
+
return (0, _3_types_js_1.constructResolvedInviteLink)(result);
|
|
628
|
+
}
|
|
629
|
+
}
|
|
531
630
|
}
|
|
532
631
|
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, 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, 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, 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";
|
|
21
|
+
import type { AlbumStoryList, AvailableReactions, BusinessConnection, CallbackQuery, Chat, ChatActionType, ChatJoinResult, 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, AllowUnpaidMessagesFromUserParams, AnswerCallbackQueryParams, AnswerInlineQueryParams, AnswerPreCheckoutQueryParams, ApproveJoinRequestsParams, BanChatMemberParams, BoostChatParams, CreateInviteLinkParams, CreateStoryParams, CreateTopicParams, DeclineJoinRequestsParams, DeleteMessagesParams, DisallowUnpaidMessagesFromUserParams, 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)[] | {
|
|
@@ -95,6 +95,8 @@ export declare class Context {
|
|
|
95
95
|
addStoryToHighlights(storyId: number): Promise<void>;
|
|
96
96
|
/** Context-aware alias for {@link Client.addToChecklist}. */
|
|
97
97
|
addToChecklist(messageId: number, items: InputChecklistItem[]): Promise<void>;
|
|
98
|
+
/** Context-aware alias for {@link Client.allowUnpaidMessagesFromUser}. */
|
|
99
|
+
allowUnpaidMessages(params?: AllowUnpaidMessagesFromUserParams): Promise<void>;
|
|
98
100
|
/** Context-aware alias for {@link Client.answerCallbackQuery}. */
|
|
99
101
|
answerCallbackQuery(params?: AnswerCallbackQueryParams): Promise<void>;
|
|
100
102
|
/** Context-aware alias for {@link Client.answerGuestQuery}. */
|
|
@@ -115,6 +117,8 @@ export declare class Context {
|
|
|
115
117
|
banSender(params?: BanChatMemberParams): Promise<void>;
|
|
116
118
|
/** Context-aware alias for {@link Client.blockUser}. */
|
|
117
119
|
blockUser(): Promise<void>;
|
|
120
|
+
/** Context-aware alias for {@link Client.boostChat}. */
|
|
121
|
+
boostChat(params?: BoostChatParams): Promise<void>;
|
|
118
122
|
/** Context-aware alias for {@link Client.checkChecklistItem}. */
|
|
119
123
|
checkChecklistItem(messageId: number, item: number): Promise<void>;
|
|
120
124
|
/** Context-aware alias for {@link Client.checkChecklistItems}. */
|
|
@@ -149,6 +153,8 @@ export declare class Context {
|
|
|
149
153
|
deleteMessage(messageId: number, params?: DeleteMessagesParams): Promise<void>;
|
|
150
154
|
/** Context-aware alias for {@link Client.deleteMessages}. */
|
|
151
155
|
deleteMessages(messageIds: number[], params?: DeleteMessagesParams): Promise<void>;
|
|
156
|
+
/** Context-aware alias for {@link Client.deleteRevokedInviteLinks}. */
|
|
157
|
+
deleteRevokedInviteLinks(userId: ID): Promise<void>;
|
|
152
158
|
/** Context-aware alias for {@link Client.deleteScheduledMessage}. */
|
|
153
159
|
deleteScheduledMessage(messageId: number): Promise<void>;
|
|
154
160
|
/** Context-aware alias for {@link Client.deleteScheduledMessages}. */
|
|
@@ -157,6 +163,8 @@ export declare class Context {
|
|
|
157
163
|
deleteStories(storyIds: number[]): Promise<void>;
|
|
158
164
|
/** Context-aware alias for {@link Client.deleteStory}. */
|
|
159
165
|
deleteStory(storyId: number): Promise<void>;
|
|
166
|
+
/** Context-aware alias for {@link Client.deleteTopic}. */
|
|
167
|
+
deleteTopic(topicId: number): Promise<void>;
|
|
160
168
|
/** Context-aware alias for {@link Client.disableAntispam}. */
|
|
161
169
|
disableAntispam(): Promise<void>;
|
|
162
170
|
/** Context-aware alias for {@link Client.disableBusinessBots}. */
|
|
@@ -173,6 +181,8 @@ export declare class Context {
|
|
|
173
181
|
disableSlowMode(): Promise<void>;
|
|
174
182
|
/** Context-aware alias for {@link Client.disableTopics}. */
|
|
175
183
|
disableTopics(): Promise<void>;
|
|
184
|
+
/** Context-aware alias for {@link Client.disallowUnpaidMessagesFromUser}. */
|
|
185
|
+
disallowUnpaidMessages(params?: DisallowUnpaidMessagesFromUserParams): Promise<void>;
|
|
176
186
|
/** Context-aware alias for {@link Client.editInlineMessageCaption}. */
|
|
177
187
|
editInlineMessageCaption(params?: EditInlineMessageCaptionParams): Promise<void>;
|
|
178
188
|
/** Context-aware alias for {@link Client.editInlineMessageLiveLocation}. */
|
|
@@ -259,6 +269,8 @@ export declare class Context {
|
|
|
259
269
|
getOnlineCount(): Promise<number>;
|
|
260
270
|
/** Context-aware alias for {@link Client.getPollVoters}. */
|
|
261
271
|
getPollVoters(messageId: number, params?: GetPollVotersParams): Promise<PollVoterList>;
|
|
272
|
+
/** Context-aware alias for {@link Client.getRecentActions}. */
|
|
273
|
+
getRecentActions(params?: GetRecentActionsParams): Promise<RecentActionsEntry[]>;
|
|
262
274
|
/** Context-aware alias for {@link Client.getRichText}. */
|
|
263
275
|
getRichText(messageId: number): Promise<RichText | null>;
|
|
264
276
|
/** Context-aware alias for {@link Client.getSavedMessages}. */
|
|
@@ -296,7 +308,7 @@ export declare class Context {
|
|
|
296
308
|
/** Context-aware alias for {@link Client.hideMemberList}. */
|
|
297
309
|
hideMemberList(): Promise<void>;
|
|
298
310
|
/** Context-aware alias for {@link Client.joinChat}. */
|
|
299
|
-
joinChat(): Promise<
|
|
311
|
+
joinChat(): Promise<ChatJoinResult>;
|
|
300
312
|
/** Context-aware alias for {@link Client.kickChatMember}. */
|
|
301
313
|
kickChatMember(memberId: ID): Promise<void>;
|
|
302
314
|
/** Context-aware alias for {@link Client.kickChatMember}. */
|
|
@@ -415,6 +427,8 @@ export declare class Context {
|
|
|
415
427
|
replyVoice(voice: FileSource, params?: Omit<SendVoiceParams, "replyTo" | "messageThreadId" | "businessConnectionId"> & ReplyParams): Promise<MessageVoice>;
|
|
416
428
|
/** Context-aware alias for {@link Client.reportChat}. */
|
|
417
429
|
reportChat(reason: ReportReason, params?: ReportChatParams): Promise<void>;
|
|
430
|
+
/** Context-aware alias for {@link Client.reportReaction}. */
|
|
431
|
+
reportReaction(messageId: number, reactionActorId: ID): Promise<void>;
|
|
418
432
|
/** Context-aware alias for {@link Client.reportStories}. */
|
|
419
433
|
reportStories(storyIds: number[], params?: ReportStoryParams): Promise<StoryReportResult>;
|
|
420
434
|
/** Context-aware alias for {@link Client.reportStory}. */
|