@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
|
@@ -175,7 +175,7 @@ class MessageManager {
|
|
|
175
175
|
if (_2_tl_js_1.Api.is("updateNewMessage", update) || _2_tl_js_1.Api.is("updateEditMessage", update) || _2_tl_js_1.Api.is("updateNewScheduledMessage", update)) {
|
|
176
176
|
const message = await this.constructMessage(update.message);
|
|
177
177
|
if (_2_tl_js_1.Api.is("updateNewScheduledMessage", update)) {
|
|
178
|
-
message.
|
|
178
|
+
message.isScheduled = true;
|
|
179
179
|
}
|
|
180
180
|
messages.push(message);
|
|
181
181
|
}
|
|
@@ -217,7 +217,7 @@ class MessageManager {
|
|
|
217
217
|
}
|
|
218
218
|
async forwardMessages(from, to, messageIds, params) {
|
|
219
219
|
(0, _0_utilities_js_1.checkArray)(messageIds, _0_utilities_js_1.checkMessageId);
|
|
220
|
-
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(() => (0, _1_utilities_js_1.getRandomId)()), silent: params?.
|
|
220
|
+
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(() => (0, _1_utilities_js_1.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 });
|
|
221
221
|
return await this.updatesToMessages(to, result);
|
|
222
222
|
}
|
|
223
223
|
async getHistory(chatId, params) {
|
|
@@ -290,10 +290,10 @@ class MessageManager {
|
|
|
290
290
|
const replyMarkup = await this.#constructReplyMarkup(params);
|
|
291
291
|
const peer = await this.#c.getInputPeer(chatId);
|
|
292
292
|
const randomId = (0, _1_utilities_js_1.getRandomId)();
|
|
293
|
-
const noWebpage = params?.linkPreview?.
|
|
293
|
+
const noWebpage = params?.linkPreview?.isDisabled ? true : undefined;
|
|
294
294
|
const invertMedia = params?.linkPreview?.isAboveText ? true : undefined;
|
|
295
|
-
const silent = params?.
|
|
296
|
-
const noforwards = params?.
|
|
295
|
+
const silent = params?.isSilent ? true : undefined;
|
|
296
|
+
const noforwards = params?.isContentProtected ? true : undefined;
|
|
297
297
|
const sendAs = await this.#resolveSendAs(params);
|
|
298
298
|
const effect = params?.effectId ? BigInt(params.effectId) : undefined;
|
|
299
299
|
const schedule_date = params?.sendAt;
|
|
@@ -367,8 +367,8 @@ class MessageManager {
|
|
|
367
367
|
this.#checkParams(params);
|
|
368
368
|
const peer = await this.#c.getInputPeer(chatId);
|
|
369
369
|
const randomId = (0, _1_utilities_js_1.getRandomId)();
|
|
370
|
-
const silent = params?.
|
|
371
|
-
const noforwards = params?.
|
|
370
|
+
const silent = params?.isSilent ? true : undefined;
|
|
371
|
+
const noforwards = params?.isContentProtected ? true : undefined;
|
|
372
372
|
const sendAs = params?.sendAs ? await this.#c.getInputPeer(params.sendAs) : undefined;
|
|
373
373
|
const replyMarkup = await this.#constructReplyMarkup(params);
|
|
374
374
|
const result = await this.#c.invoke({
|
|
@@ -405,8 +405,8 @@ class MessageManager {
|
|
|
405
405
|
this.#checkParams(params);
|
|
406
406
|
const peer = await this.#c.getInputPeer(chatId);
|
|
407
407
|
const randomId = (0, _1_utilities_js_1.getRandomId)();
|
|
408
|
-
const silent = params?.
|
|
409
|
-
const noforwards = params?.
|
|
408
|
+
const silent = params?.isSilent ? true : undefined;
|
|
409
|
+
const noforwards = params?.isContentProtected ? true : undefined;
|
|
410
410
|
const sendAs = params?.sendAs ? await this.#c.getInputPeer(params.sendAs) : undefined;
|
|
411
411
|
const replyMarkup = await this.#constructReplyMarkup(params);
|
|
412
412
|
const result = await this.#c.invoke({
|
|
@@ -437,8 +437,8 @@ class MessageManager {
|
|
|
437
437
|
this.#checkParams(params);
|
|
438
438
|
const peer = await this.#c.getInputPeer(chatId);
|
|
439
439
|
const randomId = (0, _1_utilities_js_1.getRandomId)();
|
|
440
|
-
const silent = params?.
|
|
441
|
-
const noforwards = params?.
|
|
440
|
+
const silent = params?.isSilent ? true : undefined;
|
|
441
|
+
const noforwards = params?.isContentProtected ? true : undefined;
|
|
442
442
|
const sendAs = params?.sendAs ? await this.#c.getInputPeer(params.sendAs) : undefined;
|
|
443
443
|
const replyMarkup = await this.#constructReplyMarkup(params);
|
|
444
444
|
const result = await this.#c.invoke({
|
|
@@ -466,8 +466,8 @@ class MessageManager {
|
|
|
466
466
|
this.#checkParams(params);
|
|
467
467
|
const peer = await this.#c.getInputPeer(chatId);
|
|
468
468
|
const randomId = (0, _1_utilities_js_1.getRandomId)();
|
|
469
|
-
const silent = params?.
|
|
470
|
-
const noforwards = params?.
|
|
469
|
+
const silent = params?.isSilent ? true : undefined;
|
|
470
|
+
const noforwards = params?.isContentProtected ? true : undefined;
|
|
471
471
|
const sendAs = params?.sendAs ? await this.#c.getInputPeer(params.sendAs) : undefined;
|
|
472
472
|
const replyMarkup = await this.#constructReplyMarkup(params);
|
|
473
473
|
const result = await this.#c.invoke({
|
|
@@ -680,8 +680,8 @@ class MessageManager {
|
|
|
680
680
|
}
|
|
681
681
|
const peer = await this.#c.getInputPeer(chatId);
|
|
682
682
|
const randomId = (0, _1_utilities_js_1.getRandomId)();
|
|
683
|
-
const silent = params?.
|
|
684
|
-
const noforwards = params?.
|
|
683
|
+
const silent = params?.isSilent ? true : undefined;
|
|
684
|
+
const noforwards = params?.isContentProtected ? true : undefined;
|
|
685
685
|
const sendAs = params?.sendAs ? await this.#c.getInputPeer(params.sendAs) : undefined;
|
|
686
686
|
const replyMarkup = await this.#constructReplyMarkup(params);
|
|
687
687
|
const caption_ = params?.caption;
|
|
@@ -738,8 +738,8 @@ class MessageManager {
|
|
|
738
738
|
}
|
|
739
739
|
const peer = await this.#c.getInputPeer(chatId);
|
|
740
740
|
const randomId = (0, _1_utilities_js_1.getRandomId)();
|
|
741
|
-
const silent = params?.
|
|
742
|
-
const noforwards = params?.
|
|
741
|
+
const silent = params?.isSilent ? true : undefined;
|
|
742
|
+
const noforwards = params?.isContentProtected ? true : undefined;
|
|
743
743
|
const sendAs = params?.sendAs ? await this.#c.getInputPeer(params.sendAs) : undefined;
|
|
744
744
|
const replyMarkup = await this.#constructReplyMarkup(params);
|
|
745
745
|
const explanation = params?.explanation;
|
|
@@ -810,7 +810,7 @@ class MessageManager {
|
|
|
810
810
|
if (params?.linkPreview && params.linkPreview.type !== "input") {
|
|
811
811
|
throw new _0_errors_js_1.InputError("Expected link preview of type input.");
|
|
812
812
|
}
|
|
813
|
-
const noWebpage = params?.linkPreview && params.linkPreview.type === "input" && params.linkPreview.
|
|
813
|
+
const noWebpage = params?.linkPreview && params.linkPreview.type === "input" && params.linkPreview.isDisabled ? true : undefined;
|
|
814
814
|
const invertMedia = params?.linkPreview?.isAboveText ? true : undefined;
|
|
815
815
|
let media = undefined;
|
|
816
816
|
if (!noWebpage && params?.linkPreview?.url) {
|
|
@@ -866,7 +866,7 @@ class MessageManager {
|
|
|
866
866
|
if (params?.linkPreview && params.linkPreview.type !== "input") {
|
|
867
867
|
throw new _0_errors_js_1.InputError("Expected link preview of type input.");
|
|
868
868
|
}
|
|
869
|
-
const noWebpage = params?.linkPreview && params.linkPreview.type === "input" && params.linkPreview.
|
|
869
|
+
const noWebpage = params?.linkPreview && params.linkPreview.type === "input" && params.linkPreview.isDisabled ? true : undefined;
|
|
870
870
|
const invertMedia = params?.linkPreview?.isAboveText ? true : undefined;
|
|
871
871
|
let media = undefined;
|
|
872
872
|
if (!noWebpage && params?.linkPreview?.url) {
|
|
@@ -1077,7 +1077,7 @@ class MessageManager {
|
|
|
1077
1077
|
}
|
|
1078
1078
|
async pinMessage(chatId, messageId, params) {
|
|
1079
1079
|
this.#checkParams(params);
|
|
1080
|
-
await this.#c.invoke({ _: "messages.updatePinnedMessage", peer: await this.#c.getInputPeer(chatId), id: (0, _0_utilities_js_1.checkMessageId)(messageId), silent: params?.
|
|
1080
|
+
await this.#c.invoke({ _: "messages.updatePinnedMessage", peer: await this.#c.getInputPeer(chatId), id: (0, _0_utilities_js_1.checkMessageId)(messageId), silent: params?.isSilent ? true : undefined, pm_oneside: params?.bothSides ? undefined : true });
|
|
1081
1081
|
}
|
|
1082
1082
|
async unpinMessage(chatId, messageId, params) {
|
|
1083
1083
|
this.#checkParams(params);
|
|
@@ -1087,7 +1087,7 @@ class MessageManager {
|
|
|
1087
1087
|
await this.#c.invoke({ _: "messages.unpinAllMessages", peer: await this.#c.getInputPeer(chatId) });
|
|
1088
1088
|
}
|
|
1089
1089
|
async #sendReaction(chatId, messageId, reactions, params) {
|
|
1090
|
-
await this.#c.invoke({ _: "messages.sendReaction", peer: await this.#c.getInputPeer(chatId), msg_id: (0, _0_utilities_js_1.checkMessageId)(messageId), reaction: reactions.map((v) => (0, _3_types_js_2.reactionToTlObject)(v)), big: params?.
|
|
1090
|
+
await this.#c.invoke({ _: "messages.sendReaction", peer: await this.#c.getInputPeer(chatId), msg_id: (0, _0_utilities_js_1.checkMessageId)(messageId), reaction: reactions.map((v) => (0, _3_types_js_2.reactionToTlObject)(v)), big: params?.isBig ? true : undefined, add_to_recent: params?.addToRecents ? true : undefined });
|
|
1091
1091
|
}
|
|
1092
1092
|
async setReactions(chatId, messageId, reactions, params) {
|
|
1093
1093
|
await this.#sendReaction(chatId, messageId, reactions, params);
|
|
@@ -1097,7 +1097,7 @@ class MessageManager {
|
|
|
1097
1097
|
if (!message) {
|
|
1098
1098
|
throw new _0_errors_js_1.InputError("Message not found.");
|
|
1099
1099
|
}
|
|
1100
|
-
const chosenReactions = (message.reactions ?? []).filter((v) => v.
|
|
1100
|
+
const chosenReactions = (message.reactions ?? []).filter((v) => v.isChosen);
|
|
1101
1101
|
for (const r of chosenReactions) {
|
|
1102
1102
|
if ((0, _3_types_js_2.reactionEqual)(r.reaction, reaction)) {
|
|
1103
1103
|
return;
|
|
@@ -1111,7 +1111,7 @@ class MessageManager {
|
|
|
1111
1111
|
if (!message) {
|
|
1112
1112
|
throw new _0_errors_js_1.InputError("Message not found.");
|
|
1113
1113
|
}
|
|
1114
|
-
const chosenReactions = (message.reactions ?? []).filter((v) => v.
|
|
1114
|
+
const chosenReactions = (message.reactions ?? []).filter((v) => v.isChosen);
|
|
1115
1115
|
for (const r of chosenReactions) {
|
|
1116
1116
|
if ((0, _3_types_js_2.reactionEqual)(r.reaction, reaction)) {
|
|
1117
1117
|
const reactions = chosenReactions.filter((v) => v !== r).map((v) => v.reaction);
|
|
@@ -1157,7 +1157,7 @@ class MessageManager {
|
|
|
1157
1157
|
return { message };
|
|
1158
1158
|
}
|
|
1159
1159
|
else if (_2_tl_js_1.Api.is("updateNewScheduledMessage", update)) {
|
|
1160
|
-
message.
|
|
1160
|
+
message.isScheduled = true;
|
|
1161
1161
|
return { scheduledMessage: message };
|
|
1162
1162
|
}
|
|
1163
1163
|
else {
|
|
@@ -1372,7 +1372,7 @@ class MessageManager {
|
|
|
1372
1372
|
shipping_address_requested: params?.needShippingAddress || undefined,
|
|
1373
1373
|
email_to_provider: params?.sendEmailToProvider || undefined,
|
|
1374
1374
|
phone_to_provider: params?.sendPhoneNumberToProvider || undefined,
|
|
1375
|
-
flexible: params?.
|
|
1375
|
+
flexible: params?.isFlexible || undefined,
|
|
1376
1376
|
};
|
|
1377
1377
|
const message = await this.#sendMedia(chatId, {
|
|
1378
1378
|
_: "inputMediaInvoice",
|
|
@@ -1441,8 +1441,8 @@ class MessageManager {
|
|
|
1441
1441
|
multiMedia[i] = { ...media_, media: { _: "inputMediaDocument", id: { ...document, _: "inputDocument" } } };
|
|
1442
1442
|
}
|
|
1443
1443
|
}
|
|
1444
|
-
const silent = params?.
|
|
1445
|
-
const noforwards = params?.
|
|
1444
|
+
const silent = params?.isSilent ? true : undefined;
|
|
1445
|
+
const noforwards = params?.isContentProtected ? true : undefined;
|
|
1446
1446
|
const sendAs = params?.sendAs ? await this.#c.getInputPeer(params.sendAs) : undefined;
|
|
1447
1447
|
const result = await this.#c.invoke({
|
|
1448
1448
|
_: "messages.sendMultiMedia",
|
|
@@ -1500,7 +1500,7 @@ class MessageManager {
|
|
|
1500
1500
|
return null;
|
|
1501
1501
|
}
|
|
1502
1502
|
const voiceTranscription = await this.#c.messageStorage.getVoiceTranscription(reference);
|
|
1503
|
-
if (!voiceTranscription || !voiceTranscription.
|
|
1503
|
+
if (!voiceTranscription || !voiceTranscription.isCompleted) {
|
|
1504
1504
|
return null;
|
|
1505
1505
|
}
|
|
1506
1506
|
return voiceTranscription;
|
|
@@ -1631,8 +1631,8 @@ class MessageManager {
|
|
|
1631
1631
|
}
|
|
1632
1632
|
async openMiniApp(botId, chatId, params) {
|
|
1633
1633
|
this.#c.storage.assertUser("openMiniApp");
|
|
1634
|
-
const from_bot_menu = params?.
|
|
1635
|
-
const silent = params?.
|
|
1634
|
+
const from_bot_menu = params?.isFromMenu ? true : undefined;
|
|
1635
|
+
const silent = params?.isSilent ? true : undefined;
|
|
1636
1636
|
const compact = params?.mode === "compact" ? true : undefined;
|
|
1637
1637
|
const fullscreen = params?.mode === "fullscreen" ? true : undefined;
|
|
1638
1638
|
const peer = await this.#c.getInputPeer(chatId);
|
|
@@ -51,11 +51,11 @@ class VideoChatManager {
|
|
|
51
51
|
}
|
|
52
52
|
async startVideoChat(chatId, params) {
|
|
53
53
|
this.#c.storage.assertUser("startVideoChat");
|
|
54
|
-
return await this.#createGroupCall(chatId, params?.title, params?.
|
|
54
|
+
return await this.#createGroupCall(chatId, params?.title, params?.isLiveStream || undefined);
|
|
55
55
|
}
|
|
56
56
|
async scheduleVideoChat(chatId, startAt, params) {
|
|
57
57
|
this.#c.storage.assertUser("scheduleVideoChat");
|
|
58
|
-
return await this.#createGroupCall(chatId, params?.title, params?.
|
|
58
|
+
return await this.#createGroupCall(chatId, params?.title, params?.isLiveStream || undefined, startAt);
|
|
59
59
|
}
|
|
60
60
|
async #getInputGroupCall(id_) {
|
|
61
61
|
const id = BigInt(id_);
|
|
@@ -68,7 +68,7 @@ class VideoChatManager {
|
|
|
68
68
|
async joinVideoChat(id, params, params_) {
|
|
69
69
|
this.#c.storage.assertUser("joinVideoChat");
|
|
70
70
|
const call = await this.#getInputGroupCall(id);
|
|
71
|
-
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_?.
|
|
71
|
+
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) => _2_tl_js_1.Api.as("updates", v));
|
|
72
72
|
const updateGroupCall = updates
|
|
73
73
|
.find((v) => _2_tl_js_1.Api.is("updateGroupCallConnection", v));
|
|
74
74
|
if (!updateGroupCall)
|
|
@@ -38,7 +38,7 @@ class CallbackQueryManager {
|
|
|
38
38
|
async answerCallbackQuery(id, params) {
|
|
39
39
|
this.#c.storage.assertBot("answerCallbackQuery");
|
|
40
40
|
(0, _0_utilities_js_1.checkCallbackQueryId)(id);
|
|
41
|
-
await this.#c.invoke({ _: "messages.setBotCallbackAnswer", query_id: BigInt(id), cache_time: params?.cacheTime ?? 0, message: params?.text, alert: params?.
|
|
41
|
+
await this.#c.invoke({ _: "messages.setBotCallbackAnswer", query_id: BigInt(id), cache_time: params?.cacheTime ?? 0, message: params?.text, alert: params?.isAlert ? true : undefined });
|
|
42
42
|
}
|
|
43
43
|
async sendCallbackQuery(botId, messageId, question) {
|
|
44
44
|
this.#c.storage.assertUser("sendCallbackQuery");
|
|
@@ -256,7 +256,7 @@ class ChatListManager {
|
|
|
256
256
|
_: "channels.createChannel",
|
|
257
257
|
broadcast: type === "channel" ? true : undefined,
|
|
258
258
|
megagroup: type === "supergroup" ? true : undefined,
|
|
259
|
-
forum: params && ("
|
|
259
|
+
forum: params && ("isForum" in params) && params.isForum ? true : undefined,
|
|
260
260
|
title,
|
|
261
261
|
about: params?.description || "",
|
|
262
262
|
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;;;;;;;;;;;;;;;;;;GA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AAE,EAAE;IAU1B,gBAAgB,CAAC,MAAM,EAAE,EAAE,EAAE,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"}
|
|
@@ -59,9 +59,9 @@ class ChatManager {
|
|
|
59
59
|
return null;
|
|
60
60
|
}
|
|
61
61
|
// JOIN REQUESTS //
|
|
62
|
-
async #toggleJoinRequests(chatId,
|
|
62
|
+
async #toggleJoinRequests(chatId, isEnabled) {
|
|
63
63
|
const channel = await this.#c.getInputChannel(chatId);
|
|
64
|
-
await this.#c.invoke({ _: "channels.toggleJoinRequest", channel, enabled });
|
|
64
|
+
await this.#c.invoke({ _: "channels.toggleJoinRequest", channel, enabled: isEnabled });
|
|
65
65
|
}
|
|
66
66
|
async approveJoinRequest(chatId, userId) {
|
|
67
67
|
await this.#c.invoke({
|
|
@@ -117,15 +117,15 @@ class ChatManager {
|
|
|
117
117
|
}
|
|
118
118
|
// INVITE LINKS //
|
|
119
119
|
async createInviteLink(chatId, params) {
|
|
120
|
-
if (params?.
|
|
121
|
-
throw new _0_errors_js_1.InputError("
|
|
120
|
+
if (params?.isApprovalRequired && params?.limit) {
|
|
121
|
+
throw new _0_errors_js_1.InputError("isApprovalRequired cannot be true while limit is specified.");
|
|
122
122
|
}
|
|
123
|
-
const result = await this.#c.invoke({ _: "messages.exportChatInvite", peer: await this.#c.getInputPeer(chatId), title: params?.title, expire_date: params?.expireAt, request_needed: params?.
|
|
123
|
+
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 });
|
|
124
124
|
return (0, _3_types_js_1.constructInviteLink)(_2_tl_js_1.Api.as("chatInviteExported", result), this.#c.getPeer);
|
|
125
125
|
}
|
|
126
126
|
async getCreatedInviteLinks(chatId, params) {
|
|
127
127
|
this.#c.storage.assertUser("getCreatedInviteLinks");
|
|
128
|
-
const { invites } = await this.#c.invoke({ _: "messages.getExportedChatInvites", peer: await this.#c.getInputPeer(chatId), revoked: params?.
|
|
128
|
+
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: (0, _0_utilities_js_1.getLimit)(params?.limit), offset_date: params?.afterDate, offset_link: params?.afterInviteLink });
|
|
129
129
|
return await Promise.all(invites.map((v) => _2_tl_js_1.Api.as("chatInviteExported", v)).map((v) => (0, _3_types_js_1.constructInviteLink)(v, this.#c.getPeer)));
|
|
130
130
|
}
|
|
131
131
|
// JOINING AND LEAVING CHATS //
|
|
@@ -336,26 +336,54 @@ class ChatManager {
|
|
|
336
336
|
}
|
|
337
337
|
await this.#c.invoke({ _: "messages.editChatAbout", peer, about: description });
|
|
338
338
|
}
|
|
339
|
-
async
|
|
340
|
-
this.#c.storage.assertUser("setMemberListVisible");
|
|
339
|
+
async #setIsMemberListVisible(chatId, isVisible) {
|
|
341
340
|
const channel = await this.#c.getInputChannel(chatId);
|
|
342
|
-
const enabled = !
|
|
341
|
+
const enabled = !isVisible;
|
|
343
342
|
await this.#c.invoke({ _: "channels.toggleParticipantsHidden", channel, enabled });
|
|
344
343
|
}
|
|
345
|
-
async
|
|
346
|
-
this.#c.storage.assertUser("
|
|
344
|
+
async hideMemberList(chatId) {
|
|
345
|
+
this.#c.storage.assertUser("hideMemberList");
|
|
346
|
+
await this.#setIsMemberListVisible(chatId, false);
|
|
347
|
+
}
|
|
348
|
+
async showMemberList(chatId) {
|
|
349
|
+
this.#c.storage.assertUser("showMemberList");
|
|
350
|
+
await this.#setIsMemberListVisible(chatId, true);
|
|
351
|
+
}
|
|
352
|
+
async #setIsTopicsEnabled(chatId, isEnabled, isShownAsTabs) {
|
|
347
353
|
const channel = await this.#c.getInputChannel(chatId);
|
|
348
|
-
await this.#c.invoke({ _: "channels.toggleForum", channel, enabled, tabs });
|
|
354
|
+
await this.#c.invoke({ _: "channels.toggleForum", channel, enabled: isEnabled, tabs: isShownAsTabs });
|
|
355
|
+
}
|
|
356
|
+
async disableTopics(chatId) {
|
|
357
|
+
this.#c.storage.assertUser("disableTopics");
|
|
358
|
+
await this.#setIsTopicsEnabled(chatId, false, false);
|
|
349
359
|
}
|
|
350
|
-
async
|
|
351
|
-
this.#c.storage.assertUser("
|
|
360
|
+
async enableTopics(chatId, isShownAsTabs) {
|
|
361
|
+
this.#c.storage.assertUser("enableTopics");
|
|
362
|
+
await this.#setIsTopicsEnabled(chatId, true, isShownAsTabs);
|
|
363
|
+
}
|
|
364
|
+
async #setIsAntispamEnabled(chatId, isEnabled) {
|
|
352
365
|
const channel = await this.#c.getInputChannel(chatId);
|
|
353
|
-
await this.#c.invoke({ _: "channels.toggleAntiSpam", channel, enabled });
|
|
366
|
+
await this.#c.invoke({ _: "channels.toggleAntiSpam", channel, enabled: isEnabled });
|
|
367
|
+
}
|
|
368
|
+
async enableAntispam(chatId) {
|
|
369
|
+
this.#c.storage.assertUser("enableAntispam");
|
|
370
|
+
await this.#setIsAntispamEnabled(chatId, true);
|
|
371
|
+
}
|
|
372
|
+
async disableAntispam(chatId) {
|
|
373
|
+
this.#c.storage.assertUser("disableAntispam");
|
|
374
|
+
await this.#setIsAntispamEnabled(chatId, false);
|
|
354
375
|
}
|
|
355
|
-
async
|
|
356
|
-
this.#c.storage.assertUser("setSignaturesEnabled");
|
|
376
|
+
async #setIsSignaturesEnabled(chatId, isEnabled, params) {
|
|
357
377
|
const channel = await this.#c.getInputChannel(chatId);
|
|
358
|
-
await this.#c.invoke({ _: "channels.toggleSignatures", channel, signatures_enabled:
|
|
378
|
+
await this.#c.invoke({ _: "channels.toggleSignatures", channel, signatures_enabled: isEnabled ? true : undefined, profiles_enabled: params?.showAuthorProfile ? true : undefined });
|
|
379
|
+
}
|
|
380
|
+
async enableSignatures(chatId, params) {
|
|
381
|
+
this.#c.storage.assertUser("enableSignatures");
|
|
382
|
+
await this.#setIsSignaturesEnabled(chatId, true, params);
|
|
383
|
+
}
|
|
384
|
+
async disableSignatures(chatId) {
|
|
385
|
+
this.#c.storage.assertUser("disableSignatures");
|
|
386
|
+
await this.#setIsSignaturesEnabled(chatId, false);
|
|
359
387
|
}
|
|
360
388
|
async deleteChat(chatId) {
|
|
361
389
|
this.#c.storage.assertUser("deleteChat");
|
|
@@ -421,5 +449,17 @@ class ChatManager {
|
|
|
421
449
|
const rank = params?.tag ?? "";
|
|
422
450
|
await this.#c.invoke({ _: "messages.editChatParticipantRank", peer, participant, rank });
|
|
423
451
|
}
|
|
452
|
+
async #setIsSharingEnabled(chatId, isSharingEnabled) {
|
|
453
|
+
const peer = await this.#c.getInputPeer(chatId);
|
|
454
|
+
await this.#c.invoke({ _: "messages.toggleNoForwards", peer, enabled: !isSharingEnabled });
|
|
455
|
+
}
|
|
456
|
+
async enableSharing(chatId) {
|
|
457
|
+
this.#c.storage.assertUser("enableSharing");
|
|
458
|
+
await this.#setIsSharingEnabled(chatId, true);
|
|
459
|
+
}
|
|
460
|
+
async disableSharing(chatId) {
|
|
461
|
+
this.#c.storage.assertUser("disableSharing");
|
|
462
|
+
await this.#setIsSharingEnabled(chatId, false);
|
|
463
|
+
}
|
|
424
464
|
}
|
|
425
465
|
exports.ChatManager = ChatManager;
|
|
@@ -46,7 +46,7 @@ class GiftManager {
|
|
|
46
46
|
return (0, _3_types_js_1.constructClaimedGifts)(result, this.#c.getPeer);
|
|
47
47
|
}
|
|
48
48
|
async sendGift(chatId, giftId, params) {
|
|
49
|
-
const hide_name = params?.
|
|
49
|
+
const hide_name = params?.isPrivate ? true : undefined;
|
|
50
50
|
const include_upgrade = params?.upgrade ? true : undefined;
|
|
51
51
|
const peer = await this.#c.getInputPeer(chatId);
|
|
52
52
|
const gift_id = BigInt(giftId);
|
|
@@ -84,7 +84,7 @@ class StoryManager {
|
|
|
84
84
|
mediaAreas.push(await (0, _3_types_js_1.storyInteractiveAreaToTlObject)(area, this.#c.getPeer));
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
|
-
const updates = await this.#c.invoke({ _: "stories.sendStory", peer, random_id: randomId, media, privacy_rules: privacyRules, caption, entities, noforwards: params?.
|
|
87
|
+
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 });
|
|
88
88
|
return await this.#updatesToStory(updates);
|
|
89
89
|
}
|
|
90
90
|
async getStories(chatId, storyIds) {
|
|
@@ -23,7 +23,7 @@ import { type DC } from "../3_transport.js";
|
|
|
23
23
|
import { type BotCommand, type BotTokenCheckResult, type BusinessConnection, type CallbackQueryAnswer, type CallbackQueryQuestion, type Chat, type ChatAction, type ChatListItem, type ChatMember, type ChatP, type ChatPChannel, type ChatPGroup, type ChatPSupergroup, type ChatSettings, type ClaimedGifts, type FailedInvitation, type FileSource, type Gift, type ID, type InactiveChat, type InlineQueryAnswer, type InlineQueryResult, type InputGift, type InputMedia, type InputStoryContent, type InviteLink, type JoinRequest, type LinkPreview, type LiveStreamChannel, type Message, type MessageAnimation, type MessageAudio, type MessageContact, type MessageDice, type MessageDocument, type MessageInvoice, type MessageList, type MessageLocation, type MessagePhoto, type MessagePoll, type MessageReactionList, type MessageSticker, type MessageText, type MessageVenue, type MessageVideo, type MessageVideoNote, type MessageVoice, type MiniAppInfo, type NetworkStatistics, type ParseMode, type PasswordCheckResult, type Poll, type PriceTag, type Reaction, type SavedChats, type SlowModeDuration, type Sticker, type StickerSet, type Story, type Topic, type Translation, type User, type VideoChat, type VideoChatActive, type VideoChatScheduled, type VoiceTranscription } from "../3_types.js";
|
|
24
24
|
import { Migrate } from "../4_errors.js";
|
|
25
25
|
import type { CodeCheckResult } from "../types/0_code_check_result.js";
|
|
26
|
-
import type { AddChatMemberParams, AddContactParams, AddReactionParams, AnswerCallbackQueryParams, AnswerInlineQueryParams, AnswerPreCheckoutQueryParams, ApproveJoinRequestsParams, BanChatMemberParams, CheckUsernameParams, CreateChannelParams, CreateGroupParams, CreateInviteLinkParams, CreateStoryParams, CreateSupergroupParams, CreateTopicParams, DeclineJoinRequestsParams, DeleteMessageParams, DeleteMessagesParams, DownloadLiveStreamSegmentParams, DownloadParams, EditInlineMessageCaptionParams, EditInlineMessageMediaParams, EditInlineMessageTextParams, EditMessageCaptionParams, EditMessageLiveLocationParams, EditMessageMediaParams, EditMessageReplyMarkupParams, EditMessageTextParams, EditTopicParams, ForwardMessagesParams, GetChatMembersParams, GetChatsParams, GetClaimedGiftsParams, GetCommonChatsParams, GetCreatedInviteLinksParams, GetHistoryParams, GetJoinRequestsParams, GetLinkPreviewParams, GetMessageReactionsParams, GetMyCommandsParams, GetSavedChatsParams, GetSavedMessagesParams, GetTranslationsParams, InvokeParams, JoinVideoChatParams, OpenChatParams, OpenMiniAppParams, PinMessageParams, PromoteChatMemberParams, ScheduleVideoChatParams, SearchMessagesParams, SendAnimationParams, SendAudioParams, SendContactParams, SendDiceParams, SendDocumentParams, SendGiftParams, SendInlineQueryParams, SendInvoiceParams, SendLocationParams, SendMediaGroupParams, SendMessageDraftParams, SendMessageParams, SendPhotoParams, SendPollParams, SendStickerParams, SendVenueParams, SendVideoNoteParams, SendVideoParams, SendVoiceParams, SetBirthdayParams, SetChatMemberRightsParams, SetChatMemberTagParams, SetChatPhotoParams, SetEmojiStatusParams, SetLocationParams, SetMyCommandsParams, SetNameColorParams, SetPersonalChannelParams, SetProfileColorParams, SetReactionsParams,
|
|
26
|
+
import type { AddChatMemberParams, AddContactParams, AddReactionParams, AnswerCallbackQueryParams, AnswerInlineQueryParams, AnswerPreCheckoutQueryParams, ApproveJoinRequestsParams, BanChatMemberParams, CheckUsernameParams, CreateChannelParams, CreateGroupParams, CreateInviteLinkParams, CreateStoryParams, CreateSupergroupParams, CreateTopicParams, DeclineJoinRequestsParams, DeleteMessageParams, DeleteMessagesParams, DownloadLiveStreamSegmentParams, DownloadParams, EditInlineMessageCaptionParams, EditInlineMessageMediaParams, EditInlineMessageTextParams, EditMessageCaptionParams, EditMessageLiveLocationParams, EditMessageMediaParams, EditMessageReplyMarkupParams, EditMessageTextParams, EditTopicParams, EnableSignaturesParams, ForwardMessagesParams, GetChatMembersParams, GetChatsParams, GetClaimedGiftsParams, GetCommonChatsParams, GetCreatedInviteLinksParams, GetHistoryParams, GetJoinRequestsParams, GetLinkPreviewParams, GetMessageReactionsParams, GetMyCommandsParams, GetSavedChatsParams, GetSavedMessagesParams, GetTranslationsParams, InvokeParams, JoinVideoChatParams, OpenChatParams, OpenMiniAppParams, PinMessageParams, PromoteChatMemberParams, ScheduleVideoChatParams, SearchMessagesParams, SendAnimationParams, SendAudioParams, SendContactParams, SendDiceParams, SendDocumentParams, SendGiftParams, SendInlineQueryParams, SendInvoiceParams, SendLocationParams, SendMediaGroupParams, SendMessageDraftParams, SendMessageParams, SendPhotoParams, SendPollParams, SendStickerParams, SendVenueParams, SendVideoNoteParams, SendVideoParams, SendVoiceParams, SetBirthdayParams, SetChatMemberRightsParams, SetChatMemberTagParams, SetChatPhotoParams, SetEmojiStatusParams, SetLocationParams, SetMyCommandsParams, SetNameColorParams, SetPersonalChannelParams, SetProfileColorParams, SetReactionsParams, SetWorkingHoursParams, SignInParams, StartBotParams, StartVideoChatParams, StopPollParams, UnpinMessageParams, UpdateProfileParams } from "./0_params.js";
|
|
27
27
|
import { StorageOperations } from "./0_storage_operations.js";
|
|
28
28
|
import type { ClientGeneric } from "./1_client_generic.js";
|
|
29
29
|
import type { ClientPlainParams } from "./1_client_plain.js";
|
|
@@ -102,8 +102,8 @@ export declare class Client<C extends Context = Context> extends Composer<C> imp
|
|
|
102
102
|
* Constructs the client.
|
|
103
103
|
*/
|
|
104
104
|
constructor(params?: ClientParams);
|
|
105
|
-
get
|
|
106
|
-
get
|
|
105
|
+
get isConnected(): boolean;
|
|
106
|
+
get isDisconnected(): boolean;
|
|
107
107
|
/**
|
|
108
108
|
* Loads the session if `setDc` was not called, initializes and connnects
|
|
109
109
|
* a `ClientPlain` to generate auth key if there was none, and connects the client.
|
|
@@ -347,6 +347,18 @@ export declare class Client<C extends Context = Context> extends Composer<C> imp
|
|
|
347
347
|
* @method ac
|
|
348
348
|
*/
|
|
349
349
|
disableSponsoredMessages(): Promise<void>;
|
|
350
|
+
/**
|
|
351
|
+
* Pause the business bot in a chat. User-only.
|
|
352
|
+
*
|
|
353
|
+
* @method ac
|
|
354
|
+
*/
|
|
355
|
+
pauseBusinessBotConnection(chatId: ID): Promise<void>;
|
|
356
|
+
/**
|
|
357
|
+
* Resume the business bot in a chat. User-only.
|
|
358
|
+
*
|
|
359
|
+
* @method ac
|
|
360
|
+
*/
|
|
361
|
+
resumeBusinessBotConnection(chatId: ID): Promise<void>;
|
|
350
362
|
/**
|
|
351
363
|
* Send a text message.
|
|
352
364
|
*
|
|
@@ -1251,38 +1263,62 @@ export declare class Client<C extends Context = Context> extends Composer<C> imp
|
|
|
1251
1263
|
*/
|
|
1252
1264
|
setChatDescription(chatId: ID, description: string): Promise<void>;
|
|
1253
1265
|
/**
|
|
1254
|
-
* Hide
|
|
1266
|
+
* Hide the member list of a group to non-admins. User-only.
|
|
1267
|
+
*
|
|
1268
|
+
* @method ch
|
|
1269
|
+
* @param chatId The identifier of the group.
|
|
1270
|
+
*/
|
|
1271
|
+
hideMemberList(chatId: ID): Promise<void>;
|
|
1272
|
+
/**
|
|
1273
|
+
* Show the member list of a group to non-admins. User-only.
|
|
1274
|
+
*
|
|
1275
|
+
* @method ch
|
|
1276
|
+
* @param chatId The identifier of the group.
|
|
1277
|
+
*/
|
|
1278
|
+
showMemberList(chatId: ID): Promise<void>;
|
|
1279
|
+
/**
|
|
1280
|
+
* Enable topics in a group. User-only.
|
|
1281
|
+
*
|
|
1282
|
+
* @method ch
|
|
1283
|
+
* @param chatId The identifier of the group.
|
|
1284
|
+
* @param isShownAsTabs Whether topics should be displayed as tabs.
|
|
1285
|
+
*/
|
|
1286
|
+
enableTopics(chatId: ID, isShownAsTabs: boolean): Promise<void>;
|
|
1287
|
+
/**
|
|
1288
|
+
* Disable topics in a group. User-only.
|
|
1255
1289
|
*
|
|
1256
1290
|
* @method ch
|
|
1257
1291
|
* @param chatId The identifier of the group.
|
|
1258
|
-
* @param visible Whether the member list of the group should be visible.
|
|
1259
1292
|
*/
|
|
1260
|
-
|
|
1293
|
+
disableTopics(chatId: ID): Promise<void>;
|
|
1261
1294
|
/**
|
|
1262
|
-
* Enable
|
|
1295
|
+
* Enable automatic anti-spam in a group. User-only.
|
|
1263
1296
|
*
|
|
1264
1297
|
* @method ch
|
|
1265
1298
|
* @param chatId The identifier of the group.
|
|
1266
|
-
* @param enabled Whether topics should be enabled in the group.
|
|
1267
|
-
* @param tabs Whether topics should be displayed as tabs.
|
|
1268
1299
|
*/
|
|
1269
|
-
|
|
1300
|
+
enableAntispam(chatId: ID): Promise<void>;
|
|
1270
1301
|
/**
|
|
1271
|
-
*
|
|
1302
|
+
* Disable automatic anti-spam in a group. User-only.
|
|
1272
1303
|
*
|
|
1273
1304
|
* @method ch
|
|
1274
1305
|
* @param chatId The identifier of the group.
|
|
1275
|
-
* @param enabled Whether automatic anti-spam should be enabled in the group.
|
|
1276
1306
|
*/
|
|
1277
|
-
|
|
1307
|
+
disableAntispam(chatId: ID): Promise<void>;
|
|
1308
|
+
/**
|
|
1309
|
+
* Enable post signatures in a channel. User-only.
|
|
1310
|
+
*
|
|
1311
|
+
* @method ch
|
|
1312
|
+
* @param chatId The identifier of the channel.
|
|
1313
|
+
*/
|
|
1314
|
+
enableSignatures(chatId: ID, params?: EnableSignaturesParams): Promise<void>;
|
|
1278
1315
|
/**
|
|
1279
|
-
*
|
|
1316
|
+
* Disable post signatures in a channel. User-only.
|
|
1280
1317
|
*
|
|
1281
1318
|
* @method ch
|
|
1282
1319
|
* @param chatId The identifier of the channel.
|
|
1283
|
-
* @param enabled Whether post signatures should be enabled in the channel.
|
|
1284
1320
|
*/
|
|
1285
|
-
|
|
1321
|
+
disableSignatures(chatId: ID): Promise<void>;
|
|
1286
1322
|
/**
|
|
1287
1323
|
* Delete a chat. User-only.
|
|
1288
1324
|
*
|
|
@@ -1394,6 +1430,20 @@ export declare class Client<C extends Context = Context> extends Composer<C> imp
|
|
|
1394
1430
|
* @param userId The identifier of the user that is a member of the chat.
|
|
1395
1431
|
*/
|
|
1396
1432
|
setChatMemberTag(chatId: ID, userId: ID, params?: SetChatMemberTagParams): Promise<void>;
|
|
1433
|
+
/**
|
|
1434
|
+
* Enable sharing in a chat. User-only.
|
|
1435
|
+
*
|
|
1436
|
+
* @method ch
|
|
1437
|
+
* @param chatId The identifier of a chat.
|
|
1438
|
+
*/
|
|
1439
|
+
enableSharing(chatId: ID): Promise<void>;
|
|
1440
|
+
/**
|
|
1441
|
+
* Disable sharing in a chat. User-only.
|
|
1442
|
+
*
|
|
1443
|
+
* @method ch
|
|
1444
|
+
* @param chatId The identifier of a chat.
|
|
1445
|
+
*/
|
|
1446
|
+
disableSharing(chatId: ID): Promise<void>;
|
|
1397
1447
|
/**
|
|
1398
1448
|
* Send a callback query. User-only.
|
|
1399
1449
|
*
|