@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
|
@@ -160,7 +160,7 @@ export class MessageManager {
|
|
|
160
160
|
}
|
|
161
161
|
}
|
|
162
162
|
parseText(text_, params, isEmptyAllowed) {
|
|
163
|
-
const [text, entities_] = MessageManager.parseText(text_, params?.entities ?? [], params?.parseMode ?? this.#c.parseMode, isEmptyAllowed);
|
|
163
|
+
const [text, entities_] = MessageManager.parseText(text_, params?.entities ?? [], params?.parseMode === null ? null : params?.parseMode ?? this.#c.parseMode, isEmptyAllowed);
|
|
164
164
|
const entities = entities_?.length > 0 ? entities_.map((v) => messageEntityToTlObject(v, this.#c.getPeer)) : undefined;
|
|
165
165
|
return [text, entities];
|
|
166
166
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Api } from "../2_tl.js";
|
|
2
|
-
import { type FileSource, type ID, type
|
|
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";
|
|
@@ -7,13 +7,18 @@ import type { FileManager } from "./2_file_manager.js";
|
|
|
7
7
|
interface C extends C_ {
|
|
8
8
|
fileManager: FileManager;
|
|
9
9
|
}
|
|
10
|
-
declare const secretChatManagerUpdates: readonly ["updateEncryption", "updateNewEncryptedMessage"];
|
|
10
|
+
declare const secretChatManagerUpdates: readonly ["updateEncryption", "updateNewEncryptedMessage", "updateEncryptedChatTyping"];
|
|
11
11
|
type SecretChatManagerUpdate = Api.Types[(typeof secretChatManagerUpdates)[number]];
|
|
12
12
|
export declare class SecretChatManager implements UpdateProcessor<SecretChatManagerUpdate, true> {
|
|
13
13
|
#private;
|
|
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>;
|
|
@@ -26,10 +31,11 @@ export declare class SecretChatManager implements UpdateProcessor<SecretChatMana
|
|
|
26
31
|
sendSecretAudio(id: number, audio: FileSource, params?: SendSecretAudioParams): Promise<void>;
|
|
27
32
|
sendSecretVoice(id: number, voice: FileSource, params?: SendSecretVoiceParams): Promise<void>;
|
|
28
33
|
sendSecretAnimation(id: number, animation: FileSource, params?: SendSecretAnimationParams): Promise<void>;
|
|
29
|
-
sendSecretChatAction(id: number, action: SecretChatActionType): Promise<void>;
|
|
30
34
|
sendSecretScreenshotNotification(id: number, messageIds: string[]): Promise<void>;
|
|
31
35
|
sendSecretPhoto(id: number, photo: FileSource, params?: SendSecretPhotoParams): Promise<void>;
|
|
32
36
|
sendSecretSticker(id: number, sticker: Sticker, params?: SendSecretStickerParams): Promise<void>;
|
|
37
|
+
sendSecretTypingAction(id: number): Promise<void>;
|
|
38
|
+
sendSecretCancelTypingAction(id: number): Promise<void>;
|
|
33
39
|
canHandleUpdate(update: Api.Update): update is SecretChatManagerUpdate;
|
|
34
40
|
handleUpdate(update: SecretChatManagerUpdate): Promise<Update | null>;
|
|
35
41
|
}
|
|
@@ -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,YAAY,CAAC;AAC3E,OAAO,EAAqB,KAAK,UAAU,EAAE,KAAK,EAAE,EAAE,KAAK,SAAS,EAAE,KAAK,mBAAmB,EAAiC,KAAK,OAAO,EAAE,KAAK,MAAM,EAAE,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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"}
|
|
@@ -23,15 +23,18 @@ import { concat, equals, ige256Decrypt, ige256Encrypt, unreachable, WEEK } from
|
|
|
23
23
|
import { InputError } from "../0_errors.js";
|
|
24
24
|
import { getLogger, getRandomId, getRandomInt, intFromBytes, intToBytes, mod, modExp, sha1, sha256 } from "../1_utilities.js";
|
|
25
25
|
import { Api, repr, SecretChats, TLReader, TLWriter, X } from "../2_tl.js";
|
|
26
|
-
import {
|
|
26
|
+
import { deserializeFileId, secretMessageEntityToTlObject } from "../3_types.js";
|
|
27
27
|
import { constructSecretChat } from "../types/0_secret_chat.js";
|
|
28
28
|
import { constructSecretMessage } from "../types/2_secret_message.js";
|
|
29
|
+
import { parseHtml } from "./0_html.js";
|
|
30
|
+
import { parseMarkdown } from "./0_markdown.js";
|
|
29
31
|
import { isGoodModExpFirst, isSafePrime } from "./0_password.js";
|
|
30
32
|
import { SecretChatState } from "./0_secret_chat_state.js";
|
|
31
33
|
import { checkPhotoName } from "./0_utilities.js";
|
|
32
34
|
const secretChatManagerUpdates = [
|
|
33
35
|
"updateEncryption",
|
|
34
36
|
"updateNewEncryptedMessage",
|
|
37
|
+
"updateEncryptedChatTyping",
|
|
35
38
|
];
|
|
36
39
|
export class SecretChatManager {
|
|
37
40
|
#c;
|
|
@@ -124,6 +127,45 @@ export class SecretChatManager {
|
|
|
124
127
|
state.pendingExponent = a;
|
|
125
128
|
return constructSecretChat(result);
|
|
126
129
|
}
|
|
130
|
+
static parseText(text, entities, parseMode, isEmptyAllowed = false) {
|
|
131
|
+
switch (parseMode) {
|
|
132
|
+
case null:
|
|
133
|
+
break;
|
|
134
|
+
case "HTML": {
|
|
135
|
+
const [newText, entitiesToPush] = parseHtml(text, true);
|
|
136
|
+
text = newText;
|
|
137
|
+
for (const entity of entitiesToPush) {
|
|
138
|
+
entities.push(entity);
|
|
139
|
+
}
|
|
140
|
+
break;
|
|
141
|
+
}
|
|
142
|
+
case "Markdown": {
|
|
143
|
+
const [newText, entitiesToPush] = parseMarkdown(text, true);
|
|
144
|
+
text = newText;
|
|
145
|
+
for (const entity of entitiesToPush) {
|
|
146
|
+
entities.push(entity);
|
|
147
|
+
}
|
|
148
|
+
break;
|
|
149
|
+
}
|
|
150
|
+
default:
|
|
151
|
+
unreachable();
|
|
152
|
+
}
|
|
153
|
+
text = text.trimEnd();
|
|
154
|
+
for (const entity of entities) {
|
|
155
|
+
while (text[entity.offset + (entity.length - 1)] === undefined) {
|
|
156
|
+
--entity.length;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
if (!isEmptyAllowed && !text.length) {
|
|
160
|
+
throw new InputError("Text must not be empty.");
|
|
161
|
+
}
|
|
162
|
+
return [text, entities];
|
|
163
|
+
}
|
|
164
|
+
parseText(text_, params, isEmptyAllowed) {
|
|
165
|
+
const [text, entities_] = _a.parseText(text_, params?.entities ?? [], params?.parseMode === null ? null : params?.parseMode ?? this.#c.parseMode, isEmptyAllowed);
|
|
166
|
+
const entities = entities_?.length > 0 ? entities_.map(secretMessageEntityToTlObject) : undefined;
|
|
167
|
+
return [text, entities];
|
|
168
|
+
}
|
|
127
169
|
async acceptSecretChat(id) {
|
|
128
170
|
const state = this.#getSecretChatState(id);
|
|
129
171
|
if (!Api.is("encryptedChatRequested", state.encryptedChat)) {
|
|
@@ -201,15 +243,16 @@ export class SecretChatManager {
|
|
|
201
243
|
async sendSecretMessage(id, text, params) {
|
|
202
244
|
this.#c.storage.assertUser("sendSecretMessage");
|
|
203
245
|
const state = this.#mustGetEncryptedChat(id);
|
|
246
|
+
const [message, entities] = this.parseText(text, params);
|
|
204
247
|
const random_id = getRandomId();
|
|
205
248
|
const decryptedMessage = {
|
|
206
249
|
_: "decryptedMessage",
|
|
207
|
-
message
|
|
250
|
+
message,
|
|
208
251
|
random_id,
|
|
209
252
|
ttl: params?.ttl ?? 0,
|
|
210
253
|
silent: params?.isSilent || undefined,
|
|
211
254
|
reply_to_random_id: params?.replyToMessageId ? BigInt(params.replyToMessageId) : undefined,
|
|
212
|
-
entities
|
|
255
|
+
entities,
|
|
213
256
|
via_bot_name: params?.viaBot,
|
|
214
257
|
};
|
|
215
258
|
await this.#sendMessage(decryptedMessage, state.encryptedChat, state.authKey, state.authKeyId_);
|
|
@@ -274,13 +317,14 @@ export class SecretChatManager {
|
|
|
274
317
|
async sendSecretDocument(id, document, params) {
|
|
275
318
|
this.#c.storage.assertUser("sendSecretDocument");
|
|
276
319
|
const state = this.#mustGetEncryptedChat(id);
|
|
320
|
+
const [message, entities] = this.parseText(params?.caption ?? "", params);
|
|
277
321
|
const [key, iv] = this.#generateKeyIv();
|
|
278
322
|
const { inputEncryptedFile, fileSize } = await this.#c.fileManager.upload(document, params, null, true, { key, iv });
|
|
279
323
|
const random_id = getRandomId();
|
|
280
324
|
const decryptedMessage = {
|
|
281
325
|
_: "decryptedMessage",
|
|
282
|
-
message
|
|
283
|
-
entities
|
|
326
|
+
message,
|
|
327
|
+
entities,
|
|
284
328
|
random_id,
|
|
285
329
|
ttl: params?.ttl ?? 0,
|
|
286
330
|
silent: params?.isSilent || undefined,
|
|
@@ -305,13 +349,14 @@ export class SecretChatManager {
|
|
|
305
349
|
async sendSecretVideo(id, video, params) {
|
|
306
350
|
this.#c.storage.assertUser("sendSecretVideo");
|
|
307
351
|
const state = this.#mustGetEncryptedChat(id);
|
|
352
|
+
const [message, entities] = this.parseText(params?.caption ?? "", params);
|
|
308
353
|
const [key, iv] = this.#generateKeyIv();
|
|
309
354
|
const { inputEncryptedFile, fileSize } = await this.#c.fileManager.upload(video, params, null, true, { key, iv });
|
|
310
355
|
const random_id = getRandomId();
|
|
311
356
|
const decryptedMessage = {
|
|
312
357
|
_: "decryptedMessage",
|
|
313
|
-
message
|
|
314
|
-
entities
|
|
358
|
+
message,
|
|
359
|
+
entities,
|
|
315
360
|
random_id,
|
|
316
361
|
ttl: params?.ttl ?? 0,
|
|
317
362
|
silent: params?.isSilent || undefined,
|
|
@@ -339,13 +384,14 @@ export class SecretChatManager {
|
|
|
339
384
|
async sendSecretVideoNote(id, videoNote, params) {
|
|
340
385
|
this.#c.storage.assertUser("sendSecretVideoNote");
|
|
341
386
|
const state = this.#mustGetEncryptedChat(id);
|
|
387
|
+
const [message, entities] = this.parseText(params?.caption ?? "", params);
|
|
342
388
|
const [key, iv] = this.#generateKeyIv();
|
|
343
389
|
const { inputEncryptedFile, fileSize } = await this.#c.fileManager.upload(videoNote, params, null, true, { key, iv });
|
|
344
390
|
const random_id = getRandomId();
|
|
345
391
|
const decryptedMessage = {
|
|
346
392
|
_: "decryptedMessage",
|
|
347
|
-
message
|
|
348
|
-
entities
|
|
393
|
+
message,
|
|
394
|
+
entities,
|
|
349
395
|
random_id,
|
|
350
396
|
ttl: params?.ttl ?? 0,
|
|
351
397
|
silent: params?.isSilent || undefined,
|
|
@@ -373,13 +419,14 @@ export class SecretChatManager {
|
|
|
373
419
|
async sendSecretAudio(id, audio, params) {
|
|
374
420
|
this.#c.storage.assertUser("sendSecretAudio");
|
|
375
421
|
const state = this.#mustGetEncryptedChat(id);
|
|
422
|
+
const [message, entities] = this.parseText(params?.caption ?? "", params);
|
|
376
423
|
const [key, iv] = this.#generateKeyIv();
|
|
377
424
|
const { inputEncryptedFile, fileSize } = await this.#c.fileManager.upload(audio, params, null, true, { key, iv });
|
|
378
425
|
const random_id = getRandomId();
|
|
379
426
|
const decryptedMessage = {
|
|
380
427
|
_: "decryptedMessage",
|
|
381
|
-
message
|
|
382
|
-
entities
|
|
428
|
+
message,
|
|
429
|
+
entities,
|
|
383
430
|
random_id,
|
|
384
431
|
ttl: params?.ttl ?? 0,
|
|
385
432
|
silent: params?.isSilent || undefined,
|
|
@@ -407,13 +454,14 @@ export class SecretChatManager {
|
|
|
407
454
|
async sendSecretVoice(id, voice, params) {
|
|
408
455
|
this.#c.storage.assertUser("sendSecretVoice");
|
|
409
456
|
const state = this.#mustGetEncryptedChat(id);
|
|
457
|
+
const [message, entities] = this.parseText(params?.caption ?? "", params);
|
|
410
458
|
const [key, iv] = this.#generateKeyIv();
|
|
411
459
|
const { inputEncryptedFile, fileSize } = await this.#c.fileManager.upload(voice, params, null, true, { key, iv });
|
|
412
460
|
const random_id = getRandomId();
|
|
413
461
|
const decryptedMessage = {
|
|
414
462
|
_: "decryptedMessage",
|
|
415
|
-
message
|
|
416
|
-
entities
|
|
463
|
+
message,
|
|
464
|
+
entities,
|
|
417
465
|
random_id,
|
|
418
466
|
ttl: params?.ttl ?? 0,
|
|
419
467
|
silent: params?.isSilent || undefined,
|
|
@@ -441,13 +489,14 @@ export class SecretChatManager {
|
|
|
441
489
|
async sendSecretAnimation(id, animation, params) {
|
|
442
490
|
this.#c.storage.assertUser("sendSecretAnimation");
|
|
443
491
|
const state = this.#mustGetEncryptedChat(id);
|
|
492
|
+
const [message, entities] = this.parseText(params?.caption ?? "", params);
|
|
444
493
|
const [key, iv] = this.#generateKeyIv();
|
|
445
494
|
const { inputEncryptedFile, fileSize } = await this.#c.fileManager.upload(animation, params, null, true, { key, iv });
|
|
446
495
|
const random_id = getRandomId();
|
|
447
496
|
const decryptedMessage = {
|
|
448
497
|
_: "decryptedMessage",
|
|
449
|
-
message
|
|
450
|
-
entities
|
|
498
|
+
message,
|
|
499
|
+
entities,
|
|
451
500
|
random_id,
|
|
452
501
|
ttl: params?.ttl ?? 0,
|
|
453
502
|
silent: params?.isSilent || undefined,
|
|
@@ -473,59 +522,6 @@ export class SecretChatManager {
|
|
|
473
522
|
await this.#sendMessage(decryptedMessage, state.encryptedChat, state.authKey, state.authKeyId_, inputEncryptedFile);
|
|
474
523
|
await this.#postSendMessage(state);
|
|
475
524
|
}
|
|
476
|
-
async sendSecretChatAction(id, action) {
|
|
477
|
-
this.#c.storage.assertUser("sendSecretChatAction");
|
|
478
|
-
const state = this.#mustGetEncryptedChat(id);
|
|
479
|
-
const random_id = getRandomId();
|
|
480
|
-
let action_;
|
|
481
|
-
switch (action.type) {
|
|
482
|
-
case "typing":
|
|
483
|
-
action_ = { _: "sendMessageTypingAction" };
|
|
484
|
-
break;
|
|
485
|
-
case "uploadingPhoto":
|
|
486
|
-
action_ = { _: "sendMessageUploadPhotoAction" };
|
|
487
|
-
break;
|
|
488
|
-
case "recordingVideo":
|
|
489
|
-
action_ = { _: "sendMessageRecordVideoAction" };
|
|
490
|
-
break;
|
|
491
|
-
case "uploadingVideo":
|
|
492
|
-
action_ = { _: "sendMessageUploadVideoAction" };
|
|
493
|
-
break;
|
|
494
|
-
case "recordingVoice":
|
|
495
|
-
action_ = { _: "sendMessageRecordAudioAction" };
|
|
496
|
-
break;
|
|
497
|
-
case "uploadingAudio":
|
|
498
|
-
action_ = { _: "sendMessageUploadAudioAction" };
|
|
499
|
-
break;
|
|
500
|
-
case "uploadingDocument":
|
|
501
|
-
action_ = { _: "sendMessageUploadDocumentAction" };
|
|
502
|
-
break;
|
|
503
|
-
case "choosingLocation":
|
|
504
|
-
action_ = { _: "sendMessageGeoLocationAction" };
|
|
505
|
-
break;
|
|
506
|
-
case "recordingVideoNote":
|
|
507
|
-
action_ = { _: "sendMessageRecordRoundAction" };
|
|
508
|
-
break;
|
|
509
|
-
case "uploadingVideoNote":
|
|
510
|
-
action_ = { _: "sendMessageUploadRoundAction" };
|
|
511
|
-
break;
|
|
512
|
-
case "cancel":
|
|
513
|
-
action_ = { _: "sendMessageCancelAction" };
|
|
514
|
-
break;
|
|
515
|
-
default:
|
|
516
|
-
unreachable();
|
|
517
|
-
}
|
|
518
|
-
const decryptedMessageService = {
|
|
519
|
-
_: "decryptedMessageService",
|
|
520
|
-
action: {
|
|
521
|
-
_: "decryptedMessageActionTyping",
|
|
522
|
-
action: action_,
|
|
523
|
-
},
|
|
524
|
-
random_id,
|
|
525
|
-
};
|
|
526
|
-
await this.#sendMessage(decryptedMessageService, state.encryptedChat, state.authKey, state.authKeyId_);
|
|
527
|
-
await this.#postSendMessage(state);
|
|
528
|
-
}
|
|
529
525
|
async sendSecretScreenshotNotification(id, messageIds) {
|
|
530
526
|
this.#c.storage.assertUser("sendSecretScreenshotNotification");
|
|
531
527
|
const state = this.#mustGetEncryptedChat(id);
|
|
@@ -544,13 +540,14 @@ export class SecretChatManager {
|
|
|
544
540
|
async sendSecretPhoto(id, photo, params) {
|
|
545
541
|
this.#c.storage.assertUser("sendSecretPhoto");
|
|
546
542
|
const state = this.#mustGetEncryptedChat(id);
|
|
543
|
+
const [message, entities] = this.parseText(params?.caption ?? "", params);
|
|
547
544
|
const [key, iv] = this.#generateKeyIv();
|
|
548
545
|
const { inputEncryptedFile, fileSize } = await this.#c.fileManager.upload(photo, params, checkPhotoName(params), true, { key, iv });
|
|
549
546
|
const random_id = getRandomId();
|
|
550
547
|
const decryptedMessage = {
|
|
551
548
|
_: "decryptedMessage",
|
|
552
|
-
message
|
|
553
|
-
entities
|
|
549
|
+
message,
|
|
550
|
+
entities,
|
|
554
551
|
random_id,
|
|
555
552
|
ttl: params?.ttl ?? 0,
|
|
556
553
|
silent: params?.isSilent || undefined,
|
|
@@ -611,6 +608,18 @@ export class SecretChatManager {
|
|
|
611
608
|
await this.#sendMessage(decryptedMessage, state.encryptedChat, state.authKey, state.authKeyId_, inputEncryptedFile);
|
|
612
609
|
await this.#postSendMessage(state);
|
|
613
610
|
}
|
|
611
|
+
async sendSecretTypingAction(id) {
|
|
612
|
+
this.#c.storage.assertUser("sendSecretTypingAction");
|
|
613
|
+
const { encryptedChat } = this.#mustGetEncryptedChat(id);
|
|
614
|
+
const peer = { _: "inputEncryptedChat", chat_id: encryptedChat.id, access_hash: encryptedChat.access_hash };
|
|
615
|
+
await this.#c.invoke({ _: "messages.setEncryptedTyping", peer, typing: true });
|
|
616
|
+
}
|
|
617
|
+
async sendSecretCancelTypingAction(id) {
|
|
618
|
+
this.#c.storage.assertUser("sendSecretCancelTypingAction");
|
|
619
|
+
const { encryptedChat } = this.#mustGetEncryptedChat(id);
|
|
620
|
+
const peer = { _: "inputEncryptedChat", chat_id: encryptedChat.id, access_hash: encryptedChat.access_hash };
|
|
621
|
+
await this.#c.invoke({ _: "messages.setEncryptedTyping", peer, typing: false });
|
|
622
|
+
}
|
|
614
623
|
#sendTails = new Map();
|
|
615
624
|
async #sendMessage(message, encryptedChat, authKey, authKeyId, file) {
|
|
616
625
|
try {
|
|
@@ -993,12 +1002,6 @@ export class SecretChatManager {
|
|
|
993
1002
|
}
|
|
994
1003
|
break;
|
|
995
1004
|
}
|
|
996
|
-
case "decryptedMessageActionTyping": {
|
|
997
|
-
const secretChatAction = constructSecretChatAction(chatId, message.action);
|
|
998
|
-
if (secretChatAction !== null) {
|
|
999
|
-
this.#c.handleUpdate({ type: "secretChatAction", secretChatAction });
|
|
1000
|
-
}
|
|
1001
|
-
}
|
|
1002
1005
|
}
|
|
1003
1006
|
}
|
|
1004
1007
|
async #processUpdateNewMessageEncrypted(update) {
|
|
@@ -1064,6 +1067,9 @@ export class SecretChatManager {
|
|
|
1064
1067
|
return Api.isOneOf(secretChatManagerUpdates, update);
|
|
1065
1068
|
}
|
|
1066
1069
|
async handleUpdate(update) {
|
|
1070
|
+
if (Api.is("updateEncryptedChatTyping", update)) {
|
|
1071
|
+
return { type: "secretTyping", chatId: update.chat_id };
|
|
1072
|
+
}
|
|
1067
1073
|
if (Api.is("updateNewEncryptedMessage", update)) {
|
|
1068
1074
|
return await this.#processUpdateNewMessageEncrypted(update);
|
|
1069
1075
|
}
|
|
@@ -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;;;;;;;;;;;;;;;;;;GAkBG;AAKH,OAAO,EAAgE,KAAK,UAAU,EAAE,KAAK,YAAY,EAAE,MAAM,eAAe,CAAC;AACjI,OAAO,KAAK,EAAiB,4BAA4B,EAAE,sBAAsB,EAAE,gCAAgC,EAAE,4BAA4B,EAAE,MAAM,eAAe,CAAC;AAEzK,OAAO,KAAK,EAAE,CAAC,IAAI,EAAE,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEvD,UAAU,CAAE,SAAQ,EAAE;IACpB,WAAW,EAAE,WAAW,CAAC;CAC1B;AAED,qBAAa,iBAAiB;;gBAGhB,CAAC,EAAE,CAAC;IA2DV,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,EAAE,MAAM,CAAC,EAAE,sBAAsB;IAmCtG,mBAAmB,CAAC,IAAI,EAAE,MAAM;IAKhC,qBAAqB,CAAC,IAAI,EAAE,MAAM;IAKlC,sBAAsB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,CAAC,EAAE,4BAA4B;IAiCjG,2BAA2B,CAAC,MAAM,EAAE,MAAM;IAO1C,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;IAIjD,0BAA0B,CAAC,oBAAoB,EAAE,MAAM,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,CAAC,EAAE,gCAAgC;IAa5H,gBAAgB,CAAC,IAAI,EAAE,MAAM;IAK7B,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;IAK9C,iCAAiC,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM;IAIlE,sBAAsB,CAAC,IAAI,EAAE,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"}
|
|
@@ -17,10 +17,11 @@
|
|
|
17
17
|
* You should have received a copy of the GNU Lesser General Public License
|
|
18
18
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
19
19
|
*/
|
|
20
|
+
var _a;
|
|
20
21
|
import { contentType, unreachable } from "../0_deps.js";
|
|
21
22
|
import { InputError } from "../0_errors.js";
|
|
22
23
|
import { Api } from "../2_tl.js";
|
|
23
|
-
import { constructStickerSet, deserializeFileId } from "../3_types.js";
|
|
24
|
+
import { constructStickerSet, constructStickerSetP, deserializeFileId } from "../3_types.js";
|
|
24
25
|
import { checkStickerName } from "./0_utilities.js";
|
|
25
26
|
export class StickerSetManager {
|
|
26
27
|
#c;
|
|
@@ -82,7 +83,7 @@ export class StickerSetManager {
|
|
|
82
83
|
};
|
|
83
84
|
}
|
|
84
85
|
async createStickerSet(name, slug, stickers, params) {
|
|
85
|
-
slug =
|
|
86
|
+
slug = _a.#getSlug(slug);
|
|
86
87
|
if (this.#c.storage.isBot && !params?.userId) {
|
|
87
88
|
throw new InputError("The parameter userId is required.");
|
|
88
89
|
}
|
|
@@ -111,7 +112,7 @@ export class StickerSetManager {
|
|
|
111
112
|
return constructStickerSet(result);
|
|
112
113
|
}
|
|
113
114
|
async checkStickerSetSlug(slug) {
|
|
114
|
-
slug =
|
|
115
|
+
slug = _a.#getSlug(slug);
|
|
115
116
|
return await this.#c.invoke({ _: "stickers.checkShortName", short_name: slug });
|
|
116
117
|
}
|
|
117
118
|
async suggestStickerSetSlug(name) {
|
|
@@ -119,7 +120,7 @@ export class StickerSetManager {
|
|
|
119
120
|
return result.short_name;
|
|
120
121
|
}
|
|
121
122
|
async addStickerToStickerSet(slug, sticker, params) {
|
|
122
|
-
slug =
|
|
123
|
+
slug = _a.#getSlug(slug);
|
|
123
124
|
if (this.#c.storage.isBot && !params?.userId) {
|
|
124
125
|
throw new InputError("The parameter userId is required.");
|
|
125
126
|
}
|
|
@@ -166,18 +167,18 @@ export class StickerSetManager {
|
|
|
166
167
|
await this.#c.invoke({ _: "stickers.replaceSticker", sticker, new_sticker });
|
|
167
168
|
}
|
|
168
169
|
async deleteStickerSet(slug) {
|
|
169
|
-
slug =
|
|
170
|
+
slug = _a.#getSlug(slug);
|
|
170
171
|
await this.#c.invoke({ _: "stickers.deleteStickerSet", stickerset: { _: "inputStickerSetShortName", short_name: slug } });
|
|
171
172
|
}
|
|
172
173
|
async setStickerSetTitle(slug, title) {
|
|
173
|
-
slug =
|
|
174
|
+
slug = _a.#getSlug(slug);
|
|
174
175
|
await this.#c.invoke({ _: "stickers.renameStickerSet", stickerset: { _: "inputStickerSetShortName", short_name: slug }, title });
|
|
175
176
|
}
|
|
176
177
|
async changeStickerPositionInStickerSet(fileId, position) {
|
|
177
178
|
await this.#c.invoke({ _: "stickers.changeStickerPosition", sticker: this.#getStickerInputDocument(fileId), position });
|
|
178
179
|
}
|
|
179
180
|
async setStickerSetThumbnail(slug, thumbnail, params) {
|
|
180
|
-
slug =
|
|
181
|
+
slug = _a.#getSlug(slug);
|
|
181
182
|
if (this.#c.storage.isBot && !params?.userId) {
|
|
182
183
|
throw new InputError("The parameter userId is required.");
|
|
183
184
|
}
|
|
@@ -186,11 +187,11 @@ export class StickerSetManager {
|
|
|
186
187
|
await this.#c.invoke({ _: "stickers.setStickerSetThumb", stickerset: { _: "inputStickerSetShortName", short_name: slug }, thumb });
|
|
187
188
|
}
|
|
188
189
|
async setCustomEmojiAsStickerSetThumbnail(slug, customEmojiId) {
|
|
189
|
-
slug =
|
|
190
|
+
slug = _a.#getSlug(slug);
|
|
190
191
|
await this.#c.invoke({ _: "stickers.setStickerSetThumb", stickerset: { _: "inputStickerSetShortName", short_name: slug }, thumb_document_id: BigInt(customEmojiId) });
|
|
191
192
|
}
|
|
192
193
|
async getStickerSet(slug) {
|
|
193
|
-
slug =
|
|
194
|
+
slug = _a.#getSlug(slug);
|
|
194
195
|
const result = await this.#c.invoke({ _: "messages.getStickerSet", hash: 0, stickerset: { _: "inputStickerSetShortName", short_name: slug } });
|
|
195
196
|
return constructStickerSet(result);
|
|
196
197
|
}
|
|
@@ -198,4 +199,34 @@ export class StickerSetManager {
|
|
|
198
199
|
const result = await this.#c.invoke({ _: "messages.getStickerSet", hash: 0, stickerset: { _: "inputStickerSetDice", emoticon: emoji } });
|
|
199
200
|
return constructStickerSet(result);
|
|
200
201
|
}
|
|
202
|
+
async #installStickerSet(slug, archived) {
|
|
203
|
+
slug = _a.#getSlug(slug);
|
|
204
|
+
const short_name = slug;
|
|
205
|
+
const stickerset = { _: "inputStickerSetShortName", short_name };
|
|
206
|
+
await this.#c.invoke({ _: "messages.installStickerSet", stickerset, archived });
|
|
207
|
+
}
|
|
208
|
+
async addStickerSet(slug) {
|
|
209
|
+
this.#c.storage.assertUser("addStickerSet");
|
|
210
|
+
await this.#installStickerSet(slug, false);
|
|
211
|
+
}
|
|
212
|
+
async removeStickerSet(slug) {
|
|
213
|
+
this.#c.storage.assertUser("removeStickerSet");
|
|
214
|
+
slug = _a.#getSlug(slug);
|
|
215
|
+
const short_name = slug;
|
|
216
|
+
const stickerset = { _: "inputStickerSetShortName", short_name };
|
|
217
|
+
await this.#c.invoke({ _: "messages.uninstallStickerSet", stickerset });
|
|
218
|
+
}
|
|
219
|
+
async archiveStickerSet(slug) {
|
|
220
|
+
this.#c.storage.assertUser("archiveStickerSet");
|
|
221
|
+
await this.#installStickerSet(slug, true);
|
|
222
|
+
}
|
|
223
|
+
async unarchiveStickerSet(slug) {
|
|
224
|
+
this.#c.storage.assertUser("unarchiveStickerSet");
|
|
225
|
+
await this.#installStickerSet(slug, true);
|
|
226
|
+
}
|
|
227
|
+
async getAddedStickerSets() {
|
|
228
|
+
const result = Api.as("messages.allStickers", await this.#c.invoke({ _: "messages.getAllStickers", hash: 0n }));
|
|
229
|
+
return result.sets.map(constructStickerSetP);
|
|
230
|
+
}
|
|
201
231
|
}
|
|
232
|
+
_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,G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lObject, chatAdministratorRightsToTlObject, constructChatMemberUpdated, constructChatP, constructFailedInvitation, constructInviteLink, constructJoinRequest, constructJoinRequest2, reportReasonToTlObject, slowModeDurationToSeconds } from "../3_types.js";
|
|
23
|
+
import { availableReactionsToTlObject, chatAdministratorRightsToTlObject, constructChatMemberUpdated, constructChatP, constructFailedInvitation, constructInviteLink, constructJoinRequest, constructJoinRequest2, constructRecentActionsEntry, reportReasonToTlObject, slowModeDurationToSeconds } from "../3_types.js";
|
|
24
24
|
import { chatMemberRightsToTlObject } from "../3_types.js";
|
|
25
25
|
import { checkPassword } from "./0_password.js";
|
|
26
26
|
import { canBeInputChannel, canBeInputUser, getLimit, toInputChannel, toInputUser } from "./0_utilities.js";
|
|
@@ -525,4 +525,62 @@ export class ChatManager {
|
|
|
525
525
|
const top_msg_id = params?.topicId;
|
|
526
526
|
await this.#c.invoke({ _: "messages.readMentions", peer, top_msg_id });
|
|
527
527
|
}
|
|
528
|
+
async getAdministeredChats(params) {
|
|
529
|
+
this.#c.storage.assertUser("getAdministeredChats");
|
|
530
|
+
const for_personal = params?.isForPersonalChannel || undefined;
|
|
531
|
+
const result = await this.#c.invoke({ _: "channels.getAdminedPublicChannels", for_personal });
|
|
532
|
+
return result.chats.map(constructChatP);
|
|
533
|
+
}
|
|
534
|
+
async getRecentActions(chatId, params) {
|
|
535
|
+
this.#c.storage.assertUser("getRecentActions");
|
|
536
|
+
const channel = await this.#c.getInputChannel(chatId);
|
|
537
|
+
const limit = getLimit(params?.limit);
|
|
538
|
+
const events_filter = {
|
|
539
|
+
_: "channelAdminLogEventsFilter",
|
|
540
|
+
ban: params?.isRestrict || undefined,
|
|
541
|
+
delete: params?.isDelete || undefined,
|
|
542
|
+
demote: params?.isRestrict || undefined,
|
|
543
|
+
edit_rank: params?.isMemberTag || undefined,
|
|
544
|
+
edit: params?.isEdit || undefined,
|
|
545
|
+
forums: params?.isForum || undefined,
|
|
546
|
+
group_call: params?.isVideoChat || undefined,
|
|
547
|
+
info: params?.isChatSettings || undefined,
|
|
548
|
+
invite: params?.isInvite || undefined,
|
|
549
|
+
invites: params?.isInvite || undefined,
|
|
550
|
+
join: params?.isJoin || undefined,
|
|
551
|
+
kick: params?.isRestrict || undefined,
|
|
552
|
+
leave: params?.isLeave || undefined,
|
|
553
|
+
pinned: params?.isPin || undefined,
|
|
554
|
+
promote: params?.isRestrict || undefined,
|
|
555
|
+
send: params?.isNewMessage || undefined,
|
|
556
|
+
settings: params?.isChatSettings || undefined,
|
|
557
|
+
unban: params?.isRestrict || undefined,
|
|
558
|
+
unkick: params?.isRestrict || undefined,
|
|
559
|
+
};
|
|
560
|
+
const max_id = params?.offsetId ? BigInt(params.offsetId) : 0n;
|
|
561
|
+
const result = await this.#c.invoke({
|
|
562
|
+
_: "channels.getAdminLog",
|
|
563
|
+
channel,
|
|
564
|
+
limit,
|
|
565
|
+
max_id,
|
|
566
|
+
min_id: 0n,
|
|
567
|
+
q: "",
|
|
568
|
+
admins: [],
|
|
569
|
+
events_filter,
|
|
570
|
+
});
|
|
571
|
+
const entries = result.events.map((v) => constructRecentActionsEntry(v, this.#c.getPeer, this.#c.messageManager.getMessage.bind(this.#c.messageManager), this.#c.fileManager.getStickerSetName.bind(this.#c.fileManager)));
|
|
572
|
+
return await Promise.all(entries);
|
|
573
|
+
}
|
|
574
|
+
async deleteRevokedInviteLinks(chatId, userId) {
|
|
575
|
+
this.#c.storage.assertUser("deleteRevokedInviteLinks");
|
|
576
|
+
const peer = await this.#c.getInputPeer(chatId);
|
|
577
|
+
const admin_id = await this.#c.getInputUser(userId);
|
|
578
|
+
await this.#c.invoke({ _: "messages.deleteRevokedExportedChatInvites", peer, admin_id });
|
|
579
|
+
}
|
|
580
|
+
async boostChat(chatId, params) {
|
|
581
|
+
this.#c.storage.assertUser("boostChat");
|
|
582
|
+
const peer = await this.#c.getInputPeer(chatId);
|
|
583
|
+
const slots = params?.slots;
|
|
584
|
+
await this.#c.invoke({ _: "premium.applyBoost", peer, slots });
|
|
585
|
+
}
|
|
528
586
|
}
|
|
@@ -37,7 +37,7 @@ export class ChecklistManager {
|
|
|
37
37
|
}
|
|
38
38
|
async #updateChecklistInner(chatId, messageId, params) {
|
|
39
39
|
if (!params?.itemsToCheck?.length && !params?.itemsToUncheck?.length) {
|
|
40
|
-
throw new InputError("Both itemsToCheck and itemsToUncheck
|
|
40
|
+
throw new InputError("Both itemsToCheck and itemsToUncheck must not be empty.");
|
|
41
41
|
}
|
|
42
42
|
const peer = await this.#c.getInputPeer(chatId);
|
|
43
43
|
const msg_id = messageId;
|