@mtkruto/node 0.108.0 → 0.110.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/client/0_client_abstract.d.ts +3 -3
- package/esm/client/0_client_abstract.d.ts.map +1 -1
- package/esm/client/0_client_abstract.js +6 -6
- package/esm/client/0_html.js +4 -4
- package/esm/client/0_params.d.ts +19 -19
- package/esm/client/0_params.d.ts.map +1 -1
- package/esm/client/1_client_generic.d.ts +64 -14
- package/esm/client/1_client_generic.d.ts.map +1 -1
- package/esm/client/1_client_plain.js +1 -1
- package/esm/client/1_types.d.ts +1 -1
- package/esm/client/1_types.d.ts.map +1 -1
- package/esm/client/2_account_manager.d.ts +2 -0
- package/esm/client/2_account_manager.d.ts.map +1 -1
- package/esm/client/2_account_manager.js +18 -6
- package/esm/client/2_client_encrypted.js +2 -2
- package/esm/client/2_context.d.ts +110 -2
- package/esm/client/2_context.d.ts.map +1 -1
- package/esm/client/2_context.js +208 -19
- package/esm/client/2_file_manager.js +6 -6
- package/esm/client/2_network_statistics_manager.d.ts +1 -1
- package/esm/client/2_network_statistics_manager.d.ts.map +1 -1
- package/esm/client/2_network_statistics_manager.js +3 -3
- package/esm/client/2_sign_in.js +6 -6
- package/esm/client/2_update_manager.js +2 -2
- package/esm/client/3_message_manager.js +30 -30
- package/esm/client/3_video_chat_manager.js +3 -3
- package/esm/client/4_callback_query_manager.js +1 -1
- package/esm/client/4_chat_list_manager.js +1 -1
- package/esm/client/4_chat_manager.d.ts +11 -5
- package/esm/client/4_chat_manager.d.ts.map +1 -1
- package/esm/client/4_chat_manager.js +58 -18
- package/esm/client/4_gift_manager.js +1 -1
- package/esm/client/4_story_manager.js +1 -1
- package/esm/client/5_client.d.ts +66 -16
- package/esm/client/5_client.d.ts.map +1 -1
- package/esm/client/5_client.js +116 -50
- package/esm/client/5_client_dispatcher.d.ts +64 -14
- package/esm/client/5_client_dispatcher.d.ts.map +1 -1
- package/esm/client/5_client_dispatcher.js +83 -17
- package/esm/connection/0_connection.d.ts +2 -2
- package/esm/connection/0_connection.d.ts.map +1 -1
- package/esm/connection/1_connection_tcp.node.d.ts +1 -1
- package/esm/connection/1_connection_tcp.node.d.ts.map +1 -1
- package/esm/connection/1_connection_tcp.node.js +4 -4
- package/esm/connection/1_connection_web_socket.d.ts +1 -1
- package/esm/connection/1_connection_web_socket.d.ts.map +1 -1
- package/esm/connection/1_connection_web_socket.js +3 -3
- package/esm/session/1_session.d.ts +4 -4
- package/esm/session/1_session.d.ts.map +1 -1
- package/esm/session/1_session.js +21 -21
- package/esm/session/2_session_encrypted.js +5 -5
- package/esm/session/2_session_plain.js +2 -2
- package/esm/transport/1_transport_provider.d.ts +2 -2
- package/esm/transport/1_transport_provider.d.ts.map +1 -1
- package/esm/transport/1_transport_provider.js +2 -2
- package/esm/transport/2_transport_provider_tcp.js +1 -1
- package/esm/transport/2_transport_provider_web_socket.js +3 -3
- package/esm/types/0_bot_token_check_result.d.ts +2 -2
- package/esm/types/0_bot_token_check_result.d.ts.map +1 -1
- package/esm/types/0_code_check_result.d.ts +3 -3
- package/esm/types/0_code_check_result.d.ts.map +1 -1
- package/esm/types/0_password_check_result.d.ts +3 -3
- package/esm/types/0_password_check_result.d.ts.map +1 -1
- package/esm/types/0_video_chat.d.ts +1 -1
- package/esm/types/0_video_chat.d.ts.map +1 -1
- package/esm/types/0_video_chat.js +1 -1
- package/esm/types/0_voice_transcription.d.ts +1 -1
- package/esm/types/0_voice_transcription.d.ts.map +1 -1
- package/esm/types/0_voice_transcription.js +1 -1
- package/esm/types/1_chat_p.d.ts +1 -1
- package/esm/types/1_chat_p.d.ts.map +1 -1
- package/esm/types/1_chat_p.js +1 -1
- package/esm/types/1_input_story_content.d.ts +1 -1
- package/esm/types/1_input_story_content.d.ts.map +1 -1
- package/esm/types/1_keyboard_button.d.ts +7 -7
- package/esm/types/1_keyboard_button.d.ts.map +1 -1
- package/esm/types/1_keyboard_button.js +12 -12
- package/esm/types/1_message_reaction.d.ts +1 -1
- package/esm/types/1_message_reaction.d.ts.map +1 -1
- package/esm/types/1_message_reaction.js +1 -1
- package/esm/types/2_message_reaction_list_item.d.ts +2 -2
- package/esm/types/2_message_reaction_list_item.d.ts.map +1 -1
- package/esm/types/2_message_reaction_list_item.js +4 -4
- package/esm/types/2_reply_markup.d.ts +5 -5
- package/esm/types/2_reply_markup.d.ts.map +1 -1
- package/esm/types/2_reply_markup.js +7 -7
- package/esm/types/2_user.d.ts +1 -1
- package/esm/types/2_user.d.ts.map +1 -1
- package/esm/types/2_user.js +2 -2
- package/esm/types/3_chat_settings.d.ts +9 -9
- package/esm/types/3_chat_settings.d.ts.map +1 -1
- package/esm/types/3_chat_settings.js +9 -9
- package/esm/types/3_story.d.ts +3 -3
- package/esm/types/3_story.d.ts.map +1 -1
- package/esm/types/3_story.js +4 -4
- package/esm/types/5_claimed_gift.d.ts +1 -1
- package/esm/types/5_claimed_gift.d.ts.map +1 -1
- package/esm/types/5_claimed_gift.js +2 -2
- package/esm/types/5_link_preview.d.ts +1 -1
- package/esm/types/5_link_preview.d.ts.map +1 -1
- package/esm/types/6_message.d.ts +2 -2
- package/esm/types/6_message.d.ts.map +1 -1
- package/esm/types/6_message.js +2 -2
- package/esm/types/7_inline_query_result.d.ts +1 -1
- package/esm/types/7_inline_query_result.d.ts.map +1 -1
- package/esm/types/7_inline_query_result.js +1 -1
- package/esm/utilities/0_part_stream.d.ts +1 -1
- package/esm/utilities/0_part_stream.d.ts.map +1 -1
- package/esm/utilities/0_part_stream.js +2 -2
- package/package.json +1 -1
- package/script/client/0_client_abstract.d.ts +3 -3
- package/script/client/0_client_abstract.d.ts.map +1 -1
- package/script/client/0_client_abstract.js +6 -6
- package/script/client/0_html.js +4 -4
- package/script/client/0_params.d.ts +19 -19
- package/script/client/0_params.d.ts.map +1 -1
- package/script/client/1_client_generic.d.ts +64 -14
- package/script/client/1_client_generic.d.ts.map +1 -1
- package/script/client/1_client_plain.js +1 -1
- package/script/client/1_types.d.ts +1 -1
- package/script/client/1_types.d.ts.map +1 -1
- package/script/client/2_account_manager.d.ts +2 -0
- package/script/client/2_account_manager.d.ts.map +1 -1
- package/script/client/2_account_manager.js +18 -6
- package/script/client/2_client_encrypted.js +2 -2
- package/script/client/2_context.d.ts +110 -2
- package/script/client/2_context.d.ts.map +1 -1
- package/script/client/2_context.js +208 -19
- package/script/client/2_file_manager.js +6 -6
- package/script/client/2_network_statistics_manager.d.ts +1 -1
- package/script/client/2_network_statistics_manager.d.ts.map +1 -1
- package/script/client/2_network_statistics_manager.js +3 -3
- package/script/client/2_sign_in.js +6 -6
- package/script/client/2_update_manager.js +2 -2
- package/script/client/3_message_manager.js +30 -30
- package/script/client/3_video_chat_manager.js +3 -3
- package/script/client/4_callback_query_manager.js +1 -1
- package/script/client/4_chat_list_manager.js +1 -1
- package/script/client/4_chat_manager.d.ts +11 -5
- package/script/client/4_chat_manager.d.ts.map +1 -1
- package/script/client/4_chat_manager.js +58 -18
- package/script/client/4_gift_manager.js +1 -1
- package/script/client/4_story_manager.js +1 -1
- package/script/client/5_client.d.ts +66 -16
- package/script/client/5_client.d.ts.map +1 -1
- package/script/client/5_client.js +116 -50
- package/script/client/5_client_dispatcher.d.ts +64 -14
- package/script/client/5_client_dispatcher.d.ts.map +1 -1
- package/script/client/5_client_dispatcher.js +83 -17
- package/script/connection/0_connection.d.ts +2 -2
- package/script/connection/0_connection.d.ts.map +1 -1
- package/script/connection/1_connection_tcp.node.d.ts +1 -1
- package/script/connection/1_connection_tcp.node.d.ts.map +1 -1
- package/script/connection/1_connection_tcp.node.js +4 -4
- package/script/connection/1_connection_web_socket.d.ts +1 -1
- package/script/connection/1_connection_web_socket.d.ts.map +1 -1
- package/script/connection/1_connection_web_socket.js +3 -3
- package/script/session/1_session.d.ts +4 -4
- package/script/session/1_session.d.ts.map +1 -1
- package/script/session/1_session.js +21 -21
- package/script/session/2_session_encrypted.js +5 -5
- package/script/session/2_session_plain.js +2 -2
- package/script/transport/1_transport_provider.d.ts +2 -2
- package/script/transport/1_transport_provider.d.ts.map +1 -1
- package/script/transport/1_transport_provider.js +2 -2
- package/script/transport/2_transport_provider_tcp.js +1 -1
- package/script/transport/2_transport_provider_web_socket.js +3 -3
- package/script/types/0_bot_token_check_result.d.ts +2 -2
- package/script/types/0_bot_token_check_result.d.ts.map +1 -1
- package/script/types/0_code_check_result.d.ts +3 -3
- package/script/types/0_code_check_result.d.ts.map +1 -1
- package/script/types/0_password_check_result.d.ts +3 -3
- package/script/types/0_password_check_result.d.ts.map +1 -1
- package/script/types/0_video_chat.d.ts +1 -1
- package/script/types/0_video_chat.d.ts.map +1 -1
- package/script/types/0_video_chat.js +1 -1
- package/script/types/0_voice_transcription.d.ts +1 -1
- package/script/types/0_voice_transcription.d.ts.map +1 -1
- package/script/types/0_voice_transcription.js +1 -1
- package/script/types/1_chat_p.d.ts +1 -1
- package/script/types/1_chat_p.d.ts.map +1 -1
- package/script/types/1_chat_p.js +1 -1
- package/script/types/1_input_story_content.d.ts +1 -1
- package/script/types/1_input_story_content.d.ts.map +1 -1
- package/script/types/1_keyboard_button.d.ts +7 -7
- package/script/types/1_keyboard_button.d.ts.map +1 -1
- package/script/types/1_keyboard_button.js +12 -12
- package/script/types/1_message_reaction.d.ts +1 -1
- package/script/types/1_message_reaction.d.ts.map +1 -1
- package/script/types/1_message_reaction.js +1 -1
- package/script/types/2_message_reaction_list_item.d.ts +2 -2
- package/script/types/2_message_reaction_list_item.d.ts.map +1 -1
- package/script/types/2_message_reaction_list_item.js +4 -4
- package/script/types/2_reply_markup.d.ts +5 -5
- package/script/types/2_reply_markup.d.ts.map +1 -1
- package/script/types/2_reply_markup.js +7 -7
- package/script/types/2_user.d.ts +1 -1
- package/script/types/2_user.d.ts.map +1 -1
- package/script/types/2_user.js +2 -2
- package/script/types/3_chat_settings.d.ts +9 -9
- package/script/types/3_chat_settings.d.ts.map +1 -1
- package/script/types/3_chat_settings.js +9 -9
- package/script/types/3_story.d.ts +3 -3
- package/script/types/3_story.d.ts.map +1 -1
- package/script/types/3_story.js +4 -4
- package/script/types/5_claimed_gift.d.ts +1 -1
- package/script/types/5_claimed_gift.d.ts.map +1 -1
- package/script/types/5_claimed_gift.js +2 -2
- package/script/types/5_link_preview.d.ts +1 -1
- package/script/types/5_link_preview.d.ts.map +1 -1
- package/script/types/6_message.d.ts +2 -2
- package/script/types/6_message.d.ts.map +1 -1
- package/script/types/6_message.js +2 -2
- package/script/types/7_inline_query_result.d.ts +1 -1
- package/script/types/7_inline_query_result.d.ts.map +1 -1
- package/script/types/7_inline_query_result.js +1 -1
- package/script/utilities/0_part_stream.d.ts +1 -1
- package/script/utilities/0_part_stream.d.ts.map +1 -1
- package/script/utilities/0_part_stream.js +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"2_network_statistics_manager.d.ts","sourceRoot":"","sources":["../../src/client/2_network_statistics_manager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,cAAc,CAAC;AAEtC,qBAAa,wBAAwB;;gBAIvB,CAAC,EAAE,CAAC;IAKV,oBAAoB;;;;;;;;;;IAmB1B,6BAA6B,CAAC,
|
|
1
|
+
{"version":3,"file":"2_network_statistics_manager.d.ts","sourceRoot":"","sources":["../../src/client/2_network_statistics_manager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,cAAc,CAAC;AAEtC,qBAAa,wBAAwB;;gBAIvB,CAAC,EAAE,CAAC;IAKV,oBAAoB;;;;;;;;;;IAmB1B,6BAA6B,CAAC,MAAM,EAAE,OAAO;sBAE3B,MAAM;uBAKL,MAAM;;CA2B1B"}
|
|
@@ -43,15 +43,15 @@ export class NetworkStatisticsManager {
|
|
|
43
43
|
return { messages, cdn };
|
|
44
44
|
}
|
|
45
45
|
#pendingWrites = {};
|
|
46
|
-
getTransportReadWriteCallback(
|
|
46
|
+
getTransportReadWriteCallback(isCcdn) {
|
|
47
47
|
return {
|
|
48
48
|
read: (count) => {
|
|
49
|
-
const key =
|
|
49
|
+
const key = isCcdn ? "netstat_cdn_read" : "netstat_messages_read";
|
|
50
50
|
this.#pendingWrites[key] = (this.#pendingWrites[key] ?? 0) + count;
|
|
51
51
|
this.#write();
|
|
52
52
|
},
|
|
53
53
|
write: (count) => {
|
|
54
|
-
const key =
|
|
54
|
+
const key = isCcdn ? "netstat_cdn_write" : "netstat_messages_write";
|
|
55
55
|
this.#pendingWrites[key] = (this.#pendingWrites[key] ?? 0) + count;
|
|
56
56
|
this.#write();
|
|
57
57
|
},
|
package/esm/client/2_sign_in.js
CHANGED
|
@@ -45,7 +45,7 @@ export async function signIn(client, logger, params) {
|
|
|
45
45
|
logger.debug("signing in with", typeof params === "string" ? "bot token" : Api.is("auth.exportedAuthorization", params) ? "exported authorization" : "AuthorizeUserParams");
|
|
46
46
|
if (params && "botToken" in params) {
|
|
47
47
|
const result = await client.checkBotToken(params.botToken);
|
|
48
|
-
if (result.type === "
|
|
48
|
+
if (result.type === "signedIn") {
|
|
49
49
|
return;
|
|
50
50
|
}
|
|
51
51
|
else {
|
|
@@ -74,13 +74,13 @@ export async function signIn(client, logger, params) {
|
|
|
74
74
|
code: while (true) {
|
|
75
75
|
const code = typeof params.code === "string" ? params.code : await params.code();
|
|
76
76
|
const codeCheckResult = await client.checkCode(code);
|
|
77
|
-
if (codeCheckResult.type === "
|
|
77
|
+
if (codeCheckResult.type === "signedIn") {
|
|
78
78
|
return;
|
|
79
79
|
}
|
|
80
|
-
else if (codeCheckResult.type === "
|
|
80
|
+
else if (codeCheckResult.type === "invalidCode") {
|
|
81
81
|
continue code;
|
|
82
82
|
}
|
|
83
|
-
else if (codeCheckResult.type === "
|
|
83
|
+
else if (codeCheckResult.type === "passwordRequired") {
|
|
84
84
|
break code;
|
|
85
85
|
}
|
|
86
86
|
else {
|
|
@@ -91,10 +91,10 @@ export async function signIn(client, logger, params) {
|
|
|
91
91
|
password: while (true) {
|
|
92
92
|
const password = typeof params.password === "string" ? params.password : await params.password(passwordHint);
|
|
93
93
|
const passwordCheckResult = await client.checkPassword(password);
|
|
94
|
-
if (passwordCheckResult.type === "
|
|
94
|
+
if (passwordCheckResult.type === "signedIn") {
|
|
95
95
|
return;
|
|
96
96
|
}
|
|
97
|
-
else if (passwordCheckResult.type === "
|
|
97
|
+
else if (passwordCheckResult.type === "invalidPassword") {
|
|
98
98
|
continue password;
|
|
99
99
|
}
|
|
100
100
|
else {
|
|
@@ -956,7 +956,7 @@ export class UpdateManager {
|
|
|
956
956
|
const promise = Promise.resolve().then(async () => {
|
|
957
957
|
const logger = this.#LopenChat.branch(Api.peerToChatId(channel) + "");
|
|
958
958
|
while (true) {
|
|
959
|
-
if (this.#c.
|
|
959
|
+
if (this.#c.isDisconnected()) {
|
|
960
960
|
logger.debug("disconnected, stopping the loop");
|
|
961
961
|
this.#openChats.delete(channelId);
|
|
962
962
|
break;
|
|
@@ -978,7 +978,7 @@ export class UpdateManager {
|
|
|
978
978
|
}
|
|
979
979
|
}
|
|
980
980
|
catch (err) {
|
|
981
|
-
if (this.#c.
|
|
981
|
+
if (this.#c.isDisconnected()) {
|
|
982
982
|
continue; // breaks the loop
|
|
983
983
|
}
|
|
984
984
|
this.#LopenChat.error("an unexpected error occurred:", err);
|
|
@@ -172,7 +172,7 @@ export class MessageManager {
|
|
|
172
172
|
if (Api.is("updateNewMessage", update) || Api.is("updateEditMessage", update) || Api.is("updateNewScheduledMessage", update)) {
|
|
173
173
|
const message = await this.constructMessage(update.message);
|
|
174
174
|
if (Api.is("updateNewScheduledMessage", update)) {
|
|
175
|
-
message.
|
|
175
|
+
message.isScheduled = true;
|
|
176
176
|
}
|
|
177
177
|
messages.push(message);
|
|
178
178
|
}
|
|
@@ -214,7 +214,7 @@ export class MessageManager {
|
|
|
214
214
|
}
|
|
215
215
|
async forwardMessages(from, to, messageIds, params) {
|
|
216
216
|
checkArray(messageIds, checkMessageId);
|
|
217
|
-
const result = await this.#c.invoke({ _: "messages.forwardMessages", from_peer: await this.#c.getInputPeer(from), to_peer: await this.#c.getInputPeer(to), id: messageIds, random_id: messageIds.map(() => getRandomId()), silent: params?.
|
|
217
|
+
const result = await this.#c.invoke({ _: "messages.forwardMessages", from_peer: await this.#c.getInputPeer(from), to_peer: await this.#c.getInputPeer(to), id: messageIds, random_id: messageIds.map(() => getRandomId()), silent: params?.isSilent || undefined, top_msg_id: params?.messageThreadId, noforwards: params?.isSilent || undefined, send_as: params?.sendAs ? await this.#c.getInputPeer(params.sendAs) : undefined, drop_author: params?.dropSenderName || undefined, drop_media_captions: params?.dropCaption || undefined });
|
|
218
218
|
return await this.updatesToMessages(to, result);
|
|
219
219
|
}
|
|
220
220
|
async getHistory(chatId, params) {
|
|
@@ -287,10 +287,10 @@ export class MessageManager {
|
|
|
287
287
|
const replyMarkup = await this.#constructReplyMarkup(params);
|
|
288
288
|
const peer = await this.#c.getInputPeer(chatId);
|
|
289
289
|
const randomId = getRandomId();
|
|
290
|
-
const noWebpage = params?.linkPreview?.
|
|
290
|
+
const noWebpage = params?.linkPreview?.isDisabled ? true : undefined;
|
|
291
291
|
const invertMedia = params?.linkPreview?.isAboveText ? true : undefined;
|
|
292
|
-
const silent = params?.
|
|
293
|
-
const noforwards = params?.
|
|
292
|
+
const silent = params?.isSilent ? true : undefined;
|
|
293
|
+
const noforwards = params?.isContentProtected ? true : undefined;
|
|
294
294
|
const sendAs = await this.#resolveSendAs(params);
|
|
295
295
|
const effect = params?.effectId ? BigInt(params.effectId) : undefined;
|
|
296
296
|
const schedule_date = params?.sendAt;
|
|
@@ -364,8 +364,8 @@ export class MessageManager {
|
|
|
364
364
|
this.#checkParams(params);
|
|
365
365
|
const peer = await this.#c.getInputPeer(chatId);
|
|
366
366
|
const randomId = getRandomId();
|
|
367
|
-
const silent = params?.
|
|
368
|
-
const noforwards = params?.
|
|
367
|
+
const silent = params?.isSilent ? true : undefined;
|
|
368
|
+
const noforwards = params?.isContentProtected ? true : undefined;
|
|
369
369
|
const sendAs = params?.sendAs ? await this.#c.getInputPeer(params.sendAs) : undefined;
|
|
370
370
|
const replyMarkup = await this.#constructReplyMarkup(params);
|
|
371
371
|
const result = await this.#c.invoke({
|
|
@@ -402,8 +402,8 @@ export class MessageManager {
|
|
|
402
402
|
this.#checkParams(params);
|
|
403
403
|
const peer = await this.#c.getInputPeer(chatId);
|
|
404
404
|
const randomId = getRandomId();
|
|
405
|
-
const silent = params?.
|
|
406
|
-
const noforwards = params?.
|
|
405
|
+
const silent = params?.isSilent ? true : undefined;
|
|
406
|
+
const noforwards = params?.isContentProtected ? true : undefined;
|
|
407
407
|
const sendAs = params?.sendAs ? await this.#c.getInputPeer(params.sendAs) : undefined;
|
|
408
408
|
const replyMarkup = await this.#constructReplyMarkup(params);
|
|
409
409
|
const result = await this.#c.invoke({
|
|
@@ -434,8 +434,8 @@ export class MessageManager {
|
|
|
434
434
|
this.#checkParams(params);
|
|
435
435
|
const peer = await this.#c.getInputPeer(chatId);
|
|
436
436
|
const randomId = getRandomId();
|
|
437
|
-
const silent = params?.
|
|
438
|
-
const noforwards = params?.
|
|
437
|
+
const silent = params?.isSilent ? true : undefined;
|
|
438
|
+
const noforwards = params?.isContentProtected ? true : undefined;
|
|
439
439
|
const sendAs = params?.sendAs ? await this.#c.getInputPeer(params.sendAs) : undefined;
|
|
440
440
|
const replyMarkup = await this.#constructReplyMarkup(params);
|
|
441
441
|
const result = await this.#c.invoke({
|
|
@@ -463,8 +463,8 @@ export class MessageManager {
|
|
|
463
463
|
this.#checkParams(params);
|
|
464
464
|
const peer = await this.#c.getInputPeer(chatId);
|
|
465
465
|
const randomId = getRandomId();
|
|
466
|
-
const silent = params?.
|
|
467
|
-
const noforwards = params?.
|
|
466
|
+
const silent = params?.isSilent ? true : undefined;
|
|
467
|
+
const noforwards = params?.isContentProtected ? true : undefined;
|
|
468
468
|
const sendAs = params?.sendAs ? await this.#c.getInputPeer(params.sendAs) : undefined;
|
|
469
469
|
const replyMarkup = await this.#constructReplyMarkup(params);
|
|
470
470
|
const result = await this.#c.invoke({
|
|
@@ -677,8 +677,8 @@ export class MessageManager {
|
|
|
677
677
|
}
|
|
678
678
|
const peer = await this.#c.getInputPeer(chatId);
|
|
679
679
|
const randomId = getRandomId();
|
|
680
|
-
const silent = params?.
|
|
681
|
-
const noforwards = params?.
|
|
680
|
+
const silent = params?.isSilent ? true : undefined;
|
|
681
|
+
const noforwards = params?.isContentProtected ? true : undefined;
|
|
682
682
|
const sendAs = params?.sendAs ? await this.#c.getInputPeer(params.sendAs) : undefined;
|
|
683
683
|
const replyMarkup = await this.#constructReplyMarkup(params);
|
|
684
684
|
const caption_ = params?.caption;
|
|
@@ -735,8 +735,8 @@ export class MessageManager {
|
|
|
735
735
|
}
|
|
736
736
|
const peer = await this.#c.getInputPeer(chatId);
|
|
737
737
|
const randomId = getRandomId();
|
|
738
|
-
const silent = params?.
|
|
739
|
-
const noforwards = params?.
|
|
738
|
+
const silent = params?.isSilent ? true : undefined;
|
|
739
|
+
const noforwards = params?.isContentProtected ? true : undefined;
|
|
740
740
|
const sendAs = params?.sendAs ? await this.#c.getInputPeer(params.sendAs) : undefined;
|
|
741
741
|
const replyMarkup = await this.#constructReplyMarkup(params);
|
|
742
742
|
const explanation = params?.explanation;
|
|
@@ -807,7 +807,7 @@ export class MessageManager {
|
|
|
807
807
|
if (params?.linkPreview && params.linkPreview.type !== "input") {
|
|
808
808
|
throw new InputError("Expected link preview of type input.");
|
|
809
809
|
}
|
|
810
|
-
const noWebpage = params?.linkPreview && params.linkPreview.type === "input" && params.linkPreview.
|
|
810
|
+
const noWebpage = params?.linkPreview && params.linkPreview.type === "input" && params.linkPreview.isDisabled ? true : undefined;
|
|
811
811
|
const invertMedia = params?.linkPreview?.isAboveText ? true : undefined;
|
|
812
812
|
let media = undefined;
|
|
813
813
|
if (!noWebpage && params?.linkPreview?.url) {
|
|
@@ -863,7 +863,7 @@ export class MessageManager {
|
|
|
863
863
|
if (params?.linkPreview && params.linkPreview.type !== "input") {
|
|
864
864
|
throw new InputError("Expected link preview of type input.");
|
|
865
865
|
}
|
|
866
|
-
const noWebpage = params?.linkPreview && params.linkPreview.type === "input" && params.linkPreview.
|
|
866
|
+
const noWebpage = params?.linkPreview && params.linkPreview.type === "input" && params.linkPreview.isDisabled ? true : undefined;
|
|
867
867
|
const invertMedia = params?.linkPreview?.isAboveText ? true : undefined;
|
|
868
868
|
let media = undefined;
|
|
869
869
|
if (!noWebpage && params?.linkPreview?.url) {
|
|
@@ -1074,7 +1074,7 @@ export class MessageManager {
|
|
|
1074
1074
|
}
|
|
1075
1075
|
async pinMessage(chatId, messageId, params) {
|
|
1076
1076
|
this.#checkParams(params);
|
|
1077
|
-
await this.#c.invoke({ _: "messages.updatePinnedMessage", peer: await this.#c.getInputPeer(chatId), id: checkMessageId(messageId), silent: params?.
|
|
1077
|
+
await this.#c.invoke({ _: "messages.updatePinnedMessage", peer: await this.#c.getInputPeer(chatId), id: checkMessageId(messageId), silent: params?.isSilent ? true : undefined, pm_oneside: params?.bothSides ? undefined : true });
|
|
1078
1078
|
}
|
|
1079
1079
|
async unpinMessage(chatId, messageId, params) {
|
|
1080
1080
|
this.#checkParams(params);
|
|
@@ -1084,7 +1084,7 @@ export class MessageManager {
|
|
|
1084
1084
|
await this.#c.invoke({ _: "messages.unpinAllMessages", peer: await this.#c.getInputPeer(chatId) });
|
|
1085
1085
|
}
|
|
1086
1086
|
async #sendReaction(chatId, messageId, reactions, params) {
|
|
1087
|
-
await this.#c.invoke({ _: "messages.sendReaction", peer: await this.#c.getInputPeer(chatId), msg_id: checkMessageId(messageId), reaction: reactions.map((v) => reactionToTlObject(v)), big: params?.
|
|
1087
|
+
await this.#c.invoke({ _: "messages.sendReaction", peer: await this.#c.getInputPeer(chatId), msg_id: checkMessageId(messageId), reaction: reactions.map((v) => reactionToTlObject(v)), big: params?.isBig ? true : undefined, add_to_recent: params?.addToRecents ? true : undefined });
|
|
1088
1088
|
}
|
|
1089
1089
|
async setReactions(chatId, messageId, reactions, params) {
|
|
1090
1090
|
await this.#sendReaction(chatId, messageId, reactions, params);
|
|
@@ -1094,7 +1094,7 @@ export class MessageManager {
|
|
|
1094
1094
|
if (!message) {
|
|
1095
1095
|
throw new InputError("Message not found.");
|
|
1096
1096
|
}
|
|
1097
|
-
const chosenReactions = (message.reactions ?? []).filter((v) => v.
|
|
1097
|
+
const chosenReactions = (message.reactions ?? []).filter((v) => v.isChosen);
|
|
1098
1098
|
for (const r of chosenReactions) {
|
|
1099
1099
|
if (reactionEqual(r.reaction, reaction)) {
|
|
1100
1100
|
return;
|
|
@@ -1108,7 +1108,7 @@ export class MessageManager {
|
|
|
1108
1108
|
if (!message) {
|
|
1109
1109
|
throw new InputError("Message not found.");
|
|
1110
1110
|
}
|
|
1111
|
-
const chosenReactions = (message.reactions ?? []).filter((v) => v.
|
|
1111
|
+
const chosenReactions = (message.reactions ?? []).filter((v) => v.isChosen);
|
|
1112
1112
|
for (const r of chosenReactions) {
|
|
1113
1113
|
if (reactionEqual(r.reaction, reaction)) {
|
|
1114
1114
|
const reactions = chosenReactions.filter((v) => v !== r).map((v) => v.reaction);
|
|
@@ -1154,7 +1154,7 @@ export class MessageManager {
|
|
|
1154
1154
|
return { message };
|
|
1155
1155
|
}
|
|
1156
1156
|
else if (Api.is("updateNewScheduledMessage", update)) {
|
|
1157
|
-
message.
|
|
1157
|
+
message.isScheduled = true;
|
|
1158
1158
|
return { scheduledMessage: message };
|
|
1159
1159
|
}
|
|
1160
1160
|
else {
|
|
@@ -1369,7 +1369,7 @@ export class MessageManager {
|
|
|
1369
1369
|
shipping_address_requested: params?.needShippingAddress || undefined,
|
|
1370
1370
|
email_to_provider: params?.sendEmailToProvider || undefined,
|
|
1371
1371
|
phone_to_provider: params?.sendPhoneNumberToProvider || undefined,
|
|
1372
|
-
flexible: params?.
|
|
1372
|
+
flexible: params?.isFlexible || undefined,
|
|
1373
1373
|
};
|
|
1374
1374
|
const message = await this.#sendMedia(chatId, {
|
|
1375
1375
|
_: "inputMediaInvoice",
|
|
@@ -1438,8 +1438,8 @@ export class MessageManager {
|
|
|
1438
1438
|
multiMedia[i] = { ...media_, media: { _: "inputMediaDocument", id: { ...document, _: "inputDocument" } } };
|
|
1439
1439
|
}
|
|
1440
1440
|
}
|
|
1441
|
-
const silent = params?.
|
|
1442
|
-
const noforwards = params?.
|
|
1441
|
+
const silent = params?.isSilent ? true : undefined;
|
|
1442
|
+
const noforwards = params?.isContentProtected ? true : undefined;
|
|
1443
1443
|
const sendAs = params?.sendAs ? await this.#c.getInputPeer(params.sendAs) : undefined;
|
|
1444
1444
|
const result = await this.#c.invoke({
|
|
1445
1445
|
_: "messages.sendMultiMedia",
|
|
@@ -1497,7 +1497,7 @@ export class MessageManager {
|
|
|
1497
1497
|
return null;
|
|
1498
1498
|
}
|
|
1499
1499
|
const voiceTranscription = await this.#c.messageStorage.getVoiceTranscription(reference);
|
|
1500
|
-
if (!voiceTranscription || !voiceTranscription.
|
|
1500
|
+
if (!voiceTranscription || !voiceTranscription.isCompleted) {
|
|
1501
1501
|
return null;
|
|
1502
1502
|
}
|
|
1503
1503
|
return voiceTranscription;
|
|
@@ -1628,8 +1628,8 @@ export class MessageManager {
|
|
|
1628
1628
|
}
|
|
1629
1629
|
async openMiniApp(botId, chatId, params) {
|
|
1630
1630
|
this.#c.storage.assertUser("openMiniApp");
|
|
1631
|
-
const from_bot_menu = params?.
|
|
1632
|
-
const silent = params?.
|
|
1631
|
+
const from_bot_menu = params?.isFromMenu ? true : undefined;
|
|
1632
|
+
const silent = params?.isSilent ? true : undefined;
|
|
1633
1633
|
const compact = params?.mode === "compact" ? true : undefined;
|
|
1634
1634
|
const fullscreen = params?.mode === "fullscreen" ? true : undefined;
|
|
1635
1635
|
const peer = await this.#c.getInputPeer(chatId);
|
|
@@ -48,11 +48,11 @@ export class VideoChatManager {
|
|
|
48
48
|
}
|
|
49
49
|
async startVideoChat(chatId, params) {
|
|
50
50
|
this.#c.storage.assertUser("startVideoChat");
|
|
51
|
-
return await this.#createGroupCall(chatId, params?.title, params?.
|
|
51
|
+
return await this.#createGroupCall(chatId, params?.title, params?.isLiveStream || undefined);
|
|
52
52
|
}
|
|
53
53
|
async scheduleVideoChat(chatId, startAt, params) {
|
|
54
54
|
this.#c.storage.assertUser("scheduleVideoChat");
|
|
55
|
-
return await this.#createGroupCall(chatId, params?.title, params?.
|
|
55
|
+
return await this.#createGroupCall(chatId, params?.title, params?.isLiveStream || undefined, startAt);
|
|
56
56
|
}
|
|
57
57
|
async #getInputGroupCall(id_) {
|
|
58
58
|
const id = BigInt(id_);
|
|
@@ -65,7 +65,7 @@ export class VideoChatManager {
|
|
|
65
65
|
async joinVideoChat(id, params, params_) {
|
|
66
66
|
this.#c.storage.assertUser("joinVideoChat");
|
|
67
67
|
const call = await this.#getInputGroupCall(id);
|
|
68
|
-
const { updates } = await this.#c.invoke({ _: "phone.joinGroupCall", call, join_as: params_?.joinAs ? await this.#c.getInputPeer(params_.joinAs) : { _: "inputPeerSelf" }, params: { _: "dataJSON", data: params }, invite_hash: params_?.inviteHash, muted: params_?.
|
|
68
|
+
const { updates } = await this.#c.invoke({ _: "phone.joinGroupCall", call, join_as: params_?.joinAs ? await this.#c.getInputPeer(params_.joinAs) : { _: "inputPeerSelf" }, params: { _: "dataJSON", data: params }, invite_hash: params_?.inviteHash, muted: params_?.isAudioEnabled ? undefined : true, video_stopped: params_?.isVideoEnabled ? undefined : true }).then((v) => Api.as("updates", v));
|
|
69
69
|
const updateGroupCall = updates
|
|
70
70
|
.find((v) => Api.is("updateGroupCallConnection", v));
|
|
71
71
|
if (!updateGroupCall)
|
|
@@ -35,7 +35,7 @@ export class CallbackQueryManager {
|
|
|
35
35
|
async answerCallbackQuery(id, params) {
|
|
36
36
|
this.#c.storage.assertBot("answerCallbackQuery");
|
|
37
37
|
checkCallbackQueryId(id);
|
|
38
|
-
await this.#c.invoke({ _: "messages.setBotCallbackAnswer", query_id: BigInt(id), cache_time: params?.cacheTime ?? 0, message: params?.text, alert: params?.
|
|
38
|
+
await this.#c.invoke({ _: "messages.setBotCallbackAnswer", query_id: BigInt(id), cache_time: params?.cacheTime ?? 0, message: params?.text, alert: params?.isAlert ? true : undefined });
|
|
39
39
|
}
|
|
40
40
|
async sendCallbackQuery(botId, messageId, question) {
|
|
41
41
|
this.#c.storage.assertUser("sendCallbackQuery");
|
|
@@ -253,7 +253,7 @@ export class ChatListManager {
|
|
|
253
253
|
_: "channels.createChannel",
|
|
254
254
|
broadcast: type === "channel" ? true : undefined,
|
|
255
255
|
megagroup: type === "supergroup" ? true : undefined,
|
|
256
|
-
forum: params && ("
|
|
256
|
+
forum: params && ("isForum" in params) && params.isForum ? true : undefined,
|
|
257
257
|
title,
|
|
258
258
|
about: params?.description || "",
|
|
259
259
|
ttl_period: params?.messageTtl || undefined,
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
import { Api } from "../2_tl.js";
|
|
21
21
|
import { type ChatP, type SlowModeDuration } from "../3_types.js";
|
|
22
22
|
import { type FileSource, type ID, type Reaction, type Update } from "../3_types.js";
|
|
23
|
-
import type { AddChatMemberParams, ApproveJoinRequestsParams, BanChatMemberParams, CreateInviteLinkParams, DeclineJoinRequestsParams, GetCreatedInviteLinksParams, GetJoinRequestsParams, PromoteChatMemberParams, SetChatMemberRightsParams, SetChatMemberTagParams, SetChatPhotoParams
|
|
23
|
+
import type { AddChatMemberParams, ApproveJoinRequestsParams, BanChatMemberParams, CreateInviteLinkParams, DeclineJoinRequestsParams, EnableSignaturesParams, GetCreatedInviteLinksParams, GetJoinRequestsParams, PromoteChatMemberParams, 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";
|
|
@@ -62,16 +62,22 @@ export declare class ChatManager implements UpdateProcessor<ChatManagerUpdate, t
|
|
|
62
62
|
setSlowMode(chatId: ID, duration: SlowModeDuration): Promise<void>;
|
|
63
63
|
setChatTitle(chatId: ID, title: string): Promise<void>;
|
|
64
64
|
setChatDescription(chatId: ID, description: string): Promise<void>;
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
65
|
+
hideMemberList(chatId: ID): Promise<void>;
|
|
66
|
+
showMemberList(chatId: ID): Promise<void>;
|
|
67
|
+
disableTopics(chatId: ID): Promise<void>;
|
|
68
|
+
enableTopics(chatId: ID, isShownAsTabs: boolean): Promise<void>;
|
|
69
|
+
enableAntispam(chatId: ID): Promise<void>;
|
|
70
|
+
disableAntispam(chatId: ID): Promise<void>;
|
|
71
|
+
enableSignatures(chatId: ID, params?: EnableSignaturesParams): Promise<void>;
|
|
72
|
+
disableSignatures(chatId: ID): Promise<void>;
|
|
69
73
|
deleteChat(chatId: ID): Promise<void>;
|
|
70
74
|
getDiscussionChatSuggestions(): Promise<ChatP[]>;
|
|
71
75
|
setDiscussionChat(chatId: ID, discussionChatId: ID): Promise<void>;
|
|
72
76
|
transferChatOwnership(chatId: ID, userId: ID, password: string): Promise<void>;
|
|
73
77
|
promoteChatMember(chatId: ID, userId: ID, params?: PromoteChatMemberParams): Promise<void>;
|
|
74
78
|
setChatMemberTag(chatId: ID, userId: ID, params?: SetChatMemberTagParams): Promise<void>;
|
|
79
|
+
enableSharing(chatId: ID): Promise<void>;
|
|
80
|
+
disableSharing(chatId: ID): Promise<void>;
|
|
75
81
|
}
|
|
76
82
|
export {};
|
|
77
83
|
//# 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;A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E,MAAM,CAAC,EAAE,sBAAsB;IAK5D,iBAAiB,CAAC,MAAM,EAAE,EAAE;IAK5B,UAAU,CAAC,MAAM,EAAE,EAAE;IAarB,4BAA4B;IAc5B,iBAAiB,CAAC,MAAM,EAAE,EAAE,EAAE,gBAAgB,EAAE,EAAE;IAMlD,qBAAqB,CAAC,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,QAAQ,EAAE,MAAM;IAa9D,iBAAiB,CAAC,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,uBAAuB;IAc1E,gBAAgB,CAAC,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,sBAAsB;IAYxE,aAAa,CAAC,MAAM,EAAE,EAAE;IAKxB,cAAc,CAAC,MAAM,EAAE,EAAE;CAIhC"}
|
|
@@ -56,9 +56,9 @@ export class ChatManager {
|
|
|
56
56
|
return null;
|
|
57
57
|
}
|
|
58
58
|
// JOIN REQUESTS //
|
|
59
|
-
async #toggleJoinRequests(chatId,
|
|
59
|
+
async #toggleJoinRequests(chatId, isEnabled) {
|
|
60
60
|
const channel = await this.#c.getInputChannel(chatId);
|
|
61
|
-
await this.#c.invoke({ _: "channels.toggleJoinRequest", channel, enabled });
|
|
61
|
+
await this.#c.invoke({ _: "channels.toggleJoinRequest", channel, enabled: isEnabled });
|
|
62
62
|
}
|
|
63
63
|
async approveJoinRequest(chatId, userId) {
|
|
64
64
|
await this.#c.invoke({
|
|
@@ -114,15 +114,15 @@ export class ChatManager {
|
|
|
114
114
|
}
|
|
115
115
|
// INVITE LINKS //
|
|
116
116
|
async createInviteLink(chatId, params) {
|
|
117
|
-
if (params?.
|
|
118
|
-
throw new InputError("
|
|
117
|
+
if (params?.isApprovalRequired && params?.limit) {
|
|
118
|
+
throw new InputError("isApprovalRequired cannot be true while limit is specified.");
|
|
119
119
|
}
|
|
120
|
-
const result = await this.#c.invoke({ _: "messages.exportChatInvite", peer: await this.#c.getInputPeer(chatId), title: params?.title, expire_date: params?.expireAt, request_needed: params?.
|
|
120
|
+
const result = await this.#c.invoke({ _: "messages.exportChatInvite", peer: await this.#c.getInputPeer(chatId), title: params?.title, expire_date: params?.expireAt, request_needed: params?.isApprovalRequired ? true : undefined, usage_limit: params?.limit });
|
|
121
121
|
return constructInviteLink(Api.as("chatInviteExported", result), this.#c.getPeer);
|
|
122
122
|
}
|
|
123
123
|
async getCreatedInviteLinks(chatId, params) {
|
|
124
124
|
this.#c.storage.assertUser("getCreatedInviteLinks");
|
|
125
|
-
const { invites } = await this.#c.invoke({ _: "messages.getExportedChatInvites", peer: await this.#c.getInputPeer(chatId), revoked: params?.
|
|
125
|
+
const { invites } = await this.#c.invoke({ _: "messages.getExportedChatInvites", peer: await this.#c.getInputPeer(chatId), revoked: params?.isRevoked ? true : undefined, admin_id: params?.by ? await this.#c.getInputUser(params.by) : { _: "inputUserEmpty" }, limit: getLimit(params?.limit), offset_date: params?.afterDate, offset_link: params?.afterInviteLink });
|
|
126
126
|
return await Promise.all(invites.map((v) => Api.as("chatInviteExported", v)).map((v) => constructInviteLink(v, this.#c.getPeer)));
|
|
127
127
|
}
|
|
128
128
|
// JOINING AND LEAVING CHATS //
|
|
@@ -333,26 +333,54 @@ export class ChatManager {
|
|
|
333
333
|
}
|
|
334
334
|
await this.#c.invoke({ _: "messages.editChatAbout", peer, about: description });
|
|
335
335
|
}
|
|
336
|
-
async
|
|
337
|
-
this.#c.storage.assertUser("setMemberListVisible");
|
|
336
|
+
async #setIsMemberListVisible(chatId, isVisible) {
|
|
338
337
|
const channel = await this.#c.getInputChannel(chatId);
|
|
339
|
-
const enabled = !
|
|
338
|
+
const enabled = !isVisible;
|
|
340
339
|
await this.#c.invoke({ _: "channels.toggleParticipantsHidden", channel, enabled });
|
|
341
340
|
}
|
|
342
|
-
async
|
|
343
|
-
this.#c.storage.assertUser("
|
|
341
|
+
async hideMemberList(chatId) {
|
|
342
|
+
this.#c.storage.assertUser("hideMemberList");
|
|
343
|
+
await this.#setIsMemberListVisible(chatId, false);
|
|
344
|
+
}
|
|
345
|
+
async showMemberList(chatId) {
|
|
346
|
+
this.#c.storage.assertUser("showMemberList");
|
|
347
|
+
await this.#setIsMemberListVisible(chatId, true);
|
|
348
|
+
}
|
|
349
|
+
async #setIsTopicsEnabled(chatId, isEnabled, isShownAsTabs) {
|
|
344
350
|
const channel = await this.#c.getInputChannel(chatId);
|
|
345
|
-
await this.#c.invoke({ _: "channels.toggleForum", channel, enabled, tabs });
|
|
351
|
+
await this.#c.invoke({ _: "channels.toggleForum", channel, enabled: isEnabled, tabs: isShownAsTabs });
|
|
352
|
+
}
|
|
353
|
+
async disableTopics(chatId) {
|
|
354
|
+
this.#c.storage.assertUser("disableTopics");
|
|
355
|
+
await this.#setIsTopicsEnabled(chatId, false, false);
|
|
346
356
|
}
|
|
347
|
-
async
|
|
348
|
-
this.#c.storage.assertUser("
|
|
357
|
+
async enableTopics(chatId, isShownAsTabs) {
|
|
358
|
+
this.#c.storage.assertUser("enableTopics");
|
|
359
|
+
await this.#setIsTopicsEnabled(chatId, true, isShownAsTabs);
|
|
360
|
+
}
|
|
361
|
+
async #setIsAntispamEnabled(chatId, isEnabled) {
|
|
349
362
|
const channel = await this.#c.getInputChannel(chatId);
|
|
350
|
-
await this.#c.invoke({ _: "channels.toggleAntiSpam", channel, enabled });
|
|
363
|
+
await this.#c.invoke({ _: "channels.toggleAntiSpam", channel, enabled: isEnabled });
|
|
364
|
+
}
|
|
365
|
+
async enableAntispam(chatId) {
|
|
366
|
+
this.#c.storage.assertUser("enableAntispam");
|
|
367
|
+
await this.#setIsAntispamEnabled(chatId, true);
|
|
368
|
+
}
|
|
369
|
+
async disableAntispam(chatId) {
|
|
370
|
+
this.#c.storage.assertUser("disableAntispam");
|
|
371
|
+
await this.#setIsAntispamEnabled(chatId, false);
|
|
351
372
|
}
|
|
352
|
-
async
|
|
353
|
-
this.#c.storage.assertUser("setSignaturesEnabled");
|
|
373
|
+
async #setIsSignaturesEnabled(chatId, isEnabled, params) {
|
|
354
374
|
const channel = await this.#c.getInputChannel(chatId);
|
|
355
|
-
await this.#c.invoke({ _: "channels.toggleSignatures", channel, signatures_enabled:
|
|
375
|
+
await this.#c.invoke({ _: "channels.toggleSignatures", channel, signatures_enabled: isEnabled ? true : undefined, profiles_enabled: params?.showAuthorProfile ? true : undefined });
|
|
376
|
+
}
|
|
377
|
+
async enableSignatures(chatId, params) {
|
|
378
|
+
this.#c.storage.assertUser("enableSignatures");
|
|
379
|
+
await this.#setIsSignaturesEnabled(chatId, true, params);
|
|
380
|
+
}
|
|
381
|
+
async disableSignatures(chatId) {
|
|
382
|
+
this.#c.storage.assertUser("disableSignatures");
|
|
383
|
+
await this.#setIsSignaturesEnabled(chatId, false);
|
|
356
384
|
}
|
|
357
385
|
async deleteChat(chatId) {
|
|
358
386
|
this.#c.storage.assertUser("deleteChat");
|
|
@@ -418,4 +446,16 @@ export class ChatManager {
|
|
|
418
446
|
const rank = params?.tag ?? "";
|
|
419
447
|
await this.#c.invoke({ _: "messages.editChatParticipantRank", peer, participant, rank });
|
|
420
448
|
}
|
|
449
|
+
async #setIsSharingEnabled(chatId, isSharingEnabled) {
|
|
450
|
+
const peer = await this.#c.getInputPeer(chatId);
|
|
451
|
+
await this.#c.invoke({ _: "messages.toggleNoForwards", peer, enabled: !isSharingEnabled });
|
|
452
|
+
}
|
|
453
|
+
async enableSharing(chatId) {
|
|
454
|
+
this.#c.storage.assertUser("enableSharing");
|
|
455
|
+
await this.#setIsSharingEnabled(chatId, true);
|
|
456
|
+
}
|
|
457
|
+
async disableSharing(chatId) {
|
|
458
|
+
this.#c.storage.assertUser("disableSharing");
|
|
459
|
+
await this.#setIsSharingEnabled(chatId, false);
|
|
460
|
+
}
|
|
421
461
|
}
|
|
@@ -43,7 +43,7 @@ export class GiftManager {
|
|
|
43
43
|
return constructClaimedGifts(result, this.#c.getPeer);
|
|
44
44
|
}
|
|
45
45
|
async sendGift(chatId, giftId, params) {
|
|
46
|
-
const hide_name = params?.
|
|
46
|
+
const hide_name = params?.isPrivate ? true : undefined;
|
|
47
47
|
const include_upgrade = params?.upgrade ? true : undefined;
|
|
48
48
|
const peer = await this.#c.getInputPeer(chatId);
|
|
49
49
|
const gift_id = BigInt(giftId);
|
|
@@ -81,7 +81,7 @@ export class StoryManager {
|
|
|
81
81
|
mediaAreas.push(await storyInteractiveAreaToTlObject(area, this.#c.getPeer));
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
|
-
const updates = await this.#c.invoke({ _: "stories.sendStory", peer, random_id: randomId, media, privacy_rules: privacyRules, caption, entities, noforwards: params?.
|
|
84
|
+
const updates = await this.#c.invoke({ _: "stories.sendStory", peer, random_id: randomId, media, privacy_rules: privacyRules, caption, entities, noforwards: params?.isContentProtected ? true : undefined, period: params?.activeFor, pinned: params?.highlight ? true : undefined, media_areas: mediaAreas });
|
|
85
85
|
return await this.#updatesToStory(updates);
|
|
86
86
|
}
|
|
87
87
|
async getStories(chatId, storyIds) {
|