@mtkruto/node 0.1.800 → 0.2.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/0_deps.d.ts +2 -0
- package/esm/0_deps.d.ts.map +1 -1
- package/esm/0_deps.js +2 -1
- package/esm/2_tl.d.ts +7 -8
- package/esm/2_tl.d.ts.map +1 -1
- package/esm/2_tl.js +7 -8
- package/esm/3_errors.d.ts +519 -515
- package/esm/3_errors.d.ts.map +1 -1
- package/esm/3_errors.js +527 -512
- package/esm/3_transport.d.ts +1 -0
- package/esm/3_transport.d.ts.map +1 -1
- package/esm/3_transport.js +1 -0
- package/esm/4_errors.d.ts +7 -7
- package/esm/4_errors.d.ts.map +1 -1
- package/esm/4_errors.js +5 -5
- package/esm/client/0_client_abstract.d.ts +1 -21
- package/esm/client/0_client_abstract.d.ts.map +1 -1
- package/esm/client/0_client_abstract.js +17 -15
- package/esm/client/0_message.d.ts +3 -3
- package/esm/client/0_message.d.ts.map +1 -1
- package/esm/client/0_message.js +4 -20
- package/esm/client/0_params.d.ts +1 -1
- package/esm/client/0_params.d.ts.map +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_password.js +3 -8
- package/esm/client/0_storage_operations.d.ts +23 -23
- package/esm/client/0_storage_operations.d.ts.map +1 -1
- package/esm/client/0_storage_operations.js +13 -12
- package/esm/client/0_utilities.d.ts.map +1 -1
- package/esm/client/0_utilities.js +13 -10
- package/esm/client/1_client_encrypted.d.ts +3 -5
- package/esm/client/1_client_encrypted.d.ts.map +1 -1
- package/esm/client/1_client_encrypted.js +44 -28
- package/esm/client/1_client_plain.d.ts +2 -2
- package/esm/client/1_client_plain.d.ts.map +1 -1
- package/esm/client/1_client_plain.js +27 -19
- package/esm/client/1_types.d.ts +9 -22
- package/esm/client/1_types.d.ts.map +1 -1
- package/esm/client/2_account_manager.d.ts +2 -2
- package/esm/client/2_account_manager.js +16 -16
- package/esm/client/2_bot_info_manager.d.ts.map +1 -1
- package/esm/client/2_bot_info_manager.js +7 -6
- package/esm/client/2_business_connection_manager.d.ts +3 -3
- package/esm/client/2_business_connection_manager.d.ts.map +1 -1
- package/esm/client/2_business_connection_manager.js +6 -5
- package/esm/client/2_file_manager.d.ts +4 -4
- package/esm/client/2_file_manager.d.ts.map +1 -1
- package/esm/client/2_file_manager.js +26 -23
- package/esm/client/2_reaction_manager.d.ts +3 -3
- package/esm/client/2_reaction_manager.d.ts.map +1 -1
- package/esm/client/2_reaction_manager.js +16 -10
- package/esm/client/2_update_manager.d.ts +11 -11
- package/esm/client/2_update_manager.d.ts.map +1 -1
- package/esm/client/2_update_manager.js +162 -160
- package/esm/client/3_message_manager.d.ts +8 -9
- package/esm/client/3_message_manager.d.ts.map +1 -1
- package/esm/client/3_message_manager.js +205 -474
- package/esm/client/3_video_chat_manager.d.ts +3 -3
- package/esm/client/3_video_chat_manager.d.ts.map +1 -1
- package/esm/client/3_video_chat_manager.js +26 -36
- package/esm/client/4_callback_query_manager.d.ts +3 -3
- package/esm/client/4_callback_query_manager.d.ts.map +1 -1
- package/esm/client/4_callback_query_manager.js +5 -16
- package/esm/client/4_chat_list_manager.d.ts +5 -4
- package/esm/client/4_chat_list_manager.d.ts.map +1 -1
- package/esm/client/4_chat_list_manager.js +56 -34
- package/esm/client/4_inline_query_manager.d.ts +3 -3
- package/esm/client/4_inline_query_manager.d.ts.map +1 -1
- package/esm/client/4_inline_query_manager.js +6 -15
- package/esm/client/4_story_manager.d.ts +3 -3
- package/esm/client/4_story_manager.d.ts.map +1 -1
- package/esm/client/4_story_manager.js +15 -32
- package/esm/client/5_client.d.ts +10 -12
- package/esm/client/5_client.d.ts.map +1 -1
- package/esm/client/5_client.js +60 -114
- package/esm/{tl/7_message.d.ts → connection/1_connection_tcp.d.ts} +14 -12
- package/esm/connection/1_connection_tcp.d.ts.map +1 -0
- package/esm/connection/1_connection_tcp.js +169 -0
- package/esm/deps/deno.land/std@0.224.0/io/_constants.d.ts +3 -0
- package/esm/deps/deno.land/std@0.224.0/io/_constants.d.ts.map +1 -0
- package/esm/deps/deno.land/std@0.224.0/io/_constants.js +4 -0
- package/esm/deps/deno.land/std@0.224.0/io/iterate_reader.d.ts +70 -0
- package/esm/deps/deno.land/std@0.224.0/io/iterate_reader.d.ts.map +1 -0
- package/esm/deps/deno.land/std@0.224.0/io/iterate_reader.js +86 -0
- package/esm/deps/deno.land/std@0.224.0/io/types.d.ts +95 -0
- package/esm/deps/deno.land/std@0.224.0/io/types.d.ts.map +1 -0
- package/esm/deps/deno.land/std@0.224.0/io/types.js +3 -0
- package/esm/deps/deno.land/std@0.224.0/io/write_all.d.ts +39 -0
- package/esm/deps/deno.land/std@0.224.0/io/write_all.d.ts.map +1 -0
- package/esm/deps/deno.land/std@0.224.0/io/write_all.js +49 -0
- package/esm/deps/raw.githubusercontent.com/MTKruto/socks5/main/client.d.ts +45 -0
- package/esm/deps/raw.githubusercontent.com/MTKruto/socks5/main/client.d.ts.map +1 -0
- package/esm/deps/raw.githubusercontent.com/MTKruto/socks5/main/client.js +253 -0
- package/esm/deps/raw.githubusercontent.com/MTKruto/socks5/main/deps.d.ts +3 -0
- package/esm/deps/raw.githubusercontent.com/MTKruto/socks5/main/deps.d.ts.map +1 -0
- package/esm/deps/raw.githubusercontent.com/MTKruto/socks5/main/deps.js +1 -0
- package/esm/deps/raw.githubusercontent.com/MTKruto/socks5/main/utils.d.ts +3 -0
- package/esm/deps/raw.githubusercontent.com/MTKruto/socks5/main/utils.d.ts.map +1 -0
- package/esm/deps/raw.githubusercontent.com/MTKruto/socks5/main/utils.js +13 -0
- package/esm/mod.d.ts +0 -1
- package/esm/mod.d.ts.map +1 -1
- package/esm/mod.js +0 -1
- package/esm/tl/0_api.d.ts +14813 -0
- package/esm/tl/0_api.d.ts.map +1 -0
- package/esm/tl/0_api.js +23222 -0
- package/esm/tl/1_utilities.d.ts +32 -0
- package/esm/tl/1_utilities.d.ts.map +1 -0
- package/esm/tl/1_utilities.js +65 -0
- package/esm/tl/1_utilities_test.d.ts.map +1 -0
- package/esm/tl/2_deserialize.d.ts +23 -0
- package/esm/tl/2_deserialize.d.ts.map +1 -0
- package/esm/tl/{3_deserialize.js → 2_deserialize.js} +16 -17
- package/esm/tl/2_serialize.d.ts +22 -0
- package/esm/tl/2_serialize.d.ts.map +1 -0
- package/esm/tl/2_serialize.js +160 -0
- package/esm/tl/2_serialize_test.d.ts.map +1 -0
- package/esm/tl/{4_tl_reader.d.ts → 3_tl_reader.d.ts} +3 -3
- package/esm/tl/3_tl_reader.d.ts.map +1 -0
- package/esm/tl/{4_tl_reader.js → 3_tl_reader.js} +5 -5
- package/esm/tl/3_utilities.d.ts +5 -5
- package/esm/tl/3_utilities.d.ts.map +1 -1
- package/esm/tl/3_utilities.js +9 -10
- package/esm/tl/4_rpc_result.d.ts +27 -0
- package/esm/tl/4_rpc_result.d.ts.map +1 -0
- package/esm/tl/4_rpc_result.js +28 -0
- package/{script/tl/5_tl_writer.d.ts → esm/tl/4_tl_writer.d.ts} +2 -2
- package/esm/tl/4_tl_writer.d.ts.map +1 -0
- package/esm/tl/{5_tl_writer.js → 4_tl_writer.js} +4 -4
- package/esm/tl/5_message.d.ts +39 -0
- package/esm/tl/5_message.d.ts.map +1 -0
- package/esm/tl/5_message.js +98 -0
- package/esm/tl/5_message_test.d.ts.map +1 -0
- package/esm/transport/3_transport_provider_tcp.d.ts +14 -0
- package/esm/transport/3_transport_provider_tcp.d.ts.map +1 -0
- package/esm/transport/3_transport_provider_tcp.js +15 -0
- package/esm/types/0_birthday.d.ts +2 -2
- package/esm/types/0_birthday.d.ts.map +1 -1
- package/esm/types/0_callback_query_answer.d.ts +2 -2
- package/esm/types/0_callback_query_answer.d.ts.map +1 -1
- package/esm/types/0_chat_administrator_rights.d.ts +3 -3
- package/esm/types/0_chat_administrator_rights.d.ts.map +1 -1
- package/esm/types/0_chat_administrator_rights.js +1 -11
- package/esm/types/0_chat_member_rights.d.ts +3 -3
- package/esm/types/0_chat_member_rights.d.ts.map +1 -1
- package/esm/types/0_chat_member_rights.js +3 -3
- package/esm/types/0_chat_photo.d.ts +2 -2
- package/esm/types/0_chat_photo.d.ts.map +1 -1
- package/esm/types/0_chat_photo.js +2 -2
- package/esm/types/0_contact.d.ts +2 -2
- package/esm/types/0_contact.d.ts.map +1 -1
- package/esm/types/0_dice.d.ts +2 -2
- package/esm/types/0_dice.d.ts.map +1 -1
- package/esm/types/0_giveaway_parameters.d.ts +2 -2
- package/esm/types/0_giveaway_parameters.d.ts.map +1 -1
- package/esm/types/0_giveaway_parameters.js +3 -3
- package/esm/types/0_link_preview.d.ts +2 -2
- package/esm/types/0_link_preview.d.ts.map +1 -1
- package/esm/types/0_live_stream_channel.d.ts +2 -2
- package/esm/types/0_live_stream_channel.d.ts.map +1 -1
- package/esm/types/0_location.d.ts +2 -2
- package/esm/types/0_location.d.ts.map +1 -1
- package/esm/types/0_location.js +5 -5
- package/esm/types/0_mask_position.d.ts +2 -2
- package/esm/types/0_mask_position.d.ts.map +1 -1
- package/esm/types/0_message_entity.d.ts +3 -3
- package/esm/types/0_message_entity.d.ts.map +1 -1
- package/esm/types/0_message_entity.js +42 -42
- package/esm/types/0_message_search_filter.d.ts +2 -2
- package/esm/types/0_message_search_filter.d.ts.map +1 -1
- package/esm/types/0_message_search_filter.js +14 -15
- package/esm/types/0_opening_hours.d.ts +2 -2
- package/esm/types/0_opening_hours.d.ts.map +1 -1
- package/esm/types/0_poll_option.d.ts +2 -2
- package/esm/types/0_poll_option.d.ts.map +1 -1
- package/esm/types/0_reaction.d.ts +3 -3
- package/esm/types/0_reaction.d.ts.map +1 -1
- package/esm/types/0_reaction.js +4 -4
- package/esm/types/0_restriction_reason.d.ts +2 -2
- package/esm/types/0_restriction_reason.d.ts.map +1 -1
- package/esm/types/0_thumbnail.d.ts +2 -2
- package/esm/types/0_thumbnail.d.ts.map +1 -1
- package/esm/types/0_thumbnail.js +3 -3
- package/esm/types/0_video_chat.d.ts +2 -2
- package/esm/types/0_video_chat.d.ts.map +1 -1
- package/esm/types/0_video_chat.js +2 -2
- package/esm/types/0_voice.d.ts +2 -2
- package/esm/types/0_voice.d.ts.map +1 -1
- package/esm/types/1_animation.d.ts +2 -2
- package/esm/types/1_animation.d.ts.map +1 -1
- package/esm/types/1_animation.js +2 -2
- package/esm/types/1_audio.d.ts +2 -2
- package/esm/types/1_audio.d.ts.map +1 -1
- package/esm/types/1_audio.js +2 -2
- package/esm/types/1_bot_command_scope.d.ts +9 -2
- package/esm/types/1_bot_command_scope.d.ts.map +1 -1
- package/esm/types/1_bot_command_scope.js +9 -9
- package/esm/types/1_chat_p.d.ts +5 -5
- package/esm/types/1_chat_p.d.ts.map +1 -1
- package/esm/types/1_chat_p.js +6 -6
- package/esm/types/1_document.d.ts +2 -2
- package/esm/types/1_document.d.ts.map +1 -1
- package/esm/types/1_document.js +2 -2
- package/esm/types/1_giveaway.d.ts +2 -2
- package/esm/types/1_giveaway.d.ts.map +1 -1
- package/esm/types/1_keyboard_button.d.ts +3 -3
- package/esm/types/1_keyboard_button.d.ts.map +1 -1
- package/esm/types/1_keyboard_button.js +18 -45
- package/esm/types/1_message_reaction.d.ts +2 -2
- package/esm/types/1_message_reaction.d.ts.map +1 -1
- package/esm/types/1_message_reaction.js +5 -5
- package/esm/types/1_photo.d.ts +5 -5
- package/esm/types/1_photo.d.ts.map +1 -1
- package/esm/types/1_photo.js +4 -4
- package/esm/types/1_poll.d.ts +2 -2
- package/esm/types/1_poll.d.ts.map +1 -1
- package/esm/types/1_reaction_count.d.ts +2 -2
- package/esm/types/1_reaction_count.d.ts.map +1 -1
- package/esm/types/1_reply_quote.d.ts +2 -2
- package/esm/types/1_reply_quote.d.ts.map +1 -1
- package/esm/types/1_sticker.d.ts +3 -3
- package/esm/types/1_sticker.d.ts.map +1 -1
- package/esm/types/1_sticker.js +9 -9
- package/esm/types/1_story_privacy.d.ts +3 -3
- package/esm/types/1_story_privacy.d.ts.map +1 -1
- package/esm/types/1_story_privacy.js +14 -14
- package/esm/types/1_story_reaction.d.ts +2 -2
- package/esm/types/1_story_reaction.d.ts.map +1 -1
- package/esm/types/1_user.d.ts +2 -2
- package/esm/types/1_user.d.ts.map +1 -1
- package/esm/types/1_user.js +2 -2
- package/esm/types/1_venue.d.ts +2 -2
- package/esm/types/1_venue.d.ts.map +1 -1
- package/esm/types/1_venue.js +2 -2
- package/esm/types/1_video.d.ts +2 -2
- package/esm/types/1_video.d.ts.map +1 -1
- package/esm/types/1_video.js +2 -2
- package/esm/types/1_video_note.d.ts +2 -2
- package/esm/types/1_video_note.d.ts.map +1 -1
- package/esm/types/1_video_note.js +2 -2
- package/esm/types/2_business_connection.d.ts +2 -2
- package/esm/types/2_business_connection.d.ts.map +1 -1
- package/esm/types/2_business_connection.js +1 -2
- package/esm/types/2_chat.d.ts +2 -2
- package/esm/types/2_chat.d.ts.map +1 -1
- package/esm/types/2_chat.js +11 -11
- package/esm/types/2_chat_member.d.ts +2 -2
- package/esm/types/2_chat_member.d.ts.map +1 -1
- package/esm/types/2_chat_member.js +10 -10
- package/esm/types/2_chosen_inline_result.d.ts +2 -2
- package/esm/types/2_chosen_inline_result.d.ts.map +1 -1
- package/esm/types/2_chosen_inline_result.js +5 -5
- package/esm/types/2_game.d.ts +2 -2
- package/esm/types/2_game.d.ts.map +1 -1
- package/esm/types/2_game.js +4 -4
- package/esm/types/2_inactive_chat.d.ts +2 -2
- package/esm/types/2_inactive_chat.d.ts.map +1 -1
- package/esm/types/2_inactive_chat.js +2 -2
- package/esm/types/2_inline_keyboard_button.d.ts +3 -3
- package/esm/types/2_inline_keyboard_button.d.ts.map +1 -1
- package/esm/types/2_inline_keyboard_button.js +15 -21
- package/esm/types/2_inline_query.d.ts +2 -2
- package/esm/types/2_inline_query.d.ts.map +1 -1
- package/esm/types/2_inline_query.js +8 -8
- package/esm/types/2_invite_link.d.ts +2 -2
- package/esm/types/2_invite_link.d.ts.map +1 -1
- package/esm/types/2_invite_link.js +1 -2
- package/esm/types/2_message_reaction_count.d.ts +2 -2
- package/esm/types/2_message_reaction_count.d.ts.map +1 -1
- package/esm/types/2_message_reactions.d.ts +2 -2
- package/esm/types/2_message_reactions.d.ts.map +1 -1
- package/esm/types/2_message_reactions.js +2 -2
- package/esm/types/2_story_content.d.ts +2 -2
- package/esm/types/2_story_content.d.ts.map +1 -1
- package/esm/types/2_story_content.js +6 -6
- package/esm/types/2_story_interactions.d.ts +2 -2
- package/esm/types/2_story_interactions.d.ts.map +1 -1
- package/esm/types/2_story_interactive_area.d.ts +3 -3
- package/esm/types/2_story_interactive_area.d.ts.map +1 -1
- package/esm/types/2_story_interactive_area.js +19 -29
- package/esm/types/3_chat_member_updated.d.ts +2 -2
- package/esm/types/3_chat_member_updated.d.ts.map +1 -1
- package/esm/types/3_chat_member_updated.js +7 -7
- package/esm/types/3_reply_markup.d.ts +3 -3
- package/esm/types/3_reply_markup.d.ts.map +1 -1
- package/esm/types/3_reply_markup.js +12 -22
- package/esm/types/3_story.d.ts +2 -2
- package/esm/types/3_story.d.ts.map +1 -1
- package/esm/types/4_inline_query_result.d.ts +3 -3
- package/esm/types/4_inline_query_result.d.ts.map +1 -1
- package/esm/types/4_inline_query_result.js +53 -161
- package/esm/types/4_message.d.ts +3 -3
- package/esm/types/4_message.d.ts.map +1 -1
- package/esm/types/4_message.js +68 -59
- package/esm/types/5_callback_query.d.ts +3 -3
- package/esm/types/5_callback_query.d.ts.map +1 -1
- package/esm/types/5_callback_query.js +5 -5
- package/esm/types/5_chat_list_item.d.ts +3 -3
- package/esm/types/5_chat_list_item.d.ts.map +1 -1
- package/esm/types/5_chat_list_item.js +2 -2
- package/esm/types/5_inline_query_answer.d.ts +2 -2
- package/esm/types/5_inline_query_answer.d.ts.map +1 -1
- package/esm/types/_file_id.d.ts +2 -2
- package/esm/types/_file_id.d.ts.map +1 -1
- package/esm/types/_file_id.js +4 -4
- package/esm/types/_getters.d.ts +7 -7
- package/esm/types/_getters.d.ts.map +1 -1
- package/package.json +1 -1
- package/script/0_deps.d.ts +2 -0
- package/script/0_deps.d.ts.map +1 -1
- package/script/0_deps.js +5 -2
- package/script/2_tl.d.ts +7 -8
- package/script/2_tl.d.ts.map +1 -1
- package/script/2_tl.js +20 -11
- package/script/3_errors.d.ts +519 -515
- package/script/3_errors.d.ts.map +1 -1
- package/script/3_errors.js +543 -514
- package/script/3_transport.d.ts +1 -0
- package/script/3_transport.d.ts.map +1 -1
- package/script/3_transport.js +1 -0
- package/script/4_errors.d.ts +7 -7
- package/script/4_errors.d.ts.map +1 -1
- package/script/4_errors.js +6 -6
- package/script/client/0_client_abstract.d.ts +1 -21
- package/script/client/0_client_abstract.d.ts.map +1 -1
- package/script/client/0_client_abstract.js +41 -16
- package/script/client/0_message.d.ts +3 -3
- package/script/client/0_message.d.ts.map +1 -1
- package/script/client/0_message.js +3 -19
- package/script/client/0_params.d.ts +1 -1
- package/script/client/0_params.d.ts.map +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_password.js +2 -7
- package/script/client/0_storage_operations.d.ts +23 -23
- package/script/client/0_storage_operations.d.ts.map +1 -1
- package/script/client/0_storage_operations.js +12 -11
- package/script/client/0_utilities.d.ts.map +1 -1
- package/script/client/0_utilities.js +12 -9
- package/script/client/1_client_encrypted.d.ts +3 -5
- package/script/client/1_client_encrypted.d.ts.map +1 -1
- package/script/client/1_client_encrypted.js +42 -26
- package/script/client/1_client_plain.d.ts +2 -2
- package/script/client/1_client_plain.d.ts.map +1 -1
- package/script/client/1_client_plain.js +25 -17
- package/script/client/1_types.d.ts +9 -22
- package/script/client/1_types.d.ts.map +1 -1
- package/script/client/2_account_manager.d.ts +2 -2
- package/script/client/2_account_manager.js +15 -15
- package/script/client/2_bot_info_manager.d.ts.map +1 -1
- package/script/client/2_bot_info_manager.js +7 -6
- package/script/client/2_business_connection_manager.d.ts +3 -3
- package/script/client/2_business_connection_manager.d.ts.map +1 -1
- package/script/client/2_business_connection_manager.js +5 -4
- package/script/client/2_file_manager.d.ts +4 -4
- package/script/client/2_file_manager.d.ts.map +1 -1
- package/script/client/2_file_manager.js +25 -22
- package/script/client/2_reaction_manager.d.ts +3 -3
- package/script/client/2_reaction_manager.d.ts.map +1 -1
- package/script/client/2_reaction_manager.js +15 -9
- package/script/client/2_update_manager.d.ts +11 -11
- package/script/client/2_update_manager.d.ts.map +1 -1
- package/script/client/2_update_manager.js +161 -159
- package/script/client/3_message_manager.d.ts +8 -9
- package/script/client/3_message_manager.d.ts.map +1 -1
- package/script/client/3_message_manager.js +204 -473
- package/script/client/3_video_chat_manager.d.ts +3 -3
- package/script/client/3_video_chat_manager.d.ts.map +1 -1
- package/script/client/3_video_chat_manager.js +25 -35
- package/script/client/4_callback_query_manager.d.ts +3 -3
- package/script/client/4_callback_query_manager.d.ts.map +1 -1
- package/script/client/4_callback_query_manager.js +4 -15
- package/script/client/4_chat_list_manager.d.ts +5 -4
- package/script/client/4_chat_list_manager.d.ts.map +1 -1
- package/script/client/4_chat_list_manager.js +54 -32
- package/script/client/4_inline_query_manager.d.ts +3 -3
- package/script/client/4_inline_query_manager.d.ts.map +1 -1
- package/script/client/4_inline_query_manager.js +5 -14
- package/script/client/4_story_manager.d.ts +3 -3
- package/script/client/4_story_manager.d.ts.map +1 -1
- package/script/client/4_story_manager.js +14 -31
- package/script/client/5_client.d.ts +10 -12
- package/script/client/5_client.d.ts.map +1 -1
- package/script/client/5_client.js +59 -113
- package/{esm/tl/6_rpc_result.d.ts → script/connection/1_connection_tcp.d.ts} +14 -10
- package/script/connection/1_connection_tcp.d.ts.map +1 -0
- package/script/connection/1_connection_tcp.js +196 -0
- package/script/deps/deno.land/std@0.224.0/io/_constants.d.ts +3 -0
- package/script/deps/deno.land/std@0.224.0/io/_constants.d.ts.map +1 -0
- package/script/deps/deno.land/std@0.224.0/io/_constants.js +7 -0
- package/script/deps/deno.land/std@0.224.0/io/iterate_reader.d.ts +70 -0
- package/script/deps/deno.land/std@0.224.0/io/iterate_reader.d.ts.map +1 -0
- package/script/deps/deno.land/std@0.224.0/io/iterate_reader.js +91 -0
- package/script/deps/deno.land/std@0.224.0/io/types.d.ts +95 -0
- package/script/deps/deno.land/std@0.224.0/io/types.d.ts.map +1 -0
- package/script/deps/deno.land/std@0.224.0/io/types.js +4 -0
- package/script/deps/deno.land/std@0.224.0/io/write_all.d.ts +39 -0
- package/script/deps/deno.land/std@0.224.0/io/write_all.d.ts.map +1 -0
- package/script/deps/deno.land/std@0.224.0/io/write_all.js +54 -0
- package/script/deps/raw.githubusercontent.com/MTKruto/socks5/main/client.d.ts +45 -0
- package/script/deps/raw.githubusercontent.com/MTKruto/socks5/main/client.d.ts.map +1 -0
- package/script/deps/raw.githubusercontent.com/MTKruto/socks5/main/client.js +280 -0
- package/script/deps/raw.githubusercontent.com/MTKruto/socks5/main/deps.d.ts +3 -0
- package/script/deps/raw.githubusercontent.com/MTKruto/socks5/main/deps.d.ts.map +1 -0
- package/script/deps/raw.githubusercontent.com/MTKruto/socks5/main/deps.js +5 -0
- package/script/deps/raw.githubusercontent.com/MTKruto/socks5/main/utils.d.ts +3 -0
- package/script/deps/raw.githubusercontent.com/MTKruto/socks5/main/utils.d.ts.map +1 -0
- package/script/deps/raw.githubusercontent.com/MTKruto/socks5/main/utils.js +40 -0
- package/script/mod.d.ts +0 -1
- package/script/mod.d.ts.map +1 -1
- package/script/mod.js +0 -1
- package/script/tl/0_api.d.ts +14813 -0
- package/script/tl/0_api.d.ts.map +1 -0
- package/script/tl/0_api.js +23248 -0
- package/script/tl/1_utilities.d.ts +32 -0
- package/script/tl/1_utilities.d.ts.map +1 -0
- package/script/tl/1_utilities.js +76 -0
- package/script/tl/1_utilities_test.d.ts.map +1 -0
- package/script/tl/2_deserialize.d.ts +23 -0
- package/script/tl/2_deserialize.d.ts.map +1 -0
- package/script/tl/{3_deserialize.js → 2_deserialize.js} +19 -20
- package/script/tl/2_serialize.d.ts +22 -0
- package/script/tl/2_serialize.d.ts.map +1 -0
- package/script/tl/2_serialize.js +164 -0
- package/script/tl/2_serialize_test.d.ts.map +1 -0
- package/script/tl/{4_tl_reader.d.ts → 3_tl_reader.d.ts} +3 -3
- package/script/tl/3_tl_reader.d.ts.map +1 -0
- package/script/tl/{4_tl_reader.js → 3_tl_reader.js} +5 -5
- package/script/tl/3_utilities.d.ts +5 -5
- package/script/tl/3_utilities.d.ts.map +1 -1
- package/script/tl/3_utilities.js +9 -10
- package/script/tl/4_rpc_result.d.ts +27 -0
- package/script/tl/4_rpc_result.d.ts.map +1 -0
- package/{esm/tl/8_message_container.d.ts → script/tl/4_rpc_result.js} +12 -12
- package/{esm/tl/5_tl_writer.d.ts → script/tl/4_tl_writer.d.ts} +2 -2
- package/script/tl/4_tl_writer.d.ts.map +1 -0
- package/script/tl/{5_tl_writer.js → 4_tl_writer.js} +4 -4
- package/script/tl/5_message.d.ts +39 -0
- package/script/tl/5_message.d.ts.map +1 -0
- package/script/tl/5_message.js +106 -0
- package/script/tl/5_message_test.d.ts.map +1 -0
- package/script/transport/3_transport_provider_tcp.d.ts +14 -0
- package/script/transport/3_transport_provider_tcp.d.ts.map +1 -0
- package/script/transport/3_transport_provider_tcp.js +19 -0
- package/script/types/0_birthday.d.ts +2 -2
- package/script/types/0_birthday.d.ts.map +1 -1
- package/script/types/0_callback_query_answer.d.ts +2 -2
- package/script/types/0_callback_query_answer.d.ts.map +1 -1
- package/script/types/0_chat_administrator_rights.d.ts +3 -3
- package/script/types/0_chat_administrator_rights.d.ts.map +1 -1
- package/script/types/0_chat_administrator_rights.js +1 -11
- package/script/types/0_chat_member_rights.d.ts +3 -3
- package/script/types/0_chat_member_rights.d.ts.map +1 -1
- package/script/types/0_chat_member_rights.js +3 -3
- package/script/types/0_chat_photo.d.ts +2 -2
- package/script/types/0_chat_photo.d.ts.map +1 -1
- package/script/types/0_chat_photo.js +1 -1
- package/script/types/0_contact.d.ts +2 -2
- package/script/types/0_contact.d.ts.map +1 -1
- package/script/types/0_dice.d.ts +2 -2
- package/script/types/0_dice.d.ts.map +1 -1
- package/script/types/0_giveaway_parameters.d.ts +2 -2
- package/script/types/0_giveaway_parameters.d.ts.map +1 -1
- package/script/types/0_giveaway_parameters.js +2 -2
- package/script/types/0_link_preview.d.ts +2 -2
- package/script/types/0_link_preview.d.ts.map +1 -1
- package/script/types/0_live_stream_channel.d.ts +2 -2
- package/script/types/0_live_stream_channel.d.ts.map +1 -1
- package/script/types/0_location.d.ts +2 -2
- package/script/types/0_location.d.ts.map +1 -1
- package/script/types/0_location.js +4 -4
- package/script/types/0_mask_position.d.ts +2 -2
- package/script/types/0_mask_position.d.ts.map +1 -1
- package/script/types/0_message_entity.d.ts +3 -3
- package/script/types/0_message_entity.d.ts.map +1 -1
- package/script/types/0_message_entity.js +41 -41
- package/script/types/0_message_search_filter.d.ts +2 -2
- package/script/types/0_message_search_filter.d.ts.map +1 -1
- package/script/types/0_message_search_filter.js +14 -15
- package/script/types/0_opening_hours.d.ts +2 -2
- package/script/types/0_opening_hours.d.ts.map +1 -1
- package/script/types/0_poll_option.d.ts +2 -2
- package/script/types/0_poll_option.d.ts.map +1 -1
- package/script/types/0_reaction.d.ts +3 -3
- package/script/types/0_reaction.d.ts.map +1 -1
- package/script/types/0_reaction.js +3 -3
- package/script/types/0_restriction_reason.d.ts +2 -2
- package/script/types/0_restriction_reason.d.ts.map +1 -1
- package/script/types/0_thumbnail.d.ts +2 -2
- package/script/types/0_thumbnail.d.ts.map +1 -1
- package/script/types/0_thumbnail.js +2 -2
- package/script/types/0_video_chat.d.ts +2 -2
- 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.d.ts +2 -2
- package/script/types/0_voice.d.ts.map +1 -1
- package/script/types/1_animation.d.ts +2 -2
- package/script/types/1_animation.d.ts.map +1 -1
- package/script/types/1_animation.js +1 -1
- package/script/types/1_audio.d.ts +2 -2
- package/script/types/1_audio.d.ts.map +1 -1
- package/script/types/1_audio.js +1 -1
- package/script/types/1_bot_command_scope.d.ts +9 -2
- package/script/types/1_bot_command_scope.d.ts.map +1 -1
- package/script/types/1_bot_command_scope.js +8 -8
- package/script/types/1_chat_p.d.ts +5 -5
- package/script/types/1_chat_p.d.ts.map +1 -1
- package/script/types/1_chat_p.js +5 -5
- package/script/types/1_document.d.ts +2 -2
- package/script/types/1_document.d.ts.map +1 -1
- package/script/types/1_document.js +1 -1
- package/script/types/1_giveaway.d.ts +2 -2
- package/script/types/1_giveaway.d.ts.map +1 -1
- package/script/types/1_keyboard_button.d.ts +3 -3
- package/script/types/1_keyboard_button.d.ts.map +1 -1
- package/script/types/1_keyboard_button.js +17 -44
- package/script/types/1_message_reaction.d.ts +2 -2
- package/script/types/1_message_reaction.d.ts.map +1 -1
- package/script/types/1_message_reaction.js +4 -4
- package/script/types/1_photo.d.ts +5 -5
- package/script/types/1_photo.d.ts.map +1 -1
- package/script/types/1_photo.js +3 -3
- package/script/types/1_poll.d.ts +2 -2
- package/script/types/1_poll.d.ts.map +1 -1
- package/script/types/1_reaction_count.d.ts +2 -2
- package/script/types/1_reaction_count.d.ts.map +1 -1
- package/script/types/1_reply_quote.d.ts +2 -2
- package/script/types/1_reply_quote.d.ts.map +1 -1
- package/script/types/1_sticker.d.ts +3 -3
- package/script/types/1_sticker.d.ts.map +1 -1
- package/script/types/1_sticker.js +8 -8
- package/script/types/1_story_privacy.d.ts +3 -3
- package/script/types/1_story_privacy.d.ts.map +1 -1
- package/script/types/1_story_privacy.js +13 -13
- package/script/types/1_story_reaction.d.ts +2 -2
- package/script/types/1_story_reaction.d.ts.map +1 -1
- package/script/types/1_user.d.ts +2 -2
- package/script/types/1_user.d.ts.map +1 -1
- package/script/types/1_user.js +1 -1
- package/script/types/1_venue.d.ts +2 -2
- package/script/types/1_venue.d.ts.map +1 -1
- package/script/types/1_venue.js +1 -1
- package/script/types/1_video.d.ts +2 -2
- package/script/types/1_video.d.ts.map +1 -1
- package/script/types/1_video.js +1 -1
- package/script/types/1_video_note.d.ts +2 -2
- package/script/types/1_video_note.d.ts.map +1 -1
- package/script/types/1_video_note.js +1 -1
- package/script/types/2_business_connection.d.ts +2 -2
- package/script/types/2_business_connection.d.ts.map +1 -1
- package/script/types/2_business_connection.js +1 -2
- package/script/types/2_chat.d.ts +2 -2
- package/script/types/2_chat.d.ts.map +1 -1
- package/script/types/2_chat.js +10 -10
- package/script/types/2_chat_member.d.ts +2 -2
- package/script/types/2_chat_member.d.ts.map +1 -1
- package/script/types/2_chat_member.js +9 -9
- package/script/types/2_chosen_inline_result.d.ts +2 -2
- package/script/types/2_chosen_inline_result.d.ts.map +1 -1
- package/script/types/2_chosen_inline_result.js +4 -4
- package/script/types/2_game.d.ts +2 -2
- package/script/types/2_game.d.ts.map +1 -1
- package/script/types/2_game.js +3 -3
- package/script/types/2_inactive_chat.d.ts +2 -2
- package/script/types/2_inactive_chat.d.ts.map +1 -1
- package/script/types/2_inactive_chat.js +1 -1
- package/script/types/2_inline_keyboard_button.d.ts +3 -3
- package/script/types/2_inline_keyboard_button.d.ts.map +1 -1
- package/script/types/2_inline_keyboard_button.js +14 -20
- package/script/types/2_inline_query.d.ts +2 -2
- package/script/types/2_inline_query.d.ts.map +1 -1
- package/script/types/2_inline_query.js +7 -7
- package/script/types/2_invite_link.d.ts +2 -2
- package/script/types/2_invite_link.d.ts.map +1 -1
- package/script/types/2_invite_link.js +1 -2
- package/script/types/2_message_reaction_count.d.ts +2 -2
- package/script/types/2_message_reaction_count.d.ts.map +1 -1
- package/script/types/2_message_reactions.d.ts +2 -2
- package/script/types/2_message_reactions.d.ts.map +1 -1
- package/script/types/2_message_reactions.js +1 -1
- package/script/types/2_story_content.d.ts +2 -2
- package/script/types/2_story_content.d.ts.map +1 -1
- package/script/types/2_story_content.js +5 -5
- package/script/types/2_story_interactions.d.ts +2 -2
- package/script/types/2_story_interactions.d.ts.map +1 -1
- package/script/types/2_story_interactive_area.d.ts +3 -3
- package/script/types/2_story_interactive_area.d.ts.map +1 -1
- package/script/types/2_story_interactive_area.js +18 -28
- package/script/types/3_chat_member_updated.d.ts +2 -2
- package/script/types/3_chat_member_updated.d.ts.map +1 -1
- package/script/types/3_chat_member_updated.js +6 -6
- package/script/types/3_reply_markup.d.ts +3 -3
- package/script/types/3_reply_markup.d.ts.map +1 -1
- package/script/types/3_reply_markup.js +11 -21
- package/script/types/3_story.d.ts +2 -2
- package/script/types/3_story.d.ts.map +1 -1
- package/script/types/4_inline_query_result.d.ts +3 -3
- package/script/types/4_inline_query_result.d.ts.map +1 -1
- package/script/types/4_inline_query_result.js +52 -160
- package/script/types/4_message.d.ts +3 -3
- package/script/types/4_message.d.ts.map +1 -1
- package/script/types/4_message.js +67 -58
- package/script/types/5_callback_query.d.ts +3 -3
- package/script/types/5_callback_query.d.ts.map +1 -1
- package/script/types/5_callback_query.js +4 -4
- package/script/types/5_chat_list_item.d.ts +3 -3
- package/script/types/5_chat_list_item.d.ts.map +1 -1
- package/script/types/5_chat_list_item.js +1 -1
- package/script/types/5_inline_query_answer.d.ts +2 -2
- package/script/types/5_inline_query_answer.d.ts.map +1 -1
- package/script/types/_file_id.d.ts +2 -2
- package/script/types/_file_id.d.ts.map +1 -1
- package/script/types/_file_id.js +3 -3
- package/script/types/_getters.d.ts +7 -7
- package/script/types/_getters.d.ts.map +1 -1
- package/esm/tl/1_tl_object.d.ts +0 -64
- package/esm/tl/1_tl_object.d.ts.map +0 -1
- package/esm/tl/1_tl_object.js +0 -221
- package/esm/tl/1_tl_object_test.d.ts.map +0 -1
- package/esm/tl/2_types.d.ts +0 -28060
- package/esm/tl/2_types.d.ts.map +0 -1
- package/esm/tl/2_types.js +0 -68685
- package/esm/tl/2_types_test.d.ts.map +0 -1
- package/esm/tl/3_deserialize.d.ts +0 -23
- package/esm/tl/3_deserialize.d.ts.map +0 -1
- package/esm/tl/3_functions.d.ts +0 -14094
- package/esm/tl/3_functions.d.ts.map +0 -1
- package/esm/tl/3_functions.js +0 -28475
- package/esm/tl/3_functions_test.d.ts.map +0 -1
- package/esm/tl/4_tl_reader.d.ts.map +0 -1
- package/esm/tl/5_tl_writer.d.ts.map +0 -1
- package/esm/tl/6_rpc_result.d.ts.map +0 -1
- package/esm/tl/6_rpc_result.js +0 -49
- package/esm/tl/7_message.d.ts.map +0 -1
- package/esm/tl/7_message.js +0 -90
- package/esm/tl/7_message_test.d.ts.map +0 -1
- package/esm/tl/8_message_container.d.ts.map +0 -1
- package/esm/tl/8_message_container.js +0 -72
- package/script/tl/1_tl_object.d.ts +0 -64
- package/script/tl/1_tl_object.d.ts.map +0 -1
- package/script/tl/1_tl_object.js +0 -228
- package/script/tl/1_tl_object_test.d.ts.map +0 -1
- package/script/tl/2_types.d.ts +0 -28060
- package/script/tl/2_types.d.ts.map +0 -1
- package/script/tl/2_types.js +0 -70558
- package/script/tl/2_types_test.d.ts.map +0 -1
- package/script/tl/3_deserialize.d.ts +0 -23
- package/script/tl/3_deserialize.d.ts.map +0 -1
- package/script/tl/3_functions.d.ts +0 -14094
- package/script/tl/3_functions.d.ts.map +0 -1
- package/script/tl/3_functions.js +0 -29121
- package/script/tl/3_functions_test.d.ts.map +0 -1
- package/script/tl/4_tl_reader.d.ts.map +0 -1
- package/script/tl/5_tl_writer.d.ts.map +0 -1
- package/script/tl/6_rpc_result.d.ts +0 -30
- package/script/tl/6_rpc_result.d.ts.map +0 -1
- package/script/tl/6_rpc_result.js +0 -53
- package/script/tl/7_message.d.ts +0 -32
- package/script/tl/7_message.d.ts.map +0 -1
- package/script/tl/7_message.js +0 -95
- package/script/tl/7_message_test.d.ts.map +0 -1
- package/script/tl/8_message_container.d.ts +0 -32
- package/script/tl/8_message_container.d.ts.map +0 -1
- package/script/tl/8_message_container.js +0 -76
package/esm/client/5_client.js
CHANGED
|
@@ -28,11 +28,11 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
28
28
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
29
29
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
30
30
|
};
|
|
31
|
-
var _Client_instances, _a, _Client_client, _Client_guaranteeUpdateDelivery, _Client_updateManager, _Client_networkStatisticsManager, _Client_botInfoManager, _Client_fileManager, _Client_reactionManager, _Client_videoChatManager, _Client_businessConnectionManager, _Client_messageManager, _Client_storyManager, _Client_callbackQueryManager, _Client_inlineQueryManager, _Client_chatListManager, _Client_accountManager, _Client_storage_, _Client_messageStorage_, _Client_parseMode, _Client_apiId, _Client_apiHash, _Client_publicKeys, _Client_ignoreOutgoing, _Client_persistCache, _Client_LsignIn, _Client_LpingLoop, _Client_LhandleMigrationError, _Client_L$initConncetion,
|
|
31
|
+
var _Client_instances, _a, _Client_client, _Client_guaranteeUpdateDelivery, _Client_updateManager, _Client_networkStatisticsManager, _Client_botInfoManager, _Client_fileManager, _Client_reactionManager, _Client_videoChatManager, _Client_businessConnectionManager, _Client_messageManager, _Client_storyManager, _Client_callbackQueryManager, _Client_inlineQueryManager, _Client_chatListManager, _Client_accountManager, _Client_storage_, _Client_messageStorage_, _Client_parseMode, _Client_apiId, _Client_apiHash, _Client_publicKeys, _Client_ignoreOutgoing, _Client_persistCache, _Client_LsignIn, _Client_LpingLoop, _Client_LhandleMigrationError, _Client_L$initConncetion, _Client_getApiId, _Client_getCdnConnectionPool, _Client_getCdnConnection, _Client_constructContext, _Client_propagateConnectionState, _Client_lastPropagatedConnectionState, _Client_stateChangeHandler, _Client_storageInited, _Client_initStorage, _Client_connectionInited, _Client_lastPropagatedAuthorizationState, _Client_propagateAuthorizationState, _Client_getSelfId, _Client_pingLoopStarted, _Client_pingLoopAbortController, _Client_pingInterval, _Client_lastUpdates, _Client_startPingLoop, _Client_pingLoop, _Client_invoke, _Client_handleInvokeError, _Client_getUserAccessHash, _Client_getChannelAccessHash, _Client_getInputPeerInner, _Client_handleCtxUpdate, _Client_queueHandleCtxUpdate, _Client_handleUpdate, _Client_lastGetMe, _Client_getMe;
|
|
32
32
|
import { unreachable } from "../0_deps.js";
|
|
33
33
|
import { AccessError, InputError } from "../0_errors.js";
|
|
34
34
|
import { cleanObject, drop, getLogger, getRandomId, minute, mustPrompt, mustPromptOneOf, second, ZERO_CHANNEL_ID } from "../1_utilities.js";
|
|
35
|
-
import { as, chatIdToPeerId,
|
|
35
|
+
import { as, chatIdToPeerId, getChatIdPeerType, is, peerToChatId } from "../2_tl.js";
|
|
36
36
|
import { StorageMemory } from "../2_storage.js";
|
|
37
37
|
import { constructUser } from "../3_types.js";
|
|
38
38
|
import { APP_VERSION, DEVICE_MODEL, LANG_CODE, LANG_PACK, LAYER, MAX_CHANNEL_ID, MAX_CHAT_ID, SYSTEM_LANG_CODE, SYSTEM_VERSION, USERNAME_TTL } from "../4_constants.js";
|
|
@@ -67,7 +67,6 @@ export const handleMigrationError = Symbol("handleMigrationError");
|
|
|
67
67
|
// global Client ID counter for logs
|
|
68
68
|
let id = 0;
|
|
69
69
|
const getEntity = Symbol();
|
|
70
|
-
const functionNamespaces = Object.entries(functions).filter(([, v]) => !(v instanceof Function)).map(([k]) => k);
|
|
71
70
|
/**
|
|
72
71
|
* An MTKruto client.
|
|
73
72
|
*/
|
|
@@ -153,62 +152,6 @@ export class Client extends Composer {
|
|
|
153
152
|
_Client_LpingLoop.set(this, void 0);
|
|
154
153
|
_Client_LhandleMigrationError.set(this, void 0);
|
|
155
154
|
_Client_L$initConncetion.set(this, void 0);
|
|
156
|
-
_Client_namespaceProxies.set(this, (() => {
|
|
157
|
-
// deno-lint-ignore no-explicit-any
|
|
158
|
-
const proxies = {};
|
|
159
|
-
for (const name of functionNamespaces) {
|
|
160
|
-
const ns = functions[name];
|
|
161
|
-
proxies[name] = new Proxy({}, {
|
|
162
|
-
get: (_, key) => {
|
|
163
|
-
if (key in ns) {
|
|
164
|
-
// deno-lint-ignore no-explicit-any
|
|
165
|
-
const func = ns[key];
|
|
166
|
-
if (func instanceof Function) {
|
|
167
|
-
// deno-lint-ignore no-explicit-any
|
|
168
|
-
return (params) => {
|
|
169
|
-
// deno-lint-ignore ban-ts-comment
|
|
170
|
-
// @ts-ignore
|
|
171
|
-
return this.invoke(new func(params));
|
|
172
|
-
};
|
|
173
|
-
}
|
|
174
|
-
else {
|
|
175
|
-
unreachable();
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
},
|
|
179
|
-
set() {
|
|
180
|
-
return true;
|
|
181
|
-
},
|
|
182
|
-
});
|
|
183
|
-
}
|
|
184
|
-
return proxies;
|
|
185
|
-
})());
|
|
186
|
-
Object.defineProperty(this, "api", {
|
|
187
|
-
enumerable: true,
|
|
188
|
-
configurable: true,
|
|
189
|
-
writable: true,
|
|
190
|
-
value: new Proxy({}, {
|
|
191
|
-
get: (_, key) => {
|
|
192
|
-
if (key in functions) {
|
|
193
|
-
const func = functions[key];
|
|
194
|
-
if (func instanceof Function) {
|
|
195
|
-
// deno-lint-ignore no-explicit-any
|
|
196
|
-
return (params) => {
|
|
197
|
-
// deno-lint-ignore ban-ts-comment
|
|
198
|
-
// @ts-ignore
|
|
199
|
-
return this.invoke(new func(params));
|
|
200
|
-
};
|
|
201
|
-
}
|
|
202
|
-
else {
|
|
203
|
-
return __classPrivateFieldGet(this, _Client_namespaceProxies, "f")[key];
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
},
|
|
207
|
-
set() {
|
|
208
|
-
return true;
|
|
209
|
-
},
|
|
210
|
-
})
|
|
211
|
-
});
|
|
212
155
|
_Client_constructContext.set(this, async (update) => {
|
|
213
156
|
const msg = "message" in update ? update.message : "editedMessage" in update ? update.editedMessage : "callbackQuery" in update ? update.callbackQuery.message : undefined;
|
|
214
157
|
const reactions = "messageInteractions" in update ? update.messageInteractions : undefined;
|
|
@@ -660,10 +603,9 @@ export class Client extends Composer {
|
|
|
660
603
|
__classPrivateFieldSet(this, _Client_L$initConncetion, L.branch("#initConnection"), "f");
|
|
661
604
|
const c = {
|
|
662
605
|
id,
|
|
663
|
-
api: this.api,
|
|
664
606
|
invoke: async (function_, businessConnectionId) => {
|
|
665
607
|
if (businessConnectionId) {
|
|
666
|
-
return await this.
|
|
608
|
+
return await this.invoke({ _: "invokeWithBusinessConnection", connection_id: businessConnectionId, query: function_ });
|
|
667
609
|
}
|
|
668
610
|
else {
|
|
669
611
|
return await this.invoke(function_);
|
|
@@ -785,7 +727,7 @@ export class Client extends Composer {
|
|
|
785
727
|
const [authKey, dc] = await Promise.all([this.storage.getAuthKey(), this.storage.getDc()]);
|
|
786
728
|
if (authKey != null && dc != null) {
|
|
787
729
|
await __classPrivateFieldGet(this, _Client_client, "f").setAuthKey(authKey);
|
|
788
|
-
|
|
730
|
+
__classPrivateFieldGet(this, _Client_client, "f").setDc(dc);
|
|
789
731
|
if (__classPrivateFieldGet(this, _Client_client, "f").serverSalt == 0n) {
|
|
790
732
|
__classPrivateFieldGet(this, _Client_client, "f").serverSalt = await this.storage.getServerSalt() ?? 0n;
|
|
791
733
|
}
|
|
@@ -813,7 +755,7 @@ export class Client extends Composer {
|
|
|
813
755
|
}
|
|
814
756
|
await this.connect();
|
|
815
757
|
}
|
|
816
|
-
async [(_Client_client = new WeakMap(), _Client_guaranteeUpdateDelivery = new WeakMap(), _Client_updateManager = new WeakMap(), _Client_networkStatisticsManager = new WeakMap(), _Client_botInfoManager = new WeakMap(), _Client_fileManager = new WeakMap(), _Client_reactionManager = new WeakMap(), _Client_videoChatManager = new WeakMap(), _Client_businessConnectionManager = new WeakMap(), _Client_messageManager = new WeakMap(), _Client_storyManager = new WeakMap(), _Client_callbackQueryManager = new WeakMap(), _Client_inlineQueryManager = new WeakMap(), _Client_chatListManager = new WeakMap(), _Client_accountManager = new WeakMap(), _Client_storage_ = new WeakMap(), _Client_messageStorage_ = new WeakMap(), _Client_parseMode = new WeakMap(), _Client_apiId = new WeakMap(), _Client_apiHash = new WeakMap(), _Client_publicKeys = new WeakMap(), _Client_ignoreOutgoing = new WeakMap(), _Client_persistCache = new WeakMap(), _Client_LsignIn = new WeakMap(), _Client_LpingLoop = new WeakMap(), _Client_LhandleMigrationError = new WeakMap(), _Client_L$initConncetion = new WeakMap(),
|
|
758
|
+
async [(_Client_client = new WeakMap(), _Client_guaranteeUpdateDelivery = new WeakMap(), _Client_updateManager = new WeakMap(), _Client_networkStatisticsManager = new WeakMap(), _Client_botInfoManager = new WeakMap(), _Client_fileManager = new WeakMap(), _Client_reactionManager = new WeakMap(), _Client_videoChatManager = new WeakMap(), _Client_businessConnectionManager = new WeakMap(), _Client_messageManager = new WeakMap(), _Client_storyManager = new WeakMap(), _Client_callbackQueryManager = new WeakMap(), _Client_inlineQueryManager = new WeakMap(), _Client_chatListManager = new WeakMap(), _Client_accountManager = new WeakMap(), _Client_storage_ = new WeakMap(), _Client_messageStorage_ = new WeakMap(), _Client_parseMode = new WeakMap(), _Client_apiId = new WeakMap(), _Client_apiHash = new WeakMap(), _Client_publicKeys = new WeakMap(), _Client_ignoreOutgoing = new WeakMap(), _Client_persistCache = new WeakMap(), _Client_LsignIn = new WeakMap(), _Client_LpingLoop = new WeakMap(), _Client_LhandleMigrationError = new WeakMap(), _Client_L$initConncetion = new WeakMap(), _Client_constructContext = new WeakMap(), _Client_lastPropagatedConnectionState = new WeakMap(), _Client_stateChangeHandler = new WeakMap(), _Client_storageInited = new WeakMap(), _Client_connectionInited = new WeakMap(), _Client_lastPropagatedAuthorizationState = new WeakMap(), _Client_pingLoopStarted = new WeakMap(), _Client_pingLoopAbortController = new WeakMap(), _Client_pingInterval = new WeakMap(), _Client_lastUpdates = new WeakMap(), _Client_handleInvokeError = new WeakMap(), _Client_lastGetMe = new WeakMap(), _Client_instances = new WeakSet(), _Client_getApiId = async function _Client_getApiId() {
|
|
817
759
|
const apiId = __classPrivateFieldGet(this, _Client_apiId, "f") || await this.storage.getApiId();
|
|
818
760
|
if (!apiId) {
|
|
819
761
|
throw new InputError("apiId not set");
|
|
@@ -827,11 +769,11 @@ export class Client extends Composer {
|
|
|
827
769
|
let prev = 0;
|
|
828
770
|
return {
|
|
829
771
|
size: connectionCount,
|
|
830
|
-
|
|
772
|
+
invoke: () => {
|
|
831
773
|
if (prev + 1 > connections.length)
|
|
832
774
|
prev = 0;
|
|
833
775
|
const connection = connections[prev++];
|
|
834
|
-
return connection.
|
|
776
|
+
return connection.invoke;
|
|
835
777
|
},
|
|
836
778
|
connect: async () => {
|
|
837
779
|
for await (const connection of connections) {
|
|
@@ -863,8 +805,8 @@ export class Client extends Composer {
|
|
|
863
805
|
client.invoke.use(async (ctx, next) => {
|
|
864
806
|
if (ctx.error instanceof AuthKeyUnregistered && dcId) {
|
|
865
807
|
try {
|
|
866
|
-
const exportedAuth = await this.
|
|
867
|
-
await client.
|
|
808
|
+
const exportedAuth = await this.invoke({ _: "auth.exportAuthorization", dc_id: dcId });
|
|
809
|
+
await client.invoke({ ...exportedAuth, _: "auth.importAuthorization" });
|
|
868
810
|
return true;
|
|
869
811
|
}
|
|
870
812
|
catch (err) {
|
|
@@ -876,7 +818,7 @@ export class Client extends Composer {
|
|
|
876
818
|
}
|
|
877
819
|
});
|
|
878
820
|
return {
|
|
879
|
-
|
|
821
|
+
invoke: client.invoke,
|
|
880
822
|
connect: async () => {
|
|
881
823
|
await client.connect();
|
|
882
824
|
if (dcId && dcId != __classPrivateFieldGet(this, _Client_client, "f").dcId) {
|
|
@@ -947,12 +889,12 @@ export class Client extends Composer {
|
|
|
947
889
|
params = { phone: () => mustPrompt("Phone number:"), code: () => mustPrompt("Verification code:"), password: () => mustPrompt("Password:") };
|
|
948
890
|
}
|
|
949
891
|
}
|
|
950
|
-
__classPrivateFieldGet(this, _Client_LsignIn, "f").debug("authorizing with", typeof params === "string" ? "bot token" :
|
|
892
|
+
__classPrivateFieldGet(this, _Client_LsignIn, "f").debug("authorizing with", typeof params === "string" ? "bot token" : is("auth.exportedAuthorization", params) ? "exported authorization" : "AuthorizeUserParams");
|
|
951
893
|
if (params && "botToken" in params) {
|
|
952
894
|
while (true) {
|
|
953
895
|
try {
|
|
954
|
-
const auth = await this.
|
|
955
|
-
await this.storage.setAccountId(Number(
|
|
896
|
+
const auth = await this.invoke({ _: "auth.importBotAuthorization", api_id: apiId, api_hash: __classPrivateFieldGet(this, _Client_apiHash, "f"), bot_auth_token: params.botToken, flags: 0 });
|
|
897
|
+
await this.storage.setAccountId(Number(as("auth.authorization", auth).user.id));
|
|
956
898
|
await this.storage.setAccountType("bot");
|
|
957
899
|
break;
|
|
958
900
|
}
|
|
@@ -978,12 +920,13 @@ export class Client extends Composer {
|
|
|
978
920
|
while (true) {
|
|
979
921
|
try {
|
|
980
922
|
phone = typeof params.phone === "string" ? params.phone : await params.phone();
|
|
981
|
-
const sendCode = () => this.
|
|
923
|
+
const sendCode = () => this.invoke({
|
|
924
|
+
_: "auth.sendCode",
|
|
982
925
|
phone_number: phone,
|
|
983
926
|
api_id: __classPrivateFieldGet(this, _Client_apiId, "f"),
|
|
984
927
|
api_hash: __classPrivateFieldGet(this, _Client_apiHash, "f"),
|
|
985
|
-
settings:
|
|
986
|
-
}).then((v) =>
|
|
928
|
+
settings: { _: "codeSettings" },
|
|
929
|
+
}).then((v) => as("auth.sentCode", v));
|
|
987
930
|
try {
|
|
988
931
|
sentCode = await sendCode();
|
|
989
932
|
}
|
|
@@ -1012,12 +955,13 @@ export class Client extends Composer {
|
|
|
1012
955
|
code: while (true) {
|
|
1013
956
|
const code = typeof params.code === "string" ? params.code : await params.code();
|
|
1014
957
|
try {
|
|
1015
|
-
const auth = await this.
|
|
958
|
+
const auth = await this.invoke({
|
|
959
|
+
_: "auth.signIn",
|
|
1016
960
|
phone_number: phone,
|
|
1017
961
|
phone_code: code,
|
|
1018
962
|
phone_code_hash: sentCode.phone_code_hash,
|
|
1019
963
|
});
|
|
1020
|
-
await this.storage.setAccountId(Number(
|
|
964
|
+
await this.storage.setAccountId(Number(as("auth.authorization", auth).user.id));
|
|
1021
965
|
await this.storage.setAccountType("user");
|
|
1022
966
|
__classPrivateFieldGet(this, _Client_LsignIn, "f").debug("signed in as user");
|
|
1023
967
|
await __classPrivateFieldGet(this, _Client_instances, "m", _Client_propagateAuthorizationState).call(this, true);
|
|
@@ -1038,15 +982,15 @@ export class Client extends Composer {
|
|
|
1038
982
|
throw err;
|
|
1039
983
|
}
|
|
1040
984
|
password: while (true) {
|
|
1041
|
-
const ap = await this.
|
|
1042
|
-
if (!(ap.current_algo
|
|
1043
|
-
throw new Error(`Handling ${ap.current_algo?.
|
|
985
|
+
const ap = await this.invoke({ _: "account.getPassword" });
|
|
986
|
+
if (!(is("passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow", ap.current_algo))) {
|
|
987
|
+
throw new Error(`Handling ${ap.current_algo?._} not implemented`);
|
|
1044
988
|
}
|
|
1045
989
|
try {
|
|
1046
990
|
const password = typeof params.password === "string" ? params.password : await params.password(ap.hint ?? null);
|
|
1047
991
|
const input = await checkPassword(password, ap);
|
|
1048
|
-
const auth = await this.
|
|
1049
|
-
await this.storage.setAccountId(Number(
|
|
992
|
+
const auth = await this.invoke({ _: "auth.checkPassword", password: input });
|
|
993
|
+
await this.storage.setAccountId(Number(as("auth.authorization", auth).user.id));
|
|
1050
994
|
await this.storage.setAccountType("user");
|
|
1051
995
|
__classPrivateFieldGet(this, _Client_LsignIn, "f").debug("signed in as user");
|
|
1052
996
|
await __classPrivateFieldGet(this, _Client_instances, "m", _Client_propagateAuthorizationState).call(this, true);
|
|
@@ -1077,7 +1021,7 @@ export class Client extends Composer {
|
|
|
1077
1021
|
try {
|
|
1078
1022
|
await Promise.all([
|
|
1079
1023
|
this.storage.reset(),
|
|
1080
|
-
this.
|
|
1024
|
+
this.invoke({ _: "auth.logOut" }).then(() => {
|
|
1081
1025
|
__classPrivateFieldGet(this, _Client_instances, "m", _Client_propagateAuthorizationState).call(this, false);
|
|
1082
1026
|
}),
|
|
1083
1027
|
]);
|
|
@@ -1114,10 +1058,10 @@ export class Client extends Composer {
|
|
|
1114
1058
|
*/
|
|
1115
1059
|
async getInputPeer(id) {
|
|
1116
1060
|
if (id === "me" || id == await __classPrivateFieldGet(this, _Client_instances, "m", _Client_getSelfId).call(this)) {
|
|
1117
|
-
return
|
|
1061
|
+
return { _: "inputPeerSelf" };
|
|
1118
1062
|
}
|
|
1119
1063
|
const inputPeer = await __classPrivateFieldGet(this, _Client_instances, "m", _Client_getInputPeerInner).call(this, id);
|
|
1120
|
-
if (((inputPeer
|
|
1064
|
+
if (((is("inputPeerUser", inputPeer) || is("inputPeerChannel", inputPeer)) && inputPeer.access_hash == 0n) && await this.storage.getAccountType() == "bot") {
|
|
1121
1065
|
if ("channel_id" in inputPeer) {
|
|
1122
1066
|
inputPeer.access_hash = await __classPrivateFieldGet(this, _Client_instances, "m", _Client_getChannelAccessHash).call(this, inputPeer.channel_id);
|
|
1123
1067
|
}
|
|
@@ -1125,7 +1069,7 @@ export class Client extends Composer {
|
|
|
1125
1069
|
inputPeer.access_hash = await __classPrivateFieldGet(this, _Client_instances, "m", _Client_getUserAccessHash).call(this, inputPeer.user_id);
|
|
1126
1070
|
}
|
|
1127
1071
|
}
|
|
1128
|
-
if ((inputPeer
|
|
1072
|
+
if ((is("inputPeerUser", inputPeer) || is("inputPeerChannel", inputPeer)) && inputPeer.access_hash == 0n && await this.storage.getAccountType() == "user") {
|
|
1129
1073
|
throw new AccessError(`Cannot access the chat ${id} because there is no access hash for it.`);
|
|
1130
1074
|
}
|
|
1131
1075
|
return inputPeer;
|
|
@@ -1137,10 +1081,10 @@ export class Client extends Composer {
|
|
|
1137
1081
|
*/
|
|
1138
1082
|
async getInputChannel(id) {
|
|
1139
1083
|
const inputPeer = await this.getInputPeer(id);
|
|
1140
|
-
if (!(inputPeer
|
|
1084
|
+
if (!(is("inputPeerChannel", inputPeer))) {
|
|
1141
1085
|
throw new TypeError(`The chat ${id} is not a channel neither a supergroup.`);
|
|
1142
1086
|
}
|
|
1143
|
-
return
|
|
1087
|
+
return { ...inputPeer, _: "inputChannel" };
|
|
1144
1088
|
}
|
|
1145
1089
|
/**
|
|
1146
1090
|
* Get a user's inputUser. Useful when calling API functions directly.
|
|
@@ -1149,10 +1093,10 @@ export class Client extends Composer {
|
|
|
1149
1093
|
*/
|
|
1150
1094
|
async getInputUser(id) {
|
|
1151
1095
|
const inputPeer = await this.getInputPeer(id);
|
|
1152
|
-
if (!(inputPeer
|
|
1096
|
+
if (!(is("inputPeerUser", inputPeer))) {
|
|
1153
1097
|
throw new TypeError(`The chat ${id} is not a private chat.`);
|
|
1154
1098
|
}
|
|
1155
|
-
return
|
|
1099
|
+
return { ...inputPeer, _: "inputUser" };
|
|
1156
1100
|
}
|
|
1157
1101
|
async [(_Client_propagateAuthorizationState = async function _Client_propagateAuthorizationState(authorized) {
|
|
1158
1102
|
if (__classPrivateFieldGet(this, _Client_lastPropagatedAuthorizationState, "f") != authorized) {
|
|
@@ -1182,7 +1126,7 @@ export class Client extends Composer {
|
|
|
1182
1126
|
continue;
|
|
1183
1127
|
}
|
|
1184
1128
|
__classPrivateFieldGet(this, _Client_pingLoopAbortController, "f").signal.throwIfAborted();
|
|
1185
|
-
await this.
|
|
1129
|
+
await this.invoke({ _: "ping_delay_disconnect", ping_id: getRandomId(), disconnect_delay: __classPrivateFieldGet(this, _Client_pingInterval, "f") / second + 15 });
|
|
1186
1130
|
if (Date.now() - __classPrivateFieldGet(this, _Client_lastUpdates, "f").getTime() >= 15 * minute) {
|
|
1187
1131
|
drop(__classPrivateFieldGet(this, _Client_updateManager, "f").recoverUpdateGap("lastUpdates"));
|
|
1188
1132
|
}
|
|
@@ -1198,20 +1142,22 @@ export class Client extends Composer {
|
|
|
1198
1142
|
let n = 1;
|
|
1199
1143
|
while (true) {
|
|
1200
1144
|
try {
|
|
1201
|
-
if (
|
|
1202
|
-
const result = await __classPrivateFieldGet(this, _Client_client, "f").invoke(
|
|
1145
|
+
if (!__classPrivateFieldGet(this, _Client_connectionInited, "f") && !isMtprotoFunction(function_)) {
|
|
1146
|
+
const result = await __classPrivateFieldGet(this, _Client_client, "f").invoke({
|
|
1147
|
+
_: "initConnection",
|
|
1203
1148
|
api_id: await __classPrivateFieldGet(this, _Client_instances, "m", _Client_getApiId).call(this),
|
|
1204
1149
|
app_version: this.appVersion,
|
|
1205
1150
|
device_model: this.deviceModel,
|
|
1206
1151
|
lang_code: this.langCode,
|
|
1207
1152
|
lang_pack: this.langPack,
|
|
1208
|
-
query:
|
|
1153
|
+
query: {
|
|
1154
|
+
_: "invokeWithLayer",
|
|
1209
1155
|
layer: LAYER,
|
|
1210
1156
|
query: function_,
|
|
1211
|
-
}
|
|
1157
|
+
},
|
|
1212
1158
|
system_lang_code: this.systemLangCode,
|
|
1213
1159
|
system_version: this.systemVersion,
|
|
1214
|
-
}
|
|
1160
|
+
}, noWait);
|
|
1215
1161
|
__classPrivateFieldSet(this, _Client_connectionInited, true, "f");
|
|
1216
1162
|
__classPrivateFieldGet(this, _Client_L$initConncetion, "f").debug("connection inited");
|
|
1217
1163
|
return result;
|
|
@@ -1240,15 +1186,15 @@ export class Client extends Composer {
|
|
|
1240
1186
|
}
|
|
1241
1187
|
}
|
|
1242
1188
|
}, _Client_getUserAccessHash = async function _Client_getUserAccessHash(userId) {
|
|
1243
|
-
const users = await this.
|
|
1244
|
-
const user = users[0]
|
|
1189
|
+
const users = await this.invoke({ _: "users.getUsers", id: [{ _: "inputUser", user_id: userId, access_hash: 0n }] });
|
|
1190
|
+
const user = as("user", users[0]);
|
|
1245
1191
|
if (user) {
|
|
1246
1192
|
await this.messageStorage.setEntity(user);
|
|
1247
1193
|
}
|
|
1248
1194
|
return user?.access_hash ?? 0n;
|
|
1249
1195
|
}, _Client_getChannelAccessHash = async function _Client_getChannelAccessHash(channelId) {
|
|
1250
|
-
const channels = await this.
|
|
1251
|
-
const channel = channels.chats[0]
|
|
1196
|
+
const channels = await this.invoke({ _: "channels.getChannels", id: [{ _: "inputChannel", channel_id: channelId, access_hash: 0n }] });
|
|
1197
|
+
const channel = as("channel", channels.chats[0]);
|
|
1252
1198
|
if (channel) {
|
|
1253
1199
|
await this.messageStorage.setEntity(channel);
|
|
1254
1200
|
}
|
|
@@ -1267,13 +1213,13 @@ export class Client extends Composer {
|
|
|
1267
1213
|
resolvedId = id;
|
|
1268
1214
|
}
|
|
1269
1215
|
else {
|
|
1270
|
-
const resolved = await this.
|
|
1216
|
+
const resolved = await this.invoke({ _: "contacts.resolveUsername", username: id });
|
|
1271
1217
|
await __classPrivateFieldGet(this, _Client_updateManager, "f").processChats(resolved.chats);
|
|
1272
1218
|
await __classPrivateFieldGet(this, _Client_updateManager, "f").processUsers(resolved.users);
|
|
1273
|
-
if (resolved.peer
|
|
1219
|
+
if (is("peerUser", resolved.peer)) {
|
|
1274
1220
|
resolvedId = peerToChatId(resolved.peer);
|
|
1275
1221
|
}
|
|
1276
|
-
else if (resolved.peer
|
|
1222
|
+
else if (is("peerChannel", resolved.peer)) {
|
|
1277
1223
|
resolvedId = peerToChatId(resolved.peer);
|
|
1278
1224
|
}
|
|
1279
1225
|
else {
|
|
@@ -1283,11 +1229,11 @@ export class Client extends Composer {
|
|
|
1283
1229
|
const resolvedIdType = getChatIdPeerType(resolvedId);
|
|
1284
1230
|
if (resolvedIdType == "user") {
|
|
1285
1231
|
const accessHash = await this.messageStorage.getUserAccessHash(resolvedId);
|
|
1286
|
-
return
|
|
1232
|
+
return { _: "inputPeerUser", user_id: chatIdToPeerId(resolvedId), access_hash: accessHash ?? 0n };
|
|
1287
1233
|
}
|
|
1288
1234
|
else if (resolvedIdType == "channel") {
|
|
1289
1235
|
const accessHash = await this.messageStorage.getChannelAccessHash(resolvedId);
|
|
1290
|
-
return
|
|
1236
|
+
return { _: "inputPeerChannel", channel_id: chatIdToPeerId(resolvedId), access_hash: accessHash ?? 0n };
|
|
1291
1237
|
}
|
|
1292
1238
|
else {
|
|
1293
1239
|
unreachable();
|
|
@@ -1295,14 +1241,14 @@ export class Client extends Composer {
|
|
|
1295
1241
|
}
|
|
1296
1242
|
else if (id > 0) {
|
|
1297
1243
|
const accessHash = await this.messageStorage.getUserAccessHash(id);
|
|
1298
|
-
return
|
|
1244
|
+
return { _: "inputPeerUser", user_id: chatIdToPeerId(id), access_hash: accessHash ?? 0n };
|
|
1299
1245
|
}
|
|
1300
1246
|
else if (-MAX_CHAT_ID <= id) {
|
|
1301
|
-
return
|
|
1247
|
+
return { _: "inputPeerChat", chat_id: BigInt(Math.abs(id)) };
|
|
1302
1248
|
}
|
|
1303
1249
|
else if (ZERO_CHANNEL_ID - MAX_CHANNEL_ID <= id && id != ZERO_CHANNEL_ID) {
|
|
1304
1250
|
const accessHash = await this.messageStorage.getChannelAccessHash(id);
|
|
1305
|
-
return
|
|
1251
|
+
return { _: "inputPeerChannel", channel_id: chatIdToPeerId(id), access_hash: accessHash ?? 0n };
|
|
1306
1252
|
}
|
|
1307
1253
|
else {
|
|
1308
1254
|
throw new InputError("The ID is of an format unknown.");
|
|
@@ -1310,7 +1256,7 @@ export class Client extends Composer {
|
|
|
1310
1256
|
}, getEntity)](peer) {
|
|
1311
1257
|
const id = peerToChatId(peer);
|
|
1312
1258
|
const entity = await this.messageStorage.getEntity(id);
|
|
1313
|
-
if (entity == null && await this.storage.getAccountType() == "bot" && peer
|
|
1259
|
+
if (entity == null && await this.storage.getAccountType() == "bot" && is("peerUser", peer) || is("peerChannel", peer)) {
|
|
1314
1260
|
await this.getInputPeer(id);
|
|
1315
1261
|
}
|
|
1316
1262
|
else {
|
|
@@ -1327,10 +1273,10 @@ export class Client extends Composer {
|
|
|
1327
1273
|
* @method ac
|
|
1328
1274
|
*/
|
|
1329
1275
|
async getMe() {
|
|
1330
|
-
let user_ = await this[getEntity](
|
|
1276
|
+
let user_ = await this[getEntity]({ _: "peerUser", user_id: BigInt(await __classPrivateFieldGet(this, _Client_instances, "m", _Client_getSelfId).call(this)) });
|
|
1331
1277
|
if (user_ == null) {
|
|
1332
|
-
const users = await this.
|
|
1333
|
-
user_ = users[0]
|
|
1278
|
+
const users = await this.invoke({ _: "users.getUsers", id: [{ _: "inputUserSelf" }] });
|
|
1279
|
+
user_ = as("user", users[0]);
|
|
1334
1280
|
await this.messageStorage.setEntity(user_);
|
|
1335
1281
|
}
|
|
1336
1282
|
const user = constructUser(user_);
|
|
@@ -1916,7 +1862,7 @@ export class Client extends Composer {
|
|
|
1916
1862
|
* @returns The chat's administrators.
|
|
1917
1863
|
*/
|
|
1918
1864
|
async getChatAdministrators(chatId) {
|
|
1919
|
-
return await __classPrivateFieldGet(this,
|
|
1865
|
+
return await __classPrivateFieldGet(this, _Client_chatListManager, "f").getChatAdministrators(chatId);
|
|
1920
1866
|
}
|
|
1921
1867
|
/**
|
|
1922
1868
|
* Enable join requests in a chat. User-only.
|
|
@@ -2396,9 +2342,9 @@ _a = Client, _Client_handleCtxUpdate = async function _Client_handleCtxUpdate(up
|
|
|
2396
2342
|
});
|
|
2397
2343
|
}, _Client_handleUpdate = async function _Client_handleUpdate(update) {
|
|
2398
2344
|
const promises = new Array();
|
|
2399
|
-
if (update
|
|
2345
|
+
if (is("updateUserName", update)) {
|
|
2400
2346
|
await this.messageStorage.updateUsernames(Number(update.user_id), update.usernames.map((v) => v.username));
|
|
2401
|
-
const peer =
|
|
2347
|
+
const peer = { ...update, _: "peerUser" };
|
|
2402
2348
|
const entity = await this[getEntity](peer);
|
|
2403
2349
|
if (entity != null) {
|
|
2404
2350
|
entity.usernames = update.usernames;
|
|
@@ -17,16 +17,18 @@
|
|
|
17
17
|
* You should have received a copy of the GNU Lesser General Public License
|
|
18
18
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
19
19
|
*/
|
|
20
|
-
import
|
|
21
|
-
import {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
20
|
+
import * as dntShim from "../_dnt.shims.js";
|
|
21
|
+
import { Connection } from "./0_connection.js";
|
|
22
|
+
export declare class ConnectionTCP implements Connection {
|
|
23
|
+
#private;
|
|
24
|
+
connect: typeof dntShim.Deno.connect;
|
|
25
|
+
stateChangeHandler?: Connection["stateChangeHandler"];
|
|
26
|
+
callback?: Connection["callback"];
|
|
27
|
+
constructor(hostname: string, port: number);
|
|
28
|
+
get connected(): boolean;
|
|
29
|
+
open(): Promise<void>;
|
|
30
|
+
read(p: Uint8Array): Promise<void>;
|
|
31
|
+
write(p: Uint8Array): Promise<void>;
|
|
32
|
+
close(): void;
|
|
31
33
|
}
|
|
32
|
-
//# sourceMappingURL=
|
|
34
|
+
//# sourceMappingURL=1_connection_tcp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"1_connection_tcp.d.ts","sourceRoot":"","sources":["../../src/connection/1_connection_tcp.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAC;AAK5C,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAI/C,qBAAa,aAAc,YAAW,UAAU;;IAU9C,OAAO,EAAE,OAAO,OAAO,CAAC,IAAI,CAAC,OAAO,CAAwB;IAC5D,kBAAkB,CAAC,EAAE,UAAU,CAAC,oBAAoB,CAAC,CAAC;IACtD,QAAQ,CAAC,EAAE,UAAU,CAAC,UAAU,CAAC,CAAC;gBAEtB,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;IAK1C,IAAI,SAAS,IAAI,OAAO,CAEvB;IAQK,IAAI;IA8CJ,IAAI,CAAC,CAAC,EAAE,UAAU;IAgBlB,KAAK,CAAC,CAAC,EAAE,UAAU;IA0BzB,KAAK;CAON"}
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
2
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
3
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
4
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
5
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
6
|
+
};
|
|
7
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
8
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
9
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
10
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
|
+
};
|
|
12
|
+
var _ConnectionTCP_instances, _ConnectionTCP_hostname, _ConnectionTCP_port, _ConnectionTCP_connection, _ConnectionTCP_rMutex, _ConnectionTCP_wMutex, _ConnectionTCP_buffer, _ConnectionTCP_nextResolve, _ConnectionTCP_canRead, _ConnectionTCP_canWrite, _ConnectionTCP_assertConnected, _ConnectionTCP_rejectRead;
|
|
13
|
+
/**
|
|
14
|
+
* MTKruto - Cross-runtime JavaScript library for building Telegram clients
|
|
15
|
+
* Copyright (C) 2023-2024 Roj <https://roj.im/>
|
|
16
|
+
*
|
|
17
|
+
* This file is part of MTKruto.
|
|
18
|
+
*
|
|
19
|
+
* This program is free software: you can redistribute it and/or modify
|
|
20
|
+
* it under the terms of the GNU Lesser General Public License as published by
|
|
21
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
22
|
+
* (at your option) any later version.
|
|
23
|
+
*
|
|
24
|
+
* This program is distributed in the hope that it will be useful,
|
|
25
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
26
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
27
|
+
* GNU Lesser General Public License for more details.
|
|
28
|
+
*
|
|
29
|
+
* You should have received a copy of the GNU Lesser General Public License
|
|
30
|
+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
31
|
+
*/
|
|
32
|
+
import * as dntShim from "../_dnt.shims.js";
|
|
33
|
+
import { concat, iterateReader } from "../0_deps.js";
|
|
34
|
+
import { getLogger, Mutex } from "../1_utilities.js";
|
|
35
|
+
const L = getLogger("ConnectionTCP");
|
|
36
|
+
export class ConnectionTCP {
|
|
37
|
+
constructor(hostname, port) {
|
|
38
|
+
_ConnectionTCP_instances.add(this);
|
|
39
|
+
_ConnectionTCP_hostname.set(this, void 0);
|
|
40
|
+
_ConnectionTCP_port.set(this, void 0);
|
|
41
|
+
_ConnectionTCP_connection.set(this, void 0);
|
|
42
|
+
_ConnectionTCP_rMutex.set(this, new Mutex());
|
|
43
|
+
_ConnectionTCP_wMutex.set(this, new Mutex());
|
|
44
|
+
_ConnectionTCP_buffer.set(this, new Uint8Array());
|
|
45
|
+
_ConnectionTCP_nextResolve.set(this, null);
|
|
46
|
+
_ConnectionTCP_canRead.set(this, false);
|
|
47
|
+
_ConnectionTCP_canWrite.set(this, false);
|
|
48
|
+
Object.defineProperty(this, "connect", {
|
|
49
|
+
enumerable: true,
|
|
50
|
+
configurable: true,
|
|
51
|
+
writable: true,
|
|
52
|
+
value: dntShim.Deno.connect
|
|
53
|
+
});
|
|
54
|
+
Object.defineProperty(this, "stateChangeHandler", {
|
|
55
|
+
enumerable: true,
|
|
56
|
+
configurable: true,
|
|
57
|
+
writable: true,
|
|
58
|
+
value: void 0
|
|
59
|
+
});
|
|
60
|
+
Object.defineProperty(this, "callback", {
|
|
61
|
+
enumerable: true,
|
|
62
|
+
configurable: true,
|
|
63
|
+
writable: true,
|
|
64
|
+
value: void 0
|
|
65
|
+
});
|
|
66
|
+
__classPrivateFieldSet(this, _ConnectionTCP_hostname, hostname, "f");
|
|
67
|
+
__classPrivateFieldSet(this, _ConnectionTCP_port, port, "f");
|
|
68
|
+
}
|
|
69
|
+
get connected() {
|
|
70
|
+
return !!__classPrivateFieldGet(this, _ConnectionTCP_connection, "f") && __classPrivateFieldGet(this, _ConnectionTCP_canRead, "f") && __classPrivateFieldGet(this, _ConnectionTCP_canWrite, "f");
|
|
71
|
+
}
|
|
72
|
+
async open() {
|
|
73
|
+
if (this.connected) {
|
|
74
|
+
throw new Error("Connection already open");
|
|
75
|
+
}
|
|
76
|
+
const connection = await this.connect({
|
|
77
|
+
hostname: __classPrivateFieldGet(this, _ConnectionTCP_hostname, "f"),
|
|
78
|
+
port: __classPrivateFieldGet(this, _ConnectionTCP_port, "f"),
|
|
79
|
+
});
|
|
80
|
+
__classPrivateFieldSet(this, _ConnectionTCP_canRead, __classPrivateFieldSet(this, _ConnectionTCP_canWrite, true, "f"), "f");
|
|
81
|
+
this.stateChangeHandler?.(true);
|
|
82
|
+
Promise.resolve().then(async () => {
|
|
83
|
+
do {
|
|
84
|
+
try {
|
|
85
|
+
for await (const chunk of iterateReader(connection)) {
|
|
86
|
+
this.callback?.read(chunk.length);
|
|
87
|
+
__classPrivateFieldSet(this, _ConnectionTCP_buffer, concat([__classPrivateFieldGet(this, _ConnectionTCP_buffer, "f"), chunk]), "f");
|
|
88
|
+
if (__classPrivateFieldGet(this, _ConnectionTCP_nextResolve, "f") != null && __classPrivateFieldGet(this, _ConnectionTCP_buffer, "f").length >= __classPrivateFieldGet(this, _ConnectionTCP_nextResolve, "f")[0]) {
|
|
89
|
+
__classPrivateFieldGet(this, _ConnectionTCP_nextResolve, "f")[1].resolve();
|
|
90
|
+
__classPrivateFieldSet(this, _ConnectionTCP_nextResolve, null, "f");
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
__classPrivateFieldSet(this, _ConnectionTCP_canRead, false, "f");
|
|
94
|
+
break;
|
|
95
|
+
}
|
|
96
|
+
catch (err) {
|
|
97
|
+
if (!this.connected) {
|
|
98
|
+
this.stateChangeHandler?.(false);
|
|
99
|
+
__classPrivateFieldGet(this, _ConnectionTCP_instances, "m", _ConnectionTCP_rejectRead).call(this);
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
L.error(err);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
} while (this.connected);
|
|
106
|
+
});
|
|
107
|
+
__classPrivateFieldSet(this, _ConnectionTCP_connection, connection, "f");
|
|
108
|
+
}
|
|
109
|
+
async read(p) {
|
|
110
|
+
__classPrivateFieldGet(this, _ConnectionTCP_instances, "m", _ConnectionTCP_assertConnected).call(this);
|
|
111
|
+
const unlock = await __classPrivateFieldGet(this, _ConnectionTCP_rMutex, "f").lock();
|
|
112
|
+
try {
|
|
113
|
+
__classPrivateFieldGet(this, _ConnectionTCP_instances, "m", _ConnectionTCP_assertConnected).call(this);
|
|
114
|
+
if (__classPrivateFieldGet(this, _ConnectionTCP_buffer, "f").length < p.length) {
|
|
115
|
+
await new Promise((resolve, reject) => __classPrivateFieldSet(this, _ConnectionTCP_nextResolve, [p.length, { resolve, reject }], "f"));
|
|
116
|
+
}
|
|
117
|
+
const slice = __classPrivateFieldGet(this, _ConnectionTCP_buffer, "f").slice(0, p.length);
|
|
118
|
+
p.set(slice);
|
|
119
|
+
__classPrivateFieldSet(this, _ConnectionTCP_buffer, __classPrivateFieldGet(this, _ConnectionTCP_buffer, "f").slice(slice.length), "f");
|
|
120
|
+
}
|
|
121
|
+
finally {
|
|
122
|
+
unlock();
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
async write(p) {
|
|
126
|
+
__classPrivateFieldGet(this, _ConnectionTCP_instances, "m", _ConnectionTCP_assertConnected).call(this);
|
|
127
|
+
const unlock = await __classPrivateFieldGet(this, _ConnectionTCP_wMutex, "f").lock();
|
|
128
|
+
try {
|
|
129
|
+
__classPrivateFieldGet(this, _ConnectionTCP_instances, "m", _ConnectionTCP_assertConnected).call(this);
|
|
130
|
+
let written = 0;
|
|
131
|
+
while (written < p.length) {
|
|
132
|
+
try {
|
|
133
|
+
const wrote = await __classPrivateFieldGet(this, _ConnectionTCP_connection, "f").write(p.subarray(written));
|
|
134
|
+
this.callback?.write(wrote);
|
|
135
|
+
written += wrote;
|
|
136
|
+
}
|
|
137
|
+
catch (err) {
|
|
138
|
+
if (err instanceof dntShim.Deno.errors.BrokenPipe) {
|
|
139
|
+
__classPrivateFieldSet(this, _ConnectionTCP_canWrite, false, "f");
|
|
140
|
+
}
|
|
141
|
+
if (!this.connected) {
|
|
142
|
+
this.stateChangeHandler?.(false);
|
|
143
|
+
}
|
|
144
|
+
throw err;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
finally {
|
|
149
|
+
unlock();
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
close() {
|
|
153
|
+
__classPrivateFieldGet(this, _ConnectionTCP_instances, "m", _ConnectionTCP_assertConnected).call(this);
|
|
154
|
+
__classPrivateFieldGet(this, _ConnectionTCP_connection, "f").close();
|
|
155
|
+
__classPrivateFieldSet(this, _ConnectionTCP_canRead, __classPrivateFieldSet(this, _ConnectionTCP_canWrite, false, "f"), "f");
|
|
156
|
+
__classPrivateFieldSet(this, _ConnectionTCP_connection, undefined, "f");
|
|
157
|
+
__classPrivateFieldGet(this, _ConnectionTCP_instances, "m", _ConnectionTCP_rejectRead).call(this);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
_ConnectionTCP_hostname = new WeakMap(), _ConnectionTCP_port = new WeakMap(), _ConnectionTCP_connection = new WeakMap(), _ConnectionTCP_rMutex = new WeakMap(), _ConnectionTCP_wMutex = new WeakMap(), _ConnectionTCP_buffer = new WeakMap(), _ConnectionTCP_nextResolve = new WeakMap(), _ConnectionTCP_canRead = new WeakMap(), _ConnectionTCP_canWrite = new WeakMap(), _ConnectionTCP_instances = new WeakSet(), _ConnectionTCP_assertConnected = function _ConnectionTCP_assertConnected() {
|
|
161
|
+
if (!this.connected) {
|
|
162
|
+
throw new Error("Connection not open");
|
|
163
|
+
}
|
|
164
|
+
}, _ConnectionTCP_rejectRead = function _ConnectionTCP_rejectRead() {
|
|
165
|
+
if (__classPrivateFieldGet(this, _ConnectionTCP_nextResolve, "f") != null) {
|
|
166
|
+
__classPrivateFieldGet(this, _ConnectionTCP_nextResolve, "f")[1].reject(new Error("Connection was closed"));
|
|
167
|
+
__classPrivateFieldSet(this, _ConnectionTCP_nextResolve, null, "f");
|
|
168
|
+
}
|
|
169
|
+
};
|