@mtkruto/node 0.1.201 → 0.1.299
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/COPYING +674 -0
- package/README.md +77 -1
- package/esm/0_deps.d.ts +20 -1
- package/esm/0_deps.js +21 -1
- package/esm/0_errors.d.ts +19 -0
- package/esm/0_errors.js +19 -0
- package/esm/1_utilities.d.ts +20 -1
- package/esm/1_utilities.js +20 -1
- package/esm/2_connection.d.ts +19 -0
- package/esm/2_connection.js +19 -0
- package/esm/2_tl.d.ts +19 -0
- package/esm/2_tl.js +19 -0
- package/esm/3_errors.d.ts +19 -0
- package/esm/3_errors.js +19 -0
- package/esm/3_storage.d.ts +19 -0
- package/esm/3_storage.js +19 -0
- package/esm/3_transport.d.ts +19 -0
- package/esm/3_transport.js +19 -0
- package/esm/3_types.d.ts +19 -0
- package/esm/3_types.js +19 -0
- package/esm/4_constants.js +19 -0
- package/esm/4_errors.d.ts +19 -0
- package/esm/4_errors.js +22 -3
- package/esm/5_client.d.ts +19 -0
- package/esm/5_client.js +19 -0
- package/esm/client/0_client_abstract.d.ts +19 -0
- package/esm/client/0_client_abstract.js +19 -0
- package/esm/client/0_filters.d.ts +19 -0
- package/esm/client/0_filters.js +19 -0
- package/esm/client/0_html.d.ts +19 -0
- package/esm/client/0_html.js +19 -0
- package/esm/client/0_markdown.js +5 -5
- package/esm/client/0_message.d.ts +19 -0
- package/esm/client/0_message.js +19 -0
- package/esm/client/0_params.d.ts +19 -0
- package/esm/client/0_params.js +19 -0
- package/esm/client/0_password.js +19 -0
- package/esm/client/0_types.d.ts +19 -0
- package/esm/client/0_types.js +19 -0
- package/esm/client/0_utilities.d.ts +7 -0
- package/esm/client/0_utilities.js +66 -4
- package/esm/client/1_account_manager.d.ts +19 -0
- package/esm/client/1_account_manager.js +23 -4
- package/esm/client/1_bot_info_manager.d.ts +19 -0
- package/esm/client/1_bot_info_manager.js +19 -0
- package/esm/client/1_business_connection_manager.d.ts +19 -0
- package/esm/client/1_business_connection_manager.js +19 -0
- package/esm/client/1_client_encrypted.d.ts +19 -0
- package/esm/client/1_client_encrypted.js +23 -4
- package/esm/client/1_client_plain.d.ts +19 -0
- package/esm/client/1_client_plain.js +22 -3
- package/esm/client/1_composer.d.ts +19 -0
- package/esm/client/1_composer.js +19 -0
- package/esm/client/1_file_manager.d.ts +19 -0
- package/esm/client/1_file_manager.js +25 -5
- package/esm/client/1_network_statistics_manager.d.ts +19 -0
- package/esm/client/1_network_statistics_manager.js +19 -0
- package/esm/client/1_reaction_manager.d.ts +19 -0
- package/esm/client/1_reaction_manager.js +21 -2
- package/esm/client/1_update_manager.d.ts +19 -0
- package/esm/client/1_update_manager.js +28 -8
- package/esm/client/2_message_manager.d.ts +19 -0
- package/esm/client/2_message_manager.js +66 -24
- package/esm/client/3_callback_query_manager.d.ts +19 -0
- package/esm/client/3_callback_query_manager.js +21 -0
- package/esm/client/3_chat_list_manager.d.ts +19 -0
- package/esm/client/3_chat_list_manager.js +32 -12
- package/esm/client/3_inline_query_manager.d.ts +19 -0
- package/esm/client/3_inline_query_manager.js +23 -2
- package/esm/client/3_story_manager.d.ts +19 -0
- package/esm/client/3_story_manager.js +26 -5
- package/esm/client/4_client.d.ts +19 -0
- package/esm/client/4_client.js +37 -17
- package/esm/connection/0_connection.d.ts +19 -0
- package/esm/connection/0_connection.js +19 -0
- package/esm/connection/1_connection_web_socket.js +22 -2
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/DomHandler.d.ts +83 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/DomHandler.js +203 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/DomSerializer.d.ts +50 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/DomSerializer.js +274 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/ElementType.d.ts +47 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/ElementType.js +51 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/FeedHandler.d.ts +66 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/FeedHandler.js +191 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/Node.d.ts +168 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/Node.js +385 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/Parser.d.ts +159 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/Parser.js +431 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/Tokenizer.d.ts +181 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/Tokenizer.js +1046 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/mod.d.ts +42 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/mod.js +52 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/decode.d.ts +11 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/decode.js +122 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/decode_codepoint.d.ts +1 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/decode_codepoint.js +24 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/encode.d.ts +46 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/encode.js +121 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/decode.d.ts +31 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/decode.js +30 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/entities.d.ts +2128 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/entities.js +2127 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/legacy.d.ts +109 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/legacy.js +108 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/xml.d.ts +8 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/xml.js +1 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/mod.d.ts +90 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/mod.js +95 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/helpers.d.ts +50 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/helpers.js +128 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/legacy.d.ts +46 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/legacy.js +110 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/manipulation.d.ts +42 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/manipulation.js +120 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/mod.d.ts +6 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/mod.js +6 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/querying.d.ts +54 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/querying.js +110 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/stringify.d.ts +40 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/stringify.js +75 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/traversal.d.ts +58 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/traversal.js +101 -0
- package/{script/deps/deno.land/x/tgcrypto@0.3.3 → esm/deps/deno.land/x/tgcrypto@0.4.0}/mod.d.ts +0 -1
- package/esm/deps/deno.land/x/{tgcrypto@0.3.3 → tgcrypto@0.4.0}/mod.js +0 -11
- package/esm/deps/deno.land/x/tgcrypto@0.4.0/tgcrypto.js +308 -0
- package/esm/deps/raw.githubusercontent.com/MTKruto/compress/main/zlib/deflate.d.ts +2 -0
- package/esm/deps/raw.githubusercontent.com/MTKruto/compress/main/zlib/deflate.js +5 -1
- package/esm/deps/raw.githubusercontent.com/MTKruto/compress/main/zlib/inflate.d.ts +2 -2
- package/esm/deps/raw.githubusercontent.com/MTKruto/compress/main/zlib/inflate.js +5 -1
- package/esm/deps/raw.githubusercontent.com/MTKruto/compress/main/zlib/zlib/crc32.js +1 -1
- package/esm/deps/raw.githubusercontent.com/MTKruto/compress/main/zlib/zlib/deflate.js +8 -8
- package/esm/deps/raw.githubusercontent.com/MTKruto/compress/main/zlib/zlib/inffast.js +2 -2
- package/esm/deps/raw.githubusercontent.com/MTKruto/compress/main/zlib/zlib/inflate.js +19 -21
- package/esm/deps/raw.githubusercontent.com/MTKruto/compress/main/zlib/zlib/trees.js +3 -3
- package/esm/mod.d.ts +20 -1
- package/esm/mod.js +20 -1
- package/esm/storage/0_storage.d.ts +19 -0
- package/esm/storage/0_storage.js +25 -5
- package/esm/storage/1_utilities.d.ts +19 -1
- package/esm/storage/1_utilities.js +21 -3
- package/esm/storage/2_storage_indexed_db.d.ts +19 -0
- package/esm/storage/2_storage_indexed_db.js +19 -0
- package/esm/storage/2_storage_local_storage.d.ts +19 -0
- package/esm/storage/2_storage_local_storage.js +20 -4
- package/esm/storage/2_storage_memory.d.ts +19 -0
- package/esm/storage/2_storage_memory.js +19 -0
- package/esm/storage/2_storage_session_storage.d.ts +19 -0
- package/esm/storage/2_storage_session_storage.js +20 -4
- package/esm/tl/0_tl_raw_reader.d.ts +19 -0
- package/esm/tl/0_tl_raw_reader.js +19 -0
- package/esm/tl/0_tl_raw_writer.d.ts +19 -0
- package/esm/tl/0_tl_raw_writer.js +19 -0
- package/esm/tl/1_tl_object.d.ts +19 -0
- package/esm/tl/1_tl_object.js +19 -0
- package/esm/tl/2_types.d.ts +19 -0
- package/esm/tl/2_types.js +19 -0
- package/esm/tl/3_deserialize.d.ts +19 -0
- package/esm/tl/3_deserialize.js +19 -0
- package/esm/tl/3_functions.d.ts +19 -0
- package/esm/tl/3_functions.js +19 -0
- package/esm/tl/3_utilities.d.ts +19 -0
- package/esm/tl/3_utilities.js +24 -4
- package/esm/tl/4_tl_reader.d.ts +19 -0
- package/esm/tl/4_tl_reader.js +19 -0
- package/esm/tl/5_tl_writer.d.ts +19 -0
- package/esm/tl/5_tl_writer.js +19 -0
- package/esm/tl/6_rpc_result.d.ts +19 -0
- package/esm/tl/6_rpc_result.js +19 -0
- package/esm/tl/7_message.d.ts +19 -0
- package/esm/tl/7_message.js +19 -0
- package/esm/tl/8_message_container.d.ts +19 -0
- package/esm/tl/8_message_container.js +19 -0
- package/esm/transport/0_obfuscation.js +19 -0
- package/esm/transport/0_transport.d.ts +19 -0
- package/esm/transport/0_transport.js +19 -0
- package/esm/transport/1_transport_abridged.d.ts +19 -0
- package/esm/transport/1_transport_abridged.js +19 -0
- package/esm/transport/1_transport_intermediate.d.ts +19 -0
- package/esm/transport/1_transport_intermediate.js +19 -0
- package/esm/transport/2_transport_provider.d.ts +19 -0
- package/esm/transport/2_transport_provider.js +23 -4
- package/esm/transport/3_transport_provider_web_socket.d.ts +19 -0
- package/esm/transport/3_transport_provider_web_socket.js +19 -0
- package/esm/types/0_authorization_state.d.ts +19 -0
- package/esm/types/0_authorization_state.js +19 -0
- package/esm/types/0_bot_command.d.ts +19 -0
- package/esm/types/0_bot_command.js +19 -0
- package/esm/types/0_chat_action.d.ts +19 -0
- package/esm/types/0_chat_action.js +19 -0
- package/esm/types/0_chat_administrator_rights.d.ts +19 -0
- package/esm/types/0_chat_administrator_rights.js +19 -0
- package/esm/types/0_chat_member_rights.d.ts +19 -0
- package/esm/types/0_chat_member_rights.js +19 -0
- package/esm/types/0_chat_photo.d.ts +19 -1
- package/esm/types/0_chat_photo.js +19 -2
- package/esm/types/0_connection_state.d.ts +19 -0
- package/esm/types/0_connection_state.js +19 -0
- package/esm/types/0_contact.d.ts +19 -0
- package/esm/types/0_contact.js +19 -0
- package/esm/types/0_dice.d.ts +19 -0
- package/esm/types/0_dice.js +19 -0
- package/esm/types/0_file_source.d.ts +19 -0
- package/esm/types/0_file_source.js +19 -0
- package/esm/types/0_giveaway_parameters.d.ts +19 -0
- package/esm/types/0_giveaway_parameters.js +19 -0
- package/esm/types/0_id.d.ts +19 -0
- package/esm/types/0_id.js +19 -0
- package/esm/types/0_keyboard_button_poll_type.d.ts +19 -0
- package/esm/types/0_keyboard_button_poll_type.js +19 -0
- package/esm/types/0_link_preview.d.ts +19 -0
- package/esm/types/0_link_preview.js +19 -0
- package/esm/types/0_location.d.ts +19 -0
- package/esm/types/0_location.js +19 -0
- package/esm/types/0_login_url.d.ts +19 -0
- package/esm/types/0_login_url.js +19 -0
- package/esm/types/0_mask_position.d.ts +19 -0
- package/esm/types/0_mask_position.js +19 -0
- package/esm/types/0_message_entity.d.ts +19 -0
- package/esm/types/0_message_entity.js +22 -3
- package/esm/types/0_message_reference.d.ts +19 -0
- package/esm/types/0_message_reference.js +19 -0
- package/esm/types/0_message_search_filter.d.ts +19 -0
- package/esm/types/0_message_search_filter.js +21 -2
- package/esm/types/0_mini_app_info.d.ts +19 -0
- package/esm/types/0_mini_app_info.js +19 -0
- package/esm/types/0_network_statistics_entry.d.ts +19 -0
- package/esm/types/0_network_statistics_entry.js +19 -0
- package/esm/types/0_parse_mode.d.ts +19 -0
- package/esm/types/0_parse_mode.js +19 -0
- package/esm/types/0_poll_option.d.ts +19 -0
- package/esm/types/0_poll_option.js +19 -0
- package/esm/types/0_price_tag.d.ts +19 -0
- package/esm/types/0_price_tag.js +19 -0
- package/esm/types/0_reaction.d.ts +19 -0
- package/esm/types/0_reaction.js +21 -2
- package/esm/types/0_restriction_reason.d.ts +19 -0
- package/esm/types/0_restriction_reason.js +19 -0
- package/esm/types/0_story_reference.d.ts +19 -0
- package/esm/types/0_story_reference.js +19 -0
- package/esm/types/0_thumbnail.d.ts +19 -0
- package/esm/types/0_thumbnail.js +19 -0
- package/esm/types/0_voice.d.ts +19 -0
- package/esm/types/0_voice.js +19 -0
- package/esm/types/1_animation.d.ts +19 -0
- package/esm/types/1_animation.js +19 -0
- package/esm/types/1_audio.d.ts +19 -0
- package/esm/types/1_audio.js +19 -0
- package/esm/types/1_bot_command_scope.d.ts +19 -0
- package/esm/types/1_bot_command_scope.js +22 -3
- package/esm/types/1_chat_p.d.ts +19 -0
- package/esm/types/1_chat_p.js +22 -2
- package/esm/types/1_document.d.ts +19 -0
- package/esm/types/1_document.js +19 -0
- package/esm/types/1_giveaway.d.ts +19 -0
- package/esm/types/1_giveaway.js +19 -0
- package/esm/types/1_inline_query_result_button.d.ts +19 -0
- package/esm/types/1_inline_query_result_button.js +19 -0
- package/esm/types/1_input_message_content.d.ts +19 -0
- package/esm/types/1_input_message_content.js +19 -0
- package/esm/types/1_input_story_content.d.ts +19 -0
- package/esm/types/1_input_story_content.js +19 -0
- package/esm/types/1_keyboard_button.d.ts +19 -0
- package/esm/types/1_keyboard_button.js +22 -3
- package/esm/types/1_message_reaction.d.ts +19 -0
- package/esm/types/1_message_reaction.js +21 -2
- package/esm/types/1_network_statistics.d.ts +19 -0
- package/esm/types/1_network_statistics.js +19 -0
- package/esm/types/1_photo.d.ts +19 -0
- package/esm/types/1_photo.js +19 -0
- package/esm/types/1_poll.d.ts +19 -0
- package/esm/types/1_poll.js +19 -0
- package/esm/types/1_reaction_count.d.ts +19 -0
- package/esm/types/1_reaction_count.js +19 -0
- package/esm/types/1_reply_quote.d.ts +19 -0
- package/esm/types/1_reply_quote.js +19 -0
- package/esm/types/1_sticker.d.ts +19 -0
- package/esm/types/1_sticker.js +19 -0
- package/esm/types/1_story_privacy.d.ts +19 -0
- package/esm/types/1_story_privacy.js +22 -3
- package/esm/types/1_story_reaction.d.ts +19 -0
- package/esm/types/1_story_reaction.js +19 -0
- package/esm/types/1_user.d.ts +19 -0
- package/esm/types/1_user.js +19 -0
- package/esm/types/1_venue.d.ts +19 -0
- package/esm/types/1_venue.js +19 -0
- package/esm/types/1_video.d.ts +19 -0
- package/esm/types/1_video.js +19 -0
- package/esm/types/1_video_note.d.ts +19 -0
- package/esm/types/1_video_note.js +19 -0
- package/esm/types/2_business_connection.d.ts +19 -0
- package/esm/types/2_business_connection.js +19 -0
- package/esm/types/2_chat_member.d.ts +19 -0
- package/esm/types/2_chat_member.js +25 -5
- package/esm/types/2_chosen_inline_result.d.ts +19 -0
- package/esm/types/2_chosen_inline_result.js +22 -2
- package/esm/types/2_game.d.ts +19 -0
- package/esm/types/2_game.js +19 -0
- package/esm/types/2_inactive_chat.d.ts +19 -0
- package/esm/types/2_inactive_chat.js +22 -2
- package/esm/types/2_inline_keyboard_button.d.ts +19 -0
- package/esm/types/2_inline_keyboard_button.js +22 -3
- package/esm/types/2_inline_query.d.ts +19 -0
- package/esm/types/2_inline_query.js +22 -3
- package/esm/types/2_invite_link.d.ts +19 -0
- package/esm/types/2_invite_link.js +22 -2
- package/esm/types/2_message_interactions.d.ts +19 -0
- package/esm/types/2_message_interactions.js +19 -0
- package/esm/types/2_message_reaction_count.d.ts +19 -0
- package/esm/types/2_message_reaction_count.js +19 -0
- package/esm/types/2_message_reactions.d.ts +19 -0
- package/esm/types/2_message_reactions.js +19 -0
- package/esm/types/2_story_content.d.ts +19 -0
- package/esm/types/2_story_content.js +24 -5
- package/esm/types/2_story_interactions.d.ts +19 -0
- package/esm/types/2_story_interactions.js +19 -0
- package/esm/types/2_story_interactive_area.d.ts +19 -0
- package/esm/types/2_story_interactive_area.js +24 -5
- package/esm/types/3_chat_member_updated.d.ts +19 -0
- package/esm/types/3_chat_member_updated.js +23 -3
- package/esm/types/3_reply_markup.d.ts +19 -0
- package/esm/types/3_reply_markup.js +23 -3
- package/esm/types/3_story.d.ts +19 -0
- package/esm/types/3_story.js +22 -2
- package/esm/types/4_inline_query_result.d.ts +19 -0
- package/esm/types/4_inline_query_result.js +24 -5
- package/esm/types/4_message.d.ts +19 -0
- package/esm/types/4_message.js +36 -16
- package/esm/types/5_callback_query.d.ts +19 -0
- package/esm/types/5_callback_query.js +23 -3
- package/esm/types/5_chat.d.ts +19 -0
- package/esm/types/5_chat.js +27 -7
- package/esm/types/6_update.d.ts +19 -0
- package/esm/types/6_update.js +19 -0
- package/esm/types/_file_id.d.ts +19 -0
- package/esm/types/_file_id.js +28 -8
- package/esm/types/_getters.d.ts +19 -0
- package/esm/types/_getters.js +19 -0
- package/esm/utilities/0_bigint.d.ts +1 -0
- package/esm/utilities/0_bigint.js +44 -0
- package/esm/utilities/0_buffer.d.ts +19 -0
- package/esm/utilities/0_buffer.js +19 -0
- package/esm/utilities/0_cache_map.d.ts +19 -0
- package/esm/utilities/0_cache_map.js +19 -0
- package/esm/utilities/0_color.d.ts +19 -0
- package/esm/utilities/0_color.js +19 -0
- package/esm/utilities/0_crypto.d.ts +19 -0
- package/esm/utilities/0_crypto.js +19 -0
- package/esm/utilities/0_hash.js +19 -0
- package/esm/utilities/0_logger.d.ts +27 -0
- package/esm/utilities/0_logger.js +28 -5
- package/esm/utilities/0_mutex.d.ts +19 -0
- package/esm/utilities/0_mutex.js +19 -0
- package/esm/utilities/0_object.d.ts +19 -0
- package/esm/utilities/0_object.js +19 -0
- package/esm/utilities/0_rle.d.ts +19 -0
- package/esm/utilities/0_rle.js +19 -0
- package/esm/utilities/0_types.d.ts +19 -0
- package/esm/utilities/0_types.js +19 -0
- package/esm/utilities/1_auth.js +19 -0
- package/esm/utilities/1_base64.d.ts +19 -0
- package/esm/utilities/1_base64.js +19 -0
- package/esm/utilities/1_math.d.ts +20 -0
- package/esm/utilities/1_math.js +70 -0
- package/esm/utilities/1_misc.d.ts +19 -0
- package/esm/utilities/1_misc.js +21 -2
- package/esm/utilities/1_queue.d.ts +19 -0
- package/esm/utilities/1_queue.js +19 -0
- package/package.json +1 -1
- package/script/0_deps.d.ts +20 -1
- package/script/0_deps.js +22 -3
- package/script/0_errors.d.ts +19 -0
- package/script/0_errors.js +19 -0
- package/script/1_utilities.d.ts +20 -1
- package/script/1_utilities.js +20 -1
- package/script/2_connection.d.ts +19 -0
- package/script/2_connection.js +19 -0
- package/script/2_tl.d.ts +19 -0
- package/script/2_tl.js +19 -0
- package/script/3_errors.d.ts +19 -0
- package/script/3_errors.js +19 -0
- package/script/3_storage.d.ts +19 -0
- package/script/3_storage.js +19 -0
- package/script/3_transport.d.ts +19 -0
- package/script/3_transport.js +19 -0
- package/script/3_types.d.ts +19 -0
- package/script/3_types.js +19 -0
- package/script/4_constants.js +19 -0
- package/script/4_errors.d.ts +19 -0
- package/script/4_errors.js +22 -3
- package/script/5_client.d.ts +19 -0
- package/script/5_client.js +19 -0
- package/script/client/0_client_abstract.d.ts +19 -0
- package/script/client/0_client_abstract.js +19 -0
- package/script/client/0_filters.d.ts +19 -0
- package/script/client/0_filters.js +19 -0
- package/script/client/0_html.d.ts +19 -0
- package/script/client/0_html.js +19 -0
- package/script/client/0_markdown.js +5 -5
- package/script/client/0_message.d.ts +19 -0
- package/script/client/0_message.js +19 -0
- package/script/client/0_params.d.ts +19 -0
- package/script/client/0_params.js +19 -0
- package/script/client/0_password.js +19 -0
- package/script/client/0_types.d.ts +19 -0
- package/script/client/0_types.js +19 -0
- package/script/client/0_utilities.d.ts +7 -0
- package/script/client/0_utilities.js +73 -4
- package/script/client/1_account_manager.d.ts +19 -0
- package/script/client/1_account_manager.js +23 -4
- package/script/client/1_bot_info_manager.d.ts +19 -0
- package/script/client/1_bot_info_manager.js +19 -0
- package/script/client/1_business_connection_manager.d.ts +19 -0
- package/script/client/1_business_connection_manager.js +19 -0
- package/script/client/1_client_encrypted.d.ts +19 -0
- package/script/client/1_client_encrypted.js +21 -2
- package/script/client/1_client_plain.d.ts +19 -0
- package/script/client/1_client_plain.js +21 -2
- package/script/client/1_composer.d.ts +19 -0
- package/script/client/1_composer.js +19 -0
- package/script/client/1_file_manager.d.ts +19 -0
- package/script/client/1_file_manager.js +24 -4
- package/script/client/1_network_statistics_manager.d.ts +19 -0
- package/script/client/1_network_statistics_manager.js +19 -0
- package/script/client/1_reaction_manager.d.ts +19 -0
- package/script/client/1_reaction_manager.js +21 -2
- package/script/client/1_update_manager.d.ts +19 -0
- package/script/client/1_update_manager.js +27 -7
- package/script/client/2_message_manager.d.ts +19 -0
- package/script/client/2_message_manager.js +70 -28
- package/script/client/3_callback_query_manager.d.ts +19 -0
- package/script/client/3_callback_query_manager.js +21 -0
- package/script/client/3_chat_list_manager.d.ts +19 -0
- package/script/client/3_chat_list_manager.js +31 -11
- package/script/client/3_inline_query_manager.d.ts +19 -0
- package/script/client/3_inline_query_manager.js +23 -2
- package/script/client/3_story_manager.d.ts +19 -0
- package/script/client/3_story_manager.js +23 -2
- package/script/client/4_client.d.ts +19 -0
- package/script/client/4_client.js +35 -15
- package/script/connection/0_connection.d.ts +19 -0
- package/script/connection/0_connection.js +19 -0
- package/script/connection/1_connection_web_socket.js +21 -1
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/DomHandler.d.ts +83 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/DomHandler.js +207 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/DomSerializer.d.ts +50 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/DomSerializer.js +301 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/ElementType.d.ts +47 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/ElementType.js +55 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/FeedHandler.d.ts +66 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/FeedHandler.js +222 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/Node.d.ts +168 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/Node.js +404 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/Parser.d.ts +159 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/Parser.js +438 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/Tokenizer.d.ts +181 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/Tokenizer.js +1052 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/mod.d.ts +42 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/mod.js +88 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/decode.d.ts +11 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/decode.js +128 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/decode_codepoint.d.ts +1 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/decode_codepoint.js +30 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/encode.d.ts +46 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/encode.js +129 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/decode.d.ts +31 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/decode.js +32 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/entities.d.ts +2128 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/entities.js +2129 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/legacy.d.ts +109 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/legacy.js +110 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/xml.d.ts +8 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/xml.js +3 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/mod.d.ts +90 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/mod.js +114 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/helpers.d.ts +50 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/helpers.js +134 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/legacy.d.ts +46 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/legacy.js +118 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/manipulation.d.ts +42 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/manipulation.js +129 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/mod.d.ts +6 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/mod.js +22 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/querying.d.ts +54 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/querying.js +119 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/stringify.d.ts +40 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/stringify.js +86 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/traversal.d.ts +58 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/traversal.js +112 -0
- package/{esm/deps/deno.land/x/tgcrypto@0.3.3 → script/deps/deno.land/x/tgcrypto@0.4.0}/mod.d.ts +0 -1
- package/script/deps/deno.land/x/{tgcrypto@0.3.3 → tgcrypto@0.4.0}/mod.js +1 -13
- package/script/deps/deno.land/x/tgcrypto@0.4.0/tgcrypto.js +310 -0
- package/script/deps/raw.githubusercontent.com/MTKruto/compress/main/zlib/deflate.d.ts +2 -0
- package/script/deps/raw.githubusercontent.com/MTKruto/compress/main/zlib/deflate.js +7 -1
- package/script/deps/raw.githubusercontent.com/MTKruto/compress/main/zlib/inflate.d.ts +2 -2
- package/script/deps/raw.githubusercontent.com/MTKruto/compress/main/zlib/inflate.js +7 -1
- package/script/deps/raw.githubusercontent.com/MTKruto/compress/main/zlib/zlib/crc32.js +1 -1
- package/script/deps/raw.githubusercontent.com/MTKruto/compress/main/zlib/zlib/deflate.js +8 -8
- package/script/deps/raw.githubusercontent.com/MTKruto/compress/main/zlib/zlib/inffast.js +2 -2
- package/script/deps/raw.githubusercontent.com/MTKruto/compress/main/zlib/zlib/inflate.js +19 -21
- package/script/deps/raw.githubusercontent.com/MTKruto/compress/main/zlib/zlib/trees.js +3 -3
- package/script/mod.d.ts +20 -1
- package/script/mod.js +21 -1
- package/script/storage/0_storage.d.ts +19 -0
- package/script/storage/0_storage.js +24 -4
- package/script/storage/1_utilities.d.ts +19 -1
- package/script/storage/1_utilities.js +22 -4
- package/script/storage/2_storage_indexed_db.d.ts +19 -0
- package/script/storage/2_storage_indexed_db.js +19 -0
- package/script/storage/2_storage_local_storage.d.ts +19 -0
- package/script/storage/2_storage_local_storage.js +19 -3
- package/script/storage/2_storage_memory.d.ts +19 -0
- package/script/storage/2_storage_memory.js +19 -0
- package/script/storage/2_storage_session_storage.d.ts +19 -0
- package/script/storage/2_storage_session_storage.js +19 -3
- package/script/tl/0_tl_raw_reader.d.ts +19 -0
- package/script/tl/0_tl_raw_reader.js +19 -0
- package/script/tl/0_tl_raw_writer.d.ts +19 -0
- package/script/tl/0_tl_raw_writer.js +19 -0
- package/script/tl/1_tl_object.d.ts +19 -0
- package/script/tl/1_tl_object.js +19 -0
- package/script/tl/2_types.d.ts +19 -0
- package/script/tl/2_types.js +19 -0
- package/script/tl/3_deserialize.d.ts +19 -0
- package/script/tl/3_deserialize.js +19 -0
- package/script/tl/3_functions.d.ts +19 -0
- package/script/tl/3_functions.js +19 -0
- package/script/tl/3_utilities.d.ts +19 -0
- package/script/tl/3_utilities.js +23 -3
- package/script/tl/4_tl_reader.d.ts +19 -0
- package/script/tl/4_tl_reader.js +19 -0
- package/script/tl/5_tl_writer.d.ts +19 -0
- package/script/tl/5_tl_writer.js +19 -0
- package/script/tl/6_rpc_result.d.ts +19 -0
- package/script/tl/6_rpc_result.js +19 -0
- package/script/tl/7_message.d.ts +19 -0
- package/script/tl/7_message.js +19 -0
- package/script/tl/8_message_container.d.ts +19 -0
- package/script/tl/8_message_container.js +19 -0
- package/script/transport/0_obfuscation.js +19 -0
- package/script/transport/0_transport.d.ts +19 -0
- package/script/transport/0_transport.js +19 -0
- package/script/transport/1_transport_abridged.d.ts +19 -0
- package/script/transport/1_transport_abridged.js +19 -0
- package/script/transport/1_transport_intermediate.d.ts +19 -0
- package/script/transport/1_transport_intermediate.js +19 -0
- package/script/transport/2_transport_provider.d.ts +19 -0
- package/script/transport/2_transport_provider.js +23 -4
- package/script/transport/3_transport_provider_web_socket.d.ts +19 -0
- package/script/transport/3_transport_provider_web_socket.js +19 -0
- package/script/types/0_authorization_state.d.ts +19 -0
- package/script/types/0_authorization_state.js +19 -0
- package/script/types/0_bot_command.d.ts +19 -0
- package/script/types/0_bot_command.js +19 -0
- package/script/types/0_chat_action.d.ts +19 -0
- package/script/types/0_chat_action.js +19 -0
- package/script/types/0_chat_administrator_rights.d.ts +19 -0
- package/script/types/0_chat_administrator_rights.js +19 -0
- package/script/types/0_chat_member_rights.d.ts +19 -0
- package/script/types/0_chat_member_rights.js +19 -0
- package/script/types/0_chat_photo.d.ts +19 -1
- package/script/types/0_chat_photo.js +19 -2
- package/script/types/0_connection_state.d.ts +19 -0
- package/script/types/0_connection_state.js +19 -0
- package/script/types/0_contact.d.ts +19 -0
- package/script/types/0_contact.js +19 -0
- package/script/types/0_dice.d.ts +19 -0
- package/script/types/0_dice.js +19 -0
- package/script/types/0_file_source.d.ts +19 -0
- package/script/types/0_file_source.js +19 -0
- package/script/types/0_giveaway_parameters.d.ts +19 -0
- package/script/types/0_giveaway_parameters.js +19 -0
- package/script/types/0_id.d.ts +19 -0
- package/script/types/0_id.js +19 -0
- package/script/types/0_keyboard_button_poll_type.d.ts +19 -0
- package/script/types/0_keyboard_button_poll_type.js +19 -0
- package/script/types/0_link_preview.d.ts +19 -0
- package/script/types/0_link_preview.js +19 -0
- package/script/types/0_location.d.ts +19 -0
- package/script/types/0_location.js +19 -0
- package/script/types/0_login_url.d.ts +19 -0
- package/script/types/0_login_url.js +19 -0
- package/script/types/0_mask_position.d.ts +19 -0
- package/script/types/0_mask_position.js +19 -0
- package/script/types/0_message_entity.d.ts +19 -0
- package/script/types/0_message_entity.js +22 -3
- package/script/types/0_message_reference.d.ts +19 -0
- package/script/types/0_message_reference.js +19 -0
- package/script/types/0_message_search_filter.d.ts +19 -0
- package/script/types/0_message_search_filter.js +21 -2
- package/script/types/0_mini_app_info.d.ts +19 -0
- package/script/types/0_mini_app_info.js +19 -0
- package/script/types/0_network_statistics_entry.d.ts +19 -0
- package/script/types/0_network_statistics_entry.js +19 -0
- package/script/types/0_parse_mode.d.ts +19 -0
- package/script/types/0_parse_mode.js +19 -0
- package/script/types/0_poll_option.d.ts +19 -0
- package/script/types/0_poll_option.js +19 -0
- package/script/types/0_price_tag.d.ts +19 -0
- package/script/types/0_price_tag.js +19 -0
- package/script/types/0_reaction.d.ts +19 -0
- package/script/types/0_reaction.js +21 -2
- package/script/types/0_restriction_reason.d.ts +19 -0
- package/script/types/0_restriction_reason.js +19 -0
- package/script/types/0_story_reference.d.ts +19 -0
- package/script/types/0_story_reference.js +19 -0
- package/script/types/0_thumbnail.d.ts +19 -0
- package/script/types/0_thumbnail.js +19 -0
- package/script/types/0_voice.d.ts +19 -0
- package/script/types/0_voice.js +19 -0
- package/script/types/1_animation.d.ts +19 -0
- package/script/types/1_animation.js +19 -0
- package/script/types/1_audio.d.ts +19 -0
- package/script/types/1_audio.js +19 -0
- package/script/types/1_bot_command_scope.d.ts +19 -0
- package/script/types/1_bot_command_scope.js +22 -3
- package/script/types/1_chat_p.d.ts +19 -0
- package/script/types/1_chat_p.js +21 -1
- package/script/types/1_document.d.ts +19 -0
- package/script/types/1_document.js +19 -0
- package/script/types/1_giveaway.d.ts +19 -0
- package/script/types/1_giveaway.js +19 -0
- package/script/types/1_inline_query_result_button.d.ts +19 -0
- package/script/types/1_inline_query_result_button.js +19 -0
- package/script/types/1_input_message_content.d.ts +19 -0
- package/script/types/1_input_message_content.js +19 -0
- package/script/types/1_input_story_content.d.ts +19 -0
- package/script/types/1_input_story_content.js +19 -0
- package/script/types/1_keyboard_button.d.ts +19 -0
- package/script/types/1_keyboard_button.js +22 -3
- package/script/types/1_message_reaction.d.ts +19 -0
- package/script/types/1_message_reaction.js +21 -2
- package/script/types/1_network_statistics.d.ts +19 -0
- package/script/types/1_network_statistics.js +19 -0
- package/script/types/1_photo.d.ts +19 -0
- package/script/types/1_photo.js +19 -0
- package/script/types/1_poll.d.ts +19 -0
- package/script/types/1_poll.js +19 -0
- package/script/types/1_reaction_count.d.ts +19 -0
- package/script/types/1_reaction_count.js +19 -0
- package/script/types/1_reply_quote.d.ts +19 -0
- package/script/types/1_reply_quote.js +19 -0
- package/script/types/1_sticker.d.ts +19 -0
- package/script/types/1_sticker.js +19 -0
- package/script/types/1_story_privacy.d.ts +19 -0
- package/script/types/1_story_privacy.js +22 -3
- package/script/types/1_story_reaction.d.ts +19 -0
- package/script/types/1_story_reaction.js +19 -0
- package/script/types/1_user.d.ts +19 -0
- package/script/types/1_user.js +19 -0
- package/script/types/1_venue.d.ts +19 -0
- package/script/types/1_venue.js +19 -0
- package/script/types/1_video.d.ts +19 -0
- package/script/types/1_video.js +19 -0
- package/script/types/1_video_note.d.ts +19 -0
- package/script/types/1_video_note.js +19 -0
- package/script/types/2_business_connection.d.ts +19 -0
- package/script/types/2_business_connection.js +19 -0
- package/script/types/2_chat_member.d.ts +19 -0
- package/script/types/2_chat_member.js +24 -4
- package/script/types/2_chosen_inline_result.d.ts +19 -0
- package/script/types/2_chosen_inline_result.js +21 -1
- package/script/types/2_game.d.ts +19 -0
- package/script/types/2_game.js +19 -0
- package/script/types/2_inactive_chat.d.ts +19 -0
- package/script/types/2_inactive_chat.js +21 -1
- package/script/types/2_inline_keyboard_button.d.ts +19 -0
- package/script/types/2_inline_keyboard_button.js +22 -3
- package/script/types/2_inline_query.d.ts +19 -0
- package/script/types/2_inline_query.js +22 -3
- package/script/types/2_invite_link.d.ts +19 -0
- package/script/types/2_invite_link.js +21 -1
- package/script/types/2_message_interactions.d.ts +19 -0
- package/script/types/2_message_interactions.js +19 -0
- package/script/types/2_message_reaction_count.d.ts +19 -0
- package/script/types/2_message_reaction_count.js +19 -0
- package/script/types/2_message_reactions.d.ts +19 -0
- package/script/types/2_message_reactions.js +19 -0
- package/script/types/2_story_content.d.ts +19 -0
- package/script/types/2_story_content.js +24 -5
- package/script/types/2_story_interactions.d.ts +19 -0
- package/script/types/2_story_interactions.js +19 -0
- package/script/types/2_story_interactive_area.d.ts +19 -0
- package/script/types/2_story_interactive_area.js +24 -5
- package/script/types/3_chat_member_updated.d.ts +19 -0
- package/script/types/3_chat_member_updated.js +22 -2
- package/script/types/3_reply_markup.d.ts +19 -0
- package/script/types/3_reply_markup.js +22 -2
- package/script/types/3_story.d.ts +19 -0
- package/script/types/3_story.js +21 -1
- package/script/types/4_inline_query_result.d.ts +19 -0
- package/script/types/4_inline_query_result.js +24 -5
- package/script/types/4_message.d.ts +19 -0
- package/script/types/4_message.js +35 -15
- package/script/types/5_callback_query.d.ts +19 -0
- package/script/types/5_callback_query.js +22 -2
- package/script/types/5_chat.d.ts +19 -0
- package/script/types/5_chat.js +26 -6
- package/script/types/6_update.d.ts +19 -0
- package/script/types/6_update.js +19 -0
- package/script/types/_file_id.d.ts +19 -0
- package/script/types/_file_id.js +27 -7
- package/script/types/_getters.d.ts +19 -0
- package/script/types/_getters.js +19 -0
- package/script/utilities/0_bigint.d.ts +1 -0
- package/script/utilities/0_bigint.js +46 -1
- package/script/utilities/0_buffer.d.ts +19 -0
- package/script/utilities/0_buffer.js +19 -0
- package/script/utilities/0_cache_map.d.ts +19 -0
- package/script/utilities/0_cache_map.js +19 -0
- package/script/utilities/0_color.d.ts +19 -0
- package/script/utilities/0_color.js +19 -0
- package/script/utilities/0_crypto.d.ts +19 -0
- package/script/utilities/0_crypto.js +19 -0
- package/script/utilities/0_hash.js +19 -0
- package/script/utilities/0_logger.d.ts +27 -0
- package/script/utilities/0_logger.js +30 -6
- package/script/utilities/0_mutex.d.ts +19 -0
- package/script/utilities/0_mutex.js +19 -0
- package/script/utilities/0_object.d.ts +19 -0
- package/script/utilities/0_object.js +19 -0
- package/script/utilities/0_rle.d.ts +19 -0
- package/script/utilities/0_rle.js +19 -0
- package/script/utilities/0_types.d.ts +19 -0
- package/script/utilities/0_types.js +19 -0
- package/script/utilities/1_auth.js +19 -0
- package/script/utilities/1_base64.d.ts +19 -0
- package/script/utilities/1_base64.js +19 -0
- package/script/utilities/1_math.d.ts +20 -0
- package/script/utilities/1_math.js +74 -0
- package/script/utilities/1_misc.d.ts +19 -0
- package/script/utilities/1_misc.js +21 -2
- package/script/utilities/1_queue.d.ts +19 -0
- package/script/utilities/1_queue.js +19 -0
- package/esm/deps/deno.land/x/tgcrypto@0.3.3/tgcrypto.js +0 -324
- package/esm/utilities/0_control.d.ts +0 -1
- package/esm/utilities/0_control.js +0 -3
- package/script/deps/deno.land/x/tgcrypto@0.3.3/tgcrypto.js +0 -326
- package/script/utilities/0_control.d.ts +0 -1
- package/script/utilities/0_control.js +0 -7
- /package/{LICENSE → COPYING.LESSER} +0 -0
- /package/esm/deps/deno.land/x/{tgcrypto@0.3.3 → tgcrypto@0.4.0}/tgcrypto.d.ts +0 -0
- /package/script/deps/deno.land/x/{tgcrypto@0.3.3 → tgcrypto@0.4.0}/tgcrypto.d.ts +0 -0
|
@@ -1,4 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* MTKruto - Cross-runtime JavaScript library for building Telegram clients
|
|
4
|
+
* Copyright (C) 2023-2024 Roj <https://roj.im/>
|
|
5
|
+
*
|
|
6
|
+
* This file is part of MTKruto.
|
|
7
|
+
*
|
|
8
|
+
* This program is free software: you can redistribute it and/or modify
|
|
9
|
+
* it under the terms of the GNU Lesser General Public License as published by
|
|
10
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
11
|
+
* (at your option) any later version.
|
|
12
|
+
*
|
|
13
|
+
* This program is distributed in the hope that it will be useful,
|
|
14
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
15
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
16
|
+
* GNU Lesser General Public License for more details.
|
|
17
|
+
*
|
|
18
|
+
* You should have received a copy of the GNU Lesser General Public License
|
|
19
|
+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
20
|
+
*/
|
|
2
21
|
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
3
22
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
4
23
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
@@ -23,6 +42,8 @@ const _0_message_search_filter_js_1 = require("../types/0_message_search_filter.
|
|
|
23
42
|
const _0_html_js_1 = require("./0_html.js");
|
|
24
43
|
const _0_markdown_js_1 = require("./0_markdown.js");
|
|
25
44
|
const _0_utilities_js_1 = require("./0_utilities.js");
|
|
45
|
+
const _0_utilities_js_2 = require("./0_utilities.js");
|
|
46
|
+
const _0_utilities_js_3 = require("./0_utilities.js");
|
|
26
47
|
const FALLBACK_MIME_TYPE = "application/octet-stream";
|
|
27
48
|
const STICKER_MIME_TYPES = ["image/webp", "video/webm", "application/x-tgsticker"];
|
|
28
49
|
class MessageManager {
|
|
@@ -44,6 +65,7 @@ class MessageManager {
|
|
|
44
65
|
__classPrivateFieldSet(this, _MessageManager_LresolveFileId, L.branch("resolveFileId"), "f");
|
|
45
66
|
}
|
|
46
67
|
async getMessages(chatId, messageIds) {
|
|
68
|
+
(0, _0_utilities_js_2.checkArray)(messageIds, _0_utilities_js_1.checkMessageId);
|
|
47
69
|
const peer = await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId);
|
|
48
70
|
let messages_ = new Array();
|
|
49
71
|
const chatId_ = (0, _2_tl_js_1.peerToChatId)(peer);
|
|
@@ -114,7 +136,7 @@ class MessageManager {
|
|
|
114
136
|
break;
|
|
115
137
|
}
|
|
116
138
|
default:
|
|
117
|
-
(0,
|
|
139
|
+
(0, _0_deps_js_1.unreachable)();
|
|
118
140
|
}
|
|
119
141
|
text = text.trimEnd();
|
|
120
142
|
for (const entity of entities) {
|
|
@@ -122,6 +144,9 @@ class MessageManager {
|
|
|
122
144
|
--entity.length;
|
|
123
145
|
}
|
|
124
146
|
}
|
|
147
|
+
if (!text.length) {
|
|
148
|
+
throw new _0_errors_js_1.InputError("Text must not be empty.");
|
|
149
|
+
}
|
|
125
150
|
return [text, entities];
|
|
126
151
|
}
|
|
127
152
|
async parseText(text_, params) {
|
|
@@ -133,6 +158,7 @@ class MessageManager {
|
|
|
133
158
|
return await (0, _3_types_js_2.constructMessage)(message_, __classPrivateFieldGet(this, _MessageManager_c, "f").getEntity, this.getMessage.bind(this), __classPrivateFieldGet(this, _MessageManager_c, "f").fileManager.getStickerSetName.bind(__classPrivateFieldGet(this, _MessageManager_c, "f").fileManager), r, business);
|
|
134
159
|
}
|
|
135
160
|
async forwardMessages(from, to, messageIds, params) {
|
|
161
|
+
(0, _0_utilities_js_2.checkArray)(messageIds, _0_utilities_js_1.checkMessageId);
|
|
136
162
|
const result = await __classPrivateFieldGet(this, _MessageManager_c, "f").api.messages.forwardMessages({
|
|
137
163
|
from_peer: await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(from),
|
|
138
164
|
to_peer: await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(to),
|
|
@@ -176,7 +202,7 @@ class MessageManager {
|
|
|
176
202
|
hash: 0n,
|
|
177
203
|
});
|
|
178
204
|
if (!("messages" in result)) {
|
|
179
|
-
(0,
|
|
205
|
+
(0, _0_deps_js_1.unreachable)();
|
|
180
206
|
}
|
|
181
207
|
for (const message_ of result.messages) {
|
|
182
208
|
const message = await this.constructMessage(message_, false);
|
|
@@ -425,11 +451,11 @@ class MessageManager {
|
|
|
425
451
|
}
|
|
426
452
|
}
|
|
427
453
|
if (media == null) {
|
|
428
|
-
if (typeof photo === "string" && (0,
|
|
454
|
+
if (typeof photo === "string" && (0, _0_utilities_js_3.isHttpUrl)(photo)) {
|
|
429
455
|
media = new _2_tl_js_1.types.InputMediaPhotoExternal({ url: photo, spoiler });
|
|
430
456
|
}
|
|
431
457
|
else {
|
|
432
|
-
const [contents, fileName] = await (0,
|
|
458
|
+
const [contents, fileName] = await (0, _0_utilities_js_3.getFileContents)(photo);
|
|
433
459
|
const file = await __classPrivateFieldGet(this, _MessageManager_c, "f").fileManager.upload(contents, { fileName, chunkSize: params?.chunkSize, signal: params?.signal });
|
|
434
460
|
media = new _2_tl_js_1.types.InputMediaUploadedPhoto({ file, spoiler });
|
|
435
461
|
}
|
|
@@ -448,10 +474,10 @@ class MessageManager {
|
|
|
448
474
|
}
|
|
449
475
|
if (fileId != null) {
|
|
450
476
|
if (!expectedFileType.includes(fileId.type)) {
|
|
451
|
-
(0,
|
|
477
|
+
(0, _0_deps_js_1.unreachable)();
|
|
452
478
|
}
|
|
453
479
|
return {
|
|
454
|
-
id: "id" in fileId.location ? fileId.location.id : (0,
|
|
480
|
+
id: "id" in fileId.location ? fileId.location.id : (0, _0_deps_js_1.unreachable)(),
|
|
455
481
|
access_hash: fileId.location.accessHash,
|
|
456
482
|
file_reference: fileId.fileReference ?? new Uint8Array(),
|
|
457
483
|
};
|
|
@@ -459,6 +485,13 @@ class MessageManager {
|
|
|
459
485
|
return null;
|
|
460
486
|
}
|
|
461
487
|
async sendPoll(chatId, question, options, params) {
|
|
488
|
+
question = question?.trim();
|
|
489
|
+
if (!question) {
|
|
490
|
+
throw new Error("Question must not be empty.");
|
|
491
|
+
}
|
|
492
|
+
if (!Array.isArray(options) || options.length < 2) {
|
|
493
|
+
throw new Error("There must be at least two options.");
|
|
494
|
+
}
|
|
462
495
|
const peer = await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId);
|
|
463
496
|
const randomId = (0, _1_utilities_js_1.getRandomId)();
|
|
464
497
|
const silent = params?.disableNotification ? true : undefined;
|
|
@@ -503,7 +536,7 @@ class MessageManager {
|
|
|
503
536
|
}
|
|
504
537
|
async editMessageReplyMarkup(chatId, messageId, params) {
|
|
505
538
|
const result = await __classPrivateFieldGet(this, _MessageManager_c, "f").api.messages.editMessage({
|
|
506
|
-
id: messageId,
|
|
539
|
+
id: (0, _0_utilities_js_1.checkMessageId)(messageId),
|
|
507
540
|
peer: await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId),
|
|
508
541
|
reply_markup: await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_constructReplyMarkup).call(this, params),
|
|
509
542
|
});
|
|
@@ -531,7 +564,7 @@ class MessageManager {
|
|
|
531
564
|
});
|
|
532
565
|
}
|
|
533
566
|
const result = await __classPrivateFieldGet(this, _MessageManager_c, "f").api.messages.editMessage({
|
|
534
|
-
id: messageId,
|
|
567
|
+
id: (0, _0_utilities_js_1.checkMessageId)(messageId),
|
|
535
568
|
peer: await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId),
|
|
536
569
|
entities,
|
|
537
570
|
message,
|
|
@@ -568,6 +601,7 @@ class MessageManager {
|
|
|
568
601
|
});
|
|
569
602
|
}
|
|
570
603
|
async deleteMessages(chatId, messageIds, params) {
|
|
604
|
+
(0, _0_utilities_js_2.checkArray)(messageIds, _0_utilities_js_1.checkMessageId);
|
|
571
605
|
const peer = await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId);
|
|
572
606
|
if (peer instanceof _2_tl_js_1.types.InputPeerChannel) {
|
|
573
607
|
await __classPrivateFieldGet(this, _MessageManager_c, "f").api.channels.deleteMessages({ channel: new _2_tl_js_1.types.InputChannel(peer), id: messageIds });
|
|
@@ -584,7 +618,7 @@ class MessageManager {
|
|
|
584
618
|
async pinMessage(chatId, messageId, params) {
|
|
585
619
|
await __classPrivateFieldGet(this, _MessageManager_c, "f").api.messages.updatePinnedMessage({
|
|
586
620
|
peer: await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId),
|
|
587
|
-
id: messageId,
|
|
621
|
+
id: (0, _0_utilities_js_1.checkMessageId)(messageId),
|
|
588
622
|
silent: params?.disableNotification ? true : undefined,
|
|
589
623
|
pm_oneside: params?.bothSides ? undefined : true,
|
|
590
624
|
});
|
|
@@ -592,7 +626,7 @@ class MessageManager {
|
|
|
592
626
|
async unpinMessage(chatId, messageId) {
|
|
593
627
|
await __classPrivateFieldGet(this, _MessageManager_c, "f").api.messages.updatePinnedMessage({
|
|
594
628
|
peer: await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId),
|
|
595
|
-
id: messageId,
|
|
629
|
+
id: (0, _0_utilities_js_1.checkMessageId)(messageId),
|
|
596
630
|
unpin: true,
|
|
597
631
|
});
|
|
598
632
|
}
|
|
@@ -603,14 +637,18 @@ class MessageManager {
|
|
|
603
637
|
// TODO: sync with storage
|
|
604
638
|
await __classPrivateFieldGet(this, _MessageManager_c, "f").api.messages.setChatAvailableReactions({
|
|
605
639
|
peer: await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId),
|
|
606
|
-
available_reactions: availableReactions == "none" ? new _2_tl_js_1.types.ChatReactionsNone() : availableReactions == "all" ? new _2_tl_js_1.types.ChatReactionsAll() : Array.isArray(availableReactions) ? new _2_tl_js_1.types.ChatReactionsSome({ reactions: availableReactions.map((v) => v.type == "emoji" ? new _2_tl_js_1.types.ReactionEmoji({ emoticon: v.emoji }) : new _2_tl_js_1.types.ReactionCustomEmoji({ document_id: BigInt(v.id) })) }) : (0,
|
|
640
|
+
available_reactions: availableReactions == "none" ? new _2_tl_js_1.types.ChatReactionsNone() : availableReactions == "all" ? new _2_tl_js_1.types.ChatReactionsAll() : Array.isArray(availableReactions) ? new _2_tl_js_1.types.ChatReactionsSome({ reactions: availableReactions.map((v) => v.type == "emoji" ? new _2_tl_js_1.types.ReactionEmoji({ emoticon: v.emoji }) : new _2_tl_js_1.types.ReactionCustomEmoji({ document_id: BigInt(v.id) })) }) : (0, _0_deps_js_1.unreachable)(),
|
|
607
641
|
});
|
|
608
642
|
}
|
|
609
643
|
async setReactions(chatId, messageId, reactions, params) {
|
|
610
644
|
await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_sendReaction).call(this, chatId, messageId, reactions, params);
|
|
611
645
|
}
|
|
612
646
|
async addReaction(chatId, messageId, reaction, params) {
|
|
613
|
-
const
|
|
647
|
+
const message = await this.getMessage(chatId, messageId);
|
|
648
|
+
if (!message) {
|
|
649
|
+
throw new _0_errors_js_1.InputError("Message not found.");
|
|
650
|
+
}
|
|
651
|
+
const chosenReactions = (message.reactions ?? []).filter((v) => v.chosen);
|
|
614
652
|
for (const r of chosenReactions) {
|
|
615
653
|
if ((0, _3_types_js_2.reactionEqual)(r.reaction, reaction)) {
|
|
616
654
|
return;
|
|
@@ -620,7 +658,11 @@ class MessageManager {
|
|
|
620
658
|
await this.setReactions(chatId, messageId, reactions, params);
|
|
621
659
|
}
|
|
622
660
|
async removeReaction(chatId, messageId, reaction) {
|
|
623
|
-
const
|
|
661
|
+
const message = await this.getMessage(chatId, messageId);
|
|
662
|
+
if (!message) {
|
|
663
|
+
throw new _0_errors_js_1.InputError("Message not found.");
|
|
664
|
+
}
|
|
665
|
+
const chosenReactions = (message.reactions ?? []).filter((v) => v.chosen);
|
|
624
666
|
for (const r of chosenReactions) {
|
|
625
667
|
if ((0, _3_types_js_2.reactionEqual)(r.reaction, reaction)) {
|
|
626
668
|
const reactions = chosenReactions.filter((v) => v != r).map((v) => v.reaction);
|
|
@@ -757,7 +799,7 @@ class MessageManager {
|
|
|
757
799
|
async deleteChatPhoto(chatId) {
|
|
758
800
|
const peer = await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId);
|
|
759
801
|
if (!(peer instanceof _2_tl_js_1.types.InputPeerChannel) && !(peer instanceof _2_tl_js_1.types.InputPeerChat)) {
|
|
760
|
-
(0,
|
|
802
|
+
(0, _0_deps_js_1.unreachable)();
|
|
761
803
|
}
|
|
762
804
|
if (peer instanceof _2_tl_js_1.types.InputPeerChannel) {
|
|
763
805
|
await __classPrivateFieldGet(this, _MessageManager_c, "f").api.channels.editPhoto({ channel: new _2_tl_js_1.types.InputChannel(peer), photo: new _2_tl_js_1.types.InputChatPhotoEmpty() });
|
|
@@ -769,9 +811,9 @@ class MessageManager {
|
|
|
769
811
|
async setChatPhoto(chatId, photo, params) {
|
|
770
812
|
const peer = await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId);
|
|
771
813
|
if (!(peer instanceof _2_tl_js_1.types.InputPeerChannel) && !(peer instanceof _2_tl_js_1.types.InputPeerChat)) {
|
|
772
|
-
(0,
|
|
814
|
+
(0, _0_deps_js_1.unreachable)();
|
|
773
815
|
}
|
|
774
|
-
const [contents, fileName] = await (0,
|
|
816
|
+
const [contents, fileName] = await (0, _0_utilities_js_3.getFileContents)(photo);
|
|
775
817
|
const file = await __classPrivateFieldGet(this, _MessageManager_c, "f").fileManager.upload(contents, { fileName: params?.fileName ?? fileName, chunkSize: params?.chunkSize, signal: params?.signal });
|
|
776
818
|
const photo_ = new _2_tl_js_1.types.InputChatUploadedPhoto({ file });
|
|
777
819
|
if (peer instanceof _2_tl_js_1.types.InputPeerChannel) {
|
|
@@ -853,7 +895,7 @@ class MessageManager {
|
|
|
853
895
|
hash: 0n,
|
|
854
896
|
});
|
|
855
897
|
if (participants instanceof _2_tl_js_1.types.channels.ChannelParticipantsNotModified) {
|
|
856
|
-
(0,
|
|
898
|
+
(0, _0_deps_js_1.unreachable)();
|
|
857
899
|
}
|
|
858
900
|
const chatMembers = new Array();
|
|
859
901
|
for (const p of participants.participants) {
|
|
@@ -864,7 +906,7 @@ class MessageManager {
|
|
|
864
906
|
else if (peer instanceof _2_tl_js_1.types.InputPeerChat) {
|
|
865
907
|
const fullChat = await __classPrivateFieldGet(this, _MessageManager_c, "f").api.messages.getFullChat(peer); // TODO: full chat cache
|
|
866
908
|
if (!(fullChat.full_chat instanceof _2_tl_js_1.types.ChatFull) || !(fullChat.full_chat.participants instanceof _2_tl_js_1.types.ChatParticipants)) {
|
|
867
|
-
(0,
|
|
909
|
+
(0, _0_deps_js_1.unreachable)();
|
|
868
910
|
}
|
|
869
911
|
const chatMembers = new Array();
|
|
870
912
|
for (const p of fullChat.full_chat.participants.participants) {
|
|
@@ -873,7 +915,7 @@ class MessageManager {
|
|
|
873
915
|
return chatMembers;
|
|
874
916
|
}
|
|
875
917
|
else {
|
|
876
|
-
(0,
|
|
918
|
+
(0, _0_deps_js_1.unreachable)();
|
|
877
919
|
}
|
|
878
920
|
}
|
|
879
921
|
async enableJoinRequests(chatId) {
|
|
@@ -900,7 +942,7 @@ class MessageManager {
|
|
|
900
942
|
from_id: params?.from ? await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(params.from) : undefined,
|
|
901
943
|
});
|
|
902
944
|
if (!("messages" in result)) {
|
|
903
|
-
(0,
|
|
945
|
+
(0, _0_deps_js_1.unreachable)();
|
|
904
946
|
}
|
|
905
947
|
const messages = new Array();
|
|
906
948
|
for (const message_ of result.messages) {
|
|
@@ -951,7 +993,7 @@ class MessageManager {
|
|
|
951
993
|
await __classPrivateFieldGet(this, _MessageManager_c, "f").api.messages.addChatUser({ chat_id: peer.chat_id, user_id: new _2_tl_js_1.types.InputUserSelf(), fwd_limit: 0 }); // TODO: use potential high-level method for adding participants to chats
|
|
952
994
|
}
|
|
953
995
|
else {
|
|
954
|
-
(0,
|
|
996
|
+
(0, _0_deps_js_1.unreachable)();
|
|
955
997
|
}
|
|
956
998
|
}
|
|
957
999
|
async leaveChat(chatId) {
|
|
@@ -966,7 +1008,7 @@ class MessageManager {
|
|
|
966
1008
|
await __classPrivateFieldGet(this, _MessageManager_c, "f").api.messages.deleteChatUser({ chat_id: peer.chat_id, user_id: new _2_tl_js_1.types.InputUserSelf() }); // TODO: use potential high-level method for adding participants to chats
|
|
967
1009
|
}
|
|
968
1010
|
else {
|
|
969
|
-
(0,
|
|
1011
|
+
(0, _0_deps_js_1.unreachable)();
|
|
970
1012
|
}
|
|
971
1013
|
}
|
|
972
1014
|
async blockUser(userId) {
|
|
@@ -1059,7 +1101,7 @@ class MessageManager {
|
|
|
1059
1101
|
const message = await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_updatesToMessages).call(this, chatId, result).then((v) => v[0]);
|
|
1060
1102
|
return (0, _3_types_js_2.assertMessageType)(message, "location");
|
|
1061
1103
|
}
|
|
1062
|
-
(0,
|
|
1104
|
+
(0, _0_deps_js_1.unreachable)();
|
|
1063
1105
|
}
|
|
1064
1106
|
async editInlineMessageLiveLocation(inlineMessageId, latitude, longitude, params) {
|
|
1065
1107
|
await __classPrivateFieldGet(this, _MessageManager_c, "f").storage.assertBot("editInlineMessageLiveLocation");
|
|
@@ -1137,18 +1179,18 @@ _MessageManager_c = new WeakMap(), _MessageManager_LresolveFileId = new WeakMap(
|
|
|
1137
1179
|
}
|
|
1138
1180
|
}
|
|
1139
1181
|
if (media == null) {
|
|
1140
|
-
if (typeof document === "string" && (0,
|
|
1182
|
+
if (typeof document === "string" && (0, _0_utilities_js_3.isHttpUrl)(document)) {
|
|
1141
1183
|
if (!urlSupported) {
|
|
1142
1184
|
throw new _0_errors_js_1.InputError("URL not supported.");
|
|
1143
1185
|
}
|
|
1144
1186
|
media = new _2_tl_js_1.types.InputMediaDocumentExternal({ url: document, spoiler });
|
|
1145
1187
|
}
|
|
1146
1188
|
else {
|
|
1147
|
-
const [contents, fileName_] = await (0,
|
|
1189
|
+
const [contents, fileName_] = await (0, _0_utilities_js_3.getFileContents)(document);
|
|
1148
1190
|
let fileName = params?.fileName ?? fileName_;
|
|
1149
1191
|
const mimeType = params?.mimeType ?? (0, _0_deps_js_1.contentType)(fileName.split(".").slice(-1)[0]) ?? FALLBACK_MIME_TYPE;
|
|
1150
1192
|
if (expectedMimeTypes && !expectedMimeTypes.includes(mimeType)) {
|
|
1151
|
-
(0,
|
|
1193
|
+
(0, _0_deps_js_1.unreachable)();
|
|
1152
1194
|
}
|
|
1153
1195
|
if (fileName.endsWith(".tgs") && fileType == _3_types_js_2.FileType.Document) {
|
|
1154
1196
|
fileName += "-";
|
|
@@ -1156,7 +1198,7 @@ _MessageManager_c = new WeakMap(), _MessageManager_LresolveFileId = new WeakMap(
|
|
|
1156
1198
|
const file = await __classPrivateFieldGet(this, _MessageManager_c, "f").fileManager.upload(contents, { fileName, chunkSize: params?.chunkSize, signal: params?.signal });
|
|
1157
1199
|
let thumb = undefined;
|
|
1158
1200
|
if (params?.thumbnail) {
|
|
1159
|
-
const [thumbContents, fileName__] = await (0,
|
|
1201
|
+
const [thumbContents, fileName__] = await (0, _0_utilities_js_3.getFileContents)(params.thumbnail);
|
|
1160
1202
|
thumb = await __classPrivateFieldGet(this, _MessageManager_c, "f").fileManager.upload(thumbContents, { fileName: fileName__, chunkSize: params?.chunkSize, signal: params?.signal });
|
|
1161
1203
|
}
|
|
1162
1204
|
media = new _2_tl_js_1.types.InputMediaUploadedDocument({
|
|
@@ -1198,7 +1240,7 @@ _MessageManager_c = new WeakMap(), _MessageManager_LresolveFileId = new WeakMap(
|
|
|
1198
1240
|
}, _MessageManager_sendReaction = async function _MessageManager_sendReaction(chatId, messageId, reactions, params) {
|
|
1199
1241
|
await __classPrivateFieldGet(this, _MessageManager_c, "f").api.messages.sendReaction({
|
|
1200
1242
|
peer: await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId),
|
|
1201
|
-
msg_id: messageId,
|
|
1243
|
+
msg_id: (0, _0_utilities_js_1.checkMessageId)(messageId),
|
|
1202
1244
|
reaction: reactions.map((v) => (0, _3_types_js_2.reactionToTlObject)(v)),
|
|
1203
1245
|
big: params?.big ? true : undefined,
|
|
1204
1246
|
add_to_recent: params?.addToRecents ? true : undefined,
|
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MTKruto - Cross-runtime JavaScript library for building Telegram clients
|
|
3
|
+
* Copyright (C) 2023-2024 Roj <https://roj.im/>
|
|
4
|
+
*
|
|
5
|
+
* This file is part of MTKruto.
|
|
6
|
+
*
|
|
7
|
+
* This program is free software: you can redistribute it and/or modify
|
|
8
|
+
* it under the terms of the GNU Lesser General Public License as published by
|
|
9
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
10
|
+
* (at your option) any later version.
|
|
11
|
+
*
|
|
12
|
+
* This program is distributed in the hope that it will be useful,
|
|
13
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
15
|
+
* GNU Lesser General Public License for more details.
|
|
16
|
+
*
|
|
17
|
+
* You should have received a copy of the GNU Lesser General Public License
|
|
18
|
+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
19
|
+
*/
|
|
1
20
|
import { enums, types } from "../2_tl.js";
|
|
2
21
|
import { Update } from "../3_types.js";
|
|
3
22
|
import { AnswerCallbackQueryParams } from "./0_params.js";
|
|
@@ -1,4 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* MTKruto - Cross-runtime JavaScript library for building Telegram clients
|
|
4
|
+
* Copyright (C) 2023-2024 Roj <https://roj.im/>
|
|
5
|
+
*
|
|
6
|
+
* This file is part of MTKruto.
|
|
7
|
+
*
|
|
8
|
+
* This program is free software: you can redistribute it and/or modify
|
|
9
|
+
* it under the terms of the GNU Lesser General Public License as published by
|
|
10
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
11
|
+
* (at your option) any later version.
|
|
12
|
+
*
|
|
13
|
+
* This program is distributed in the hope that it will be useful,
|
|
14
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
15
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
16
|
+
* GNU Lesser General Public License for more details.
|
|
17
|
+
*
|
|
18
|
+
* You should have received a copy of the GNU Lesser General Public License
|
|
19
|
+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
20
|
+
*/
|
|
2
21
|
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
3
22
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
4
23
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
@@ -15,6 +34,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
15
34
|
exports.CallbackQueryManager = void 0;
|
|
16
35
|
const _2_tl_js_1 = require("../2_tl.js");
|
|
17
36
|
const _3_types_js_1 = require("../3_types.js");
|
|
37
|
+
const _0_utilities_js_1 = require("./0_utilities.js");
|
|
18
38
|
class CallbackQueryManager {
|
|
19
39
|
constructor(c) {
|
|
20
40
|
_CallbackQueryManager_c.set(this, void 0);
|
|
@@ -22,6 +42,7 @@ class CallbackQueryManager {
|
|
|
22
42
|
}
|
|
23
43
|
async answerCallbackQuery(id, params) {
|
|
24
44
|
await __classPrivateFieldGet(this, _CallbackQueryManager_c, "f").storage.assertBot("answerCallbackQuery");
|
|
45
|
+
(0, _0_utilities_js_1.checkCallbackQueryId)(id);
|
|
25
46
|
await __classPrivateFieldGet(this, _CallbackQueryManager_c, "f").api.messages.setBotCallbackAnswer({
|
|
26
47
|
query_id: BigInt(id),
|
|
27
48
|
cache_time: params?.cacheTime ?? 0,
|
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MTKruto - Cross-runtime JavaScript library for building Telegram clients
|
|
3
|
+
* Copyright (C) 2023-2024 Roj <https://roj.im/>
|
|
4
|
+
*
|
|
5
|
+
* This file is part of MTKruto.
|
|
6
|
+
*
|
|
7
|
+
* This program is free software: you can redistribute it and/or modify
|
|
8
|
+
* it under the terms of the GNU Lesser General Public License as published by
|
|
9
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
10
|
+
* (at your option) any later version.
|
|
11
|
+
*
|
|
12
|
+
* This program is distributed in the hope that it will be useful,
|
|
13
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
15
|
+
* GNU Lesser General Public License for more details.
|
|
16
|
+
*
|
|
17
|
+
* You should have received a copy of the GNU Lesser General Public License
|
|
18
|
+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
19
|
+
*/
|
|
1
20
|
import { enums, types } from "../2_tl.js";
|
|
2
21
|
import { Chat, ID } from "../3_types.js";
|
|
3
22
|
import { C as C_ } from "./0_types.js";
|
|
@@ -1,4 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* MTKruto - Cross-runtime JavaScript library for building Telegram clients
|
|
4
|
+
* Copyright (C) 2023-2024 Roj <https://roj.im/>
|
|
5
|
+
*
|
|
6
|
+
* This file is part of MTKruto.
|
|
7
|
+
*
|
|
8
|
+
* This program is free software: you can redistribute it and/or modify
|
|
9
|
+
* it under the terms of the GNU Lesser General Public License as published by
|
|
10
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
11
|
+
* (at your option) any later version.
|
|
12
|
+
*
|
|
13
|
+
* This program is distributed in the hope that it will be useful,
|
|
14
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
15
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
16
|
+
* GNU Lesser General Public License for more details.
|
|
17
|
+
*
|
|
18
|
+
* You should have received a copy of the GNU Lesser General Public License
|
|
19
|
+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
20
|
+
*/
|
|
2
21
|
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
3
22
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
4
23
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
@@ -13,6 +32,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
13
32
|
var _ChatListManager_instances, _ChatListManager_c, _ChatListManager_LgetChats, _ChatListManager_sendChatUpdate, _ChatListManager_chats, _ChatListManager_archivedChats, _ChatListManager_chatsLoadedFromStorage, _ChatListManager_tryGetChatId, _ChatListManager_getChatAnywhere, _ChatListManager_getChatList, _ChatListManager_loadChatsFromStorage, _ChatListManager_getLoadedChats, _ChatListManager_pinnedChats, _ChatListManager_pinnedArchiveChats, _ChatListManager_storageHadPinnedChats, _ChatListManager_pinnedChatsLoaded, _ChatListManager_loadPinnedChats, _ChatListManager_fetchPinnedChats, _ChatListManager_getPinnedChats, _ChatListManager_updateOrAddChat, _ChatListManager_removeChat, _ChatListManager_handleUpdateFolderPeers, _ChatListManager_handleUpdatePinnedDialogs, _ChatListManager_handleUpdateChannel, _ChatListManager_handleUpdateChat, _ChatListManager_handleUpdateUser, _ChatListManager_fetchChats;
|
|
14
33
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
34
|
exports.ChatListManager = void 0;
|
|
35
|
+
const _0_deps_js_1 = require("../0_deps.js");
|
|
16
36
|
const _0_errors_js_1 = require("../0_errors.js");
|
|
17
37
|
const _1_utilities_js_1 = require("../1_utilities.js");
|
|
18
38
|
const _2_tl_js_1 = require("../2_tl.js");
|
|
@@ -57,7 +77,7 @@ class ChatListManager {
|
|
|
57
77
|
const pinnedChats = await __classPrivateFieldGet(this, _ChatListManager_instances, "m", _ChatListManager_getPinnedChats).call(this, listId);
|
|
58
78
|
const chat = await (0, _3_types_js_1.constructChat3)(chatId, pinnedChats.indexOf(chatId), message, __classPrivateFieldGet(this, _ChatListManager_c, "f").getEntity);
|
|
59
79
|
if (chat == null) {
|
|
60
|
-
(0,
|
|
80
|
+
(0, _0_deps_js_1.unreachable)();
|
|
61
81
|
}
|
|
62
82
|
__classPrivateFieldGet(this, _ChatListManager_chats, "f").set(chatId, chat);
|
|
63
83
|
await __classPrivateFieldGet(this, _ChatListManager_c, "f").storage.setChat(listId, chatId, chat.pinned, chat.lastMessage?.id ?? 0, chat.lastMessage?.date ?? new Date(0));
|
|
@@ -78,7 +98,7 @@ class ChatListManager {
|
|
|
78
98
|
const pinnedChats = await __classPrivateFieldGet(this, _ChatListManager_instances, "m", _ChatListManager_getPinnedChats).call(this, listId);
|
|
79
99
|
const chat = await (0, _3_types_js_1.constructChat3)(chatId, pinnedChats.indexOf(chatId), message, __classPrivateFieldGet(this, _ChatListManager_c, "f").getEntity);
|
|
80
100
|
if (chat == null) {
|
|
81
|
-
(0,
|
|
101
|
+
(0, _0_deps_js_1.unreachable)();
|
|
82
102
|
}
|
|
83
103
|
__classPrivateFieldGet(this, _ChatListManager_chats, "f").set(chatId, chat);
|
|
84
104
|
}
|
|
@@ -149,7 +169,7 @@ class ChatListManager {
|
|
|
149
169
|
await __classPrivateFieldGet(this, _ChatListManager_instances, "m", _ChatListManager_handleUpdateUser).call(this, update);
|
|
150
170
|
}
|
|
151
171
|
else {
|
|
152
|
-
(0,
|
|
172
|
+
(0, _0_deps_js_1.unreachable)();
|
|
153
173
|
}
|
|
154
174
|
}
|
|
155
175
|
async getChat(chatId) {
|
|
@@ -162,7 +182,7 @@ class ChatListManager {
|
|
|
162
182
|
maybeChatId = __classPrivateFieldGet(this, _ChatListManager_instances, "m", _ChatListManager_tryGetChatId).call(this, (0, _0_utilities_js_1.getUsername)(chatId));
|
|
163
183
|
}
|
|
164
184
|
else {
|
|
165
|
-
(0,
|
|
185
|
+
(0, _0_deps_js_1.unreachable)();
|
|
166
186
|
}
|
|
167
187
|
if (maybeChatId != null) {
|
|
168
188
|
const [chat] = __classPrivateFieldGet(this, _ChatListManager_instances, "m", _ChatListManager_getChatAnywhere).call(this, maybeChatId);
|
|
@@ -193,7 +213,7 @@ class ChatListManager {
|
|
|
193
213
|
const chats = await __classPrivateFieldGet(this, _ChatListManager_c, "f").api.messages.getChats({ id: [inputPeer.chat_id] }).then((v) => v[_2_tl_js_1.as](_2_tl_js_1.types.messages.Chats));
|
|
194
214
|
const chat = chats.chats[0];
|
|
195
215
|
if (chat instanceof _2_tl_js_1.types.ChatEmpty) {
|
|
196
|
-
(0,
|
|
216
|
+
(0, _0_deps_js_1.unreachable)();
|
|
197
217
|
}
|
|
198
218
|
return (0, _3_types_js_1.constructChat2)(chat, -1, undefined);
|
|
199
219
|
}
|
|
@@ -201,7 +221,7 @@ class ChatListManager {
|
|
|
201
221
|
const channels = await __classPrivateFieldGet(this, _ChatListManager_c, "f").api.channels.getChannels({ id: [new _2_tl_js_1.types.InputChannel(inputPeer)] });
|
|
202
222
|
const channel = channels.chats[0];
|
|
203
223
|
if (channel instanceof _2_tl_js_1.types.ChatEmpty) {
|
|
204
|
-
(0,
|
|
224
|
+
(0, _0_deps_js_1.unreachable)();
|
|
205
225
|
}
|
|
206
226
|
return (0, _3_types_js_1.constructChat2)(channel, -1, undefined);
|
|
207
227
|
}
|
|
@@ -209,12 +229,12 @@ class ChatListManager {
|
|
|
209
229
|
const users = await __classPrivateFieldGet(this, _ChatListManager_c, "f").api.users.getUsers({ id: [new _2_tl_js_1.types.InputUser(inputPeer)] });
|
|
210
230
|
const user = users[0];
|
|
211
231
|
if (user instanceof _2_tl_js_1.types.UserEmpty) {
|
|
212
|
-
(0,
|
|
232
|
+
(0, _0_deps_js_1.unreachable)();
|
|
213
233
|
}
|
|
214
234
|
return (0, _3_types_js_1.constructChat2)(user, -1, undefined);
|
|
215
235
|
}
|
|
216
236
|
else {
|
|
217
|
-
(0,
|
|
237
|
+
(0, _0_deps_js_1.unreachable)();
|
|
218
238
|
}
|
|
219
239
|
}
|
|
220
240
|
}
|
|
@@ -320,7 +340,7 @@ _ChatListManager_c = new WeakMap(), _ChatListManager_LgetChats = new WeakMap(),
|
|
|
320
340
|
await __classPrivateFieldGet(this, _ChatListManager_c, "f").storage.setPinnedChats(1, __classPrivateFieldGet(this, _ChatListManager_pinnedArchiveChats, "f"));
|
|
321
341
|
}
|
|
322
342
|
if (listId != null && listId != 0 && listId != 1) {
|
|
323
|
-
(0,
|
|
343
|
+
(0, _0_deps_js_1.unreachable)();
|
|
324
344
|
}
|
|
325
345
|
}, _ChatListManager_getPinnedChats = async function _ChatListManager_getPinnedChats(listId) {
|
|
326
346
|
if (!__classPrivateFieldGet(this, _ChatListManager_pinnedChatsLoaded, "f")) {
|
|
@@ -335,7 +355,7 @@ _ChatListManager_c = new WeakMap(), _ChatListManager_LgetChats = new WeakMap(),
|
|
|
335
355
|
case 1:
|
|
336
356
|
return __classPrivateFieldGet(this, _ChatListManager_pinnedArchiveChats, "f");
|
|
337
357
|
default:
|
|
338
|
-
(0,
|
|
358
|
+
(0, _0_deps_js_1.unreachable)();
|
|
339
359
|
}
|
|
340
360
|
}, _ChatListManager_updateOrAddChat = async function _ChatListManager_updateOrAddChat(chatId) {
|
|
341
361
|
const [chat, listId] = __classPrivateFieldGet(this, _ChatListManager_instances, "m", _ChatListManager_getChatAnywhere).call(this, chatId);
|
|
@@ -432,7 +452,7 @@ _ChatListManager_c = new WeakMap(), _ChatListManager_LgetChats = new WeakMap(),
|
|
|
432
452
|
});
|
|
433
453
|
const pinnedChats = await __classPrivateFieldGet(this, _ChatListManager_instances, "m", _ChatListManager_getPinnedChats).call(this, listId);
|
|
434
454
|
if (!(dialogs instanceof _2_tl_js_1.types.messages.Dialogs) && !(dialogs instanceof _2_tl_js_1.types.messages.DialogsSlice)) {
|
|
435
|
-
(0,
|
|
455
|
+
(0, _0_deps_js_1.unreachable)();
|
|
436
456
|
}
|
|
437
457
|
if (dialogs.dialogs.length < limit) {
|
|
438
458
|
await __classPrivateFieldGet(this, _ChatListManager_c, "f").storage.setHasAllChats(listId, true);
|
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MTKruto - Cross-runtime JavaScript library for building Telegram clients
|
|
3
|
+
* Copyright (C) 2023-2024 Roj <https://roj.im/>
|
|
4
|
+
*
|
|
5
|
+
* This file is part of MTKruto.
|
|
6
|
+
*
|
|
7
|
+
* This program is free software: you can redistribute it and/or modify
|
|
8
|
+
* it under the terms of the GNU Lesser General Public License as published by
|
|
9
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
10
|
+
* (at your option) any later version.
|
|
11
|
+
*
|
|
12
|
+
* This program is distributed in the hope that it will be useful,
|
|
13
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
15
|
+
* GNU Lesser General Public License for more details.
|
|
16
|
+
*
|
|
17
|
+
* You should have received a copy of the GNU Lesser General Public License
|
|
18
|
+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
19
|
+
*/
|
|
1
20
|
import { enums, types } from "../2_tl.js";
|
|
2
21
|
import { InlineQueryResult, Update } from "../3_types.js";
|
|
3
22
|
import { AnswerInlineQueryParams } from "./0_params.js";
|
|
@@ -1,4 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* MTKruto - Cross-runtime JavaScript library for building Telegram clients
|
|
4
|
+
* Copyright (C) 2023-2024 Roj <https://roj.im/>
|
|
5
|
+
*
|
|
6
|
+
* This file is part of MTKruto.
|
|
7
|
+
*
|
|
8
|
+
* This program is free software: you can redistribute it and/or modify
|
|
9
|
+
* it under the terms of the GNU Lesser General Public License as published by
|
|
10
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
11
|
+
* (at your option) any later version.
|
|
12
|
+
*
|
|
13
|
+
* This program is distributed in the hope that it will be useful,
|
|
14
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
15
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
16
|
+
* GNU Lesser General Public License for more details.
|
|
17
|
+
*
|
|
18
|
+
* You should have received a copy of the GNU Lesser General Public License
|
|
19
|
+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
20
|
+
*/
|
|
2
21
|
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
3
22
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
4
23
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
@@ -13,9 +32,10 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
13
32
|
var _InlineQueryManager_c;
|
|
14
33
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
34
|
exports.InlineQueryManager = void 0;
|
|
16
|
-
const
|
|
35
|
+
const _0_deps_js_1 = require("../0_deps.js");
|
|
17
36
|
const _2_tl_js_1 = require("../2_tl.js");
|
|
18
37
|
const _3_types_js_1 = require("../3_types.js");
|
|
38
|
+
const _0_utilities_js_1 = require("./0_utilities.js");
|
|
19
39
|
class InlineQueryManager {
|
|
20
40
|
constructor(c) {
|
|
21
41
|
_InlineQueryManager_c.set(this, void 0);
|
|
@@ -23,6 +43,7 @@ class InlineQueryManager {
|
|
|
23
43
|
}
|
|
24
44
|
async answerInlineQuery(id, results, params) {
|
|
25
45
|
await __classPrivateFieldGet(this, _InlineQueryManager_c, "f").storage.assertBot("answerInlineQuery");
|
|
46
|
+
(0, _0_utilities_js_1.checkInlineQueryId)(id);
|
|
26
47
|
await __classPrivateFieldGet(this, _InlineQueryManager_c, "f").api.messages.setInlineBotResults({
|
|
27
48
|
query_id: BigInt(id),
|
|
28
49
|
results: await Promise.all(results.map((v) => (0, _3_types_js_1.inlineQueryResultToTlObject)(v, __classPrivateFieldGet(this, _InlineQueryManager_c, "f").messageManager.parseText.bind(__classPrivateFieldGet(this, _InlineQueryManager_c, "f").messageManager), __classPrivateFieldGet(this, _InlineQueryManager_c, "f").messageManager.usernameResolver.bind(__classPrivateFieldGet(this, _InlineQueryManager_c, "f").messageManager)))),
|
|
@@ -45,7 +66,7 @@ class InlineQueryManager {
|
|
|
45
66
|
return { chosenInlineResult: await (0, _3_types_js_1.constructChosenInlineResult)(update, __classPrivateFieldGet(this, _InlineQueryManager_c, "f").getEntity) };
|
|
46
67
|
}
|
|
47
68
|
else {
|
|
48
|
-
(0,
|
|
69
|
+
(0, _0_deps_js_1.unreachable)();
|
|
49
70
|
}
|
|
50
71
|
}
|
|
51
72
|
}
|
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MTKruto - Cross-runtime JavaScript library for building Telegram clients
|
|
3
|
+
* Copyright (C) 2023-2024 Roj <https://roj.im/>
|
|
4
|
+
*
|
|
5
|
+
* This file is part of MTKruto.
|
|
6
|
+
*
|
|
7
|
+
* This program is free software: you can redistribute it and/or modify
|
|
8
|
+
* it under the terms of the GNU Lesser General Public License as published by
|
|
9
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
10
|
+
* (at your option) any later version.
|
|
11
|
+
*
|
|
12
|
+
* This program is distributed in the hope that it will be useful,
|
|
13
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
15
|
+
* GNU Lesser General Public License for more details.
|
|
16
|
+
*
|
|
17
|
+
* You should have received a copy of the GNU Lesser General Public License
|
|
18
|
+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
19
|
+
*/
|
|
1
20
|
import { enums, types } from "../2_tl.js";
|
|
2
21
|
import { ID, Story, Update } from "../3_types.js";
|
|
3
22
|
import { InputStoryContent } from "../types/1_input_story_content.js";
|