@mtkruto/node 0.69.0 → 0.70.1
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/0_deps.d.ts +3 -1
- package/esm/0_deps.d.ts.map +1 -1
- package/esm/0_deps.js +3 -1
- package/esm/3_types.d.ts +35 -35
- package/esm/3_types.d.ts.map +1 -1
- package/esm/3_types.js +35 -35
- package/esm/_dnt.polyfills.d.ts +20 -13
- package/esm/_dnt.polyfills.d.ts.map +1 -1
- package/esm/_dnt.polyfills.js +120 -11
- package/esm/client/0_abortable_loop.d.ts +27 -0
- package/esm/client/0_abortable_loop.d.ts.map +1 -0
- package/esm/client/0_abortable_loop.js +49 -0
- package/esm/client/0_client_abstract.d.ts +1 -0
- package/esm/client/0_client_abstract.d.ts.map +1 -1
- package/esm/client/0_client_abstract.js +3 -0
- package/esm/client/0_filters.d.ts +9 -3
- package/esm/client/0_filters.d.ts.map +1 -1
- package/esm/client/0_filters.js +4 -1
- package/esm/client/0_params.d.ts +1 -1
- package/esm/client/0_password.d.ts +2 -2
- package/esm/client/0_password.d.ts.map +1 -1
- package/esm/client/0_storage_operations.d.ts +53 -71
- package/esm/client/0_storage_operations.d.ts.map +1 -1
- package/esm/client/0_storage_operations.js +241 -238
- package/esm/client/0_update_processor.d.ts +2 -2
- package/esm/client/0_update_processor.d.ts.map +1 -1
- package/esm/client/0_utilities.d.ts +2 -2
- package/esm/client/0_utilities.d.ts.map +1 -1
- package/esm/client/1_types.d.ts +2 -2
- package/esm/client/1_types.d.ts.map +1 -1
- package/esm/client/2_account_manager.js +5 -5
- package/esm/client/2_business_connection_manager.d.ts +1 -1
- package/esm/client/2_business_connection_manager.d.ts.map +1 -1
- package/esm/client/2_business_connection_manager.js +3 -3
- package/esm/client/2_client_encrypted.d.ts +1 -1
- package/esm/client/2_client_encrypted.d.ts.map +1 -1
- package/esm/client/2_client_encrypted.js +26 -23
- package/esm/client/2_file_manager.js +2 -2
- package/esm/client/2_network_statistics_manager.d.ts +2 -2
- package/esm/client/2_network_statistics_manager.d.ts.map +1 -1
- package/esm/client/2_network_statistics_manager.js +30 -4
- package/esm/client/2_payment_manager.d.ts +1 -1
- package/esm/client/2_payment_manager.d.ts.map +1 -1
- package/esm/client/2_payment_manager.js +2 -2
- package/esm/client/2_reaction_manager.d.ts +1 -1
- package/esm/client/2_reaction_manager.d.ts.map +1 -1
- package/esm/client/2_reaction_manager.js +2 -2
- package/esm/client/2_translations_manager.d.ts +1 -1
- package/esm/client/2_translations_manager.d.ts.map +1 -1
- package/esm/client/2_translations_manager.js +15 -11
- package/esm/client/2_update_manager.d.ts +4 -2
- package/esm/client/2_update_manager.d.ts.map +1 -1
- package/esm/client/2_update_manager.js +62 -80
- package/esm/client/3_message_manager.d.ts +2 -2
- package/esm/client/3_message_manager.d.ts.map +1 -1
- package/esm/client/3_message_manager.js +5 -5
- package/esm/client/3_video_chat_manager.d.ts +1 -1
- package/esm/client/3_video_chat_manager.d.ts.map +1 -1
- package/esm/client/4_callback_query_manager.d.ts +1 -1
- package/esm/client/4_callback_query_manager.d.ts.map +1 -1
- package/esm/client/4_callback_query_manager.js +1 -1
- package/esm/client/4_chat_list_manager.d.ts +2 -3
- package/esm/client/4_chat_list_manager.d.ts.map +1 -1
- package/esm/client/4_chat_list_manager.js +10 -265
- package/esm/client/4_chat_manager.d.ts +2 -2
- package/esm/client/4_chat_manager.d.ts.map +1 -1
- package/esm/client/4_chat_manager.js +7 -7
- package/esm/client/4_gift_manager.js +3 -3
- package/esm/client/4_inline_query_manager.d.ts +1 -1
- package/esm/client/4_inline_query_manager.d.ts.map +1 -1
- package/esm/client/4_inline_query_manager.js +3 -3
- package/esm/client/4_link_preview_manager.d.ts +1 -1
- package/esm/client/4_link_preview_manager.d.ts.map +1 -1
- package/esm/client/4_link_preview_manager.js +3 -3
- package/esm/client/4_poll_manager.d.ts +1 -1
- package/esm/client/4_poll_manager.d.ts.map +1 -1
- package/esm/client/4_poll_manager.js +1 -1
- package/esm/client/4_story_manager.d.ts +1 -1
- package/esm/client/4_story_manager.d.ts.map +1 -1
- package/esm/client/4_story_manager.js +7 -7
- package/esm/client/5_client.d.ts +15 -9
- package/esm/client/5_client.d.ts.map +1 -1
- package/esm/client/5_client.js +420 -382
- package/esm/deps/jsr.io/@std/cache/0.2.0/_serialize_arg_list.d.ts +12 -0
- package/esm/deps/jsr.io/@std/cache/0.2.0/_serialize_arg_list.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/cache/0.2.0/_serialize_arg_list.js +69 -0
- package/esm/deps/jsr.io/@std/cache/0.2.0/lru_cache.d.ts +112 -0
- package/esm/deps/jsr.io/@std/cache/0.2.0/lru_cache.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/cache/0.2.0/lru_cache.js +140 -0
- package/esm/deps/jsr.io/@std/cache/0.2.0/memoize.d.ts +111 -0
- package/esm/deps/jsr.io/@std/cache/0.2.0/memoize.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/cache/0.2.0/memoize.js +82 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.7/hex.d.ts +39 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.7/hex.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.7/hex.js +109 -0
- package/esm/session/1_session.d.ts +1 -0
- package/esm/session/1_session.d.ts.map +1 -1
- package/esm/session/1_session.js +3 -0
- package/esm/session/2_session_encrypted.d.ts +2 -2
- package/esm/session/2_session_encrypted.d.ts.map +1 -1
- package/esm/session/2_session_encrypted.js +198 -135
- package/esm/storage/0_storage.d.ts +1 -0
- package/esm/storage/0_storage.d.ts.map +1 -1
- package/esm/storage/2_storage_indexed_db.d.ts +1 -0
- package/esm/storage/2_storage_indexed_db.d.ts.map +1 -1
- package/esm/storage/2_storage_indexed_db.js +3 -0
- package/esm/storage/2_storage_local_storage.node.d.ts +1 -0
- package/esm/storage/2_storage_local_storage.node.d.ts.map +1 -1
- package/esm/storage/2_storage_local_storage.node.js +3 -0
- package/esm/storage/2_storage_memory.d.ts +1 -0
- package/esm/storage/2_storage_memory.d.ts.map +1 -1
- package/esm/storage/2_storage_memory.js +3 -0
- package/esm/storage/2_storage_session_storage.d.ts +1 -0
- package/esm/storage/2_storage_session_storage.d.ts.map +1 -1
- package/esm/storage/2_storage_session_storage.js +3 -0
- package/esm/tl/0_utilities.d.ts +1 -0
- package/esm/tl/0_utilities.d.ts.map +1 -1
- package/esm/tl/0_utilities.js +20 -1
- package/esm/tl/1_telegram_api.d.ts +810 -254
- package/esm/tl/1_telegram_api.d.ts.map +1 -1
- package/esm/tl/1_telegram_api.js +912 -213
- package/esm/tl/1_tl_reader.d.ts +2 -2
- package/esm/tl/1_tl_reader.d.ts.map +1 -1
- package/esm/tl/1_tl_writer.d.ts +2 -2
- package/esm/tl/1_tl_writer.d.ts.map +1 -1
- package/esm/tl/2_mtproto.d.ts +1 -1
- package/esm/tl/2_mtproto.d.ts.map +1 -1
- package/esm/tl/2_telegram.d.ts +1 -1
- package/esm/tl/2_telegram.d.ts.map +1 -1
- package/esm/types/0_file_source.d.ts +1 -1
- package/esm/types/0_file_source.d.ts.map +1 -1
- package/esm/types/1_chat_p.d.ts +10 -0
- package/esm/types/1_chat_p.d.ts.map +1 -1
- package/esm/types/1_chat_p.js +4 -0
- package/esm/types/2_chat.d.ts +2 -5
- package/esm/types/2_chat.d.ts.map +1 -1
- package/esm/types/2_chat.js +10 -15
- package/esm/types/{0_message_entity.d.ts → 2_message_entity.d.ts} +3 -3
- package/esm/types/{0_message_entity.d.ts.map → 2_message_entity.d.ts.map} +1 -1
- package/esm/types/{0_message_entity.js → 2_message_entity.js} +7 -7
- package/esm/types/2_message_reaction_count.d.ts +2 -3
- package/esm/types/2_message_reaction_count.d.ts.map +1 -1
- package/esm/types/2_message_reaction_count.js +4 -6
- package/esm/types/2_poll_answer.d.ts +2 -3
- package/esm/types/2_poll_answer.d.ts.map +1 -1
- package/esm/types/2_poll_answer.js +4 -5
- package/esm/types/2_story_interactive_area.d.ts +2 -2
- package/esm/types/2_story_interactive_area.d.ts.map +1 -1
- package/esm/types/2_story_interactive_area.js +2 -2
- package/esm/types/{1_story_privacy.d.ts → 2_story_privacy.d.ts} +3 -3
- package/esm/types/{1_story_privacy.d.ts.map → 2_story_privacy.d.ts.map} +1 -1
- package/esm/types/{1_story_privacy.js → 2_story_privacy.js} +10 -10
- package/{script/types/1_user.d.ts → esm/types/2_user.d.ts} +5 -1
- package/esm/types/2_user.d.ts.map +1 -0
- package/esm/types/{1_user.js → 2_user.js} +24 -0
- package/esm/types/{2_business_connection.d.ts → 3_business_connection.d.ts} +4 -4
- package/esm/types/3_business_connection.d.ts.map +1 -0
- package/esm/types/{2_business_connection.js → 3_business_connection.js} +10 -3
- package/{script/types/2_chat_member.d.ts → esm/types/3_chat_member.d.ts} +6 -4
- package/esm/types/{2_chat_member.d.ts.map → 3_chat_member.d.ts.map} +1 -1
- package/esm/types/{2_chat_member.js → 3_chat_member.js} +5 -5
- package/esm/types/{2_chat_settings.d.ts → 3_chat_settings.d.ts} +2 -2
- package/{script/types/2_chat_settings.d.ts.map → esm/types/3_chat_settings.d.ts.map} +1 -1
- package/esm/types/{2_chat_settings.js → 3_chat_settings.js} +1 -1
- package/esm/types/{2_chosen_inline_result.d.ts → 3_chosen_inline_result.d.ts} +4 -4
- package/esm/types/3_chosen_inline_result.d.ts.map +1 -0
- package/esm/types/{2_chosen_inline_result.js → 3_chosen_inline_result.js} +3 -3
- package/esm/types/{2_forward_header.d.ts → 3_forward_header.d.ts} +4 -5
- package/esm/types/3_forward_header.d.ts.map +1 -0
- package/esm/types/{2_forward_header.js → 3_forward_header.js} +11 -12
- package/{script/types/2_game.d.ts → esm/types/3_game.d.ts} +2 -2
- package/esm/types/3_game.d.ts.map +1 -0
- package/esm/types/{2_gift_upgraded_component.d.ts → 3_gift_upgraded_component.d.ts} +2 -2
- package/esm/types/{2_gift_upgraded_component.d.ts.map → 3_gift_upgraded_component.d.ts.map} +1 -1
- package/esm/types/{2_gift_upgraded_component.js → 3_gift_upgraded_component.js} +1 -1
- package/esm/types/{2_inline_query.d.ts → 3_inline_query.d.ts} +4 -4
- package/esm/types/3_inline_query.d.ts.map +1 -0
- package/esm/types/{2_inline_query.js → 3_inline_query.js} +5 -5
- package/{script/types/1_input_media.d.ts → esm/types/3_input_media.d.ts} +2 -2
- package/esm/types/{1_input_media.d.ts.map → 3_input_media.d.ts.map} +1 -1
- package/{script/types/2_invite_link.d.ts → esm/types/3_invite_link.d.ts} +4 -4
- package/{script/types/2_invite_link.d.ts.map → esm/types/3_invite_link.d.ts.map} +1 -1
- package/esm/types/{2_invite_link.js → 3_invite_link.js} +5 -5
- package/{script/types/2_message_reactions.d.ts → esm/types/3_message_reactions.d.ts} +5 -6
- package/esm/types/3_message_reactions.d.ts.map +1 -0
- package/esm/types/{2_message_reactions.js → 3_message_reactions.js} +10 -12
- package/esm/types/{1_poll_option.d.ts → 3_poll_option.d.ts} +2 -2
- package/esm/types/{1_poll_option.d.ts.map → 3_poll_option.d.ts.map} +1 -1
- package/esm/types/{1_poll_option.js → 3_poll_option.js} +1 -1
- package/esm/types/{2_pre_checkout_query.d.ts → 3_pre_checkout_query.d.ts} +4 -4
- package/esm/types/3_pre_checkout_query.d.ts.map +1 -0
- package/esm/types/{2_pre_checkout_query.js → 3_pre_checkout_query.js} +5 -5
- package/{script/types/1_reply_quote.d.ts → esm/types/3_reply_quote.d.ts} +2 -2
- package/esm/types/{1_reply_quote.d.ts.map → 3_reply_quote.d.ts.map} +1 -1
- package/esm/types/{1_reply_quote.js → 3_reply_quote.js} +1 -1
- package/esm/types/3_story.d.ts +4 -5
- package/esm/types/3_story.d.ts.map +1 -1
- package/esm/types/3_story.js +6 -7
- package/esm/types/{3_chat_member_updated.d.ts → 4_chat_member_updated.d.ts} +6 -7
- package/esm/types/4_chat_member_updated.d.ts.map +1 -0
- package/esm/types/{3_chat_member_updated.js → 4_chat_member_updated.js} +13 -14
- package/esm/types/{3_gift.d.ts → 4_gift.d.ts} +6 -6
- package/esm/types/{3_gift.d.ts.map → 4_gift.d.ts.map} +1 -1
- package/esm/types/{3_gift.js → 4_gift.js} +7 -7
- package/esm/types/{3_join_request.d.ts → 4_join_request.d.ts} +6 -7
- package/esm/types/4_join_request.d.ts.map +1 -0
- package/esm/types/{3_join_request.js → 4_join_request.js} +17 -18
- package/esm/types/{2_poll.d.ts → 4_poll.d.ts} +3 -3
- package/esm/types/{2_poll.d.ts.map → 4_poll.d.ts.map} +1 -1
- package/esm/types/{2_poll.js → 4_poll.js} +2 -2
- package/{script/types/2_reply_to.d.ts → esm/types/4_reply_to.d.ts} +2 -2
- package/esm/types/{2_reply_to.d.ts.map → 4_reply_to.d.ts.map} +1 -1
- package/esm/types/{4_claimed_gift.d.ts → 5_claimed_gift.d.ts} +5 -6
- package/esm/types/5_claimed_gift.d.ts.map +1 -0
- package/esm/types/{4_claimed_gift.js → 5_claimed_gift.js} +4 -4
- package/esm/types/{4_link_preview.d.ts → 5_link_preview.d.ts} +4 -4
- package/{script/types/4_link_preview.d.ts.map → esm/types/5_link_preview.d.ts.map} +1 -1
- package/esm/types/{4_link_preview.js → 5_link_preview.js} +3 -3
- package/esm/types/{5_claimed_gifts.d.ts → 6_claimed_gifts.d.ts} +4 -4
- package/esm/types/6_claimed_gifts.d.ts.map +1 -0
- package/esm/types/{5_claimed_gifts.js → 6_claimed_gifts.js} +4 -4
- package/esm/types/{5_message.d.ts → 6_message.d.ts} +10 -11
- package/esm/types/6_message.d.ts.map +1 -0
- package/esm/types/{5_message.js → 6_message.js} +41 -66
- package/{script/types/5_message_content.d.ts → esm/types/6_message_content.d.ts} +3 -3
- package/esm/types/{5_message_content.d.ts.map → 6_message_content.d.ts.map} +1 -1
- package/{script/types/6_callback_query.d.ts → esm/types/7_callback_query.d.ts} +5 -5
- package/esm/types/{6_callback_query.d.ts.map → 7_callback_query.d.ts.map} +1 -1
- package/esm/types/{6_callback_query.js → 7_callback_query.js} +5 -5
- package/{script/types/6_chat_list_item.d.ts → esm/types/7_chat_list_item.d.ts} +6 -7
- package/esm/types/7_chat_list_item.d.ts.map +1 -0
- package/esm/types/{6_chat_list_item.js → 7_chat_list_item.js} +11 -11
- package/{script/types/6_inline_query_result.d.ts → esm/types/7_inline_query_result.d.ts} +3 -3
- package/esm/types/{6_inline_query_result.d.ts.map → 7_inline_query_result.d.ts.map} +1 -1
- package/esm/types/{6_inline_query_result.js → 7_inline_query_result.js} +1 -1
- package/esm/types/{6_saved_chat.d.ts → 7_saved_chat.d.ts} +4 -5
- package/esm/types/7_saved_chat.d.ts.map +1 -0
- package/esm/types/{6_saved_chat.js → 7_saved_chat.js} +4 -4
- package/esm/types/{6_topic.d.ts → 7_topic.d.ts} +2 -2
- package/esm/types/{6_topic.d.ts.map → 7_topic.d.ts.map} +1 -1
- package/esm/types/{7_inline_query_answer.d.ts → 8_inline_query_answer.d.ts} +2 -2
- package/esm/types/{7_inline_query_answer.d.ts.map → 8_inline_query_answer.d.ts.map} +1 -1
- package/esm/types/{7_inline_query_answer.js → 8_inline_query_answer.js} +1 -1
- package/{script/types/7_saved_chats.d.ts → esm/types/8_saved_chats.d.ts} +5 -5
- package/esm/types/8_saved_chats.d.ts.map +1 -0
- package/esm/types/{7_saved_chats.js → 8_saved_chats.js} +3 -3
- package/esm/types/{7_update.d.ts → 8_update.d.ts} +35 -16
- package/esm/types/8_update.d.ts.map +1 -0
- package/esm/types/_file_id.d.ts +1 -1
- package/esm/types/_file_id.d.ts.map +1 -1
- package/esm/types/_getters.d.ts +0 -7
- package/esm/types/_getters.d.ts.map +1 -1
- package/esm/utilities/0_hash.d.ts +2 -2
- package/esm/utilities/0_hash.d.ts.map +1 -1
- package/esm/utilities/0_misc.d.ts +1 -0
- package/esm/utilities/0_misc.d.ts.map +1 -1
- package/esm/utilities/0_misc.js +14 -1
- package/esm/utilities/0_part_stream.d.ts +1 -1
- package/esm/utilities/0_part_stream.d.ts.map +1 -1
- package/package.json +1 -1
- package/script/0_deps.d.ts +3 -1
- package/script/0_deps.d.ts.map +1 -1
- package/script/0_deps.js +6 -1
- package/script/3_types.d.ts +35 -35
- package/script/3_types.d.ts.map +1 -1
- package/script/3_types.js +35 -35
- package/script/_dnt.polyfills.d.ts +20 -13
- package/script/_dnt.polyfills.d.ts.map +1 -1
- package/script/_dnt.polyfills.js +120 -11
- package/script/client/0_abortable_loop.d.ts +27 -0
- package/script/client/0_abortable_loop.d.ts.map +1 -0
- package/script/client/0_abortable_loop.js +53 -0
- package/script/client/0_client_abstract.d.ts +1 -0
- package/script/client/0_client_abstract.d.ts.map +1 -1
- package/script/client/0_client_abstract.js +3 -0
- package/script/client/0_filters.d.ts +9 -3
- package/script/client/0_filters.d.ts.map +1 -1
- package/script/client/0_filters.js +4 -1
- package/script/client/0_params.d.ts +1 -1
- package/script/client/0_password.d.ts +2 -2
- package/script/client/0_password.d.ts.map +1 -1
- package/script/client/0_storage_operations.d.ts +53 -71
- package/script/client/0_storage_operations.d.ts.map +1 -1
- package/script/client/0_storage_operations.js +239 -236
- package/script/client/0_update_processor.d.ts +2 -2
- package/script/client/0_update_processor.d.ts.map +1 -1
- package/script/client/0_utilities.d.ts +2 -2
- package/script/client/0_utilities.d.ts.map +1 -1
- package/script/client/1_types.d.ts +2 -2
- package/script/client/1_types.d.ts.map +1 -1
- package/script/client/2_account_manager.js +5 -5
- package/script/client/2_business_connection_manager.d.ts +1 -1
- package/script/client/2_business_connection_manager.d.ts.map +1 -1
- package/script/client/2_business_connection_manager.js +3 -3
- package/script/client/2_client_encrypted.d.ts +1 -1
- package/script/client/2_client_encrypted.d.ts.map +1 -1
- package/script/client/2_client_encrypted.js +26 -23
- package/script/client/2_file_manager.js +2 -2
- package/script/client/2_network_statistics_manager.d.ts +2 -2
- package/script/client/2_network_statistics_manager.d.ts.map +1 -1
- package/script/client/2_network_statistics_manager.js +30 -4
- package/script/client/2_payment_manager.d.ts +1 -1
- package/script/client/2_payment_manager.d.ts.map +1 -1
- package/script/client/2_payment_manager.js +2 -2
- package/script/client/2_reaction_manager.d.ts +1 -1
- package/script/client/2_reaction_manager.d.ts.map +1 -1
- package/script/client/2_reaction_manager.js +2 -2
- package/script/client/2_translations_manager.d.ts +1 -1
- package/script/client/2_translations_manager.d.ts.map +1 -1
- package/script/client/2_translations_manager.js +15 -11
- package/script/client/2_update_manager.d.ts +4 -2
- package/script/client/2_update_manager.d.ts.map +1 -1
- package/script/client/2_update_manager.js +62 -80
- package/script/client/3_message_manager.d.ts +2 -2
- package/script/client/3_message_manager.d.ts.map +1 -1
- package/script/client/3_message_manager.js +5 -5
- package/script/client/3_video_chat_manager.d.ts +1 -1
- package/script/client/3_video_chat_manager.d.ts.map +1 -1
- package/script/client/4_callback_query_manager.d.ts +1 -1
- package/script/client/4_callback_query_manager.d.ts.map +1 -1
- package/script/client/4_callback_query_manager.js +1 -1
- package/script/client/4_chat_list_manager.d.ts +2 -3
- package/script/client/4_chat_list_manager.d.ts.map +1 -1
- package/script/client/4_chat_list_manager.js +9 -264
- package/script/client/4_chat_manager.d.ts +2 -2
- package/script/client/4_chat_manager.d.ts.map +1 -1
- package/script/client/4_chat_manager.js +7 -7
- package/script/client/4_gift_manager.js +3 -3
- package/script/client/4_inline_query_manager.d.ts +1 -1
- package/script/client/4_inline_query_manager.d.ts.map +1 -1
- package/script/client/4_inline_query_manager.js +3 -3
- package/script/client/4_link_preview_manager.d.ts +1 -1
- package/script/client/4_link_preview_manager.d.ts.map +1 -1
- package/script/client/4_link_preview_manager.js +3 -3
- package/script/client/4_poll_manager.d.ts +1 -1
- package/script/client/4_poll_manager.d.ts.map +1 -1
- package/script/client/4_poll_manager.js +1 -1
- package/script/client/4_story_manager.d.ts +1 -1
- package/script/client/4_story_manager.d.ts.map +1 -1
- package/script/client/4_story_manager.js +7 -7
- package/script/client/5_client.d.ts +15 -9
- package/script/client/5_client.d.ts.map +1 -1
- package/script/client/5_client.js +418 -380
- package/script/deps/jsr.io/@std/cache/0.2.0/_serialize_arg_list.d.ts +12 -0
- package/script/deps/jsr.io/@std/cache/0.2.0/_serialize_arg_list.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/cache/0.2.0/_serialize_arg_list.js +72 -0
- package/script/deps/jsr.io/@std/cache/0.2.0/lru_cache.d.ts +112 -0
- package/script/deps/jsr.io/@std/cache/0.2.0/lru_cache.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/cache/0.2.0/lru_cache.js +144 -0
- package/script/deps/jsr.io/@std/cache/0.2.0/memoize.d.ts +111 -0
- package/script/deps/jsr.io/@std/cache/0.2.0/memoize.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/cache/0.2.0/memoize.js +85 -0
- package/script/deps/jsr.io/@std/encoding/1.0.7/hex.d.ts +39 -0
- package/script/deps/jsr.io/@std/encoding/1.0.7/hex.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/encoding/1.0.7/hex.js +113 -0
- package/script/session/1_session.d.ts +1 -0
- package/script/session/1_session.d.ts.map +1 -1
- package/script/session/1_session.js +3 -0
- package/script/session/2_session_encrypted.d.ts +2 -2
- package/script/session/2_session_encrypted.d.ts.map +1 -1
- package/script/session/2_session_encrypted.js +197 -134
- package/script/storage/0_storage.d.ts +1 -0
- package/script/storage/0_storage.d.ts.map +1 -1
- package/script/storage/2_storage_indexed_db.d.ts +1 -0
- package/script/storage/2_storage_indexed_db.d.ts.map +1 -1
- package/script/storage/2_storage_indexed_db.js +3 -0
- package/script/storage/2_storage_local_storage.node.d.ts +1 -0
- package/script/storage/2_storage_local_storage.node.d.ts.map +1 -1
- package/script/storage/2_storage_local_storage.node.js +3 -0
- package/script/storage/2_storage_memory.d.ts +1 -0
- package/script/storage/2_storage_memory.d.ts.map +1 -1
- package/script/storage/2_storage_memory.js +3 -0
- package/script/storage/2_storage_session_storage.d.ts +1 -0
- package/script/storage/2_storage_session_storage.d.ts.map +1 -1
- package/script/storage/2_storage_session_storage.js +3 -0
- package/script/tl/0_utilities.d.ts +1 -0
- package/script/tl/0_utilities.d.ts.map +1 -1
- package/script/tl/0_utilities.js +20 -0
- package/script/tl/1_telegram_api.d.ts +810 -254
- package/script/tl/1_telegram_api.d.ts.map +1 -1
- package/script/tl/1_telegram_api.js +912 -213
- package/script/tl/1_tl_reader.d.ts +2 -2
- package/script/tl/1_tl_reader.d.ts.map +1 -1
- package/script/tl/1_tl_writer.d.ts +2 -2
- package/script/tl/1_tl_writer.d.ts.map +1 -1
- package/script/tl/2_mtproto.d.ts +1 -1
- package/script/tl/2_mtproto.d.ts.map +1 -1
- package/script/tl/2_telegram.d.ts +1 -1
- package/script/tl/2_telegram.d.ts.map +1 -1
- package/script/types/0_file_source.d.ts +1 -1
- package/script/types/0_file_source.d.ts.map +1 -1
- package/script/types/1_chat_p.d.ts +10 -0
- package/script/types/1_chat_p.d.ts.map +1 -1
- package/script/types/1_chat_p.js +5 -0
- package/script/types/2_chat.d.ts +2 -5
- package/script/types/2_chat.d.ts.map +1 -1
- package/script/types/2_chat.js +10 -15
- package/script/types/{0_message_entity.d.ts → 2_message_entity.d.ts} +3 -3
- package/script/types/{0_message_entity.d.ts.map → 2_message_entity.d.ts.map} +1 -1
- package/script/types/{0_message_entity.js → 2_message_entity.js} +7 -7
- package/script/types/2_message_reaction_count.d.ts +2 -3
- package/script/types/2_message_reaction_count.d.ts.map +1 -1
- package/script/types/2_message_reaction_count.js +4 -6
- package/script/types/2_poll_answer.d.ts +2 -3
- package/script/types/2_poll_answer.d.ts.map +1 -1
- package/script/types/2_poll_answer.js +4 -5
- package/script/types/2_story_interactive_area.d.ts +2 -2
- package/script/types/2_story_interactive_area.d.ts.map +1 -1
- package/script/types/2_story_interactive_area.js +2 -2
- package/script/types/{1_story_privacy.d.ts → 2_story_privacy.d.ts} +3 -3
- package/script/types/{1_story_privacy.d.ts.map → 2_story_privacy.d.ts.map} +1 -1
- package/script/types/{1_story_privacy.js → 2_story_privacy.js} +10 -10
- package/{esm/types/1_user.d.ts → script/types/2_user.d.ts} +5 -1
- package/script/types/2_user.d.ts.map +1 -0
- package/script/types/{1_user.js → 2_user.js} +25 -0
- package/script/types/{2_business_connection.d.ts → 3_business_connection.d.ts} +4 -4
- package/script/types/3_business_connection.d.ts.map +1 -0
- package/script/types/{2_business_connection.js → 3_business_connection.js} +10 -3
- package/{esm/types/2_chat_member.d.ts → script/types/3_chat_member.d.ts} +6 -4
- package/script/types/{2_chat_member.d.ts.map → 3_chat_member.d.ts.map} +1 -1
- package/script/types/{2_chat_member.js → 3_chat_member.js} +5 -5
- package/script/types/{2_chat_settings.d.ts → 3_chat_settings.d.ts} +2 -2
- package/{esm/types/2_chat_settings.d.ts.map → script/types/3_chat_settings.d.ts.map} +1 -1
- package/script/types/{2_chat_settings.js → 3_chat_settings.js} +2 -2
- package/script/types/{2_chosen_inline_result.d.ts → 3_chosen_inline_result.d.ts} +4 -4
- package/script/types/3_chosen_inline_result.d.ts.map +1 -0
- package/script/types/{2_chosen_inline_result.js → 3_chosen_inline_result.js} +4 -4
- package/script/types/{2_forward_header.d.ts → 3_forward_header.d.ts} +4 -5
- package/script/types/3_forward_header.d.ts.map +1 -0
- package/script/types/{2_forward_header.js → 3_forward_header.js} +11 -12
- package/{esm/types/2_game.d.ts → script/types/3_game.d.ts} +2 -2
- package/script/types/3_game.d.ts.map +1 -0
- package/script/types/{2_gift_upgraded_component.d.ts → 3_gift_upgraded_component.d.ts} +2 -2
- package/script/types/{2_gift_upgraded_component.d.ts.map → 3_gift_upgraded_component.d.ts.map} +1 -1
- package/script/types/{2_gift_upgraded_component.js → 3_gift_upgraded_component.js} +2 -2
- package/script/types/{2_inline_query.d.ts → 3_inline_query.d.ts} +4 -4
- package/script/types/3_inline_query.d.ts.map +1 -0
- package/script/types/{2_inline_query.js → 3_inline_query.js} +5 -5
- package/{esm/types/1_input_media.d.ts → script/types/3_input_media.d.ts} +2 -2
- package/script/types/{1_input_media.d.ts.map → 3_input_media.d.ts.map} +1 -1
- package/{esm/types/2_invite_link.d.ts → script/types/3_invite_link.d.ts} +4 -4
- package/{esm/types/2_invite_link.d.ts.map → script/types/3_invite_link.d.ts.map} +1 -1
- package/script/types/{2_invite_link.js → 3_invite_link.js} +5 -5
- package/{esm/types/2_message_reactions.d.ts → script/types/3_message_reactions.d.ts} +5 -6
- package/script/types/3_message_reactions.d.ts.map +1 -0
- package/script/types/{2_message_reactions.js → 3_message_reactions.js} +10 -12
- package/script/types/{1_poll_option.d.ts → 3_poll_option.d.ts} +2 -2
- package/script/types/{1_poll_option.d.ts.map → 3_poll_option.d.ts.map} +1 -1
- package/script/types/{1_poll_option.js → 3_poll_option.js} +2 -2
- package/script/types/{2_pre_checkout_query.d.ts → 3_pre_checkout_query.d.ts} +4 -4
- package/script/types/3_pre_checkout_query.d.ts.map +1 -0
- package/script/types/{2_pre_checkout_query.js → 3_pre_checkout_query.js} +5 -5
- package/{esm/types/1_reply_quote.d.ts → script/types/3_reply_quote.d.ts} +2 -2
- package/script/types/{1_reply_quote.d.ts.map → 3_reply_quote.d.ts.map} +1 -1
- package/script/types/{1_reply_quote.js → 3_reply_quote.js} +2 -2
- package/script/types/3_story.d.ts +4 -5
- package/script/types/3_story.d.ts.map +1 -1
- package/script/types/3_story.js +8 -9
- package/script/types/{3_chat_member_updated.d.ts → 4_chat_member_updated.d.ts} +6 -7
- package/script/types/4_chat_member_updated.d.ts.map +1 -0
- package/script/types/{3_chat_member_updated.js → 4_chat_member_updated.js} +13 -14
- package/script/types/{3_gift.d.ts → 4_gift.d.ts} +6 -6
- package/script/types/{3_gift.d.ts.map → 4_gift.d.ts.map} +1 -1
- package/script/types/{3_gift.js → 4_gift.js} +9 -9
- package/script/types/{3_join_request.d.ts → 4_join_request.d.ts} +6 -7
- package/script/types/4_join_request.d.ts.map +1 -0
- package/script/types/{3_join_request.js → 4_join_request.js} +17 -18
- package/script/types/{2_poll.d.ts → 4_poll.d.ts} +3 -3
- package/script/types/{2_poll.d.ts.map → 4_poll.d.ts.map} +1 -1
- package/script/types/{2_poll.js → 4_poll.js} +5 -5
- package/{esm/types/2_reply_to.d.ts → script/types/4_reply_to.d.ts} +2 -2
- package/script/types/{2_reply_to.d.ts.map → 4_reply_to.d.ts.map} +1 -1
- package/script/types/{4_claimed_gift.d.ts → 5_claimed_gift.d.ts} +5 -6
- package/script/types/5_claimed_gift.d.ts.map +1 -0
- package/script/types/{4_claimed_gift.js → 5_claimed_gift.js} +5 -5
- package/script/types/{4_link_preview.d.ts → 5_link_preview.d.ts} +4 -4
- package/{esm/types/4_link_preview.d.ts.map → script/types/5_link_preview.d.ts.map} +1 -1
- package/script/types/{4_link_preview.js → 5_link_preview.js} +3 -3
- package/script/types/{5_claimed_gifts.d.ts → 6_claimed_gifts.d.ts} +4 -4
- package/script/types/6_claimed_gifts.d.ts.map +1 -0
- package/script/types/{5_claimed_gifts.js → 6_claimed_gifts.js} +4 -4
- package/script/types/{5_message.d.ts → 6_message.d.ts} +10 -11
- package/script/types/6_message.d.ts.map +1 -0
- package/script/types/{5_message.js → 6_message.js} +45 -70
- package/{esm/types/5_message_content.d.ts → script/types/6_message_content.d.ts} +3 -3
- package/script/types/{5_message_content.d.ts.map → 6_message_content.d.ts.map} +1 -1
- package/{esm/types/6_callback_query.d.ts → script/types/7_callback_query.d.ts} +5 -5
- package/script/types/{6_callback_query.d.ts.map → 7_callback_query.d.ts.map} +1 -1
- package/script/types/{6_callback_query.js → 7_callback_query.js} +5 -5
- package/{esm/types/6_chat_list_item.d.ts → script/types/7_chat_list_item.d.ts} +6 -7
- package/script/types/7_chat_list_item.d.ts.map +1 -0
- package/script/types/{6_chat_list_item.js → 7_chat_list_item.js} +11 -11
- package/{esm/types/6_inline_query_result.d.ts → script/types/7_inline_query_result.d.ts} +3 -3
- package/script/types/{6_inline_query_result.d.ts.map → 7_inline_query_result.d.ts.map} +1 -1
- package/script/types/{6_inline_query_result.js → 7_inline_query_result.js} +3 -3
- package/script/types/{6_saved_chat.d.ts → 7_saved_chat.d.ts} +4 -5
- package/script/types/7_saved_chat.d.ts.map +1 -0
- package/script/types/{6_saved_chat.js → 7_saved_chat.js} +4 -4
- package/script/types/{6_topic.d.ts → 7_topic.d.ts} +2 -2
- package/script/types/{6_topic.d.ts.map → 7_topic.d.ts.map} +1 -1
- package/script/types/{7_inline_query_answer.d.ts → 8_inline_query_answer.d.ts} +2 -2
- package/script/types/{7_inline_query_answer.d.ts.map → 8_inline_query_answer.d.ts.map} +1 -1
- package/script/types/{7_inline_query_answer.js → 8_inline_query_answer.js} +2 -2
- package/{esm/types/7_saved_chats.d.ts → script/types/8_saved_chats.d.ts} +5 -5
- package/script/types/8_saved_chats.d.ts.map +1 -0
- package/script/types/{7_saved_chats.js → 8_saved_chats.js} +3 -3
- package/script/types/{7_update.d.ts → 8_update.d.ts} +35 -16
- package/script/types/8_update.d.ts.map +1 -0
- package/script/types/_file_id.d.ts +1 -1
- package/script/types/_file_id.d.ts.map +1 -1
- package/script/types/_getters.d.ts +0 -7
- package/script/types/_getters.d.ts.map +1 -1
- package/script/utilities/0_hash.d.ts +2 -2
- package/script/utilities/0_hash.d.ts.map +1 -1
- package/script/utilities/0_misc.d.ts +1 -0
- package/script/utilities/0_misc.d.ts.map +1 -1
- package/script/utilities/0_misc.js +14 -0
- package/script/utilities/0_part_stream.d.ts +1 -1
- package/script/utilities/0_part_stream.d.ts.map +1 -1
- package/esm/types/1_user.d.ts.map +0 -1
- package/esm/types/2_business_connection.d.ts.map +0 -1
- package/esm/types/2_chosen_inline_result.d.ts.map +0 -1
- package/esm/types/2_forward_header.d.ts.map +0 -1
- package/esm/types/2_game.d.ts.map +0 -1
- package/esm/types/2_inline_query.d.ts.map +0 -1
- package/esm/types/2_message_reactions.d.ts.map +0 -1
- package/esm/types/2_pre_checkout_query.d.ts.map +0 -1
- package/esm/types/3_chat_member_updated.d.ts.map +0 -1
- package/esm/types/3_join_request.d.ts.map +0 -1
- package/esm/types/4_claimed_gift.d.ts.map +0 -1
- package/esm/types/5_claimed_gifts.d.ts.map +0 -1
- package/esm/types/5_message.d.ts.map +0 -1
- package/esm/types/6_chat_list_item.d.ts.map +0 -1
- package/esm/types/6_saved_chat.d.ts.map +0 -1
- package/esm/types/7_saved_chats.d.ts.map +0 -1
- package/esm/types/7_update.d.ts.map +0 -1
- package/script/types/1_user.d.ts.map +0 -1
- package/script/types/2_business_connection.d.ts.map +0 -1
- package/script/types/2_chosen_inline_result.d.ts.map +0 -1
- package/script/types/2_forward_header.d.ts.map +0 -1
- package/script/types/2_game.d.ts.map +0 -1
- package/script/types/2_inline_query.d.ts.map +0 -1
- package/script/types/2_message_reactions.d.ts.map +0 -1
- package/script/types/2_pre_checkout_query.d.ts.map +0 -1
- package/script/types/3_chat_member_updated.d.ts.map +0 -1
- package/script/types/3_join_request.d.ts.map +0 -1
- package/script/types/4_claimed_gift.d.ts.map +0 -1
- package/script/types/5_claimed_gifts.d.ts.map +0 -1
- package/script/types/5_message.d.ts.map +0 -1
- package/script/types/6_chat_list_item.d.ts.map +0 -1
- package/script/types/6_saved_chat.d.ts.map +0 -1
- package/script/types/7_saved_chats.d.ts.map +0 -1
- package/script/types/7_update.d.ts.map +0 -1
- /package/esm/types/{2_game.js → 3_game.js} +0 -0
- /package/esm/types/{1_input_media.js → 3_input_media.js} +0 -0
- /package/esm/types/{2_reply_to.js → 4_reply_to.js} +0 -0
- /package/esm/types/{5_message_content.js → 6_message_content.js} +0 -0
- /package/esm/types/{6_topic.js → 7_topic.js} +0 -0
- /package/esm/types/{7_update.js → 8_update.js} +0 -0
- /package/script/types/{2_game.js → 3_game.js} +0 -0
- /package/script/types/{1_input_media.js → 3_input_media.js} +0 -0
- /package/script/types/{2_reply_to.js → 4_reply_to.js} +0 -0
- /package/script/types/{5_message_content.js → 6_message_content.js} +0 -0
- /package/script/types/{6_topic.js → 7_topic.js} +0 -0
- /package/script/types/{7_update.js → 8_update.js} +0 -0
|
@@ -30,6 +30,8 @@ const _3_types_js_1 = require("../3_types.js");
|
|
|
30
30
|
const _4_constants_js_1 = require("../4_constants.js");
|
|
31
31
|
const _4_errors_js_1 = require("../4_errors.js");
|
|
32
32
|
const _4_errors_js_2 = require("../4_errors.js");
|
|
33
|
+
const _2_telegram_js_1 = require("../tl/2_telegram.js");
|
|
34
|
+
const _0_abortable_loop_js_1 = require("./0_abortable_loop.js");
|
|
33
35
|
const _0_password_js_1 = require("./0_password.js");
|
|
34
36
|
const _0_storage_operations_js_1 = require("./0_storage_operations.js");
|
|
35
37
|
const _0_utilities_js_1 = require("./0_utilities.js");
|
|
@@ -66,7 +68,8 @@ exports.restartAuth = Symbol("restartAuth");
|
|
|
66
68
|
exports.handleMigrationError = Symbol("handleMigrationError");
|
|
67
69
|
// global Client ID counter for logs
|
|
68
70
|
let id = 0;
|
|
69
|
-
const
|
|
71
|
+
const getPeer = Symbol();
|
|
72
|
+
const mustGetPeer = Symbol();
|
|
70
73
|
/**
|
|
71
74
|
* An MTKruto client.
|
|
72
75
|
*/
|
|
@@ -151,6 +154,7 @@ class Client extends Composer {
|
|
|
151
154
|
#L;
|
|
152
155
|
#LsignIn;
|
|
153
156
|
#LupdateGapRecoveryLoop;
|
|
157
|
+
#LstorageWriteLoop;
|
|
154
158
|
#LhandleMigrationError;
|
|
155
159
|
#Lmin;
|
|
156
160
|
/**
|
|
@@ -190,6 +194,7 @@ class Client extends Composer {
|
|
|
190
194
|
const L = this.#L = (0, _1_utilities_js_1.getLogger)("Client").client(id++);
|
|
191
195
|
this.#LsignIn = L.branch("signIn");
|
|
192
196
|
this.#LupdateGapRecoveryLoop = L.branch("updateGapRecoveryLoop");
|
|
197
|
+
this.#LstorageWriteLoop = L.branch("storageWriteLoop");
|
|
193
198
|
this.#LhandleMigrationError = L.branch("[handleMigrationError]");
|
|
194
199
|
this.#Lmin = L.branch("min");
|
|
195
200
|
const c = {
|
|
@@ -217,7 +222,7 @@ class Client extends Composer {
|
|
|
217
222
|
getInputChannel: this.getInputChannel.bind(this),
|
|
218
223
|
getInputUser: this.getInputUser.bind(this),
|
|
219
224
|
getInputPeerChatId: this.#getInputPeerChatId.bind(this),
|
|
220
|
-
|
|
225
|
+
getPeer: this[mustGetPeer].bind(this),
|
|
221
226
|
handleUpdate: this.#queueHandleCtxUpdate.bind(this),
|
|
222
227
|
parseMode: this.#parseMode,
|
|
223
228
|
outgoingMessages: this.#outgoingMessages,
|
|
@@ -316,22 +321,21 @@ class Client extends Composer {
|
|
|
316
321
|
return this.#client?.disconnected ?? true;
|
|
317
322
|
}
|
|
318
323
|
#constructContext = async (update) => {
|
|
319
|
-
const
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
if (msg !== undefined) {
|
|
323
|
-
return { chatId: msg.chat.id, messageId: msg.id, businessConnectionId: msg.businessConnectionId, senderId: msg.from?.id, userId: msg.from?.id };
|
|
324
|
+
const mustGetMsg = (ctx) => {
|
|
325
|
+
if (ctx.msg !== undefined) {
|
|
326
|
+
return { chatId: ctx.msg.chat.id, messageId: ctx.msg.id, businessConnectionId: ctx.msg.businessConnectionId, senderId: ctx.msg.from?.id, userId: ctx.msg.from?.id };
|
|
324
327
|
}
|
|
325
|
-
|
|
328
|
+
const reactions = "messageInteractions" in update ? update.messageInteractions : undefined;
|
|
329
|
+
if (reactions !== undefined) {
|
|
326
330
|
return { chatId: reactions.chatId, messageId: reactions.messageId };
|
|
327
331
|
}
|
|
328
332
|
else {
|
|
329
333
|
(0, _0_deps_js_1.unreachable)();
|
|
330
334
|
}
|
|
331
335
|
};
|
|
332
|
-
const mustGetUserId = () => {
|
|
333
|
-
if (msg?.from) {
|
|
334
|
-
return msg.from.id;
|
|
336
|
+
const mustGetUserId = (ctx) => {
|
|
337
|
+
if (ctx.msg?.from) {
|
|
338
|
+
return ctx.msg.from.id;
|
|
335
339
|
}
|
|
336
340
|
else if ("callbackQuery" in update) {
|
|
337
341
|
return update.callbackQuery.from.id;
|
|
@@ -356,9 +360,6 @@ class Client extends Composer {
|
|
|
356
360
|
}
|
|
357
361
|
(0, _0_deps_js_1.unreachable)();
|
|
358
362
|
};
|
|
359
|
-
const chat_ = "messageReactions" in update ? update.messageReactions.chat : "messageReactionCount" in update ? update.messageReactionCount.chat : "chatMember" in update ? update.chatMember.chat : "myChatMember" in update ? update.myChatMember.chat : "joinRequest" in update ? update.joinRequest.chat : "story" in update ? update.story.chat : undefined;
|
|
360
|
-
const chat = chat_ ?? msg?.chat;
|
|
361
|
-
const from = "callbackQuery" in update ? update.callbackQuery.from : "inlineQuery" in update ? update.inlineQuery.from : "chatMember" in update ? update.chatMember.from : "myChatMember" in update ? update.myChatMember.from : "messageReactions" in update ? update.messageReactions.user : "preCheckoutQuery" in update ? update.preCheckoutQuery.from : "joinRequest" in update ? update.joinRequest.from : "businessConnection" in update ? update.businessConnection.user : "pollAnswer" in update ? update.pollAnswer.from : msg?.from ? msg.from : undefined;
|
|
362
363
|
const getReplyTo = (quote, chatId, messageId) => {
|
|
363
364
|
if ("story" in update) {
|
|
364
365
|
return { chatId: update.story.chat.id, storyId: update.story.id };
|
|
@@ -367,352 +368,368 @@ class Client extends Composer {
|
|
|
367
368
|
const shouldQuote = quote === undefined ? !isPrivate : quote;
|
|
368
369
|
return shouldQuote ? { messageId } : undefined;
|
|
369
370
|
};
|
|
370
|
-
|
|
371
|
+
if (this.#lastGetMe === null && !("connectionState" in update) && (!("authorizationState" in update) || ("authorizationState" in update && update.authorizationState.authorized))) {
|
|
372
|
+
await this.#getMe();
|
|
373
|
+
}
|
|
371
374
|
const context = {
|
|
372
375
|
...update,
|
|
373
376
|
client: this,
|
|
374
|
-
me
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
377
|
+
get me() {
|
|
378
|
+
return this.client.#lastGetMe === null ? undefined : this.client.#lastGetMe;
|
|
379
|
+
},
|
|
380
|
+
get msg() {
|
|
381
|
+
return "message" in update ? update.message : "editedMessage" in update ? update.editedMessage : "scheduledMessage" in update ? update.scheduledMessage : "callbackQuery" in update ? update.callbackQuery.message : undefined;
|
|
382
|
+
},
|
|
383
|
+
get chat() {
|
|
384
|
+
return this.msg?.chat ?? ("messageReactions" in update ? update.messageReactions.chat : "messageReactionCount" in update ? update.messageReactionCount.chat : "chatMember" in update ? update.chatMember.chat : "myChatMember" in update ? update.myChatMember.chat : "joinRequest" in update ? update.joinRequest.chat : "story" in update ? update.story.chat : undefined);
|
|
385
|
+
},
|
|
386
|
+
get from() {
|
|
387
|
+
const from = "callbackQuery" in update ? update.callbackQuery.from : "inlineQuery" in update ? update.inlineQuery.from : "chatMember" in update ? update.chatMember.from : "myChatMember" in update ? update.myChatMember.from : "messageReactions" in update ? update.messageReactions.user : "preCheckoutQuery" in update ? update.preCheckoutQuery.from : "joinRequest" in update ? update.joinRequest.from : "businessConnection" in update ? update.businessConnection.user : "pollAnswer" in update ? update.pollAnswer.from : this.msg?.from;
|
|
388
|
+
return from;
|
|
389
|
+
},
|
|
390
|
+
toJSON() {
|
|
391
|
+
if ("update" in update) {
|
|
392
|
+
return { update: (0, _2_tl_js_1.toJSON)(update.update) };
|
|
393
|
+
}
|
|
394
|
+
else {
|
|
395
|
+
return update;
|
|
396
|
+
}
|
|
397
|
+
},
|
|
398
|
+
reply(text, params) {
|
|
399
|
+
const { chatId, messageId, businessConnectionId } = mustGetMsg(this);
|
|
383
400
|
const replyTo = getReplyTo(params?.quote, chatId, messageId);
|
|
384
|
-
return this.sendMessage(chatId, text, { ...params, replyTo, businessConnectionId });
|
|
401
|
+
return this.client.sendMessage(chatId, text, { ...params, replyTo, businessConnectionId });
|
|
385
402
|
},
|
|
386
|
-
replyPoll
|
|
387
|
-
const { chatId, messageId, businessConnectionId } = mustGetMsg();
|
|
403
|
+
replyPoll(question, options, params) {
|
|
404
|
+
const { chatId, messageId, businessConnectionId } = mustGetMsg(this);
|
|
388
405
|
const replyTo = getReplyTo(params?.quote, chatId, messageId);
|
|
389
|
-
return this.sendPoll(chatId, question, options, { ...params, replyTo, businessConnectionId });
|
|
406
|
+
return this.client.sendPoll(chatId, question, options, { ...params, replyTo, businessConnectionId });
|
|
390
407
|
},
|
|
391
|
-
replyPhoto
|
|
392
|
-
const { chatId, messageId, businessConnectionId } = mustGetMsg();
|
|
408
|
+
replyPhoto(photo, params) {
|
|
409
|
+
const { chatId, messageId, businessConnectionId } = mustGetMsg(this);
|
|
393
410
|
const replyTo = getReplyTo(params?.quote, chatId, messageId);
|
|
394
|
-
return this.sendPhoto(chatId, photo, { ...params, replyTo, businessConnectionId });
|
|
411
|
+
return this.client.sendPhoto(chatId, photo, { ...params, replyTo, businessConnectionId });
|
|
395
412
|
},
|
|
396
|
-
replyMediaGroup
|
|
397
|
-
const { chatId, messageId, businessConnectionId } = mustGetMsg();
|
|
413
|
+
replyMediaGroup(media, params) {
|
|
414
|
+
const { chatId, messageId, businessConnectionId } = mustGetMsg(this);
|
|
398
415
|
const replyTo = getReplyTo(params?.quote, chatId, messageId);
|
|
399
|
-
return this.sendMediaGroup(chatId, media, { ...params, replyTo, businessConnectionId });
|
|
416
|
+
return this.client.sendMediaGroup(chatId, media, { ...params, replyTo, businessConnectionId });
|
|
400
417
|
},
|
|
401
|
-
replyInvoice
|
|
402
|
-
const { chatId, messageId, businessConnectionId } = mustGetMsg();
|
|
418
|
+
replyInvoice(title, description, payload, currency, prices, params) {
|
|
419
|
+
const { chatId, messageId, businessConnectionId } = mustGetMsg(this);
|
|
403
420
|
const replyTo = getReplyTo(params?.quote, chatId, messageId);
|
|
404
|
-
return this.sendInvoice(chatId, title, description, payload, currency, prices, { ...params, replyTo, businessConnectionId });
|
|
421
|
+
return this.client.sendInvoice(chatId, title, description, payload, currency, prices, { ...params, replyTo, businessConnectionId });
|
|
405
422
|
},
|
|
406
|
-
replyDocument
|
|
407
|
-
const { chatId, messageId, businessConnectionId } = mustGetMsg();
|
|
423
|
+
replyDocument(document, params) {
|
|
424
|
+
const { chatId, messageId, businessConnectionId } = mustGetMsg(this);
|
|
408
425
|
const replyTo = getReplyTo(params?.quote, chatId, messageId);
|
|
409
|
-
return this.sendDocument(chatId, document, { ...params, replyTo, businessConnectionId });
|
|
426
|
+
return this.client.sendDocument(chatId, document, { ...params, replyTo, businessConnectionId });
|
|
410
427
|
},
|
|
411
|
-
replySticker
|
|
412
|
-
const { chatId, messageId, businessConnectionId } = mustGetMsg();
|
|
428
|
+
replySticker(sticker, params) {
|
|
429
|
+
const { chatId, messageId, businessConnectionId } = mustGetMsg(this);
|
|
413
430
|
const replyTo = getReplyTo(params?.quote, chatId, messageId);
|
|
414
|
-
return this.sendSticker(chatId, sticker, { ...params, replyTo, businessConnectionId });
|
|
431
|
+
return this.client.sendSticker(chatId, sticker, { ...params, replyTo, businessConnectionId });
|
|
415
432
|
},
|
|
416
|
-
replyContact
|
|
417
|
-
const { chatId, messageId, businessConnectionId } = mustGetMsg();
|
|
433
|
+
replyContact(firstName, number, params) {
|
|
434
|
+
const { chatId, messageId, businessConnectionId } = mustGetMsg(this);
|
|
418
435
|
const replyTo = getReplyTo(params?.quote, chatId, messageId);
|
|
419
|
-
return this.sendContact(chatId, firstName, number, { ...params, replyTo, businessConnectionId });
|
|
436
|
+
return this.client.sendContact(chatId, firstName, number, { ...params, replyTo, businessConnectionId });
|
|
420
437
|
},
|
|
421
|
-
replyLocation
|
|
422
|
-
const { chatId, messageId, businessConnectionId } = mustGetMsg();
|
|
438
|
+
replyLocation(latitude, longitude, params) {
|
|
439
|
+
const { chatId, messageId, businessConnectionId } = mustGetMsg(this);
|
|
423
440
|
const replyTo = getReplyTo(params?.quote, chatId, messageId);
|
|
424
|
-
return this.sendLocation(chatId, latitude, longitude, { ...params, replyTo, businessConnectionId });
|
|
441
|
+
return this.client.sendLocation(chatId, latitude, longitude, { ...params, replyTo, businessConnectionId });
|
|
425
442
|
},
|
|
426
|
-
replyDice
|
|
427
|
-
const { chatId, messageId, businessConnectionId } = mustGetMsg();
|
|
443
|
+
replyDice(params) {
|
|
444
|
+
const { chatId, messageId, businessConnectionId } = mustGetMsg(this);
|
|
428
445
|
const replyTo = getReplyTo(params?.quote, chatId, messageId);
|
|
429
|
-
return this.sendDice(chatId, { ...params, replyTo, businessConnectionId });
|
|
446
|
+
return this.client.sendDice(chatId, { ...params, replyTo, businessConnectionId });
|
|
430
447
|
},
|
|
431
|
-
replyVenue
|
|
432
|
-
const { chatId, messageId, businessConnectionId } = mustGetMsg();
|
|
448
|
+
replyVenue(latitude, longitude, title, address, params) {
|
|
449
|
+
const { chatId, messageId, businessConnectionId } = mustGetMsg(this);
|
|
433
450
|
const replyTo = getReplyTo(params?.quote, chatId, messageId);
|
|
434
|
-
return this.sendVenue(chatId, latitude, longitude, title, address, { ...params, replyTo, businessConnectionId });
|
|
451
|
+
return this.client.sendVenue(chatId, latitude, longitude, title, address, { ...params, replyTo, businessConnectionId });
|
|
435
452
|
},
|
|
436
|
-
replyVideo
|
|
437
|
-
const { chatId, messageId, businessConnectionId } = mustGetMsg();
|
|
453
|
+
replyVideo(video, params) {
|
|
454
|
+
const { chatId, messageId, businessConnectionId } = mustGetMsg(this);
|
|
438
455
|
const replyTo = getReplyTo(params?.quote, chatId, messageId);
|
|
439
|
-
return this.sendVideo(chatId, video, { ...params, replyTo, businessConnectionId });
|
|
456
|
+
return this.client.sendVideo(chatId, video, { ...params, replyTo, businessConnectionId });
|
|
440
457
|
},
|
|
441
|
-
replyAnimation
|
|
442
|
-
const { chatId, messageId, businessConnectionId } = mustGetMsg();
|
|
458
|
+
replyAnimation(document, params) {
|
|
459
|
+
const { chatId, messageId, businessConnectionId } = mustGetMsg(this);
|
|
443
460
|
const replyTo = getReplyTo(params?.quote, chatId, messageId);
|
|
444
|
-
return this.sendAnimation(chatId, document, { ...params, replyTo, businessConnectionId });
|
|
461
|
+
return this.client.sendAnimation(chatId, document, { ...params, replyTo, businessConnectionId });
|
|
445
462
|
},
|
|
446
|
-
replyVoice
|
|
447
|
-
const { chatId, messageId, businessConnectionId } = mustGetMsg();
|
|
463
|
+
replyVoice(document, params) {
|
|
464
|
+
const { chatId, messageId, businessConnectionId } = mustGetMsg(this);
|
|
448
465
|
const replyTo = getReplyTo(params?.quote, chatId, messageId);
|
|
449
|
-
return this.sendVoice(chatId, document, { ...params, replyTo, businessConnectionId });
|
|
466
|
+
return this.client.sendVoice(chatId, document, { ...params, replyTo, businessConnectionId });
|
|
450
467
|
},
|
|
451
|
-
replyAudio
|
|
452
|
-
const { chatId, messageId, businessConnectionId } = mustGetMsg();
|
|
468
|
+
replyAudio(document, params) {
|
|
469
|
+
const { chatId, messageId, businessConnectionId } = mustGetMsg(this);
|
|
453
470
|
const replyTo = getReplyTo(params?.quote, chatId, messageId);
|
|
454
|
-
return this.sendAudio(chatId, document, { ...params, replyTo, businessConnectionId });
|
|
471
|
+
return this.client.sendAudio(chatId, document, { ...params, replyTo, businessConnectionId });
|
|
455
472
|
},
|
|
456
|
-
replyVideoNote
|
|
457
|
-
const { chatId, messageId, businessConnectionId } = mustGetMsg();
|
|
473
|
+
replyVideoNote(videoNote, params) {
|
|
474
|
+
const { chatId, messageId, businessConnectionId } = mustGetMsg(this);
|
|
458
475
|
const replyTo = getReplyTo(params?.quote, chatId, messageId);
|
|
459
|
-
return this.sendVideoNote(chatId, videoNote, { ...params, replyTo, businessConnectionId });
|
|
476
|
+
return this.client.sendVideoNote(chatId, videoNote, { ...params, replyTo, businessConnectionId });
|
|
460
477
|
},
|
|
461
|
-
delete
|
|
462
|
-
const { chatId, messageId } = mustGetMsg();
|
|
463
|
-
return this.deleteMessage(chatId, messageId);
|
|
478
|
+
delete() {
|
|
479
|
+
const { chatId, messageId } = mustGetMsg(this);
|
|
480
|
+
return this.client.deleteMessage(chatId, messageId);
|
|
464
481
|
},
|
|
465
|
-
forward
|
|
466
|
-
const { chatId, messageId } = mustGetMsg();
|
|
467
|
-
return this.forwardMessage(chatId, to, messageId, params);
|
|
482
|
+
forward(to, params) {
|
|
483
|
+
const { chatId, messageId } = mustGetMsg(this);
|
|
484
|
+
return this.client.forwardMessage(chatId, to, messageId, params);
|
|
468
485
|
},
|
|
469
|
-
pin
|
|
470
|
-
const { chatId, messageId, businessConnectionId } = mustGetMsg();
|
|
471
|
-
return this.pinMessage(chatId, messageId, { ...params, businessConnectionId });
|
|
486
|
+
pin(params) {
|
|
487
|
+
const { chatId, messageId, businessConnectionId } = mustGetMsg(this);
|
|
488
|
+
return this.client.pinMessage(chatId, messageId, { ...params, businessConnectionId });
|
|
472
489
|
},
|
|
473
|
-
unpin
|
|
474
|
-
const { chatId, messageId, businessConnectionId } = mustGetMsg();
|
|
475
|
-
return this.unpinMessage(chatId, messageId, { businessConnectionId });
|
|
490
|
+
unpin() {
|
|
491
|
+
const { chatId, messageId, businessConnectionId } = mustGetMsg(this);
|
|
492
|
+
return this.client.unpinMessage(chatId, messageId, { businessConnectionId });
|
|
476
493
|
},
|
|
477
|
-
banSender
|
|
478
|
-
const { chatId, senderId } = mustGetMsg();
|
|
494
|
+
banSender(params) {
|
|
495
|
+
const { chatId, senderId } = mustGetMsg(this);
|
|
479
496
|
if (!senderId) {
|
|
480
497
|
(0, _0_deps_js_1.unreachable)();
|
|
481
498
|
}
|
|
482
|
-
return this.banChatMember(chatId, senderId, params);
|
|
499
|
+
return this.client.banChatMember(chatId, senderId, params);
|
|
483
500
|
},
|
|
484
|
-
kickSender
|
|
485
|
-
const { chatId, senderId } = mustGetMsg();
|
|
501
|
+
kickSender() {
|
|
502
|
+
const { chatId, senderId } = mustGetMsg(this);
|
|
486
503
|
if (!senderId) {
|
|
487
504
|
(0, _0_deps_js_1.unreachable)();
|
|
488
505
|
}
|
|
489
|
-
return this.kickChatMember(chatId, senderId);
|
|
506
|
+
return this.client.kickChatMember(chatId, senderId);
|
|
490
507
|
},
|
|
491
|
-
setSenderRights
|
|
492
|
-
const { chatId, senderId } = mustGetMsg();
|
|
508
|
+
setSenderRights(params) {
|
|
509
|
+
const { chatId, senderId } = mustGetMsg(this);
|
|
493
510
|
if (!senderId) {
|
|
494
511
|
(0, _0_deps_js_1.unreachable)();
|
|
495
512
|
}
|
|
496
|
-
return this.setChatMemberRights(chatId, senderId, params);
|
|
513
|
+
return this.client.setChatMemberRights(chatId, senderId, params);
|
|
497
514
|
},
|
|
498
|
-
getChatAdministrators
|
|
499
|
-
const { chatId } = mustGetMsg();
|
|
500
|
-
return this.getChatAdministrators(chatId);
|
|
515
|
+
getChatAdministrators() {
|
|
516
|
+
const { chatId } = mustGetMsg(this);
|
|
517
|
+
return this.client.getChatAdministrators(chatId);
|
|
501
518
|
},
|
|
502
|
-
react
|
|
503
|
-
const { chatId, messageId } = mustGetMsg();
|
|
504
|
-
return this.setReactions(chatId, messageId, reactions, params);
|
|
519
|
+
react(reactions, params) {
|
|
520
|
+
const { chatId, messageId } = mustGetMsg(this);
|
|
521
|
+
return this.client.setReactions(chatId, messageId, reactions, params);
|
|
505
522
|
},
|
|
506
|
-
answerCallbackQuery
|
|
523
|
+
answerCallbackQuery(params) {
|
|
507
524
|
if (!("callbackQuery" in update)) {
|
|
508
525
|
(0, _0_deps_js_1.unreachable)();
|
|
509
526
|
}
|
|
510
|
-
return this.answerCallbackQuery(update.callbackQuery.id, params);
|
|
527
|
+
return this.client.answerCallbackQuery(update.callbackQuery.id, params);
|
|
511
528
|
},
|
|
512
|
-
answerInlineQuery
|
|
529
|
+
answerInlineQuery(results, params) {
|
|
513
530
|
if (!("inlineQuery" in update)) {
|
|
514
531
|
(0, _0_deps_js_1.unreachable)();
|
|
515
532
|
}
|
|
516
|
-
return this.answerInlineQuery(update.inlineQuery.id, results, params);
|
|
533
|
+
return this.client.answerInlineQuery(update.inlineQuery.id, results, params);
|
|
517
534
|
},
|
|
518
|
-
sendChatAction
|
|
519
|
-
const { chatId } = mustGetMsg();
|
|
520
|
-
return this.sendChatAction(chatId, chatAction, params);
|
|
535
|
+
sendChatAction(chatAction, params) {
|
|
536
|
+
const { chatId } = mustGetMsg(this);
|
|
537
|
+
return this.client.sendChatAction(chatId, chatAction, params);
|
|
521
538
|
},
|
|
522
|
-
editInlineMessageText
|
|
539
|
+
editInlineMessageText(text, params) {
|
|
523
540
|
const inlineMessageId = mustGetInlineMsgId();
|
|
524
|
-
return this.editInlineMessageText(inlineMessageId, text, params);
|
|
541
|
+
return this.client.editInlineMessageText(inlineMessageId, text, params);
|
|
525
542
|
},
|
|
526
|
-
editInlineMessageMedia
|
|
543
|
+
editInlineMessageMedia(media, params) {
|
|
527
544
|
const inlineMessageId = mustGetInlineMsgId();
|
|
528
|
-
return this.editInlineMessageMedia(inlineMessageId, media, params);
|
|
545
|
+
return this.client.editInlineMessageMedia(inlineMessageId, media, params);
|
|
529
546
|
},
|
|
530
|
-
editInlineMessageCaption
|
|
547
|
+
editInlineMessageCaption(params) {
|
|
531
548
|
const inlineMessageId = mustGetInlineMsgId();
|
|
532
|
-
return this.editInlineMessageCaption(inlineMessageId, params);
|
|
549
|
+
return this.client.editInlineMessageCaption(inlineMessageId, params);
|
|
533
550
|
},
|
|
534
|
-
editInlineMessageLiveLocation
|
|
551
|
+
editInlineMessageLiveLocation(latitude, longitude, params) {
|
|
535
552
|
const inlineMessageId = mustGetInlineMsgId();
|
|
536
|
-
return this.editInlineMessageLiveLocation(inlineMessageId, latitude, longitude, params);
|
|
553
|
+
return this.client.editInlineMessageLiveLocation(inlineMessageId, latitude, longitude, params);
|
|
537
554
|
},
|
|
538
|
-
editInlineMessageReplyMarkup
|
|
555
|
+
editInlineMessageReplyMarkup(params) {
|
|
539
556
|
const inlineMessageId = mustGetInlineMsgId();
|
|
540
|
-
return this.editInlineMessageReplyMarkup(inlineMessageId, params);
|
|
557
|
+
return this.client.editInlineMessageReplyMarkup(inlineMessageId, params);
|
|
541
558
|
},
|
|
542
|
-
editMessageText
|
|
543
|
-
const { chatId } = mustGetMsg();
|
|
544
|
-
return this.editMessageText(chatId, messageId, text, params);
|
|
559
|
+
editMessageText(messageId, text, params) {
|
|
560
|
+
const { chatId } = mustGetMsg(this);
|
|
561
|
+
return this.client.editMessageText(chatId, messageId, text, params);
|
|
545
562
|
},
|
|
546
|
-
editMessageCaption
|
|
547
|
-
const { chatId } = mustGetMsg();
|
|
548
|
-
return this.editMessageCaption(chatId, messageId, params);
|
|
563
|
+
editMessageCaption(messageId, params) {
|
|
564
|
+
const { chatId } = mustGetMsg(this);
|
|
565
|
+
return this.client.editMessageCaption(chatId, messageId, params);
|
|
549
566
|
},
|
|
550
|
-
editMessageMedia
|
|
551
|
-
const { chatId } = mustGetMsg();
|
|
552
|
-
return this.editMessageMedia(chatId, messageId, media, params);
|
|
567
|
+
editMessageMedia(messageId, media, params) {
|
|
568
|
+
const { chatId } = mustGetMsg(this);
|
|
569
|
+
return this.client.editMessageMedia(chatId, messageId, media, params);
|
|
553
570
|
},
|
|
554
|
-
editMessageLiveLocation
|
|
555
|
-
const { chatId } = mustGetMsg();
|
|
556
|
-
return this.editMessageLiveLocation(chatId, messageId, latitude, longitude, params);
|
|
571
|
+
editMessageLiveLocation(messageId, latitude, longitude, params) {
|
|
572
|
+
const { chatId } = mustGetMsg(this);
|
|
573
|
+
return this.client.editMessageLiveLocation(chatId, messageId, latitude, longitude, params);
|
|
557
574
|
},
|
|
558
|
-
editMessageReplyMarkup
|
|
559
|
-
const { chatId } = mustGetMsg();
|
|
560
|
-
return this.editMessageReplyMarkup(chatId, messageId, params);
|
|
575
|
+
editMessageReplyMarkup(messageId, params) {
|
|
576
|
+
const { chatId } = mustGetMsg(this);
|
|
577
|
+
return this.client.editMessageReplyMarkup(chatId, messageId, params);
|
|
561
578
|
},
|
|
562
|
-
getMessage
|
|
563
|
-
const { chatId } = mustGetMsg();
|
|
564
|
-
return this.getMessage(chatId, messageId);
|
|
579
|
+
getMessage(messageId) {
|
|
580
|
+
const { chatId } = mustGetMsg(this);
|
|
581
|
+
return this.client.getMessage(chatId, messageId);
|
|
565
582
|
},
|
|
566
|
-
getMessages
|
|
567
|
-
const { chatId } = mustGetMsg();
|
|
568
|
-
return this.getMessages(chatId, messageIds);
|
|
583
|
+
getMessages(messageIds) {
|
|
584
|
+
const { chatId } = mustGetMsg(this);
|
|
585
|
+
return this.client.getMessages(chatId, messageIds);
|
|
569
586
|
},
|
|
570
|
-
forwardMessage
|
|
571
|
-
const { chatId } = mustGetMsg();
|
|
572
|
-
return this.forwardMessage(chatId, to, messageId, params);
|
|
587
|
+
forwardMessage(to, messageId, params) {
|
|
588
|
+
const { chatId } = mustGetMsg(this);
|
|
589
|
+
return this.client.forwardMessage(chatId, to, messageId, params);
|
|
573
590
|
},
|
|
574
|
-
forwardMessages
|
|
575
|
-
const { chatId } = mustGetMsg();
|
|
576
|
-
return this.forwardMessages(chatId, to, messageIds, params);
|
|
591
|
+
forwardMessages(to, messageIds, params) {
|
|
592
|
+
const { chatId } = mustGetMsg(this);
|
|
593
|
+
return this.client.forwardMessages(chatId, to, messageIds, params);
|
|
577
594
|
},
|
|
578
|
-
deleteMessage
|
|
579
|
-
const { chatId } = mustGetMsg();
|
|
580
|
-
return this.deleteMessage(chatId, messageId, params);
|
|
595
|
+
deleteMessage(messageId, params) {
|
|
596
|
+
const { chatId } = mustGetMsg(this);
|
|
597
|
+
return this.client.deleteMessage(chatId, messageId, params);
|
|
581
598
|
},
|
|
582
|
-
deleteMessages
|
|
583
|
-
const { chatId } = mustGetMsg();
|
|
584
|
-
return this.deleteMessages(chatId, messageIds, params);
|
|
599
|
+
deleteMessages(messageIds, params) {
|
|
600
|
+
const { chatId } = mustGetMsg(this);
|
|
601
|
+
return this.client.deleteMessages(chatId, messageIds, params);
|
|
585
602
|
},
|
|
586
|
-
pinMessage
|
|
587
|
-
const { chatId } = mustGetMsg();
|
|
588
|
-
return this.pinMessage(chatId, messageId, params);
|
|
603
|
+
pinMessage(messageId, params) {
|
|
604
|
+
const { chatId } = mustGetMsg(this);
|
|
605
|
+
return this.client.pinMessage(chatId, messageId, params);
|
|
589
606
|
},
|
|
590
|
-
unpinMessage
|
|
591
|
-
const { chatId } = mustGetMsg();
|
|
592
|
-
return this.unpinMessage(chatId, messageId);
|
|
607
|
+
unpinMessage(messageId) {
|
|
608
|
+
const { chatId } = mustGetMsg(this);
|
|
609
|
+
return this.client.unpinMessage(chatId, messageId);
|
|
593
610
|
},
|
|
594
|
-
unpinMessages
|
|
595
|
-
const { chatId } = mustGetMsg();
|
|
596
|
-
return this.unpinMessages(chatId);
|
|
611
|
+
unpinMessages() {
|
|
612
|
+
const { chatId } = mustGetMsg(this);
|
|
613
|
+
return this.client.unpinMessages(chatId);
|
|
597
614
|
},
|
|
598
|
-
setAvailableReactions
|
|
599
|
-
const { chatId } = mustGetMsg();
|
|
600
|
-
return this.setAvailableReactions(chatId, availableReactions);
|
|
615
|
+
setAvailableReactions(availableReactions) {
|
|
616
|
+
const { chatId } = mustGetMsg(this);
|
|
617
|
+
return this.client.setAvailableReactions(chatId, availableReactions);
|
|
601
618
|
},
|
|
602
|
-
addReaction
|
|
603
|
-
const { chatId } = mustGetMsg();
|
|
604
|
-
return this.addReaction(chatId, messageId, reaction, params);
|
|
619
|
+
addReaction(messageId, reaction, params) {
|
|
620
|
+
const { chatId } = mustGetMsg(this);
|
|
621
|
+
return this.client.addReaction(chatId, messageId, reaction, params);
|
|
605
622
|
},
|
|
606
|
-
removeReaction
|
|
607
|
-
const { chatId } = mustGetMsg();
|
|
608
|
-
return this.removeReaction(chatId, messageId, reaction);
|
|
623
|
+
removeReaction(messageId, reaction) {
|
|
624
|
+
const { chatId } = mustGetMsg(this);
|
|
625
|
+
return this.client.removeReaction(chatId, messageId, reaction);
|
|
609
626
|
},
|
|
610
|
-
setReactions
|
|
611
|
-
const { chatId } = mustGetMsg();
|
|
612
|
-
return this.setReactions(chatId, messageId, reactions, params);
|
|
627
|
+
setReactions(messageId, reactions, params) {
|
|
628
|
+
const { chatId } = mustGetMsg(this);
|
|
629
|
+
return this.client.setReactions(chatId, messageId, reactions, params);
|
|
613
630
|
},
|
|
614
|
-
read
|
|
615
|
-
const { chatId, messageId } = mustGetMsg();
|
|
616
|
-
return this.readMessages(chatId, messageId);
|
|
631
|
+
read() {
|
|
632
|
+
const { chatId, messageId } = mustGetMsg(this);
|
|
633
|
+
return this.client.readMessages(chatId, messageId);
|
|
617
634
|
},
|
|
618
|
-
setChatPhoto
|
|
619
|
-
const { chatId } = mustGetMsg();
|
|
620
|
-
return this.setChatPhoto(chatId, photo, params);
|
|
635
|
+
setChatPhoto(photo, params) {
|
|
636
|
+
const { chatId } = mustGetMsg(this);
|
|
637
|
+
return this.client.setChatPhoto(chatId, photo, params);
|
|
621
638
|
},
|
|
622
|
-
deleteChatPhoto
|
|
623
|
-
const { chatId } = mustGetMsg();
|
|
624
|
-
return this.deleteChatPhoto(chatId);
|
|
639
|
+
deleteChatPhoto() {
|
|
640
|
+
const { chatId } = mustGetMsg(this);
|
|
641
|
+
return this.client.deleteChatPhoto(chatId);
|
|
625
642
|
},
|
|
626
|
-
banChatMember
|
|
627
|
-
const { chatId } = mustGetMsg();
|
|
628
|
-
return this.banChatMember(chatId, memberId, params);
|
|
643
|
+
banChatMember(memberId, params) {
|
|
644
|
+
const { chatId } = mustGetMsg(this);
|
|
645
|
+
return this.client.banChatMember(chatId, memberId, params);
|
|
629
646
|
},
|
|
630
|
-
unbanChatMember
|
|
631
|
-
const { chatId } = mustGetMsg();
|
|
632
|
-
return this.unbanChatMember(chatId, memberId);
|
|
647
|
+
unbanChatMember(memberId) {
|
|
648
|
+
const { chatId } = mustGetMsg(this);
|
|
649
|
+
return this.client.unbanChatMember(chatId, memberId);
|
|
633
650
|
},
|
|
634
|
-
kickChatMember
|
|
635
|
-
const { chatId } = mustGetMsg();
|
|
636
|
-
return this.kickChatMember(chatId, memberId);
|
|
651
|
+
kickChatMember(memberId) {
|
|
652
|
+
const { chatId } = mustGetMsg(this);
|
|
653
|
+
return this.client.kickChatMember(chatId, memberId);
|
|
637
654
|
},
|
|
638
|
-
setChatMemberRights
|
|
639
|
-
const { chatId } = mustGetMsg();
|
|
640
|
-
return this.setChatMemberRights(chatId, memberId, params);
|
|
655
|
+
setChatMemberRights(memberId, params) {
|
|
656
|
+
const { chatId } = mustGetMsg(this);
|
|
657
|
+
return this.client.setChatMemberRights(chatId, memberId, params);
|
|
641
658
|
},
|
|
642
|
-
deleteChatMemberMessages
|
|
643
|
-
const { chatId } = mustGetMsg();
|
|
644
|
-
return this.deleteChatMemberMessages(chatId, userId);
|
|
659
|
+
deleteChatMemberMessages(userId) {
|
|
660
|
+
const { chatId } = mustGetMsg(this);
|
|
661
|
+
return this.client.deleteChatMemberMessages(chatId, userId);
|
|
645
662
|
},
|
|
646
|
-
searchMessages
|
|
647
|
-
const { chatId } = mustGetMsg();
|
|
663
|
+
searchMessages(params) {
|
|
664
|
+
const { chatId } = mustGetMsg(this);
|
|
648
665
|
params ??= {};
|
|
649
666
|
params.chatId = chatId;
|
|
650
|
-
return this.searchMessages(params);
|
|
667
|
+
return this.client.searchMessages(params);
|
|
651
668
|
},
|
|
652
|
-
setBoostsRequiredToCircumventRestrictions
|
|
653
|
-
const { chatId } = mustGetMsg();
|
|
654
|
-
return this.setBoostsRequiredToCircumventRestrictions(chatId, boosts);
|
|
669
|
+
setBoostsRequiredToCircumventRestrictions(boosts) {
|
|
670
|
+
const { chatId } = mustGetMsg(this);
|
|
671
|
+
return this.client.setBoostsRequiredToCircumventRestrictions(chatId, boosts);
|
|
655
672
|
},
|
|
656
|
-
createInviteLink
|
|
657
|
-
const { chatId } = mustGetMsg();
|
|
658
|
-
return this.createInviteLink(chatId, params);
|
|
673
|
+
createInviteLink(params) {
|
|
674
|
+
const { chatId } = mustGetMsg(this);
|
|
675
|
+
return this.client.createInviteLink(chatId, params);
|
|
659
676
|
},
|
|
660
|
-
getCreatedInviteLinks
|
|
661
|
-
const { chatId } = mustGetMsg();
|
|
662
|
-
return this.getCreatedInviteLinks(chatId, params);
|
|
677
|
+
getCreatedInviteLinks(params) {
|
|
678
|
+
const { chatId } = mustGetMsg(this);
|
|
679
|
+
return this.client.getCreatedInviteLinks(chatId, params);
|
|
663
680
|
},
|
|
664
|
-
leave
|
|
665
|
-
const { chatId } = mustGetMsg();
|
|
666
|
-
return this.leaveChat(chatId);
|
|
681
|
+
leave() {
|
|
682
|
+
const { chatId } = mustGetMsg(this);
|
|
683
|
+
return this.client.leaveChat(chatId);
|
|
667
684
|
},
|
|
668
|
-
block
|
|
669
|
-
return this.blockUser(mustGetUserId());
|
|
685
|
+
block() {
|
|
686
|
+
return this.client.blockUser(mustGetUserId(this));
|
|
670
687
|
},
|
|
671
|
-
unblock
|
|
672
|
-
return this.unblockUser(mustGetUserId());
|
|
688
|
+
unblock() {
|
|
689
|
+
return this.client.unblockUser(mustGetUserId(this));
|
|
673
690
|
},
|
|
674
|
-
getChatMember
|
|
675
|
-
const { chatId } = mustGetMsg();
|
|
676
|
-
return this.getChatMember(chatId, userId);
|
|
691
|
+
getChatMember(userId) {
|
|
692
|
+
const { chatId } = mustGetMsg(this);
|
|
693
|
+
return this.client.getChatMember(chatId, userId);
|
|
677
694
|
},
|
|
678
|
-
getChatMembers
|
|
679
|
-
const { chatId } = mustGetMsg();
|
|
680
|
-
return this.getChatMembers(chatId, params);
|
|
695
|
+
getChatMembers(params) {
|
|
696
|
+
const { chatId } = mustGetMsg(this);
|
|
697
|
+
return this.client.getChatMembers(chatId, params);
|
|
681
698
|
},
|
|
682
|
-
setChatStickerSet
|
|
683
|
-
const { chatId } = mustGetMsg();
|
|
684
|
-
return this.setChatStickerSet(chatId, setName);
|
|
699
|
+
setChatStickerSet(setName) {
|
|
700
|
+
const { chatId } = mustGetMsg(this);
|
|
701
|
+
return this.client.setChatStickerSet(chatId, setName);
|
|
685
702
|
},
|
|
686
|
-
deleteChatStickerSet
|
|
687
|
-
const { chatId } = mustGetMsg();
|
|
688
|
-
return this.deleteChatStickerSet(chatId);
|
|
703
|
+
deleteChatStickerSet() {
|
|
704
|
+
const { chatId } = mustGetMsg(this);
|
|
705
|
+
return this.client.deleteChatStickerSet(chatId);
|
|
689
706
|
},
|
|
690
|
-
getBusinessConnection
|
|
691
|
-
const { businessConnectionId } = mustGetMsg();
|
|
707
|
+
getBusinessConnection() {
|
|
708
|
+
const { businessConnectionId } = mustGetMsg(this);
|
|
692
709
|
if (!businessConnectionId) {
|
|
693
710
|
(0, _0_deps_js_1.unreachable)();
|
|
694
711
|
}
|
|
695
|
-
return this.getBusinessConnection(businessConnectionId);
|
|
712
|
+
return this.client.getBusinessConnection(businessConnectionId);
|
|
696
713
|
},
|
|
697
|
-
answerPreCheckoutQuery
|
|
714
|
+
answerPreCheckoutQuery(ok, params) {
|
|
698
715
|
if (!("preCheckoutQuery" in update)) {
|
|
699
716
|
(0, _0_deps_js_1.unreachable)();
|
|
700
717
|
}
|
|
701
|
-
return this.answerPreCheckoutQuery(update.preCheckoutQuery.id, ok, params);
|
|
718
|
+
return this.client.answerPreCheckoutQuery(update.preCheckoutQuery.id, ok, params);
|
|
702
719
|
},
|
|
703
|
-
approveJoinRequest
|
|
704
|
-
const { chatId, userId } = mustGetMsg();
|
|
720
|
+
approveJoinRequest() {
|
|
721
|
+
const { chatId, userId } = mustGetMsg(this);
|
|
705
722
|
if (!userId) {
|
|
706
723
|
(0, _0_deps_js_1.unreachable)();
|
|
707
724
|
}
|
|
708
|
-
return this.approveJoinRequest(chatId, userId);
|
|
725
|
+
return this.client.approveJoinRequest(chatId, userId);
|
|
709
726
|
},
|
|
710
|
-
declineJoinRequest
|
|
711
|
-
const { chatId, userId } = mustGetMsg();
|
|
727
|
+
declineJoinRequest() {
|
|
728
|
+
const { chatId, userId } = mustGetMsg(this);
|
|
712
729
|
if (!userId) {
|
|
713
730
|
(0, _0_deps_js_1.unreachable)();
|
|
714
731
|
}
|
|
715
|
-
return this.declineJoinRequest(chatId, userId);
|
|
732
|
+
return this.client.declineJoinRequest(chatId, userId);
|
|
716
733
|
},
|
|
717
734
|
};
|
|
718
735
|
return (0, _1_utilities_js_1.cleanObject)(context);
|
|
@@ -734,6 +751,7 @@ class Client extends Composer {
|
|
|
734
751
|
await this.storage.initialize();
|
|
735
752
|
if (!this.#guaranteeUpdateDelivery) {
|
|
736
753
|
await this.storage.deleteUpdates();
|
|
754
|
+
await this.storage.commit(true);
|
|
737
755
|
}
|
|
738
756
|
this.#storageInited = true;
|
|
739
757
|
}
|
|
@@ -754,28 +772,39 @@ class Client extends Composer {
|
|
|
754
772
|
if (this.#authString && !this.#authStringImported) {
|
|
755
773
|
await this.importAuthString(this.#authString);
|
|
756
774
|
}
|
|
757
|
-
const
|
|
758
|
-
if (authKey !== null && dc !== null) {
|
|
759
|
-
if (!this.#client || this.#client.dc !== dc) {
|
|
775
|
+
const auth = this.storage.auth.mustGet();
|
|
776
|
+
if (auth.authKey !== null && auth.dc !== null) {
|
|
777
|
+
if (!this.#client || this.#client.dc !== auth.dc) {
|
|
760
778
|
this.#client?.disconnect();
|
|
761
|
-
this.#setMainClient(this.#newClient(dc, true, false));
|
|
779
|
+
this.#setMainClient(this.#newClient(auth.dc, true, false));
|
|
762
780
|
}
|
|
763
|
-
await this.#client.setAuthKey(authKey);
|
|
781
|
+
await this.#client.setAuthKey(auth.authKey);
|
|
764
782
|
if (this.#client.serverSalt === 0n) {
|
|
765
783
|
this.#client.serverSalt = await this.storage.getServerSalt() ?? 0n;
|
|
766
784
|
}
|
|
767
785
|
}
|
|
768
786
|
else {
|
|
769
|
-
const dc =
|
|
787
|
+
const dc = auth.dc ?? this.#initialDc;
|
|
770
788
|
if (!this.#client || this.#client.dc !== dc) {
|
|
771
789
|
this.#client?.disconnect();
|
|
772
790
|
this.#setMainClient(this.#newClient(dc, true, false));
|
|
773
791
|
}
|
|
774
792
|
}
|
|
775
793
|
await this.#client.connect();
|
|
776
|
-
await
|
|
777
|
-
|
|
778
|
-
|
|
794
|
+
await this.storage.auth.update((v) => {
|
|
795
|
+
v.authKey = this.#client.authKey;
|
|
796
|
+
v.dc = this.#client.dc;
|
|
797
|
+
});
|
|
798
|
+
await this.storage.setServerSalt(this.#client.serverSalt);
|
|
799
|
+
this.#updateGapRecoveryLoop.start();
|
|
800
|
+
this.#clientDisconnectionLoop.start();
|
|
801
|
+
if (!this.#messageStorage_.isMemory) {
|
|
802
|
+
this.#storageWriteLoop.start();
|
|
803
|
+
}
|
|
804
|
+
else {
|
|
805
|
+
this.#L.debug("not starting storageWriteLoop");
|
|
806
|
+
}
|
|
807
|
+
await this.storage.commit(true);
|
|
779
808
|
}
|
|
780
809
|
finally {
|
|
781
810
|
unlock();
|
|
@@ -787,16 +816,20 @@ class Client extends Composer {
|
|
|
787
816
|
newDc += "-test";
|
|
788
817
|
}
|
|
789
818
|
this.disconnect();
|
|
790
|
-
await this.storage.
|
|
791
|
-
|
|
819
|
+
await this.storage.auth.update((v) => {
|
|
820
|
+
v.authKey = null;
|
|
821
|
+
v.dc = newDc;
|
|
822
|
+
});
|
|
792
823
|
await this.connect();
|
|
793
824
|
this.#LhandleMigrationError.debug(`migrated to DC${newDc}`);
|
|
794
825
|
}
|
|
795
|
-
disconnect() {
|
|
826
|
+
async disconnect() {
|
|
796
827
|
this.#disconnectAllClients();
|
|
797
|
-
this.#
|
|
798
|
-
this.#
|
|
828
|
+
this.#clientDisconnectionLoop.abort();
|
|
829
|
+
this.#updateGapRecoveryLoop.abort();
|
|
830
|
+
this.#storageWriteLoop.abort();
|
|
799
831
|
this.#updateManager.closeAllChats();
|
|
832
|
+
await this.messageStorage.commit(true);
|
|
800
833
|
}
|
|
801
834
|
#lastPropagatedAuthorizationState = null;
|
|
802
835
|
async #propagateAuthorizationState(authorized) {
|
|
@@ -820,68 +853,50 @@ class Client extends Composer {
|
|
|
820
853
|
return this.#lastGetMe?.isPremium ?? false;
|
|
821
854
|
}
|
|
822
855
|
#lastUpdates = new Date();
|
|
823
|
-
#
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
this.#updateGapRecoveryLoopAbortController?.abort();
|
|
829
|
-
const controller = this.#updateGapRecoveryLoopAbortController = new AbortController();
|
|
830
|
-
while (this.connected) {
|
|
831
|
-
try {
|
|
832
|
-
await (0, _0_deps_js_1.delay)(60 * _0_deps_js_1.SECOND, { signal: controller.signal });
|
|
833
|
-
if (!this.connected) {
|
|
834
|
-
break;
|
|
835
|
-
}
|
|
836
|
-
controller.signal.throwIfAborted();
|
|
837
|
-
if (Date.now() - this.#lastUpdates.getTime() >= 15 * _0_deps_js_1.MINUTE) {
|
|
838
|
-
(0, _1_utilities_js_1.drop)(this.#updateManager.recoverUpdateGap("lastUpdates").then(() => {
|
|
839
|
-
this.#lastUpdates = new Date();
|
|
840
|
-
}));
|
|
841
|
-
}
|
|
842
|
-
}
|
|
843
|
-
catch (err) {
|
|
844
|
-
if (err instanceof DOMException && err.name === "AbortError") {
|
|
845
|
-
break;
|
|
846
|
-
}
|
|
847
|
-
else if (!this.connected) {
|
|
848
|
-
break;
|
|
849
|
-
}
|
|
850
|
-
this.#LupdateGapRecoveryLoop.error(err);
|
|
851
|
-
}
|
|
856
|
+
#updateGapRecoveryLoop = new _0_abortable_loop_js_1.AbortableLoop(async (loop, signal) => {
|
|
857
|
+
await (0, _0_deps_js_1.delay)(60 * _0_deps_js_1.SECOND, { signal });
|
|
858
|
+
if (!this.connected) {
|
|
859
|
+
loop.abort();
|
|
860
|
+
return;
|
|
852
861
|
}
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
break;
|
|
878
|
-
}
|
|
879
|
-
else if (!this.connected) {
|
|
880
|
-
break;
|
|
881
|
-
}
|
|
862
|
+
if (Date.now() - this.#lastUpdates.getTime() >= 15 * _0_deps_js_1.MINUTE) {
|
|
863
|
+
(0, _1_utilities_js_1.drop)(this.#updateManager.recoverUpdateGap("lastUpdates").then(() => {
|
|
864
|
+
this.#lastUpdates = new Date();
|
|
865
|
+
}));
|
|
866
|
+
}
|
|
867
|
+
}, (loop, err) => {
|
|
868
|
+
if (!this.connected) {
|
|
869
|
+
loop.abort();
|
|
870
|
+
}
|
|
871
|
+
else {
|
|
872
|
+
this.#LupdateGapRecoveryLoop.error(err);
|
|
873
|
+
}
|
|
874
|
+
});
|
|
875
|
+
#clientDisconnectionLoop = new _0_abortable_loop_js_1.AbortableLoop(async (loop, signal) => {
|
|
876
|
+
await (0, _0_deps_js_1.delay)(60 * _0_deps_js_1.SECOND, { signal });
|
|
877
|
+
if (!this.connected) {
|
|
878
|
+
loop.abort();
|
|
879
|
+
return;
|
|
880
|
+
}
|
|
881
|
+
const now = Date.now();
|
|
882
|
+
const disconnectAfter = 5 * _0_deps_js_1.MINUTE;
|
|
883
|
+
for (const [i, client] of this.#clients.entries()) {
|
|
884
|
+
if (i > 0 && !client.disconnected && client.lastRequest && now - client.lastRequest.getTime() >= disconnectAfter) {
|
|
885
|
+
client?.disconnect();
|
|
882
886
|
}
|
|
883
887
|
}
|
|
884
|
-
}
|
|
888
|
+
}, (loop) => {
|
|
889
|
+
if (!this.connected) {
|
|
890
|
+
loop.abort();
|
|
891
|
+
}
|
|
892
|
+
});
|
|
893
|
+
#storageWriteLoop = new _0_abortable_loop_js_1.AbortableLoop(async (_loop, signal) => {
|
|
894
|
+
await (0, _0_deps_js_1.delay)(60 * _0_deps_js_1.SECOND, { signal });
|
|
895
|
+
await this.messageStorage.commit();
|
|
896
|
+
await this.storage.commit();
|
|
897
|
+
}, (err) => {
|
|
898
|
+
this.#LstorageWriteLoop.error(err);
|
|
899
|
+
});
|
|
885
900
|
/**
|
|
886
901
|
* Signs in using the provided parameters if not already signed in.
|
|
887
902
|
* If no parameters are provided, the credentials will be prompted in runtime.
|
|
@@ -923,8 +938,11 @@ class Client extends Composer {
|
|
|
923
938
|
while (true) {
|
|
924
939
|
try {
|
|
925
940
|
const auth = await this.invoke({ _: "auth.importBotAuthorization", api_id: this.#apiId, api_hash: this.#apiHash, bot_auth_token: params.botToken, flags: 0 });
|
|
926
|
-
await this.storage.
|
|
927
|
-
|
|
941
|
+
await this.storage.auth.update((v) => {
|
|
942
|
+
v.userId = Number(_2_tl_js_1.Api.as("auth.authorization", auth).user.id);
|
|
943
|
+
v.isBot = true;
|
|
944
|
+
});
|
|
945
|
+
await this.storage.commit(true);
|
|
928
946
|
break;
|
|
929
947
|
}
|
|
930
948
|
catch (err) {
|
|
@@ -990,8 +1008,10 @@ class Client extends Composer {
|
|
|
990
1008
|
phone_code: code,
|
|
991
1009
|
phone_code_hash: sentCode.phone_code_hash,
|
|
992
1010
|
});
|
|
993
|
-
await this.storage.
|
|
994
|
-
|
|
1011
|
+
await this.storage.auth.update((v) => {
|
|
1012
|
+
v.userId = Number(_2_tl_js_1.Api.as("auth.authorization", auth).user.id);
|
|
1013
|
+
v.isBot = false;
|
|
1014
|
+
});
|
|
995
1015
|
this.#LsignIn.debug("signed in as user");
|
|
996
1016
|
await this.#propagateAuthorizationState(true);
|
|
997
1017
|
await this.#updateManager.fetchState("signIn");
|
|
@@ -1019,8 +1039,11 @@ class Client extends Composer {
|
|
|
1019
1039
|
const password = typeof params.password === "string" ? params.password : await params.password(ap.hint ?? null);
|
|
1020
1040
|
const input = await (0, _0_password_js_1.checkPassword)(password, ap);
|
|
1021
1041
|
const auth = await this.invoke({ _: "auth.checkPassword", password: input });
|
|
1022
|
-
await this.storage.
|
|
1023
|
-
|
|
1042
|
+
await this.storage.auth.update((v) => {
|
|
1043
|
+
v.userId = Number(_2_tl_js_1.Api.as("auth.authorization", auth).user.id);
|
|
1044
|
+
v.isBot = false;
|
|
1045
|
+
});
|
|
1046
|
+
await this.storage.commit(true);
|
|
1024
1047
|
this.#LsignIn.debug("signed in as user");
|
|
1025
1048
|
await this.#propagateAuthorizationState(true);
|
|
1026
1049
|
await this.#updateManager.fetchState("signIn");
|
|
@@ -1150,18 +1173,19 @@ class Client extends Composer {
|
|
|
1150
1173
|
async #setupClient(client) {
|
|
1151
1174
|
const storage = client.dc === this.#client.dc ? this.storage : new _0_storage_operations_js_1.StorageOperations(this.storage.provider.branch(client.dc + (client.cdn ? "_cdn" : "")));
|
|
1152
1175
|
await storage.initialize();
|
|
1153
|
-
const
|
|
1154
|
-
|
|
1155
|
-
|
|
1176
|
+
const auth = storage.auth.mustGet();
|
|
1177
|
+
const serverSalt = await storage.getServerSalt();
|
|
1178
|
+
if (auth.authKey !== null) {
|
|
1179
|
+
await client.setAuthKey(auth.authKey);
|
|
1156
1180
|
if (serverSalt) {
|
|
1157
1181
|
client.serverSalt = serverSalt;
|
|
1158
1182
|
}
|
|
1159
1183
|
}
|
|
1160
1184
|
await client.connect();
|
|
1161
|
-
if (
|
|
1185
|
+
if (auth.authKey === null) {
|
|
1162
1186
|
await this.#importAuthorization(client);
|
|
1163
1187
|
}
|
|
1164
|
-
await storage.
|
|
1188
|
+
await storage.auth.update((v) => v.authKey = client.authKey);
|
|
1165
1189
|
if (client.dc !== this.#client.dc) {
|
|
1166
1190
|
await storage.setServerSalt(client.serverSalt);
|
|
1167
1191
|
client.handlers.onNewServerSalt = async (serverSalt) => {
|
|
@@ -1171,9 +1195,10 @@ class Client extends Composer {
|
|
|
1171
1195
|
}
|
|
1172
1196
|
async #importAuthorization(client) {
|
|
1173
1197
|
if (this.#client.dc === client.dc && this.#client.cdn === client.cdn) {
|
|
1174
|
-
const
|
|
1175
|
-
|
|
1176
|
-
|
|
1198
|
+
const auth = this.storage.auth.mustGet();
|
|
1199
|
+
const serverSalt = await this.storage.getServerSalt();
|
|
1200
|
+
if (auth.authKey !== null) {
|
|
1201
|
+
await client.setAuthKey(auth.authKey);
|
|
1177
1202
|
if (serverSalt) {
|
|
1178
1203
|
client.serverSalt = serverSalt;
|
|
1179
1204
|
}
|
|
@@ -1259,23 +1284,17 @@ class Client extends Composer {
|
|
|
1259
1284
|
await this.storage.importAuthString(authString);
|
|
1260
1285
|
this.#authStringImported = true;
|
|
1261
1286
|
if (!this.#apiId) {
|
|
1262
|
-
this.#apiId =
|
|
1287
|
+
this.#apiId = this.storage.auth.mustGet().apiId;
|
|
1263
1288
|
}
|
|
1264
1289
|
}
|
|
1265
1290
|
async #getUserAccessHash(userId) {
|
|
1266
1291
|
const users = await this.invoke({ _: "users.getUsers", id: [{ _: "inputUser", user_id: userId, access_hash: 0n }] });
|
|
1267
1292
|
const user = _2_tl_js_1.Api.is("user", users[0]) ? users[0] : undefined;
|
|
1268
|
-
if (user) {
|
|
1269
|
-
await this.messageStorage.setEntity(user);
|
|
1270
|
-
}
|
|
1271
1293
|
return user?.access_hash ?? 0n;
|
|
1272
1294
|
}
|
|
1273
1295
|
async #getChannelAccessHash(channelId) {
|
|
1274
1296
|
const channels = await this.invoke({ _: "channels.getChannels", id: [{ _: "inputChannel", channel_id: channelId, access_hash: 0n }] });
|
|
1275
1297
|
const channel = _2_tl_js_1.Api.is("channel", channels.chats[0]) ? channels.chats[0] : undefined;
|
|
1276
|
-
if (channel) {
|
|
1277
|
-
await this.messageStorage.setEntity(channel);
|
|
1278
|
-
}
|
|
1279
1298
|
return channel?.access_hash ?? 0n;
|
|
1280
1299
|
}
|
|
1281
1300
|
/**
|
|
@@ -1288,7 +1307,7 @@ class Client extends Composer {
|
|
|
1288
1307
|
return { _: "inputPeerSelf" };
|
|
1289
1308
|
}
|
|
1290
1309
|
const inputPeer = await this.#getInputPeerInner(id);
|
|
1291
|
-
if (((_2_tl_js_1.Api.is("inputPeerUser", inputPeer) || _2_tl_js_1.Api.is("inputPeerChannel", inputPeer)) && inputPeer.access_hash === 0n) &&
|
|
1310
|
+
if (((_2_tl_js_1.Api.is("inputPeerUser", inputPeer) || _2_tl_js_1.Api.is("inputPeerChannel", inputPeer)) && inputPeer.access_hash === 0n) && this.storage.isBot) {
|
|
1292
1311
|
if ("channel_id" in inputPeer) {
|
|
1293
1312
|
inputPeer.access_hash = await this.#getChannelAccessHash(inputPeer.channel_id);
|
|
1294
1313
|
}
|
|
@@ -1345,7 +1364,7 @@ class Client extends Composer {
|
|
|
1345
1364
|
if (typeof id === "string") {
|
|
1346
1365
|
id = (0, _0_utilities_js_1.getUsername)(id);
|
|
1347
1366
|
let resolvedId = 0;
|
|
1348
|
-
const maybeUsername = await this.messageStorage.
|
|
1367
|
+
const maybeUsername = await this.messageStorage.usernames.get([id]);
|
|
1349
1368
|
if (maybeUsername !== null && Date.now() - maybeUsername[1].getTime() < _4_constants_js_1.USERNAME_TTL) {
|
|
1350
1369
|
const [id] = maybeUsername;
|
|
1351
1370
|
resolvedId = id;
|
|
@@ -1392,22 +1411,23 @@ class Client extends Composer {
|
|
|
1392
1411
|
throw new _0_errors_js_1.InputError("The ID is of an format unknown.");
|
|
1393
1412
|
}
|
|
1394
1413
|
if (!_2_tl_js_1.Api.is("inputPeerChat", peer) && !peer.access_hash) {
|
|
1395
|
-
|
|
1396
|
-
const
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
}
|
|
1414
|
+
// TODO
|
|
1415
|
+
// const chatId = Api.peerToChatId(peer);
|
|
1416
|
+
// const minPeerReference = await this.messageStorage.getLastMinPeerReference(chatId);
|
|
1417
|
+
// if (minPeerReference) {
|
|
1418
|
+
// const minInputPeer = await this.#getMinInputPeer(canBeInputChannel(peer) ? "channel" : "user", { ...minPeerReference, senderId: chatId });
|
|
1419
|
+
// if (minInputPeer) {
|
|
1420
|
+
// this.#Lmin.debug("resolved input min peer", minInputPeer);
|
|
1421
|
+
// peer = minInputPeer;
|
|
1422
|
+
// }
|
|
1423
|
+
// }
|
|
1404
1424
|
}
|
|
1405
1425
|
return peer;
|
|
1406
1426
|
}
|
|
1407
1427
|
async #getMinInputPeer(type, reference) {
|
|
1408
|
-
const
|
|
1409
|
-
if (
|
|
1410
|
-
const peer = { _: "inputPeerChannel", channel_id:
|
|
1428
|
+
const peer_ = await this.messageStorage.peers.get([reference.chatId]);
|
|
1429
|
+
if (peer_ !== null && (peer_[0].type === "channel" || peer_[0].type === "supergroup")) {
|
|
1430
|
+
const peer = { _: "inputPeerChannel", channel_id: BigInt(peer_[0].id), access_hash: peer_[1] };
|
|
1411
1431
|
if (type === "user") {
|
|
1412
1432
|
return { _: "inputPeerUserFromMessage", peer, msg_id: reference.messageId, user_id: _2_tl_js_1.Api.chatIdToPeerId(reference.senderId) };
|
|
1413
1433
|
}
|
|
@@ -1419,16 +1439,19 @@ class Client extends Composer {
|
|
|
1419
1439
|
return null;
|
|
1420
1440
|
}
|
|
1421
1441
|
}
|
|
1422
|
-
async [
|
|
1442
|
+
async [getPeer](peer) {
|
|
1423
1443
|
const id = _2_tl_js_1.Api.peerToChatId(peer);
|
|
1424
|
-
const entity = await this.messageStorage.
|
|
1425
|
-
if (entity === null &&
|
|
1444
|
+
const entity = await this.messageStorage.peers.get([id]);
|
|
1445
|
+
if (entity === null && this.storage.isBot && _2_tl_js_1.Api.is("peerUser", peer) || _2_tl_js_1.Api.is("peerChannel", peer)) {
|
|
1426
1446
|
await this.getInputPeer(id);
|
|
1427
1447
|
}
|
|
1428
1448
|
else {
|
|
1429
1449
|
return entity;
|
|
1430
1450
|
}
|
|
1431
|
-
return await this.messageStorage.
|
|
1451
|
+
return await this.messageStorage.peers.get([id]);
|
|
1452
|
+
}
|
|
1453
|
+
[mustGetPeer](peer) {
|
|
1454
|
+
return this.messageStorage.peers.mustGet([(0, _2_telegram_js_1.peerToChatId)(peer)]);
|
|
1432
1455
|
}
|
|
1433
1456
|
async #handleCtxUpdate(update) {
|
|
1434
1457
|
if (this.#disableUpdates && !("authorizationState" in update) && !("connectionState" in update)) {
|
|
@@ -1448,65 +1471,81 @@ class Client extends Composer {
|
|
|
1448
1471
|
});
|
|
1449
1472
|
}
|
|
1450
1473
|
async #handleUpdate(update) {
|
|
1451
|
-
const
|
|
1474
|
+
const maybePromises = new Array();
|
|
1452
1475
|
if (_2_tl_js_1.Api.is("updateUserName", update)) {
|
|
1453
|
-
|
|
1476
|
+
const value = [Number(update.user_id), new Date()];
|
|
1477
|
+
for (const username_ of update.usernames) {
|
|
1478
|
+
const username = username_.username.toLowerCase();
|
|
1479
|
+
this.messageStorage.usernames.set([username], value);
|
|
1480
|
+
}
|
|
1454
1481
|
const peer = { ...update, _: "peerUser" };
|
|
1455
|
-
const
|
|
1456
|
-
if (
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1482
|
+
const peer_ = await this[getPeer](peer);
|
|
1483
|
+
if (peer_ !== null) {
|
|
1484
|
+
const username = update.usernames[0];
|
|
1485
|
+
if (username !== undefined) {
|
|
1486
|
+
peer_[0].username = username.username;
|
|
1487
|
+
const also = update.usernames.filter((v) => v !== username);
|
|
1488
|
+
if (also.length) {
|
|
1489
|
+
peer_[0].also = also.map((v) => v.username);
|
|
1490
|
+
}
|
|
1491
|
+
else {
|
|
1492
|
+
delete peer_[0].also;
|
|
1493
|
+
}
|
|
1494
|
+
}
|
|
1495
|
+
else {
|
|
1496
|
+
delete peer_[0].username;
|
|
1497
|
+
}
|
|
1498
|
+
this.messageStorage.setPeer2(peer_[0], peer_[1]);
|
|
1461
1499
|
}
|
|
1462
1500
|
}
|
|
1463
1501
|
if (this.#messageManager.canHandleUpdate(update)) {
|
|
1464
|
-
|
|
1502
|
+
maybePromises.push(() => this.#messageManager.handleUpdate(update));
|
|
1465
1503
|
}
|
|
1466
1504
|
if (this.#chatManager.canHandleUpdate(update)) {
|
|
1467
|
-
|
|
1505
|
+
maybePromises.push(() => this.#chatManager.handleUpdate(update));
|
|
1468
1506
|
}
|
|
1469
1507
|
if (this.#pollManager.canHandleUpdate(update)) {
|
|
1470
|
-
|
|
1508
|
+
maybePromises.push(() => this.#pollManager.handleUpdate(update));
|
|
1471
1509
|
}
|
|
1472
1510
|
if (this.#videoChatManager.canHandleUpdate(update)) {
|
|
1473
|
-
|
|
1511
|
+
maybePromises.push(() => this.#videoChatManager.handleUpdate(update));
|
|
1474
1512
|
}
|
|
1475
1513
|
if (this.#callbackQueryManager.canHandleUpdate(update)) {
|
|
1476
|
-
|
|
1514
|
+
maybePromises.push(() => this.#callbackQueryManager.handleUpdate(update));
|
|
1477
1515
|
}
|
|
1478
1516
|
if (this.#inlineQueryManager.canHandleUpdate(update)) {
|
|
1479
|
-
|
|
1517
|
+
maybePromises.push(() => this.#inlineQueryManager.handleUpdate(update));
|
|
1480
1518
|
}
|
|
1481
1519
|
if (this.#linkPreviewManager.canHandleUpdate(update)) {
|
|
1482
|
-
|
|
1520
|
+
maybePromises.push(() => this.#linkPreviewManager.handleUpdate(update));
|
|
1483
1521
|
}
|
|
1484
1522
|
if (this.#reactionManager.canHandleUpdate(update)) {
|
|
1485
|
-
|
|
1523
|
+
maybePromises.push(() => this.#reactionManager.handleUpdate(update));
|
|
1486
1524
|
}
|
|
1487
1525
|
if (this.#chatListManager.canHandleUpdate(update)) {
|
|
1488
|
-
|
|
1526
|
+
maybePromises.push(() => this.#chatListManager.handleUpdate(update));
|
|
1489
1527
|
}
|
|
1490
1528
|
if (this.#storyManager.canHandleUpdate(update)) {
|
|
1491
|
-
|
|
1529
|
+
maybePromises.push(() => this.#storyManager.handleUpdate(update));
|
|
1492
1530
|
}
|
|
1493
1531
|
if (this.#businessConnectionManager.canHandleUpdate(update)) {
|
|
1494
|
-
|
|
1532
|
+
maybePromises.push(() => this.#businessConnectionManager.handleUpdate(update));
|
|
1495
1533
|
}
|
|
1496
1534
|
if (this.#storyManager.canHandleUpdate(update)) {
|
|
1497
|
-
|
|
1535
|
+
maybePromises.push(() => this.#storyManager.handleUpdate(update));
|
|
1498
1536
|
}
|
|
1499
1537
|
if (this.#paymentManager.canHandleUpdate(update)) {
|
|
1500
|
-
|
|
1538
|
+
maybePromises.push(() => this.#paymentManager.handleUpdate(update));
|
|
1501
1539
|
}
|
|
1502
1540
|
if (this.#translationsManager.canHandleUpdate(update)) {
|
|
1503
|
-
|
|
1541
|
+
maybePromises.push(() => this.#translationsManager.handleUpdate(update));
|
|
1504
1542
|
}
|
|
1505
1543
|
return () => Promise.resolve().then(async () => {
|
|
1506
|
-
const updates =
|
|
1507
|
-
for (const
|
|
1544
|
+
const updates = [{ update }];
|
|
1545
|
+
for (const maybePromise of maybePromises) {
|
|
1508
1546
|
try {
|
|
1509
|
-
const
|
|
1547
|
+
const value = maybePromise();
|
|
1548
|
+
const update = value instanceof Promise ? await value : value;
|
|
1510
1549
|
if (update) {
|
|
1511
1550
|
updates.push(update);
|
|
1512
1551
|
}
|
|
@@ -1523,7 +1562,6 @@ class Client extends Composer {
|
|
|
1523
1562
|
if ("deletedMessages" in update) {
|
|
1524
1563
|
for (const { chatId, messageId } of update.deletedMessages) {
|
|
1525
1564
|
await this.messageStorage.setMessage(chatId, messageId, null);
|
|
1526
|
-
await this.#chatListManager.reassignChatLastMessage(chatId);
|
|
1527
1565
|
}
|
|
1528
1566
|
}
|
|
1529
1567
|
}
|
|
@@ -1564,14 +1602,13 @@ class Client extends Composer {
|
|
|
1564
1602
|
* @method ac
|
|
1565
1603
|
*/
|
|
1566
1604
|
async getMe() {
|
|
1567
|
-
let
|
|
1568
|
-
if (
|
|
1605
|
+
let chatP = (await this[getPeer]({ _: "peerUser", user_id: BigInt(await this.#getSelfId()) }))?.[0] ?? null;
|
|
1606
|
+
if (chatP === null) {
|
|
1569
1607
|
const users = await this.invoke({ _: "users.getUsers", id: [{ _: "inputUserSelf" }] });
|
|
1570
|
-
|
|
1571
|
-
await this.
|
|
1572
|
-
await this.storage.setIsPremium(user_.premium ?? false);
|
|
1608
|
+
chatP = (0, _3_types_js_1.constructChatP)(_2_tl_js_1.Api.as("user", users[0]));
|
|
1609
|
+
await this.storage.setIsPremium(chatP.isPremium);
|
|
1573
1610
|
}
|
|
1574
|
-
const user = (0, _3_types_js_1.
|
|
1611
|
+
const user = (0, _3_types_js_1.constructUser2)(chatP);
|
|
1575
1612
|
this.#lastGetMe = user;
|
|
1576
1613
|
return user;
|
|
1577
1614
|
}
|
|
@@ -2814,9 +2851,10 @@ class Client extends Composer {
|
|
|
2814
2851
|
* @method ch
|
|
2815
2852
|
* @param chatId The identifier of the group.
|
|
2816
2853
|
* @param enabled Whether topics should be enabled in the group.
|
|
2854
|
+
* @param tabs Whether topics should be displayed as tabs.
|
|
2817
2855
|
*/
|
|
2818
|
-
async setTopicsEnabled(chatId, enabled) {
|
|
2819
|
-
await this.#chatManager.setTopicsEnabled(chatId, enabled);
|
|
2856
|
+
async setTopicsEnabled(chatId, enabled, tabs) {
|
|
2857
|
+
await this.#chatManager.setTopicsEnabled(chatId, enabled, tabs);
|
|
2820
2858
|
}
|
|
2821
2859
|
/**
|
|
2822
2860
|
* Enable or disable automatic anti-spam in a group. User-only.
|