@mtkruto/node 0.67.2 → 0.69.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 +12 -12
- package/esm/0_deps.js +14 -14
- package/esm/0_errors.js +2 -6
- package/esm/3_errors.js +2 -12
- package/esm/3_types.d.ts +4 -0
- package/esm/3_types.d.ts.map +1 -1
- package/esm/3_types.js +4 -0
- package/esm/4_constants.d.ts +1 -1
- package/esm/4_constants.d.ts.map +1 -1
- package/esm/4_errors.d.ts +2 -2
- package/esm/4_errors.d.ts.map +1 -1
- package/esm/4_errors.js +2 -12
- package/esm/_dnt.polyfills.d.ts +99 -0
- package/esm/_dnt.polyfills.d.ts.map +1 -1
- package/esm/_dnt.polyfills.js +127 -1
- package/esm/_dnt.test_polyfills.d.ts.map +1 -0
- package/esm/client/0_client_abstract.d.ts +3 -3
- package/esm/client/0_client_abstract.d.ts.map +1 -1
- package/esm/client/0_filters.d.ts +1 -1
- package/esm/client/0_filters.d.ts.map +1 -1
- package/esm/client/0_filters.js +3 -3
- package/esm/client/0_filters_test.d.ts.map +1 -1
- package/esm/client/0_html.d.ts +1 -1
- package/esm/client/0_html.d.ts.map +1 -1
- package/esm/client/0_html.js +1 -1
- package/esm/client/0_markdown.d.ts +1 -1
- package/esm/client/0_markdown.d.ts.map +1 -1
- package/esm/client/0_markdown.js +8 -8
- package/esm/client/0_markdown_test.d.ts.map +1 -1
- package/esm/client/0_params.d.ts +44 -8
- package/esm/client/0_params.d.ts.map +1 -1
- package/esm/client/0_password.d.ts +5 -5
- package/esm/client/0_password.d.ts.map +1 -1
- package/esm/client/0_password.js +1 -1
- package/esm/client/0_password_test.d.ts.map +1 -1
- package/esm/client/0_storage_operations.d.ts +4 -4
- package/esm/client/0_storage_operations.d.ts.map +1 -1
- package/esm/client/0_storage_operations.js +159 -171
- package/esm/client/0_storage_operations_test.d.ts.map +1 -1
- package/esm/client/0_update_processor.d.ts +2 -2
- package/esm/client/0_update_processor.d.ts.map +1 -1
- package/esm/client/0_utilities.d.ts +1 -1
- package/esm/client/0_utilities.js +8 -8
- package/esm/client/0_utilities_test.d.ts.map +1 -1
- package/esm/client/1_client_plain.d.ts +3 -3
- package/esm/client/1_client_plain.d.ts.map +1 -1
- package/esm/client/1_client_plain.js +5 -23
- package/esm/client/1_composer.d.ts +3 -3
- package/esm/client/1_composer.d.ts.map +1 -1
- package/esm/client/1_composer.js +14 -27
- package/esm/client/1_types.d.ts +4 -4
- package/esm/client/1_types.d.ts.map +1 -1
- package/esm/client/2_account_manager.d.ts +3 -3
- package/esm/client/2_account_manager.d.ts.map +1 -1
- package/esm/client/2_account_manager.js +86 -98
- package/esm/client/2_bot_info_manager.d.ts +3 -3
- package/esm/client/2_bot_info_manager.d.ts.map +1 -1
- package/esm/client/2_bot_info_manager.js +26 -38
- 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 +10 -23
- package/esm/client/2_client_encrypted.d.ts +2 -2
- package/esm/client/2_client_encrypted.d.ts.map +1 -1
- package/esm/client/2_client_encrypted.js +194 -211
- package/esm/client/2_file_manager.d.ts +7 -6
- package/esm/client/2_file_manager.d.ts.map +1 -1
- package/esm/client/2_file_manager.js +303 -245
- package/esm/client/2_file_manager_test.d.ts.map +1 -1
- package/esm/client/2_network_statistics_manager.d.ts +1 -1
- package/esm/client/2_network_statistics_manager.d.ts.map +1 -1
- package/esm/client/2_network_statistics_manager.js +8 -21
- package/esm/client/2_payment_manager.d.ts +4 -4
- package/esm/client/2_payment_manager.d.ts.map +1 -1
- package/esm/client/2_payment_manager.js +7 -20
- 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 +7 -20
- package/esm/client/2_translations_manager.d.ts +4 -4
- package/esm/client/2_translations_manager.d.ts.map +1 -1
- package/esm/client/2_translations_manager.js +97 -107
- package/esm/client/2_update_manager.d.ts +2 -2
- package/esm/client/2_update_manager.d.ts.map +1 -1
- package/esm/client/2_update_manager.js +766 -761
- package/esm/client/3_client_encrypted_pool.d.ts +1 -1
- package/esm/client/3_client_encrypted_pool.d.ts.map +1 -1
- package/esm/client/3_client_encrypted_pool.js +10 -26
- package/esm/client/3_client_encrypted_pool_test.d.ts.map +1 -1
- package/esm/client/3_message_manager.d.ts +11 -8
- package/esm/client/3_message_manager.d.ts.map +1 -1
- package/esm/client/3_message_manager.js +580 -466
- package/esm/client/3_message_manager_test.d.ts.map +1 -1
- package/esm/client/3_video_chat_manager.d.ts +6 -6
- package/esm/client/3_video_chat_manager.d.ts.map +1 -1
- package/esm/client/3_video_chat_manager.js +61 -72
- package/esm/client/4_callback_query_manager.d.ts +5 -5
- package/esm/client/4_callback_query_manager.d.ts.map +1 -1
- package/esm/client/4_callback_query_manager.js +18 -30
- package/esm/client/4_chat_list_manager.d.ts +6 -6
- package/esm/client/4_chat_list_manager.d.ts.map +1 -1
- package/esm/client/4_chat_list_manager.js +328 -324
- package/esm/client/4_chat_manager.d.ts +7 -7
- package/esm/client/4_chat_manager.d.ts.map +1 -1
- package/esm/client/4_chat_manager.js +120 -133
- package/esm/client/4_forum_manager.d.ts +4 -4
- package/esm/client/4_forum_manager.d.ts.map +1 -1
- package/esm/client/4_forum_manager.js +67 -73
- package/esm/client/4_gift_manager.d.ts +4 -4
- package/esm/client/4_gift_manager.d.ts.map +1 -1
- package/esm/client/4_gift_manager.js +17 -30
- package/esm/client/4_inline_query_manager.d.ts +5 -5
- package/esm/client/4_inline_query_manager.d.ts.map +1 -1
- package/esm/client/4_inline_query_manager.js +16 -28
- package/esm/client/4_link_preview_manager.d.ts +5 -5
- package/esm/client/4_link_preview_manager.d.ts.map +1 -1
- package/esm/client/4_link_preview_manager.js +6 -19
- package/esm/client/4_poll_manager.d.ts +4 -4
- package/esm/client/4_poll_manager.d.ts.map +1 -1
- package/esm/client/4_poll_manager.js +44 -57
- package/esm/client/4_story_manager.d.ts +7 -7
- package/esm/client/4_story_manager.d.ts.map +1 -1
- package/esm/client/4_story_manager.js +43 -55
- package/esm/client/5_client.d.ts +34 -15
- package/esm/client/5_client.d.ts.map +1 -1
- package/esm/client/5_client.js +1299 -1291
- package/esm/connection/0_connection.d.ts +1 -1
- package/esm/connection/0_connection.d.ts.map +1 -1
- package/esm/connection/1_connection_tcp.node.d.ts +1 -1
- package/esm/connection/1_connection_tcp.node.d.ts.map +1 -1
- package/esm/connection/1_connection_tcp.node.js +49 -66
- package/esm/connection/1_connection_web_socket.d.ts +1 -1
- package/esm/connection/1_connection_web_socket.d.ts.map +1 -1
- package/esm/connection/1_connection_web_socket.js +75 -91
- package/esm/deps/jsr.io/@roj/tgcrypto/1.0.1/dist/tgcrypto.js +3 -11
- package/{script/deps/jsr.io/@std/assert/1.0.13 → esm/deps/jsr.io/@std/assert/1.0.14}/assert.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/assert/1.0.14/assertion_error.d.ts +26 -0
- package/esm/deps/jsr.io/@std/assert/1.0.14/assertion_error.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.14/assertion_error.js +30 -0
- package/esm/deps/jsr.io/@std/assert/{1.0.13 → 1.0.14}/equal.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/assert/{1.0.13 → 1.0.14}/equals.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/assert/{1.0.13 → 1.0.14}/false.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/assert/1.0.14/unreachable.d.ts +15 -0
- package/esm/deps/jsr.io/@std/assert/1.0.14/unreachable.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.14/unreachable.js +20 -0
- package/esm/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/_util.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/abortable.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/deadline.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/debounce.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/delay.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/delay.js +17 -2
- package/esm/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/mod.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/mux_async_iterator.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/mux_async_iterator.js +31 -47
- package/esm/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/pool.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/retry.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/tee.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/async/1.0.14/tee.js +79 -0
- package/esm/deps/jsr.io/@std/datetime/0.225.5/_date_time_formatter.js +4 -17
- package/esm/deps/jsr.io/@std/internal/1.0.10/_os.d.ts +2 -0
- package/esm/deps/jsr.io/@std/internal/1.0.10/_os.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/internal/1.0.10/_os.js +12 -0
- package/esm/deps/jsr.io/@std/internal/1.0.10/os.d.ts +3 -0
- package/esm/deps/jsr.io/@std/internal/1.0.10/os.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/internal/1.0.10/os.js +5 -0
- package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/assert_path.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/basename.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/constants.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/from_file_url.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/normalize.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/normalize_string.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/strip_trailing_separators.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/to_file_url.d.ts.map +1 -1
- package/{script/deps/jsr.io/@std/path/1.1.0 → esm/deps/jsr.io/@std/path/1.1.2}/basename.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/basename.js +1 -1
- package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/extname.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/extname.js +1 -1
- package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/is_absolute.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/is_absolute.js +1 -1
- package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/join.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/join.js +1 -1
- package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/posix/_util.d.ts.map +1 -1
- package/{script/deps/jsr.io/@std/path/1.1.0 → esm/deps/jsr.io/@std/path/1.1.2}/posix/basename.d.ts.map +1 -1
- package/{script/deps/jsr.io/@std/path/1.1.0 → esm/deps/jsr.io/@std/path/1.1.2}/posix/extname.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/posix/from_file_url.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/posix/is_absolute.d.ts.map +1 -1
- package/{script/deps/jsr.io/@std/path/1.1.0 → esm/deps/jsr.io/@std/path/1.1.2}/posix/join.d.ts.map +1 -1
- package/{script/deps/jsr.io/@std/path/1.1.0 → esm/deps/jsr.io/@std/path/1.1.2}/posix/normalize.d.ts.map +1 -1
- package/{script/deps/jsr.io/@std/path/1.1.0 → esm/deps/jsr.io/@std/path/1.1.2}/posix/to_file_url.d.ts.map +1 -1
- package/{script/deps/jsr.io/@std/path/1.1.0 → esm/deps/jsr.io/@std/path/1.1.2}/to_file_url.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/to_file_url.js +1 -1
- package/{script/deps/jsr.io/@std/path/1.1.0 → esm/deps/jsr.io/@std/path/1.1.2}/windows/_util.d.ts.map +1 -1
- package/{script/deps/jsr.io/@std/path/1.1.0 → esm/deps/jsr.io/@std/path/1.1.2}/windows/basename.d.ts.map +1 -1
- package/{script/deps/jsr.io/@std/path/1.1.0 → esm/deps/jsr.io/@std/path/1.1.2}/windows/extname.d.ts.map +1 -1
- package/{script/deps/jsr.io/@std/path/1.1.0 → esm/deps/jsr.io/@std/path/1.1.2}/windows/from_file_url.d.ts.map +1 -1
- package/{script/deps/jsr.io/@std/path/1.1.0 → esm/deps/jsr.io/@std/path/1.1.2}/windows/is_absolute.d.ts.map +1 -1
- package/{script/deps/jsr.io/@std/path/1.1.0 → esm/deps/jsr.io/@std/path/1.1.2}/windows/join.d.ts.map +1 -1
- package/{script/deps/jsr.io/@std/path/1.1.0 → esm/deps/jsr.io/@std/path/1.1.2}/windows/normalize.d.ts.map +1 -1
- package/{script/deps/jsr.io/@std/path/1.1.0 → esm/deps/jsr.io/@std/path/1.1.2}/windows/to_file_url.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/streams/{1.0.10 → 1.0.11}/to_array_buffer.d.ts.map +1 -1
- package/esm/mod.js +2 -12
- package/esm/session/0_session_state.js +12 -38
- package/esm/session/1_session.d.ts +2 -2
- package/esm/session/1_session.d.ts.map +1 -1
- package/esm/session/1_session.js +49 -72
- package/esm/session/2_session_encrypted.d.ts +2 -2
- package/esm/session/2_session_encrypted.d.ts.map +1 -1
- package/esm/session/2_session_encrypted.js +324 -320
- package/esm/session/2_session_plain.js +1 -1
- package/esm/storage/0_storage.d.ts +1 -1
- package/esm/storage/0_storage.d.ts.map +1 -1
- package/esm/storage/1_utilities.d.ts +14 -11
- package/esm/storage/1_utilities.d.ts.map +1 -1
- package/esm/storage/1_utilities.js +17 -17
- package/esm/storage/1_utilities_test.d.ts.map +1 -1
- package/esm/storage/2_storage_indexed_db.d.ts +1 -1
- package/esm/storage/2_storage_indexed_db.d.ts.map +1 -1
- package/esm/storage/2_storage_indexed_db.js +29 -47
- package/esm/storage/2_storage_local_storage.node.d.ts +1 -1
- package/esm/storage/2_storage_local_storage.node.d.ts.map +1 -1
- package/esm/storage/2_storage_local_storage.node.js +15 -28
- package/esm/storage/2_storage_memory.d.ts +2 -2
- package/esm/storage/2_storage_memory.d.ts.map +1 -1
- package/esm/storage/2_storage_memory.js +26 -43
- package/esm/storage/2_storage_session_storage.d.ts +2 -2
- package/esm/storage/2_storage_session_storage.d.ts.map +1 -1
- package/esm/storage/2_storage_session_storage.js +6 -19
- package/esm/tl/0_utilities.js +1 -1
- package/esm/tl/0_utilities_test.d.ts.map +1 -1
- package/esm/tl/1_tl_reader.d.ts +1 -1
- package/esm/tl/1_tl_reader.d.ts.map +1 -1
- package/esm/tl/1_tl_reader.js +82 -90
- package/esm/tl/1_tl_reader_test.d.ts.map +1 -1
- package/esm/tl/1_tl_writer.d.ts +1 -1
- package/esm/tl/1_tl_writer.d.ts.map +1 -1
- package/esm/tl/1_tl_writer.js +155 -164
- package/esm/tl/1_tl_writer_test.d.ts.map +1 -1
- package/esm/tl/1_utilities.d.ts +1 -1
- package/esm/tl/1_utilities.d.ts.map +1 -1
- package/esm/tl/1_utilities.js +2 -2
- package/esm/tl/2_message.js +1 -1
- package/esm/tl/2_mtproto.d.ts +1 -1
- package/esm/tl/2_mtproto.d.ts.map +1 -1
- package/esm/tl/2_telegram.d.ts +1 -1
- package/esm/tl/2_telegram.d.ts.map +1 -1
- package/esm/transport/0_obfuscation.d.ts +1 -1
- package/esm/transport/0_obfuscation.d.ts.map +1 -1
- package/esm/transport/0_obfuscation.js +2 -2
- package/esm/transport/0_transport.d.ts +1 -1
- package/esm/transport/0_transport.d.ts.map +1 -1
- package/esm/transport/0_transport.js +1 -8
- package/esm/transport/1_transport_abridged.d.ts +1 -1
- package/esm/transport/1_transport_abridged.d.ts.map +1 -1
- package/esm/transport/1_transport_abridged.js +11 -24
- package/esm/transport/1_transport_intermediate.d.ts +1 -1
- package/esm/transport/1_transport_intermediate.d.ts.map +1 -1
- package/esm/transport/1_transport_intermediate.js +10 -23
- package/esm/transport/1_transport_provider.d.ts +2 -2
- package/esm/transport/1_transport_provider.d.ts.map +1 -1
- package/esm/transport/2_transport_provider_tcp.d.ts +1 -1
- package/esm/transport/2_transport_provider_tcp.d.ts.map +1 -1
- package/esm/transport/2_transport_provider_web_socket.d.ts +1 -1
- package/esm/transport/2_transport_provider_web_socket.d.ts.map +1 -1
- package/esm/transport/2_transport_provider_web_socket.js +1 -1
- package/esm/types/0_birthday.d.ts +1 -1
- package/esm/types/0_birthday.d.ts.map +1 -1
- package/esm/types/0_callback_query_answer.d.ts +1 -1
- package/esm/types/0_callback_query_answer.d.ts.map +1 -1
- package/esm/types/0_callback_query_question.js +2 -2
- package/esm/types/0_chat_administrator_rights.d.ts +1 -1
- package/esm/types/0_chat_administrator_rights.d.ts.map +1 -1
- package/esm/types/0_chat_member_rights.d.ts +1 -1
- package/esm/types/0_chat_member_rights.d.ts.map +1 -1
- package/esm/types/0_contact.d.ts +1 -1
- package/esm/types/0_contact.d.ts.map +1 -1
- package/esm/types/0_dice.d.ts +1 -1
- package/esm/types/0_dice.d.ts.map +1 -1
- package/esm/types/0_failed_invitation.d.ts +1 -1
- package/esm/types/0_failed_invitation.d.ts.map +1 -1
- package/esm/types/0_invoice.d.ts +1 -1
- package/esm/types/0_invoice.d.ts.map +1 -1
- package/esm/types/0_live_stream_channel.d.ts +1 -1
- package/esm/types/0_live_stream_channel.d.ts.map +1 -1
- package/esm/types/0_mask_position.d.ts +1 -1
- package/esm/types/0_mask_position.d.ts.map +1 -1
- package/esm/types/0_mask_position.js +1 -1
- package/esm/types/0_message_entity.d.ts +1 -1
- package/esm/types/0_message_entity.d.ts.map +1 -1
- package/esm/types/0_message_entity.js +1 -1
- package/esm/types/0_message_search_filter.d.ts +1 -1
- package/esm/types/0_message_search_filter.d.ts.map +1 -1
- package/esm/types/0_opening_hours.d.ts +1 -1
- package/esm/types/0_opening_hours.d.ts.map +1 -1
- package/esm/types/0_reaction.js +5 -5
- package/esm/types/0_refunded_payment.d.ts +1 -1
- package/esm/types/0_refunded_payment.d.ts.map +1 -1
- package/esm/types/0_restriction_reason.d.ts +1 -1
- package/esm/types/0_restriction_reason.d.ts.map +1 -1
- package/esm/types/0_self_destruct_option.js +3 -3
- package/esm/types/0_shipping_address.d.ts +1 -1
- package/esm/types/0_shipping_address.d.ts.map +1 -1
- package/esm/types/0_slow_mode_duration.js +2 -2
- package/esm/types/0_upload_progress.d.ts +29 -0
- package/esm/types/0_upload_progress.d.ts.map +1 -0
- package/esm/types/0_upload_progress.js +20 -0
- package/esm/types/0_voice.d.ts +1 -1
- package/esm/types/0_voice.d.ts.map +1 -1
- package/esm/types/0_voice_transcription.d.ts +1 -1
- package/esm/types/0_voice_transcription.d.ts.map +1 -1
- package/esm/types/1_animation.d.ts +1 -1
- package/esm/types/1_animation.d.ts.map +1 -1
- package/esm/types/1_audio.d.ts +1 -1
- package/esm/types/1_audio.d.ts.map +1 -1
- package/esm/types/1_bot_command_scope.d.ts +2 -2
- package/esm/types/1_bot_command_scope.d.ts.map +1 -1
- package/esm/types/1_chat_p.d.ts +2 -2
- package/esm/types/1_chat_p.d.ts.map +1 -1
- package/esm/types/1_chat_p.js +2 -2
- package/esm/types/1_document.d.ts +1 -1
- package/esm/types/1_document.d.ts.map +1 -1
- package/esm/types/1_giveaway.d.ts +2 -2
- package/esm/types/1_giveaway.d.ts.map +1 -1
- package/esm/types/1_inline_keyboard_button.d.ts +3 -3
- package/esm/types/1_inline_keyboard_button.d.ts.map +1 -1
- package/esm/types/1_inline_keyboard_button.js +4 -4
- package/esm/types/1_inline_query_result_button.d.ts +1 -1
- package/esm/types/1_inline_query_result_button.d.ts.map +1 -1
- package/esm/types/1_input_media.d.ts +4 -4
- package/esm/types/1_input_media.d.ts.map +1 -1
- package/esm/types/1_input_story_content.d.ts +1 -1
- package/esm/types/1_input_story_content.d.ts.map +1 -1
- package/esm/types/1_keyboard_button.d.ts +3 -3
- package/esm/types/1_keyboard_button.d.ts.map +1 -1
- package/esm/types/1_keyboard_button.js +1 -1
- package/esm/types/1_message_reaction.d.ts +1 -1
- package/esm/types/1_message_reaction.d.ts.map +1 -1
- package/esm/types/1_message_reaction.js +2 -2
- package/esm/types/1_mini_app_info.d.ts +2 -2
- package/esm/types/1_mini_app_info.d.ts.map +1 -1
- package/esm/types/1_network_statistics.d.ts +1 -1
- package/esm/types/1_network_statistics.d.ts.map +1 -1
- package/esm/types/1_order_info.d.ts +2 -2
- package/esm/types/1_order_info.d.ts.map +1 -1
- package/esm/types/1_photo.d.ts +1 -1
- package/esm/types/1_photo.d.ts.map +1 -1
- package/esm/types/1_poll_option.d.ts +2 -2
- package/esm/types/1_poll_option.d.ts.map +1 -1
- package/esm/types/1_poll_option.js +2 -2
- 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 +4 -4
- package/esm/types/1_sticker.d.ts.map +1 -1
- package/esm/types/1_sticker.js +2 -2
- package/esm/types/1_story_privacy.d.ts +1 -1
- package/esm/types/1_story_privacy.d.ts.map +1 -1
- 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 +1 -1
- package/esm/types/1_venue.d.ts +1 -1
- package/esm/types/1_venue.d.ts.map +1 -1
- package/esm/types/1_video.d.ts +1 -1
- package/esm/types/1_video.d.ts.map +1 -1
- package/esm/types/1_video_note.d.ts +1 -1
- package/esm/types/1_video_note.d.ts.map +1 -1
- package/esm/types/2_business_connection.d.ts +3 -3
- package/esm/types/2_business_connection.d.ts.map +1 -1
- package/esm/types/2_chat.d.ts +6 -6
- package/esm/types/2_chat.d.ts.map +1 -1
- package/esm/types/2_chat.js +3 -3
- package/esm/types/2_chat_member.d.ts +4 -4
- package/esm/types/2_chat_member.d.ts.map +1 -1
- package/esm/types/2_chat_member.js +1 -1
- package/esm/types/2_chat_settings.d.ts +1 -1
- package/esm/types/2_chat_settings.d.ts.map +1 -1
- package/esm/types/2_chat_settings.js +1 -1
- package/esm/types/2_chosen_inline_result.d.ts +3 -3
- package/esm/types/2_chosen_inline_result.d.ts.map +1 -1
- package/esm/types/2_forward_header.d.ts +4 -4
- package/esm/types/2_forward_header.d.ts.map +1 -1
- package/esm/types/2_forward_header.js +6 -6
- package/esm/types/2_game.d.ts +3 -3
- package/esm/types/2_game.d.ts.map +1 -1
- package/esm/types/2_gift_upgraded_component.d.ts +2 -2
- package/esm/types/2_gift_upgraded_component.d.ts.map +1 -1
- package/esm/types/2_inactive_chat.d.ts +1 -1
- package/esm/types/2_inactive_chat.d.ts.map +1 -1
- package/esm/types/2_inline_query.d.ts +3 -3
- package/esm/types/2_inline_query.d.ts.map +1 -1
- package/esm/types/2_inline_query.js +1 -1
- package/esm/types/2_invite_link.d.ts +3 -3
- package/esm/types/2_invite_link.d.ts.map +1 -1
- package/esm/types/2_message_interactions.d.ts +1 -1
- package/esm/types/2_message_interactions.d.ts.map +1 -1
- package/esm/types/2_message_reaction_count.d.ts +4 -4
- package/esm/types/2_message_reaction_count.d.ts.map +1 -1
- package/esm/types/2_message_reactions.d.ts +4 -4
- package/esm/types/2_message_reactions.d.ts.map +1 -1
- package/esm/types/2_poll.d.ts +3 -3
- package/esm/types/2_poll.d.ts.map +1 -1
- package/esm/types/2_poll.js +3 -3
- package/esm/types/2_poll_answer.d.ts +22 -3
- package/esm/types/2_poll_answer.d.ts.map +1 -1
- package/esm/types/2_poll_answer.js +19 -0
- package/esm/types/2_pre_checkout_query.d.ts +4 -4
- package/esm/types/2_pre_checkout_query.d.ts.map +1 -1
- package/esm/types/2_reply_markup.d.ts +3 -3
- package/esm/types/2_reply_markup.d.ts.map +1 -1
- package/esm/types/2_reply_to.d.ts +2 -2
- package/esm/types/2_reply_to.d.ts.map +1 -1
- package/esm/types/2_sticker_set.d.ts +51 -0
- package/esm/types/2_sticker_set.d.ts.map +1 -0
- package/esm/types/2_sticker_set.js +91 -0
- 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_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 +5 -5
- package/esm/types/2_story_interactive_area.d.ts.map +1 -1
- package/esm/types/2_successful_payment.d.ts +2 -2
- package/esm/types/2_successful_payment.d.ts.map +1 -1
- package/esm/types/3_chat_member_updated.d.ts +5 -5
- package/esm/types/3_chat_member_updated.d.ts.map +1 -1
- package/esm/types/3_gift.d.ts +4 -4
- package/esm/types/3_gift.d.ts.map +1 -1
- package/esm/types/3_join_request.d.ts +4 -4
- package/esm/types/3_join_request.d.ts.map +1 -1
- package/esm/types/3_story.d.ts +8 -8
- package/esm/types/3_story.d.ts.map +1 -1
- package/esm/types/4_claimed_gift.d.ts +4 -4
- package/esm/types/4_claimed_gift.d.ts.map +1 -1
- package/esm/types/4_link_preview.d.ts +5 -5
- package/esm/types/4_link_preview.d.ts.map +1 -1
- package/esm/types/5_claimed_gifts.d.ts +2 -2
- package/esm/types/5_claimed_gifts.d.ts.map +1 -1
- package/esm/types/5_claimed_gifts.js +3 -3
- package/esm/types/5_message.d.ts +29 -29
- package/esm/types/5_message.d.ts.map +1 -1
- package/esm/types/5_message.js +8 -8
- package/esm/types/5_message_content.d.ts +4 -4
- package/esm/types/5_message_content.d.ts.map +1 -1
- package/esm/types/6_callback_query.d.ts +3 -3
- package/esm/types/6_callback_query.d.ts.map +1 -1
- package/esm/types/6_callback_query.js +2 -2
- package/esm/types/6_chat_list_item.d.ts +4 -4
- package/esm/types/6_chat_list_item.d.ts.map +1 -1
- package/esm/types/6_chat_list_item.js +6 -6
- package/esm/types/6_inline_query_result.d.ts +6 -6
- package/esm/types/6_inline_query_result.d.ts.map +1 -1
- package/esm/types/6_inline_query_result.js +16 -16
- package/esm/types/6_saved_chat.d.ts +36 -0
- package/esm/types/6_saved_chat.d.ts.map +1 -0
- package/esm/types/6_saved_chat.js +43 -0
- package/esm/types/6_topic.d.ts +2 -2
- package/esm/types/6_topic.d.ts.map +1 -1
- package/esm/types/6_topic.js +1 -1
- package/esm/types/7_inline_query_answer.d.ts +2 -2
- package/esm/types/7_inline_query_answer.d.ts.map +1 -1
- package/esm/types/7_saved_chats.d.ts +33 -0
- package/esm/types/7_saved_chats.d.ts.map +1 -0
- package/esm/types/7_saved_chats.js +36 -0
- package/esm/types/7_update.d.ts +44 -25
- package/esm/types/7_update.d.ts.map +1 -1
- package/esm/types/_file_id.d.ts +60 -49
- package/esm/types/_file_id.d.ts.map +1 -1
- package/esm/types/_file_id.js +92 -73
- package/esm/types/_getters.d.ts +3 -3
- package/esm/types/_getters.d.ts.map +1 -1
- package/esm/utilities/0_bigint.js +5 -5
- package/esm/utilities/0_bigint_test.d.ts.map +1 -1
- package/esm/utilities/0_buffer.d.ts +1 -1
- package/esm/utilities/0_buffer.d.ts.map +1 -1
- package/esm/utilities/0_buffer.js +3 -3
- package/esm/utilities/0_buffer_test.d.ts.map +1 -1
- package/esm/utilities/0_env.js +1 -1
- package/esm/utilities/0_hash.d.ts +2 -2
- package/esm/utilities/0_hash.d.ts.map +1 -1
- package/esm/utilities/0_misc.d.ts.map +1 -1
- package/esm/utilities/0_misc.js +4 -3
- package/esm/utilities/0_mutex.js +4 -19
- package/esm/utilities/0_part_stream.js +11 -25
- package/esm/utilities/0_part_stream_test.d.ts.map +1 -1
- package/esm/utilities/0_rle.d.ts +2 -2
- package/esm/utilities/0_rle.d.ts.map +1 -1
- package/esm/utilities/0_rle.js +1 -1
- package/esm/utilities/0_rle_test.d.ts.map +1 -1
- package/esm/utilities/0_text.d.ts +20 -1
- package/esm/utilities/0_text.d.ts.map +1 -1
- package/esm/utilities/0_text.js +19 -0
- package/esm/utilities/1_auth.d.ts +1 -1
- package/esm/utilities/1_auth.d.ts.map +1 -1
- package/esm/utilities/1_auth.js +1 -1
- package/esm/utilities/1_base64.d.ts +1 -1
- package/esm/utilities/1_base64.d.ts.map +1 -1
- package/esm/utilities/1_base64.js +1 -1
- package/esm/utilities/1_base64_test.d.ts.map +1 -1
- package/esm/utilities/1_crypto.js +42 -53
- package/esm/utilities/1_crypto_test.d.ts.map +1 -1
- package/esm/utilities/1_logger.d.ts +2 -2
- package/esm/utilities/1_logger.js +2 -2
- package/esm/utilities/1_math.js +2 -2
- package/esm/utilities/1_math_test.d.ts.map +1 -1
- package/esm/utilities/2_queue.js +29 -47
- package/package.json +1 -1
- package/script/0_deps.d.ts +12 -12
- package/script/0_deps.js +14 -14
- package/script/0_errors.js +2 -6
- package/script/2_tl.js +17 -7
- package/script/3_errors.js +2 -12
- package/script/3_types.d.ts +4 -0
- package/script/3_types.d.ts.map +1 -1
- package/script/3_types.js +4 -0
- package/script/4_constants.d.ts +1 -1
- package/script/4_constants.d.ts.map +1 -1
- package/script/4_constants.js +17 -7
- package/script/4_errors.d.ts +2 -2
- package/script/4_errors.d.ts.map +1 -1
- package/script/4_errors.js +2 -12
- package/script/_dnt.polyfills.d.ts +99 -0
- package/script/_dnt.polyfills.d.ts.map +1 -1
- package/script/_dnt.polyfills.js +128 -0
- package/script/_dnt.test_polyfills.d.ts.map +1 -0
- package/script/client/0_client_abstract.d.ts +3 -3
- package/script/client/0_client_abstract.d.ts.map +1 -1
- package/script/client/0_filters.d.ts +1 -1
- package/script/client/0_filters.d.ts.map +1 -1
- package/script/client/0_filters.js +3 -3
- package/script/client/0_filters_test.d.ts.map +1 -1
- package/script/client/0_html.d.ts +1 -1
- package/script/client/0_html.d.ts.map +1 -1
- package/script/client/0_html.js +1 -1
- package/script/client/0_markdown.d.ts +1 -1
- package/script/client/0_markdown.d.ts.map +1 -1
- package/script/client/0_markdown.js +8 -8
- package/script/client/0_markdown_test.d.ts.map +1 -1
- package/script/client/0_params.d.ts +44 -8
- package/script/client/0_params.d.ts.map +1 -1
- package/script/client/0_password.d.ts +5 -5
- package/script/client/0_password.d.ts.map +1 -1
- package/script/client/0_password.js +18 -8
- package/script/client/0_password_test.d.ts.map +1 -1
- package/script/client/0_storage_operations.d.ts +4 -4
- package/script/client/0_storage_operations.d.ts.map +1 -1
- package/script/client/0_storage_operations.js +159 -171
- package/script/client/0_storage_operations_test.d.ts.map +1 -1
- package/script/client/0_update_processor.d.ts +2 -2
- package/script/client/0_update_processor.d.ts.map +1 -1
- package/script/client/0_utilities.d.ts +1 -1
- package/script/client/0_utilities.js +8 -8
- package/script/client/0_utilities_test.d.ts.map +1 -1
- package/script/client/1_client_plain.d.ts +3 -3
- package/script/client/1_client_plain.d.ts.map +1 -1
- package/script/client/1_client_plain.js +5 -23
- package/script/client/1_composer.d.ts +3 -3
- package/script/client/1_composer.d.ts.map +1 -1
- package/script/client/1_composer.js +14 -27
- package/script/client/1_types.d.ts +4 -4
- package/script/client/1_types.d.ts.map +1 -1
- package/script/client/2_account_manager.d.ts +3 -3
- package/script/client/2_account_manager.d.ts.map +1 -1
- package/script/client/2_account_manager.js +86 -98
- package/script/client/2_bot_info_manager.d.ts +3 -3
- package/script/client/2_bot_info_manager.d.ts.map +1 -1
- package/script/client/2_bot_info_manager.js +26 -38
- 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 +10 -23
- package/script/client/2_client_encrypted.d.ts +2 -2
- package/script/client/2_client_encrypted.d.ts.map +1 -1
- package/script/client/2_client_encrypted.js +195 -212
- package/script/client/2_file_manager.d.ts +7 -6
- package/script/client/2_file_manager.d.ts.map +1 -1
- package/script/client/2_file_manager.js +320 -252
- package/script/client/2_file_manager_test.d.ts.map +1 -1
- package/script/client/2_network_statistics_manager.d.ts +1 -1
- package/script/client/2_network_statistics_manager.d.ts.map +1 -1
- package/script/client/2_network_statistics_manager.js +8 -21
- package/script/client/2_payment_manager.d.ts +4 -4
- package/script/client/2_payment_manager.d.ts.map +1 -1
- package/script/client/2_payment_manager.js +7 -20
- 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 +7 -20
- package/script/client/2_translations_manager.d.ts +4 -4
- package/script/client/2_translations_manager.d.ts.map +1 -1
- package/script/client/2_translations_manager.js +98 -108
- package/script/client/2_update_manager.d.ts +2 -2
- package/script/client/2_update_manager.d.ts.map +1 -1
- package/script/client/2_update_manager.js +766 -761
- package/script/client/3_client_encrypted_pool.d.ts +1 -1
- package/script/client/3_client_encrypted_pool.d.ts.map +1 -1
- package/script/client/3_client_encrypted_pool.js +10 -26
- package/script/client/3_client_encrypted_pool_test.d.ts.map +1 -1
- package/script/client/3_message_manager.d.ts +11 -8
- package/script/client/3_message_manager.d.ts.map +1 -1
- package/script/client/3_message_manager.js +580 -466
- package/script/client/3_message_manager_test.d.ts.map +1 -1
- package/script/client/3_video_chat_manager.d.ts +6 -6
- package/script/client/3_video_chat_manager.d.ts.map +1 -1
- package/script/client/3_video_chat_manager.js +61 -72
- package/script/client/4_callback_query_manager.d.ts +5 -5
- package/script/client/4_callback_query_manager.d.ts.map +1 -1
- package/script/client/4_callback_query_manager.js +18 -30
- package/script/client/4_chat_list_manager.d.ts +6 -6
- package/script/client/4_chat_list_manager.d.ts.map +1 -1
- package/script/client/4_chat_list_manager.js +328 -324
- package/script/client/4_chat_manager.d.ts +7 -7
- package/script/client/4_chat_manager.d.ts.map +1 -1
- package/script/client/4_chat_manager.js +120 -133
- package/script/client/4_forum_manager.d.ts +4 -4
- package/script/client/4_forum_manager.d.ts.map +1 -1
- package/script/client/4_forum_manager.js +67 -73
- package/script/client/4_gift_manager.d.ts +4 -4
- package/script/client/4_gift_manager.d.ts.map +1 -1
- package/script/client/4_gift_manager.js +17 -30
- package/script/client/4_inline_query_manager.d.ts +5 -5
- package/script/client/4_inline_query_manager.d.ts.map +1 -1
- package/script/client/4_inline_query_manager.js +16 -28
- package/script/client/4_link_preview_manager.d.ts +5 -5
- package/script/client/4_link_preview_manager.d.ts.map +1 -1
- package/script/client/4_link_preview_manager.js +6 -19
- package/script/client/4_poll_manager.d.ts +4 -4
- package/script/client/4_poll_manager.d.ts.map +1 -1
- package/script/client/4_poll_manager.js +44 -57
- package/script/client/4_story_manager.d.ts +7 -7
- package/script/client/4_story_manager.d.ts.map +1 -1
- package/script/client/4_story_manager.js +43 -55
- package/script/client/5_client.d.ts +34 -15
- package/script/client/5_client.d.ts.map +1 -1
- package/script/client/5_client.js +1299 -1291
- package/script/connection/0_connection.d.ts +1 -1
- package/script/connection/0_connection.d.ts.map +1 -1
- package/script/connection/1_connection_tcp.node.d.ts +1 -1
- package/script/connection/1_connection_tcp.node.d.ts.map +1 -1
- package/script/connection/1_connection_tcp.node.js +49 -66
- package/script/connection/1_connection_web_socket.d.ts +1 -1
- package/script/connection/1_connection_web_socket.d.ts.map +1 -1
- package/script/connection/1_connection_web_socket.js +92 -98
- package/script/deps/jsr.io/@roj/tgcrypto/1.0.1/dist/tgcrypto.js +3 -11
- package/{esm/deps/jsr.io/@std/assert/1.0.13 → script/deps/jsr.io/@std/assert/1.0.14}/assert.d.ts.map +1 -1
- package/script/deps/jsr.io/@std/assert/1.0.14/assertion_error.d.ts +26 -0
- package/script/deps/jsr.io/@std/assert/1.0.14/assertion_error.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/assert/1.0.14/assertion_error.js +34 -0
- package/script/deps/jsr.io/@std/assert/{1.0.13 → 1.0.14}/equal.d.ts.map +1 -1
- package/script/deps/jsr.io/@std/assert/{1.0.13 → 1.0.14}/equal.js +17 -7
- package/script/deps/jsr.io/@std/assert/{1.0.13 → 1.0.14}/equals.d.ts.map +1 -1
- package/script/deps/jsr.io/@std/assert/{1.0.13 → 1.0.14}/false.d.ts.map +1 -1
- package/script/deps/jsr.io/@std/assert/1.0.14/unreachable.d.ts +15 -0
- package/script/deps/jsr.io/@std/assert/1.0.14/unreachable.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/assert/1.0.14/unreachable.js +23 -0
- package/script/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/_util.d.ts.map +1 -1
- package/script/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/abortable.d.ts.map +1 -1
- package/script/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/deadline.d.ts.map +1 -1
- package/script/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/debounce.d.ts.map +1 -1
- package/script/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/delay.d.ts.map +1 -1
- package/script/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/delay.js +34 -9
- package/script/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/mod.d.ts.map +1 -1
- package/script/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/mux_async_iterator.d.ts.map +1 -1
- package/script/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/mux_async_iterator.js +31 -47
- package/script/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/pool.d.ts.map +1 -1
- package/script/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/retry.d.ts.map +1 -1
- package/script/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/tee.d.ts.map +1 -1
- package/script/deps/jsr.io/@std/async/1.0.14/tee.js +82 -0
- package/script/deps/jsr.io/@std/datetime/0.225.5/_date_time_formatter.js +4 -17
- package/script/deps/jsr.io/@std/internal/1.0.10/_os.d.ts +2 -0
- package/script/deps/jsr.io/@std/internal/1.0.10/_os.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/internal/1.0.10/_os.js +48 -0
- package/script/deps/jsr.io/@std/internal/1.0.10/format.js +17 -7
- package/script/deps/jsr.io/@std/internal/1.0.10/os.d.ts +3 -0
- package/script/deps/jsr.io/@std/internal/1.0.10/os.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/internal/1.0.10/os.js +8 -0
- package/script/deps/jsr.io/@std/internal/1.0.10/styles.js +17 -7
- package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/assert_path.d.ts.map +1 -1
- package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/basename.d.ts.map +1 -1
- package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/constants.d.ts.map +1 -1
- package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/from_file_url.d.ts.map +1 -1
- package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/normalize.d.ts.map +1 -1
- package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/normalize_string.d.ts.map +1 -1
- package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/strip_trailing_separators.d.ts.map +1 -1
- package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/to_file_url.d.ts.map +1 -1
- package/{esm/deps/jsr.io/@std/path/1.1.0 → script/deps/jsr.io/@std/path/1.1.2}/basename.d.ts.map +1 -1
- package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/basename.js +2 -2
- package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/extname.d.ts.map +1 -1
- package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/extname.js +2 -2
- package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/is_absolute.d.ts.map +1 -1
- package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/is_absolute.js +2 -2
- package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/join.d.ts.map +1 -1
- package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/join.js +2 -2
- package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/posix/_util.d.ts.map +1 -1
- package/{esm/deps/jsr.io/@std/path/1.1.0 → script/deps/jsr.io/@std/path/1.1.2}/posix/basename.d.ts.map +1 -1
- package/{esm/deps/jsr.io/@std/path/1.1.0 → script/deps/jsr.io/@std/path/1.1.2}/posix/extname.d.ts.map +1 -1
- package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/posix/from_file_url.d.ts.map +1 -1
- package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/posix/is_absolute.d.ts.map +1 -1
- package/{esm/deps/jsr.io/@std/path/1.1.0 → script/deps/jsr.io/@std/path/1.1.2}/posix/join.d.ts.map +1 -1
- package/{esm/deps/jsr.io/@std/path/1.1.0 → script/deps/jsr.io/@std/path/1.1.2}/posix/normalize.d.ts.map +1 -1
- package/{esm/deps/jsr.io/@std/path/1.1.0 → script/deps/jsr.io/@std/path/1.1.2}/posix/to_file_url.d.ts.map +1 -1
- package/{esm/deps/jsr.io/@std/path/1.1.0 → script/deps/jsr.io/@std/path/1.1.2}/to_file_url.d.ts.map +1 -1
- package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/to_file_url.js +2 -2
- package/{esm/deps/jsr.io/@std/path/1.1.0 → script/deps/jsr.io/@std/path/1.1.2}/windows/_util.d.ts.map +1 -1
- package/{esm/deps/jsr.io/@std/path/1.1.0 → script/deps/jsr.io/@std/path/1.1.2}/windows/basename.d.ts.map +1 -1
- package/{esm/deps/jsr.io/@std/path/1.1.0 → script/deps/jsr.io/@std/path/1.1.2}/windows/extname.d.ts.map +1 -1
- package/{esm/deps/jsr.io/@std/path/1.1.0 → script/deps/jsr.io/@std/path/1.1.2}/windows/from_file_url.d.ts.map +1 -1
- package/{esm/deps/jsr.io/@std/path/1.1.0 → script/deps/jsr.io/@std/path/1.1.2}/windows/is_absolute.d.ts.map +1 -1
- package/{esm/deps/jsr.io/@std/path/1.1.0 → script/deps/jsr.io/@std/path/1.1.2}/windows/join.d.ts.map +1 -1
- package/{esm/deps/jsr.io/@std/path/1.1.0 → script/deps/jsr.io/@std/path/1.1.2}/windows/normalize.d.ts.map +1 -1
- package/{esm/deps/jsr.io/@std/path/1.1.0 → script/deps/jsr.io/@std/path/1.1.2}/windows/to_file_url.d.ts.map +1 -1
- package/script/deps/jsr.io/@std/streams/{1.0.10 → 1.0.11}/to_array_buffer.d.ts.map +1 -1
- package/script/mod.js +19 -19
- package/script/session/0_session_state.js +12 -38
- package/script/session/1_session.d.ts +2 -2
- package/script/session/1_session.d.ts.map +1 -1
- package/script/session/1_session.js +66 -79
- package/script/session/2_session_encrypted.d.ts +2 -2
- package/script/session/2_session_encrypted.d.ts.map +1 -1
- package/script/session/2_session_encrypted.js +325 -321
- package/script/session/2_session_plain.js +1 -1
- package/script/storage/0_storage.d.ts +1 -1
- package/script/storage/0_storage.d.ts.map +1 -1
- package/script/storage/1_utilities.d.ts +14 -11
- package/script/storage/1_utilities.d.ts.map +1 -1
- package/script/storage/1_utilities.js +39 -39
- package/script/storage/1_utilities_test.d.ts.map +1 -1
- package/script/storage/2_storage_indexed_db.d.ts +1 -1
- package/script/storage/2_storage_indexed_db.d.ts.map +1 -1
- package/script/storage/2_storage_indexed_db.js +29 -47
- package/script/storage/2_storage_local_storage.node.d.ts +1 -1
- package/script/storage/2_storage_local_storage.node.d.ts.map +1 -1
- package/script/storage/2_storage_local_storage.node.js +15 -28
- package/script/storage/2_storage_memory.d.ts +2 -2
- package/script/storage/2_storage_memory.d.ts.map +1 -1
- package/script/storage/2_storage_memory.js +26 -43
- package/script/storage/2_storage_session_storage.d.ts +2 -2
- package/script/storage/2_storage_session_storage.d.ts.map +1 -1
- package/script/storage/2_storage_session_storage.js +6 -19
- package/script/tl/0_utilities.js +1 -1
- package/script/tl/0_utilities_test.d.ts.map +1 -1
- package/script/tl/1_tl_reader.d.ts +1 -1
- package/script/tl/1_tl_reader.d.ts.map +1 -1
- package/script/tl/1_tl_reader.js +83 -91
- package/script/tl/1_tl_reader_test.d.ts.map +1 -1
- package/script/tl/1_tl_writer.d.ts +1 -1
- package/script/tl/1_tl_writer.d.ts.map +1 -1
- package/script/tl/1_tl_writer.js +156 -165
- package/script/tl/1_tl_writer_test.d.ts.map +1 -1
- package/script/tl/1_utilities.d.ts +1 -1
- package/script/tl/1_utilities.d.ts.map +1 -1
- package/script/tl/1_utilities.js +2 -2
- package/script/tl/2_message.js +1 -1
- package/script/tl/2_mtproto.d.ts +1 -1
- package/script/tl/2_mtproto.d.ts.map +1 -1
- package/script/tl/2_telegram.d.ts +1 -1
- package/script/tl/2_telegram.d.ts.map +1 -1
- package/script/tl/2_telegram.js +17 -7
- package/script/transport/0_obfuscation.d.ts +1 -1
- package/script/transport/0_obfuscation.d.ts.map +1 -1
- package/script/transport/0_obfuscation.js +19 -9
- package/script/transport/0_transport.d.ts +1 -1
- package/script/transport/0_transport.d.ts.map +1 -1
- package/script/transport/0_transport.js +1 -8
- package/script/transport/1_transport_abridged.d.ts +1 -1
- package/script/transport/1_transport_abridged.d.ts.map +1 -1
- package/script/transport/1_transport_abridged.js +11 -24
- package/script/transport/1_transport_intermediate.d.ts +1 -1
- package/script/transport/1_transport_intermediate.d.ts.map +1 -1
- package/script/transport/1_transport_intermediate.js +10 -23
- package/script/transport/1_transport_provider.d.ts +2 -2
- package/script/transport/1_transport_provider.d.ts.map +1 -1
- package/script/transport/2_transport_provider_tcp.d.ts +1 -1
- package/script/transport/2_transport_provider_tcp.d.ts.map +1 -1
- package/script/transport/2_transport_provider_web_socket.d.ts +1 -1
- package/script/transport/2_transport_provider_web_socket.d.ts.map +1 -1
- package/script/transport/2_transport_provider_web_socket.js +1 -1
- package/script/types/0_birthday.d.ts +1 -1
- package/script/types/0_birthday.d.ts.map +1 -1
- package/script/types/0_callback_query_answer.d.ts +1 -1
- package/script/types/0_callback_query_answer.d.ts.map +1 -1
- package/script/types/0_callback_query_question.js +2 -2
- package/script/types/0_chat_administrator_rights.d.ts +1 -1
- package/script/types/0_chat_administrator_rights.d.ts.map +1 -1
- package/script/types/0_chat_member_rights.d.ts +1 -1
- package/script/types/0_chat_member_rights.d.ts.map +1 -1
- package/script/types/0_contact.d.ts +1 -1
- package/script/types/0_contact.d.ts.map +1 -1
- package/script/types/0_dice.d.ts +1 -1
- package/script/types/0_dice.d.ts.map +1 -1
- package/script/types/0_failed_invitation.d.ts +1 -1
- package/script/types/0_failed_invitation.d.ts.map +1 -1
- package/script/types/0_invoice.d.ts +1 -1
- package/script/types/0_invoice.d.ts.map +1 -1
- package/script/types/0_live_stream_channel.d.ts +1 -1
- package/script/types/0_live_stream_channel.d.ts.map +1 -1
- package/script/types/0_mask_position.d.ts +1 -1
- package/script/types/0_mask_position.d.ts.map +1 -1
- package/script/types/0_mask_position.js +1 -1
- package/script/types/0_message_entity.d.ts +1 -1
- package/script/types/0_message_entity.d.ts.map +1 -1
- package/script/types/0_message_entity.js +1 -1
- package/script/types/0_message_search_filter.d.ts +1 -1
- package/script/types/0_message_search_filter.d.ts.map +1 -1
- package/script/types/0_opening_hours.d.ts +1 -1
- package/script/types/0_opening_hours.d.ts.map +1 -1
- package/script/types/0_reaction.js +5 -5
- package/script/types/0_refunded_payment.d.ts +1 -1
- package/script/types/0_refunded_payment.d.ts.map +1 -1
- package/script/types/0_restriction_reason.d.ts +1 -1
- package/script/types/0_restriction_reason.d.ts.map +1 -1
- package/script/types/0_self_destruct_option.js +3 -3
- package/script/types/0_shipping_address.d.ts +1 -1
- package/script/types/0_shipping_address.d.ts.map +1 -1
- package/script/types/0_slow_mode_duration.js +2 -2
- package/script/types/0_upload_progress.d.ts +29 -0
- package/script/types/0_upload_progress.d.ts.map +1 -0
- package/script/types/0_upload_progress.js +21 -0
- package/script/types/0_voice.d.ts +1 -1
- package/script/types/0_voice.d.ts.map +1 -1
- package/script/types/0_voice_transcription.d.ts +1 -1
- package/script/types/0_voice_transcription.d.ts.map +1 -1
- package/script/types/1_animation.d.ts +1 -1
- package/script/types/1_animation.d.ts.map +1 -1
- package/script/types/1_audio.d.ts +1 -1
- package/script/types/1_audio.d.ts.map +1 -1
- package/script/types/1_bot_command_scope.d.ts +2 -2
- package/script/types/1_bot_command_scope.d.ts.map +1 -1
- package/script/types/1_chat_p.d.ts +2 -2
- package/script/types/1_chat_p.d.ts.map +1 -1
- package/script/types/1_chat_p.js +2 -2
- package/script/types/1_document.d.ts +1 -1
- package/script/types/1_document.d.ts.map +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_inline_keyboard_button.d.ts +3 -3
- package/script/types/1_inline_keyboard_button.d.ts.map +1 -1
- package/script/types/1_inline_keyboard_button.js +4 -4
- package/script/types/1_inline_query_result_button.d.ts +1 -1
- package/script/types/1_inline_query_result_button.d.ts.map +1 -1
- package/script/types/1_input_media.d.ts +4 -4
- package/script/types/1_input_media.d.ts.map +1 -1
- package/script/types/1_input_story_content.d.ts +1 -1
- package/script/types/1_input_story_content.d.ts.map +1 -1
- package/script/types/1_keyboard_button.d.ts +3 -3
- package/script/types/1_keyboard_button.d.ts.map +1 -1
- package/script/types/1_keyboard_button.js +1 -1
- package/script/types/1_message_reaction.d.ts +1 -1
- package/script/types/1_message_reaction.d.ts.map +1 -1
- package/script/types/1_message_reaction.js +2 -2
- package/script/types/1_mini_app_info.d.ts +2 -2
- package/script/types/1_mini_app_info.d.ts.map +1 -1
- package/script/types/1_network_statistics.d.ts +1 -1
- package/script/types/1_network_statistics.d.ts.map +1 -1
- package/script/types/1_order_info.d.ts +2 -2
- package/script/types/1_order_info.d.ts.map +1 -1
- package/script/types/1_photo.d.ts +1 -1
- package/script/types/1_photo.d.ts.map +1 -1
- package/script/types/1_poll_option.d.ts +2 -2
- package/script/types/1_poll_option.d.ts.map +1 -1
- package/script/types/1_poll_option.js +2 -2
- 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 +4 -4
- package/script/types/1_sticker.d.ts.map +1 -1
- package/script/types/1_sticker.js +2 -2
- package/script/types/1_story_privacy.d.ts +1 -1
- package/script/types/1_story_privacy.d.ts.map +1 -1
- 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 +1 -1
- package/script/types/1_venue.d.ts.map +1 -1
- package/script/types/1_video.d.ts +1 -1
- package/script/types/1_video.d.ts.map +1 -1
- package/script/types/1_video_note.d.ts +1 -1
- package/script/types/1_video_note.d.ts.map +1 -1
- package/script/types/2_business_connection.d.ts +3 -3
- package/script/types/2_business_connection.d.ts.map +1 -1
- package/script/types/2_chat.d.ts +6 -6
- package/script/types/2_chat.d.ts.map +1 -1
- package/script/types/2_chat.js +3 -3
- package/script/types/2_chat_member.d.ts +4 -4
- package/script/types/2_chat_member.d.ts.map +1 -1
- package/script/types/2_chat_member.js +1 -1
- package/script/types/2_chat_settings.d.ts +1 -1
- package/script/types/2_chat_settings.d.ts.map +1 -1
- package/script/types/2_chat_settings.js +1 -1
- package/script/types/2_chosen_inline_result.d.ts +3 -3
- package/script/types/2_chosen_inline_result.d.ts.map +1 -1
- package/script/types/2_forward_header.d.ts +4 -4
- package/script/types/2_forward_header.d.ts.map +1 -1
- package/script/types/2_forward_header.js +6 -6
- package/script/types/2_game.d.ts +3 -3
- package/script/types/2_game.d.ts.map +1 -1
- package/script/types/2_gift_upgraded_component.d.ts +2 -2
- package/script/types/2_gift_upgraded_component.d.ts.map +1 -1
- package/script/types/2_inactive_chat.d.ts +1 -1
- package/script/types/2_inactive_chat.d.ts.map +1 -1
- package/script/types/2_inline_query.d.ts +3 -3
- package/script/types/2_inline_query.d.ts.map +1 -1
- package/script/types/2_inline_query.js +1 -1
- package/script/types/2_invite_link.d.ts +3 -3
- package/script/types/2_invite_link.d.ts.map +1 -1
- package/script/types/2_message_interactions.d.ts +1 -1
- package/script/types/2_message_interactions.d.ts.map +1 -1
- package/script/types/2_message_reaction_count.d.ts +4 -4
- package/script/types/2_message_reaction_count.d.ts.map +1 -1
- package/script/types/2_message_reactions.d.ts +4 -4
- package/script/types/2_message_reactions.d.ts.map +1 -1
- package/script/types/2_poll.d.ts +3 -3
- package/script/types/2_poll.d.ts.map +1 -1
- package/script/types/2_poll.js +3 -3
- package/script/types/2_poll_answer.d.ts +22 -3
- package/script/types/2_poll_answer.d.ts.map +1 -1
- package/script/types/2_poll_answer.js +19 -0
- package/script/types/2_pre_checkout_query.d.ts +4 -4
- package/script/types/2_pre_checkout_query.d.ts.map +1 -1
- package/script/types/2_reply_markup.d.ts +3 -3
- package/script/types/2_reply_markup.d.ts.map +1 -1
- package/script/types/2_reply_to.d.ts +2 -2
- package/script/types/2_reply_to.d.ts.map +1 -1
- package/script/types/2_sticker_set.d.ts +51 -0
- package/script/types/2_sticker_set.d.ts.map +1 -0
- package/script/types/2_sticker_set.js +94 -0
- 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_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 +5 -5
- package/script/types/2_story_interactive_area.d.ts.map +1 -1
- package/script/types/2_successful_payment.d.ts +2 -2
- package/script/types/2_successful_payment.d.ts.map +1 -1
- package/script/types/3_chat_member_updated.d.ts +5 -5
- package/script/types/3_chat_member_updated.d.ts.map +1 -1
- package/script/types/3_gift.d.ts +4 -4
- package/script/types/3_gift.d.ts.map +1 -1
- package/script/types/3_join_request.d.ts +4 -4
- package/script/types/3_join_request.d.ts.map +1 -1
- package/script/types/3_story.d.ts +8 -8
- package/script/types/3_story.d.ts.map +1 -1
- package/script/types/4_claimed_gift.d.ts +4 -4
- package/script/types/4_claimed_gift.d.ts.map +1 -1
- package/script/types/4_link_preview.d.ts +5 -5
- package/script/types/4_link_preview.d.ts.map +1 -1
- package/script/types/5_claimed_gifts.d.ts +2 -2
- package/script/types/5_claimed_gifts.d.ts.map +1 -1
- package/script/types/5_claimed_gifts.js +3 -3
- package/script/types/5_message.d.ts +29 -29
- package/script/types/5_message.d.ts.map +1 -1
- package/script/types/5_message.js +8 -8
- package/script/types/5_message_content.d.ts +4 -4
- package/script/types/5_message_content.d.ts.map +1 -1
- package/script/types/6_callback_query.d.ts +3 -3
- package/script/types/6_callback_query.d.ts.map +1 -1
- package/script/types/6_callback_query.js +2 -2
- package/script/types/6_chat_list_item.d.ts +4 -4
- package/script/types/6_chat_list_item.d.ts.map +1 -1
- package/script/types/6_chat_list_item.js +6 -6
- package/script/types/6_inline_query_result.d.ts +6 -6
- package/script/types/6_inline_query_result.d.ts.map +1 -1
- package/script/types/6_inline_query_result.js +16 -16
- package/script/types/6_saved_chat.d.ts +36 -0
- package/script/types/6_saved_chat.d.ts.map +1 -0
- package/script/types/6_saved_chat.js +46 -0
- package/script/types/6_topic.d.ts +2 -2
- package/script/types/6_topic.d.ts.map +1 -1
- package/script/types/6_topic.js +1 -1
- package/script/types/7_inline_query_answer.d.ts +2 -2
- package/script/types/7_inline_query_answer.d.ts.map +1 -1
- package/script/types/7_saved_chats.d.ts +33 -0
- package/script/types/7_saved_chats.d.ts.map +1 -0
- package/script/types/7_saved_chats.js +39 -0
- package/script/types/7_update.d.ts +44 -25
- package/script/types/7_update.d.ts.map +1 -1
- package/script/types/_file_id.d.ts +60 -49
- package/script/types/_file_id.d.ts.map +1 -1
- package/script/types/_file_id.js +155 -136
- package/script/types/_getters.d.ts +3 -3
- package/script/types/_getters.d.ts.map +1 -1
- package/script/utilities/0_bigint.js +22 -12
- package/script/utilities/0_bigint_test.d.ts.map +1 -1
- package/script/utilities/0_buffer.d.ts +1 -1
- package/script/utilities/0_buffer.d.ts.map +1 -1
- package/script/utilities/0_buffer.js +3 -3
- package/script/utilities/0_buffer_test.d.ts.map +1 -1
- package/script/utilities/0_env.js +18 -8
- package/script/utilities/0_hash.d.ts +2 -2
- package/script/utilities/0_hash.d.ts.map +1 -1
- package/script/utilities/0_hash.js +17 -7
- package/script/utilities/0_misc.d.ts.map +1 -1
- package/script/utilities/0_misc.js +21 -10
- package/script/utilities/0_mutex.js +4 -19
- package/script/utilities/0_part_stream.js +11 -25
- package/script/utilities/0_part_stream_test.d.ts.map +1 -1
- package/script/utilities/0_rle.d.ts +2 -2
- package/script/utilities/0_rle.d.ts.map +1 -1
- package/script/utilities/0_rle.js +1 -1
- package/script/utilities/0_rle_test.d.ts.map +1 -1
- package/script/utilities/0_text.d.ts +20 -1
- package/script/utilities/0_text.d.ts.map +1 -1
- package/script/utilities/0_text.js +19 -0
- package/script/utilities/1_auth.d.ts +1 -1
- package/script/utilities/1_auth.d.ts.map +1 -1
- package/script/utilities/1_auth.js +18 -8
- package/script/utilities/1_base64.d.ts +1 -1
- package/script/utilities/1_base64.d.ts.map +1 -1
- package/script/utilities/1_base64.js +1 -1
- package/script/utilities/1_base64_test.d.ts.map +1 -1
- package/script/utilities/1_crypto.js +60 -61
- package/script/utilities/1_crypto_test.d.ts.map +1 -1
- package/script/utilities/1_logger.d.ts +2 -2
- package/script/utilities/1_logger.js +2 -2
- package/script/utilities/1_math.js +2 -2
- package/script/utilities/1_math_test.d.ts.map +1 -1
- package/script/utilities/2_queue.js +30 -48
- package/esm/deps/jsr.io/@std/async/1.0.13/tee.js +0 -102
- package/esm/deps/jsr.io/@std/path/1.1.0/_os.d.ts +0 -2
- package/esm/deps/jsr.io/@std/path/1.1.0/_os.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/path/1.1.0/_os.js +0 -9
- package/script/deps/jsr.io/@std/async/1.0.13/tee.js +0 -105
- package/script/deps/jsr.io/@std/path/1.1.0/_os.d.ts +0 -2
- package/script/deps/jsr.io/@std/path/1.1.0/_os.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/path/1.1.0/_os.js +0 -35
- /package/esm/deps/jsr.io/@std/assert/{1.0.13 → 1.0.14}/assert.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/assert/{1.0.13 → 1.0.14}/assert.js +0 -0
- /package/esm/deps/jsr.io/@std/assert/{1.0.13 → 1.0.14}/equal.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/assert/{1.0.13 → 1.0.14}/equal.js +0 -0
- /package/esm/deps/jsr.io/@std/assert/{1.0.13 → 1.0.14}/equals.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/assert/{1.0.13 → 1.0.14}/equals.js +0 -0
- /package/esm/deps/jsr.io/@std/assert/{1.0.13 → 1.0.14}/false.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/assert/{1.0.13 → 1.0.14}/false.js +0 -0
- /package/esm/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/_util.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/_util.js +0 -0
- /package/esm/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/abortable.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/abortable.js +0 -0
- /package/esm/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/deadline.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/deadline.js +0 -0
- /package/esm/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/debounce.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/debounce.js +0 -0
- /package/esm/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/delay.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/mod.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/mod.js +0 -0
- /package/esm/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/mux_async_iterator.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/pool.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/pool.js +0 -0
- /package/esm/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/retry.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/retry.js +0 -0
- /package/esm/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/tee.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/assert_path.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/assert_path.js +0 -0
- /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/basename.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/basename.js +0 -0
- /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/constants.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/constants.js +0 -0
- /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/from_file_url.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/from_file_url.js +0 -0
- /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/normalize.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/normalize.js +0 -0
- /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/normalize_string.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/normalize_string.js +0 -0
- /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/strip_trailing_separators.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/strip_trailing_separators.js +0 -0
- /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/to_file_url.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/to_file_url.js +0 -0
- /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/basename.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/extname.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/is_absolute.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/join.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/posix/_util.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/posix/_util.js +0 -0
- /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/posix/basename.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/posix/basename.js +0 -0
- /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/posix/extname.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/posix/extname.js +0 -0
- /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/posix/from_file_url.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/posix/from_file_url.js +0 -0
- /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/posix/is_absolute.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/posix/is_absolute.js +0 -0
- /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/posix/join.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/posix/join.js +0 -0
- /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/posix/normalize.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/posix/normalize.js +0 -0
- /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/posix/to_file_url.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/posix/to_file_url.js +0 -0
- /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/to_file_url.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/windows/_util.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/windows/_util.js +0 -0
- /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/windows/basename.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/windows/basename.js +0 -0
- /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/windows/extname.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/windows/extname.js +0 -0
- /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/windows/from_file_url.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/windows/from_file_url.js +0 -0
- /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/windows/is_absolute.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/windows/is_absolute.js +0 -0
- /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/windows/join.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/windows/join.js +0 -0
- /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/windows/normalize.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/windows/normalize.js +0 -0
- /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/windows/to_file_url.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/windows/to_file_url.js +0 -0
- /package/esm/deps/jsr.io/@std/streams/{1.0.10 → 1.0.11}/to_array_buffer.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/streams/{1.0.10 → 1.0.11}/to_array_buffer.js +0 -0
- /package/script/deps/jsr.io/@std/assert/{1.0.13 → 1.0.14}/assert.d.ts +0 -0
- /package/script/deps/jsr.io/@std/assert/{1.0.13 → 1.0.14}/assert.js +0 -0
- /package/script/deps/jsr.io/@std/assert/{1.0.13 → 1.0.14}/equal.d.ts +0 -0
- /package/script/deps/jsr.io/@std/assert/{1.0.13 → 1.0.14}/equals.d.ts +0 -0
- /package/script/deps/jsr.io/@std/assert/{1.0.13 → 1.0.14}/equals.js +0 -0
- /package/script/deps/jsr.io/@std/assert/{1.0.13 → 1.0.14}/false.d.ts +0 -0
- /package/script/deps/jsr.io/@std/assert/{1.0.13 → 1.0.14}/false.js +0 -0
- /package/script/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/_util.d.ts +0 -0
- /package/script/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/_util.js +0 -0
- /package/script/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/abortable.d.ts +0 -0
- /package/script/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/abortable.js +0 -0
- /package/script/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/deadline.d.ts +0 -0
- /package/script/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/deadline.js +0 -0
- /package/script/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/debounce.d.ts +0 -0
- /package/script/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/debounce.js +0 -0
- /package/script/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/delay.d.ts +0 -0
- /package/script/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/mod.d.ts +0 -0
- /package/script/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/mod.js +0 -0
- /package/script/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/mux_async_iterator.d.ts +0 -0
- /package/script/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/pool.d.ts +0 -0
- /package/script/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/pool.js +0 -0
- /package/script/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/retry.d.ts +0 -0
- /package/script/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/retry.js +0 -0
- /package/script/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/tee.d.ts +0 -0
- /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/assert_path.d.ts +0 -0
- /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/assert_path.js +0 -0
- /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/basename.d.ts +0 -0
- /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/basename.js +0 -0
- /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/constants.d.ts +0 -0
- /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/constants.js +0 -0
- /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/from_file_url.d.ts +0 -0
- /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/from_file_url.js +0 -0
- /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/normalize.d.ts +0 -0
- /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/normalize.js +0 -0
- /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/normalize_string.d.ts +0 -0
- /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/normalize_string.js +0 -0
- /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/strip_trailing_separators.d.ts +0 -0
- /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/strip_trailing_separators.js +0 -0
- /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/to_file_url.d.ts +0 -0
- /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/to_file_url.js +0 -0
- /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/basename.d.ts +0 -0
- /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/extname.d.ts +0 -0
- /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/is_absolute.d.ts +0 -0
- /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/join.d.ts +0 -0
- /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/posix/_util.d.ts +0 -0
- /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/posix/_util.js +0 -0
- /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/posix/basename.d.ts +0 -0
- /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/posix/basename.js +0 -0
- /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/posix/extname.d.ts +0 -0
- /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/posix/extname.js +0 -0
- /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/posix/from_file_url.d.ts +0 -0
- /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/posix/from_file_url.js +0 -0
- /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/posix/is_absolute.d.ts +0 -0
- /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/posix/is_absolute.js +0 -0
- /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/posix/join.d.ts +0 -0
- /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/posix/join.js +0 -0
- /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/posix/normalize.d.ts +0 -0
- /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/posix/normalize.js +0 -0
- /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/posix/to_file_url.d.ts +0 -0
- /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/posix/to_file_url.js +0 -0
- /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/to_file_url.d.ts +0 -0
- /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/windows/_util.d.ts +0 -0
- /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/windows/_util.js +0 -0
- /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/windows/basename.d.ts +0 -0
- /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/windows/basename.js +0 -0
- /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/windows/extname.d.ts +0 -0
- /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/windows/extname.js +0 -0
- /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/windows/from_file_url.d.ts +0 -0
- /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/windows/from_file_url.js +0 -0
- /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/windows/is_absolute.d.ts +0 -0
- /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/windows/is_absolute.js +0 -0
- /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/windows/join.d.ts +0 -0
- /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/windows/join.js +0 -0
- /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/windows/normalize.d.ts +0 -0
- /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/windows/normalize.js +0 -0
- /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/windows/to_file_url.d.ts +0 -0
- /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/windows/to_file_url.js +0 -0
- /package/script/deps/jsr.io/@std/streams/{1.0.10 → 1.0.11}/to_array_buffer.d.ts +0 -0
- /package/script/deps/jsr.io/@std/streams/{1.0.10 → 1.0.11}/to_array_buffer.js +0 -0
|
@@ -18,24 +18,13 @@
|
|
|
18
18
|
* You should have received a copy of the GNU Lesser General Public License
|
|
19
19
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
20
20
|
*/
|
|
21
|
-
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
22
|
-
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
23
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
24
|
-
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");
|
|
25
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
26
|
-
};
|
|
27
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
28
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
29
|
-
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");
|
|
30
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
31
|
-
};
|
|
32
|
-
var _MessageManager_instances, _a, _MessageManager_c, _MessageManager_LresolveFileId, _MessageManager_checkParams, _MessageManager_constructReplyMarkup, _MessageManager_resolveSendAs, _MessageManager_constructReplyTo, _MessageManager_sendDocumentInner, _MessageManager_sendMedia, _MessageManager_CAPTIONABLE_MESSAGE_TYPES, _MessageManager_editInlineMessageTextInner, _MessageManager_resolveInputMediaInner, _MessageManager_resolveInputMedia, _MessageManager_sendReaction, _MessageManager_getCachedVoiceTranscription, _MessageManager_cacheVoiceTranscription;
|
|
33
21
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
34
22
|
exports.MessageManager = void 0;
|
|
35
23
|
const _0_deps_js_1 = require("../0_deps.js");
|
|
36
24
|
const _0_errors_js_1 = require("../0_errors.js");
|
|
37
25
|
const _1_utilities_js_1 = require("../1_utilities.js");
|
|
38
26
|
const _2_tl_js_1 = require("../2_tl.js");
|
|
27
|
+
const _3_errors_js_1 = require("../3_errors.js");
|
|
39
28
|
const _3_transport_js_1 = require("../3_transport.js");
|
|
40
29
|
const _3_types_js_1 = require("../3_types.js");
|
|
41
30
|
const _3_types_js_2 = require("../3_types.js");
|
|
@@ -60,32 +49,22 @@ const messageManagerUpdates = [
|
|
|
60
49
|
"updateTranscribedAudio",
|
|
61
50
|
];
|
|
62
51
|
class MessageManager {
|
|
52
|
+
#c;
|
|
53
|
+
#LresolveFileId;
|
|
63
54
|
constructor(c) {
|
|
64
|
-
|
|
65
|
-
_MessageManager_c.set(this, void 0);
|
|
66
|
-
_MessageManager_LresolveFileId.set(this, void 0);
|
|
67
|
-
Object.defineProperty(this, "usernameResolver", {
|
|
68
|
-
enumerable: true,
|
|
69
|
-
configurable: true,
|
|
70
|
-
writable: true,
|
|
71
|
-
value: async (v) => {
|
|
72
|
-
const inputPeer = await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(v).then((v) => _2_tl_js_1.Api.as("inputPeerUser", v));
|
|
73
|
-
return { ...inputPeer, _: "inputUser" };
|
|
74
|
-
}
|
|
75
|
-
});
|
|
76
|
-
__classPrivateFieldSet(this, _MessageManager_c, c, "f");
|
|
55
|
+
this.#c = c;
|
|
77
56
|
const L = (0, _1_utilities_js_1.getLogger)("MessageManager").client(c.id);
|
|
78
|
-
|
|
57
|
+
this.#LresolveFileId = L.branch("resolveFileId");
|
|
79
58
|
}
|
|
80
59
|
async getMessages(chatId, messageIds) {
|
|
81
60
|
(0, _0_utilities_js_1.checkArray)(messageIds, _0_utilities_js_1.checkMessageId);
|
|
82
|
-
const peer = await
|
|
61
|
+
const peer = await this.#c.getInputPeer(chatId);
|
|
83
62
|
let messages_ = new Array();
|
|
84
|
-
const chatId_ = await
|
|
63
|
+
const chatId_ = await this.#c.getInputPeerChatId(peer);
|
|
85
64
|
let shouldFetch = false;
|
|
86
65
|
for (const messageId of messageIds) {
|
|
87
|
-
const message = await
|
|
88
|
-
if (message
|
|
66
|
+
const message = await this.#c.messageStorage.getMessage(chatId_, messageId);
|
|
67
|
+
if (message === null) {
|
|
89
68
|
messages_ = [];
|
|
90
69
|
shouldFetch = true;
|
|
91
70
|
break;
|
|
@@ -96,10 +75,10 @@ class MessageManager {
|
|
|
96
75
|
}
|
|
97
76
|
if (shouldFetch) {
|
|
98
77
|
if ((0, _0_utilities_js_1.canBeInputChannel)(peer)) {
|
|
99
|
-
messages_ = await
|
|
78
|
+
messages_ = await this.#c.invoke({ _: "channels.getMessages", channel: (0, _0_utilities_js_1.toInputChannel)(peer), id: messageIds.map((v) => ({ _: "inputMessageID", id: v })) }).then((v) => _2_tl_js_1.Api.as("messages.channelMessages", v).messages);
|
|
100
79
|
}
|
|
101
80
|
else {
|
|
102
|
-
messages_ = await
|
|
81
|
+
messages_ = await this.#c.invoke({
|
|
103
82
|
_: "messages.getMessages",
|
|
104
83
|
id: messageIds.map((v) => ({ _: "inputMessageID", id: v })),
|
|
105
84
|
}).then((v) => _2_tl_js_1.Api.as("messages.messages", v).messages);
|
|
@@ -111,7 +90,7 @@ class MessageManager {
|
|
|
111
90
|
continue;
|
|
112
91
|
}
|
|
113
92
|
const message = await this.constructMessage(message_);
|
|
114
|
-
if (message.chat.id
|
|
93
|
+
if (message.chat.id === chatId_) {
|
|
115
94
|
messages.push(message);
|
|
116
95
|
}
|
|
117
96
|
}
|
|
@@ -119,7 +98,7 @@ class MessageManager {
|
|
|
119
98
|
}
|
|
120
99
|
async getMessageWithReply(chatId, messageId) {
|
|
121
100
|
const message = await this.getMessage(chatId, messageId);
|
|
122
|
-
if (message
|
|
101
|
+
if (message !== null && message.replyToMessageId) {
|
|
123
102
|
message.replyToMessage = await this.getMessage(chatId, message.replyToMessageId) ?? undefined;
|
|
124
103
|
}
|
|
125
104
|
return message;
|
|
@@ -162,9 +141,23 @@ class MessageManager {
|
|
|
162
141
|
}
|
|
163
142
|
return [text, entities];
|
|
164
143
|
}
|
|
144
|
+
#checkParams(params) {
|
|
145
|
+
if (params && "replyMarkup" in params && params.replyMarkup !== undefined) {
|
|
146
|
+
this.#c.storage.assertBot("replyMarkup");
|
|
147
|
+
}
|
|
148
|
+
if (params && "businessConnectionId" in params && params.businessConnectionId !== undefined) {
|
|
149
|
+
this.#c.storage.assertBot("businessConnectionId");
|
|
150
|
+
}
|
|
151
|
+
if (params && "sendAs" in params && params.sendAs !== undefined) {
|
|
152
|
+
this.#c.storage.assertUser("sendAs");
|
|
153
|
+
}
|
|
154
|
+
if (params && "sendAt" in params && params.sendAt !== undefined) {
|
|
155
|
+
this.#c.storage.assertUser("businessConsendAtnectionId");
|
|
156
|
+
}
|
|
157
|
+
}
|
|
165
158
|
async parseText(text_, params) {
|
|
166
|
-
const [text, entities_] =
|
|
167
|
-
const entities = entities_?.length > 0 ? await Promise.all(entities_.map((v) => (0, _3_types_js_2.messageEntityToTlObject)(v,
|
|
159
|
+
const [text, entities_] = MessageManager.parseText(text_, params?.entities ?? [], params?.parseMode ?? this.#c.parseMode);
|
|
160
|
+
const entities = entities_?.length > 0 ? await Promise.all(entities_.map((v) => (0, _3_types_js_2.messageEntityToTlObject)(v, this.#c.getEntity))) : undefined;
|
|
168
161
|
return [text, entities];
|
|
169
162
|
}
|
|
170
163
|
async updatesToMessages(chatId, updates, businessConnectionId) {
|
|
@@ -194,7 +187,7 @@ class MessageManager {
|
|
|
194
187
|
}
|
|
195
188
|
else if (_2_tl_js_1.Api.is("updateShortSentMessage", updates)) {
|
|
196
189
|
const message = await this.getMessage(chatId, updates.id);
|
|
197
|
-
if (message
|
|
190
|
+
if (message !== null) {
|
|
198
191
|
messages.push(message);
|
|
199
192
|
}
|
|
200
193
|
}
|
|
@@ -206,35 +199,49 @@ class MessageManager {
|
|
|
206
199
|
let poll = null;
|
|
207
200
|
let pollResults = null;
|
|
208
201
|
if (pollId) {
|
|
209
|
-
[poll, pollResults] = await Promise.all([
|
|
202
|
+
[poll, pollResults] = await Promise.all([this.#c.messageStorage.getPoll(pollId), this.#c.messageStorage.getPollResults(pollId)]);
|
|
210
203
|
}
|
|
211
|
-
const message = await (0, _3_types_js_2.constructMessage)(message_,
|
|
204
|
+
const message = await (0, _3_types_js_2.constructMessage)(message_, this.#c.getEntity, this.getMessage.bind(this), this.#c.fileManager.getStickerSetName.bind(this.#c.fileManager), r, business, poll ?? undefined, pollResults ?? undefined);
|
|
212
205
|
if (!poll && mediaPoll) {
|
|
213
|
-
await
|
|
206
|
+
await this.#c.storage.setPoll(mediaPoll.poll.id, mediaPoll.poll);
|
|
214
207
|
}
|
|
215
208
|
if (!pollResults && mediaPoll) {
|
|
216
|
-
await
|
|
209
|
+
await this.#c.storage.setPollResults(mediaPoll.poll.id, mediaPoll.results);
|
|
217
210
|
}
|
|
218
211
|
return message;
|
|
219
212
|
}
|
|
220
213
|
async forwardMessages(from, to, messageIds, params) {
|
|
221
214
|
(0, _0_utilities_js_1.checkArray)(messageIds, _0_utilities_js_1.checkMessageId);
|
|
222
|
-
const result = await
|
|
215
|
+
const result = await this.#c.invoke({ _: "messages.forwardMessages", from_peer: await this.#c.getInputPeer(from), to_peer: await this.#c.getInputPeer(to), id: messageIds, random_id: messageIds.map(() => (0, _1_utilities_js_1.getRandomId)()), silent: params?.disableNotification || undefined, top_msg_id: params?.messageThreadId, noforwards: params?.disableNotification || undefined, send_as: params?.sendAs ? await this.#c.getInputPeer(params.sendAs) : undefined, drop_author: params?.dropSenderName || undefined, drop_media_captions: params?.dropCaption || undefined });
|
|
223
216
|
return await this.updatesToMessages(to, result);
|
|
224
217
|
}
|
|
225
218
|
async getHistory(chatId, params) {
|
|
226
|
-
|
|
219
|
+
this.#c.storage.assertUser("getHistory");
|
|
227
220
|
const limit = (0, _0_utilities_js_1.getLimit)(params?.limit);
|
|
228
|
-
let offsetId = params?.
|
|
221
|
+
let offsetId = params?.offsetId ?? 0;
|
|
229
222
|
if (offsetId < 0) {
|
|
230
223
|
offsetId = 0;
|
|
231
224
|
}
|
|
232
|
-
|
|
225
|
+
let offsetDate = params?.offsetDate ?? 0;
|
|
226
|
+
if (offsetDate < 0) {
|
|
227
|
+
offsetDate = 0;
|
|
228
|
+
}
|
|
229
|
+
const peer = await this.#c.getInputPeer(chatId);
|
|
233
230
|
const messages = new Array();
|
|
234
231
|
if (messages.length > 0) {
|
|
235
232
|
offsetId = messages[messages.length - 1].id; // TODO: track id of oldest message and don't send requests for it
|
|
236
233
|
}
|
|
237
|
-
const result = await
|
|
234
|
+
const result = await this.#c.invoke({
|
|
235
|
+
_: "messages.getHistory",
|
|
236
|
+
peer: peer,
|
|
237
|
+
offset_id: offsetId,
|
|
238
|
+
offset_date: offsetDate,
|
|
239
|
+
add_offset: params?.addOffset ?? 0,
|
|
240
|
+
limit,
|
|
241
|
+
max_id: 0,
|
|
242
|
+
min_id: 0,
|
|
243
|
+
hash: 0n,
|
|
244
|
+
});
|
|
238
245
|
if (!("messages" in result)) {
|
|
239
246
|
(0, _0_deps_js_1.unreachable)();
|
|
240
247
|
}
|
|
@@ -244,23 +251,40 @@ class MessageManager {
|
|
|
244
251
|
}
|
|
245
252
|
return messages;
|
|
246
253
|
}
|
|
254
|
+
usernameResolver = async (v) => {
|
|
255
|
+
const inputPeer = await this.#c.getInputPeer(v).then((v) => _2_tl_js_1.Api.as("inputPeerUser", v));
|
|
256
|
+
return { ...inputPeer, _: "inputUser" };
|
|
257
|
+
};
|
|
258
|
+
async #constructReplyMarkup(params) {
|
|
259
|
+
if (params?.replyMarkup) {
|
|
260
|
+
this.#c.storage.assertBot("replyMarkup");
|
|
261
|
+
return await (0, _3_types_js_2.replyMarkupToTlObject)(params.replyMarkup, this.usernameResolver.bind(this));
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
async #resolveSendAs(params) {
|
|
265
|
+
const sendAs = params?.sendAs;
|
|
266
|
+
if (sendAs !== undefined) {
|
|
267
|
+
this.#c.storage.assertUser("sendAs");
|
|
268
|
+
return sendAs ? await this.#c.getInputPeer(sendAs) : undefined;
|
|
269
|
+
}
|
|
270
|
+
}
|
|
247
271
|
async sendMessage(chatId, text, params) {
|
|
248
|
-
|
|
272
|
+
this.#checkParams(params);
|
|
249
273
|
const [message, entities] = await this.parseText(text, params);
|
|
250
|
-
const replyMarkup = await
|
|
251
|
-
const peer = await
|
|
274
|
+
const replyMarkup = await this.#constructReplyMarkup(params);
|
|
275
|
+
const peer = await this.#c.getInputPeer(chatId);
|
|
252
276
|
const randomId = (0, _1_utilities_js_1.getRandomId)();
|
|
253
277
|
const noWebpage = params?.linkPreview?.disable ? true : undefined;
|
|
254
278
|
const invertMedia = params?.linkPreview?.aboveText ? true : undefined;
|
|
255
279
|
const silent = params?.disableNotification ? true : undefined;
|
|
256
280
|
const noforwards = params?.protectContent ? true : undefined;
|
|
257
|
-
const sendAs = await
|
|
281
|
+
const sendAs = await this.#resolveSendAs(params);
|
|
258
282
|
const effect = params?.effectId ? BigInt(params.effectId) : undefined;
|
|
259
283
|
const schedule_date = params?.sendAt;
|
|
260
284
|
const allow_paid_floodskip = params?.paidBroadcast ? true : undefined;
|
|
261
285
|
let result;
|
|
262
286
|
if (!noWebpage && params?.linkPreview?.url) {
|
|
263
|
-
result = await
|
|
287
|
+
result = await this.#c.invoke({
|
|
264
288
|
_: "messages.sendMedia",
|
|
265
289
|
peer,
|
|
266
290
|
random_id: randomId,
|
|
@@ -275,7 +299,7 @@ class MessageManager {
|
|
|
275
299
|
invert_media: invertMedia,
|
|
276
300
|
silent,
|
|
277
301
|
noforwards,
|
|
278
|
-
reply_to: await
|
|
302
|
+
reply_to: await this.#constructReplyTo(params),
|
|
279
303
|
send_as: sendAs,
|
|
280
304
|
entities,
|
|
281
305
|
reply_markup: replyMarkup,
|
|
@@ -285,7 +309,7 @@ class MessageManager {
|
|
|
285
309
|
}, { businessConnectionId: params?.businessConnectionId });
|
|
286
310
|
}
|
|
287
311
|
else {
|
|
288
|
-
result = await
|
|
312
|
+
result = await this.#c.invoke({
|
|
289
313
|
_: "messages.sendMessage",
|
|
290
314
|
peer,
|
|
291
315
|
random_id: randomId,
|
|
@@ -294,7 +318,7 @@ class MessageManager {
|
|
|
294
318
|
invert_media: invertMedia,
|
|
295
319
|
silent,
|
|
296
320
|
noforwards,
|
|
297
|
-
reply_to: await
|
|
321
|
+
reply_to: await this.#constructReplyTo(params),
|
|
298
322
|
send_as: sendAs,
|
|
299
323
|
entities,
|
|
300
324
|
reply_markup: replyMarkup,
|
|
@@ -306,21 +330,38 @@ class MessageManager {
|
|
|
306
330
|
const message_ = (await this.updatesToMessages(chatId, result, params?.businessConnectionId))[0];
|
|
307
331
|
return (0, _3_types_js_2.assertMessageType)(message_, "text");
|
|
308
332
|
}
|
|
333
|
+
async #constructReplyTo(params) {
|
|
334
|
+
const topMsgId = params?.messageThreadId;
|
|
335
|
+
if (!params?.replyTo) {
|
|
336
|
+
if (topMsgId) {
|
|
337
|
+
return { _: "inputReplyToMessage", reply_to_msg_id: topMsgId };
|
|
338
|
+
}
|
|
339
|
+
else {
|
|
340
|
+
return undefined;
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
if ("messageId" in params.replyTo) {
|
|
344
|
+
return { _: "inputReplyToMessage", reply_to_msg_id: params.replyTo.messageId, top_msg_id: topMsgId, quote_text: params.replyTo.quote?.text, quote_entities: await Promise.all(params.replyTo.quote?.entities.map((v) => (0, _3_types_js_2.messageEntityToTlObject)(v, this.#c.getEntity)) ?? []), quote_offset: params.replyTo.quote?.offset };
|
|
345
|
+
}
|
|
346
|
+
else {
|
|
347
|
+
return { _: "inputReplyToStory", peer: await this.#c.getInputPeer(params.replyTo.chatId), story_id: params.replyTo.storyId };
|
|
348
|
+
}
|
|
349
|
+
}
|
|
309
350
|
async sendVenue(chatId, latitude, longitude, title, address, params) {
|
|
310
|
-
|
|
311
|
-
const peer = await
|
|
351
|
+
this.#checkParams(params);
|
|
352
|
+
const peer = await this.#c.getInputPeer(chatId);
|
|
312
353
|
const randomId = (0, _1_utilities_js_1.getRandomId)();
|
|
313
354
|
const silent = params?.disableNotification ? true : undefined;
|
|
314
355
|
const noforwards = params?.protectContent ? true : undefined;
|
|
315
|
-
const sendAs = params?.sendAs ? await
|
|
316
|
-
const replyMarkup = await
|
|
317
|
-
const result = await
|
|
356
|
+
const sendAs = params?.sendAs ? await this.#c.getInputPeer(params.sendAs) : undefined;
|
|
357
|
+
const replyMarkup = await this.#constructReplyMarkup(params);
|
|
358
|
+
const result = await this.#c.invoke({
|
|
318
359
|
_: "messages.sendMedia",
|
|
319
360
|
peer,
|
|
320
361
|
random_id: randomId,
|
|
321
362
|
silent,
|
|
322
363
|
noforwards,
|
|
323
|
-
reply_to: await
|
|
364
|
+
reply_to: await this.#constructReplyTo(params),
|
|
324
365
|
send_as: sendAs,
|
|
325
366
|
reply_markup: replyMarkup,
|
|
326
367
|
media: ({
|
|
@@ -345,20 +386,20 @@ class MessageManager {
|
|
|
345
386
|
return (0, _3_types_js_2.assertMessageType)(message, "venue");
|
|
346
387
|
}
|
|
347
388
|
async sendContact(chatId, firstName, number, params) {
|
|
348
|
-
|
|
349
|
-
const peer = await
|
|
389
|
+
this.#checkParams(params);
|
|
390
|
+
const peer = await this.#c.getInputPeer(chatId);
|
|
350
391
|
const randomId = (0, _1_utilities_js_1.getRandomId)();
|
|
351
392
|
const silent = params?.disableNotification ? true : undefined;
|
|
352
393
|
const noforwards = params?.protectContent ? true : undefined;
|
|
353
|
-
const sendAs = params?.sendAs ? await
|
|
354
|
-
const replyMarkup = await
|
|
355
|
-
const result = await
|
|
394
|
+
const sendAs = params?.sendAs ? await this.#c.getInputPeer(params.sendAs) : undefined;
|
|
395
|
+
const replyMarkup = await this.#constructReplyMarkup(params);
|
|
396
|
+
const result = await this.#c.invoke({
|
|
356
397
|
_: "messages.sendMedia",
|
|
357
398
|
peer,
|
|
358
399
|
random_id: randomId,
|
|
359
400
|
silent,
|
|
360
401
|
noforwards,
|
|
361
|
-
reply_to: await
|
|
402
|
+
reply_to: await this.#constructReplyTo(params),
|
|
362
403
|
send_as: sendAs,
|
|
363
404
|
reply_markup: replyMarkup,
|
|
364
405
|
media: ({
|
|
@@ -377,20 +418,20 @@ class MessageManager {
|
|
|
377
418
|
return (0, _3_types_js_2.assertMessageType)(message, "contact");
|
|
378
419
|
}
|
|
379
420
|
async sendDice(chatId, params) {
|
|
380
|
-
|
|
381
|
-
const peer = await
|
|
421
|
+
this.#checkParams(params);
|
|
422
|
+
const peer = await this.#c.getInputPeer(chatId);
|
|
382
423
|
const randomId = (0, _1_utilities_js_1.getRandomId)();
|
|
383
424
|
const silent = params?.disableNotification ? true : undefined;
|
|
384
425
|
const noforwards = params?.protectContent ? true : undefined;
|
|
385
|
-
const sendAs = params?.sendAs ? await
|
|
386
|
-
const replyMarkup = await
|
|
387
|
-
const result = await
|
|
426
|
+
const sendAs = params?.sendAs ? await this.#c.getInputPeer(params.sendAs) : undefined;
|
|
427
|
+
const replyMarkup = await this.#constructReplyMarkup(params);
|
|
428
|
+
const result = await this.#c.invoke({
|
|
388
429
|
_: "messages.sendMedia",
|
|
389
430
|
peer,
|
|
390
431
|
random_id: randomId,
|
|
391
432
|
silent,
|
|
392
433
|
noforwards,
|
|
393
|
-
reply_to: await
|
|
434
|
+
reply_to: await this.#constructReplyTo(params),
|
|
394
435
|
send_as: sendAs,
|
|
395
436
|
reply_markup: replyMarkup,
|
|
396
437
|
media: ({
|
|
@@ -406,20 +447,20 @@ class MessageManager {
|
|
|
406
447
|
return (0, _3_types_js_2.assertMessageType)(message, "dice");
|
|
407
448
|
}
|
|
408
449
|
async sendLocation(chatId, latitude, longitude, params) {
|
|
409
|
-
|
|
410
|
-
const peer = await
|
|
450
|
+
this.#checkParams(params);
|
|
451
|
+
const peer = await this.#c.getInputPeer(chatId);
|
|
411
452
|
const randomId = (0, _1_utilities_js_1.getRandomId)();
|
|
412
453
|
const silent = params?.disableNotification ? true : undefined;
|
|
413
454
|
const noforwards = params?.protectContent ? true : undefined;
|
|
414
|
-
const sendAs = params?.sendAs ? await
|
|
415
|
-
const replyMarkup = await
|
|
416
|
-
const result = await
|
|
455
|
+
const sendAs = params?.sendAs ? await this.#c.getInputPeer(params.sendAs) : undefined;
|
|
456
|
+
const replyMarkup = await this.#constructReplyMarkup(params);
|
|
457
|
+
const result = await this.#c.invoke({
|
|
417
458
|
_: "messages.sendMedia",
|
|
418
459
|
peer,
|
|
419
460
|
random_id: randomId,
|
|
420
461
|
silent,
|
|
421
462
|
noforwards,
|
|
422
|
-
reply_to: await
|
|
463
|
+
reply_to: await this.#constructReplyTo(params),
|
|
423
464
|
send_as: sendAs,
|
|
424
465
|
reply_markup: replyMarkup,
|
|
425
466
|
media: params?.livePeriod !== undefined
|
|
@@ -453,74 +494,151 @@ class MessageManager {
|
|
|
453
494
|
return (0, _3_types_js_2.assertMessageType)(message, "location");
|
|
454
495
|
}
|
|
455
496
|
async sendVideoNote(chatId, audio, params) {
|
|
456
|
-
|
|
457
|
-
const message = await
|
|
497
|
+
this.#checkParams(params);
|
|
498
|
+
const message = await this.#sendDocumentInner(chatId, audio, params, _3_types_js_2.FileType.VideoNote, [
|
|
458
499
|
{ _: "documentAttributeVideo", round_message: true, w: params?.length ?? 0, h: params?.length ?? 0, duration: params?.duration ?? 0 },
|
|
459
500
|
], false);
|
|
460
501
|
return (0, _3_types_js_2.assertMessageType)(message, "videoNote");
|
|
461
502
|
}
|
|
462
503
|
async sendAudio(chatId, audio, params) {
|
|
463
|
-
|
|
464
|
-
const message = await
|
|
504
|
+
this.#checkParams(params);
|
|
505
|
+
const message = await this.#sendDocumentInner(chatId, audio, params, _3_types_js_2.FileType.Audio, [
|
|
465
506
|
{ _: "documentAttributeAudio", duration: params?.duration ?? 0, performer: params?.performer, title: params?.title },
|
|
466
507
|
]);
|
|
467
508
|
return (0, _3_types_js_2.assertMessageType)(message, "audio");
|
|
468
509
|
}
|
|
469
510
|
async sendVoice(chatId, voice, params) {
|
|
470
|
-
|
|
471
|
-
const message = await
|
|
511
|
+
this.#checkParams(params);
|
|
512
|
+
const message = await this.#sendDocumentInner(chatId, voice, params, _3_types_js_2.FileType.VoiceNote, [
|
|
472
513
|
{ _: "documentAttributeAudio", voice: true, duration: params?.duration ?? 0 },
|
|
473
514
|
]);
|
|
474
515
|
return (0, _3_types_js_2.assertMessageType)(message, "voice");
|
|
475
516
|
}
|
|
476
517
|
async sendAnimation(chatId, animation, params) {
|
|
477
|
-
|
|
478
|
-
const message = await
|
|
518
|
+
this.#checkParams(params);
|
|
519
|
+
const message = await this.#sendDocumentInner(chatId, animation, params, _3_types_js_2.FileType.Animation, [
|
|
479
520
|
{ _: "documentAttributeAnimated" },
|
|
480
521
|
{ _: "documentAttributeVideo", supports_streaming: true, w: params?.width ?? 0, h: params?.height ?? 0, duration: params?.duration ?? 0 },
|
|
481
522
|
]);
|
|
482
523
|
return (0, _3_types_js_2.assertMessageType)(message, "animation");
|
|
483
524
|
}
|
|
484
525
|
async sendVideo(chatId, video, params) {
|
|
485
|
-
|
|
486
|
-
const message = await
|
|
526
|
+
this.#checkParams(params);
|
|
527
|
+
const message = await this.#sendDocumentInner(chatId, video, params, _3_types_js_2.FileType.Video, [
|
|
487
528
|
{ _: "documentAttributeVideo", supports_streaming: params?.supportsStreaming ? true : undefined, w: params?.width ?? 0, h: params?.height ?? 0, duration: params?.duration ?? 0 },
|
|
488
529
|
]);
|
|
489
530
|
return (0, _3_types_js_2.assertMessageType)(message, "video");
|
|
490
531
|
}
|
|
532
|
+
async #sendDocumentInner(chatId, document, params, fileType, otherAttribs, urlSupported = true, expectedMimeTypes) {
|
|
533
|
+
let media = null;
|
|
534
|
+
const spoiler = params?.hasSpoiler ? true : undefined;
|
|
535
|
+
const ttl_seconds = params && "selfDestruct" in params && typeof params.selfDestruct !== undefined ? (0, _3_types_js_1.selfDestructOptionToInt)(params.selfDestruct) : undefined;
|
|
536
|
+
if (typeof document === "string") {
|
|
537
|
+
const fileId = this.resolveFileId(document, fileType);
|
|
538
|
+
if (fileId !== null) {
|
|
539
|
+
media = { _: "inputMediaDocument", id: { ...fileId, _: "inputDocument" }, spoiler, query: otherAttribs.find((v) => _2_tl_js_1.Api.is("documentAttributeSticker", v))?.alt || undefined, ttl_seconds };
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
if (media === null) {
|
|
543
|
+
if (typeof document === "string" && (0, _0_utilities_js_1.isHttpUrl)(document)) {
|
|
544
|
+
if (!urlSupported) {
|
|
545
|
+
throw new _0_errors_js_1.InputError("URL not supported.");
|
|
546
|
+
}
|
|
547
|
+
media = { _: "inputMediaDocumentExternal", url: document, spoiler, ttl_seconds };
|
|
548
|
+
}
|
|
549
|
+
else {
|
|
550
|
+
let mimeType;
|
|
551
|
+
const file = await this.#c.fileManager.upload(document, params, (name) => {
|
|
552
|
+
mimeType = params?.mimeType ?? (0, _0_deps_js_1.contentType)(name.split(".").slice(-1)[0]) ?? FALLBACK_MIME_TYPE;
|
|
553
|
+
if (expectedMimeTypes && !expectedMimeTypes.includes(mimeType)) {
|
|
554
|
+
(0, _0_deps_js_1.unreachable)();
|
|
555
|
+
}
|
|
556
|
+
if (name.endsWith(".tgs") && fileType === _3_types_js_2.FileType.Document) {
|
|
557
|
+
name += "-";
|
|
558
|
+
}
|
|
559
|
+
return name;
|
|
560
|
+
});
|
|
561
|
+
if (_2_tl_js_1.Api.is("inputFileStoryDocument", file)) {
|
|
562
|
+
(0, _0_deps_js_1.unreachable)();
|
|
563
|
+
}
|
|
564
|
+
let thumb = undefined;
|
|
565
|
+
if (params?.thumbnail) {
|
|
566
|
+
thumb = await this.#c.fileManager.upload(params.thumbnail, { chunkSize: params?.chunkSize, signal: params?.signal });
|
|
567
|
+
}
|
|
568
|
+
media = { _: "inputMediaUploadedDocument", file, thumb, spoiler, attributes: [{ _: "documentAttributeFilename", file_name: file.name }, ...otherAttribs], mime_type: mimeType, force_file: fileType === _3_types_js_2.FileType.Document ? true : undefined, ttl_seconds };
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
const message = await this.#sendMedia(chatId, media, params);
|
|
572
|
+
return message;
|
|
573
|
+
}
|
|
491
574
|
async sendDocument(chatId, document, params) {
|
|
492
|
-
|
|
493
|
-
const message = await
|
|
575
|
+
this.#checkParams(params);
|
|
576
|
+
const message = await this.#sendDocumentInner(chatId, document, params, _3_types_js_2.FileType.Document, []);
|
|
494
577
|
return (0, _3_types_js_2.assertMessageType)(message, "document");
|
|
495
578
|
}
|
|
496
579
|
async sendSticker(chatId, sticker, params) {
|
|
497
|
-
|
|
498
|
-
const message = await
|
|
580
|
+
this.#checkParams(params);
|
|
581
|
+
const message = await this.#sendDocumentInner(chatId, sticker, params, _3_types_js_2.FileType.Sticker, [{ _: "documentAttributeSticker", alt: params?.emoji || "", stickerset: { _: "inputStickerSetEmpty" } }], undefined, STICKER_MIME_TYPES);
|
|
499
582
|
return (0, _3_types_js_2.assertMessageType)(message, "sticker");
|
|
500
583
|
}
|
|
501
584
|
async sendPhoto(chatId, photo, params) {
|
|
502
|
-
|
|
585
|
+
this.#checkParams(params);
|
|
503
586
|
let media = null;
|
|
504
587
|
const spoiler = params?.hasSpoiler ? true : undefined;
|
|
505
588
|
const ttl_seconds = params && "selfDestruct" in params && params.selfDestruct !== undefined ? (0, _3_types_js_1.selfDestructOptionToInt)(params.selfDestruct) : undefined;
|
|
506
589
|
if (typeof photo === "string") {
|
|
507
590
|
const fileId = this.resolveFileId(photo, [_3_types_js_2.FileType.Photo, _3_types_js_2.FileType.ProfilePhoto]);
|
|
508
|
-
if (fileId
|
|
591
|
+
if (fileId !== null) {
|
|
509
592
|
media = { _: "inputMediaPhoto", id: { ...fileId, _: "inputPhoto" }, spoiler, ttl_seconds };
|
|
510
593
|
}
|
|
511
594
|
}
|
|
512
|
-
if (media
|
|
595
|
+
if (media === null) {
|
|
513
596
|
if (typeof photo === "string" && (0, _0_utilities_js_1.isHttpUrl)(photo)) {
|
|
514
597
|
media = { _: "inputMediaPhotoExternal", url: photo, spoiler, ttl_seconds: (params && "selfDestruct" in params && params.selfDestruct !== undefined) ? (0, _3_types_js_1.selfDestructOptionToInt)(params.selfDestruct) : undefined };
|
|
515
598
|
}
|
|
516
599
|
else {
|
|
517
|
-
const file = await
|
|
600
|
+
const file = await this.#c.fileManager.upload(photo, params, null, false);
|
|
518
601
|
media = { _: "inputMediaUploadedPhoto", file, spoiler, ttl_seconds: (params && "selfDestruct" in params && params.selfDestruct !== undefined) ? (0, _3_types_js_1.selfDestructOptionToInt)(params.selfDestruct) : undefined };
|
|
519
602
|
}
|
|
520
603
|
}
|
|
521
|
-
const message = await
|
|
604
|
+
const message = await this.#sendMedia(chatId, media, params);
|
|
522
605
|
return (0, _3_types_js_2.assertMessageType)(message, "photo");
|
|
523
606
|
}
|
|
607
|
+
async #sendMedia(chatId, media, params) {
|
|
608
|
+
if (params?.starCount !== undefined) {
|
|
609
|
+
if (params.starCount <= 0) {
|
|
610
|
+
throw new _0_errors_js_1.InputError("starCount cannot be zero or negative");
|
|
611
|
+
}
|
|
612
|
+
media = { _: "inputMediaPaidMedia", stars_amount: BigInt(params.starCount), extended_media: [media] };
|
|
613
|
+
}
|
|
614
|
+
const peer = await this.#c.getInputPeer(chatId);
|
|
615
|
+
const randomId = (0, _1_utilities_js_1.getRandomId)();
|
|
616
|
+
const silent = params?.disableNotification ? true : undefined;
|
|
617
|
+
const noforwards = params?.protectContent ? true : undefined;
|
|
618
|
+
const sendAs = params?.sendAs ? await this.#c.getInputPeer(params.sendAs) : undefined;
|
|
619
|
+
const replyMarkup = await this.#constructReplyMarkup(params);
|
|
620
|
+
const caption_ = params?.caption;
|
|
621
|
+
const parseResult = caption_ !== undefined ? await this.parseText(caption_, { parseMode: params?.parseMode, entities: params?.captionEntities }) : undefined;
|
|
622
|
+
const caption = parseResult === undefined ? undefined : parseResult[0];
|
|
623
|
+
const captionEntities = parseResult === undefined ? undefined : parseResult[1];
|
|
624
|
+
const result = await this.#c.invoke({
|
|
625
|
+
_: "messages.sendMedia",
|
|
626
|
+
peer,
|
|
627
|
+
random_id: randomId,
|
|
628
|
+
silent,
|
|
629
|
+
noforwards,
|
|
630
|
+
reply_markup: replyMarkup,
|
|
631
|
+
reply_to: await this.#constructReplyTo(params),
|
|
632
|
+
send_as: sendAs,
|
|
633
|
+
media,
|
|
634
|
+
message: caption ?? "",
|
|
635
|
+
entities: captionEntities,
|
|
636
|
+
effect: params?.effectId ? BigInt(params.effectId) : undefined,
|
|
637
|
+
schedule_date: params?.sendAt,
|
|
638
|
+
allow_paid_floodskip: params?.paidBroadcast ? true : undefined,
|
|
639
|
+
}, { businessConnectionId: params?.businessConnectionId });
|
|
640
|
+
return (await this.updatesToMessages(chatId, result, params?.businessConnectionId))[0];
|
|
641
|
+
}
|
|
524
642
|
resolveFileId(maybeFileId, expectedFileType) {
|
|
525
643
|
expectedFileType = Array.isArray(expectedFileType) ? expectedFileType : [expectedFileType];
|
|
526
644
|
let fileId = null;
|
|
@@ -528,9 +646,9 @@ class MessageManager {
|
|
|
528
646
|
fileId = (0, _3_types_js_1.deserializeFileId)(maybeFileId);
|
|
529
647
|
}
|
|
530
648
|
catch (err) {
|
|
531
|
-
|
|
649
|
+
this.#LresolveFileId.warning(err);
|
|
532
650
|
}
|
|
533
|
-
if (fileId
|
|
651
|
+
if (fileId !== null) {
|
|
534
652
|
if (!expectedFileType.includes(fileId.type)) {
|
|
535
653
|
(0, _0_deps_js_1.unreachable)();
|
|
536
654
|
}
|
|
@@ -543,7 +661,7 @@ class MessageManager {
|
|
|
543
661
|
return null;
|
|
544
662
|
}
|
|
545
663
|
async sendPoll(chatId, question, options, params) {
|
|
546
|
-
|
|
664
|
+
this.#checkParams(params);
|
|
547
665
|
question = question?.trim();
|
|
548
666
|
if (!question) {
|
|
549
667
|
throw new Error("Question must not be empty.");
|
|
@@ -551,12 +669,12 @@ class MessageManager {
|
|
|
551
669
|
if (!Array.isArray(options) || options.length < 2) {
|
|
552
670
|
throw new Error("There must be at least two options.");
|
|
553
671
|
}
|
|
554
|
-
const peer = await
|
|
672
|
+
const peer = await this.#c.getInputPeer(chatId);
|
|
555
673
|
const randomId = (0, _1_utilities_js_1.getRandomId)();
|
|
556
674
|
const silent = params?.disableNotification ? true : undefined;
|
|
557
675
|
const noforwards = params?.protectContent ? true : undefined;
|
|
558
|
-
const sendAs = params?.sendAs ? await
|
|
559
|
-
const replyMarkup = await
|
|
676
|
+
const sendAs = params?.sendAs ? await this.#c.getInputPeer(params.sendAs) : undefined;
|
|
677
|
+
const replyMarkup = await this.#constructReplyMarkup(params);
|
|
560
678
|
const explanation = params?.explanation;
|
|
561
679
|
const parseResult = explanation !== undefined ? await this.parseText(explanation, { parseMode: params?.explanationParseMode, entities: params?.explanationEntities }) : undefined;
|
|
562
680
|
const solution = parseResult === undefined ? undefined : parseResult[0];
|
|
@@ -568,16 +686,16 @@ class MessageManager {
|
|
|
568
686
|
return ({ _: "pollAnswer", option: (0, _1_utilities_js_1.encodeText)(String(i)), text: { _: "textWithEntities", text: parseResult[0], entities: parseResult[1] ?? [] } });
|
|
569
687
|
}));
|
|
570
688
|
const questionParseResult = await this.parseText(question, { parseMode: params?.questionParseMode, entities: params?.questionEntities });
|
|
571
|
-
const poll = { _: "poll", id: (0, _1_utilities_js_1.getRandomId)(), answers, question: { _: "textWithEntities", text: questionParseResult[0], entities: questionParseResult[1] ?? [] }, closed: params?.isClosed ? true : undefined, close_date: params?.closeDate, close_period: params?.openPeriod ? params.openPeriod : undefined, multiple_choice: params?.allowMultipleAnswers ? true : undefined, public_voters: params?.isAnonymous === false ? true : undefined, quiz: params?.type
|
|
689
|
+
const poll = { _: "poll", id: (0, _1_utilities_js_1.getRandomId)(), answers, question: { _: "textWithEntities", text: questionParseResult[0], entities: questionParseResult[1] ?? [] }, closed: params?.isClosed ? true : undefined, close_date: params?.closeDate, close_period: params?.openPeriod ? params.openPeriod : undefined, multiple_choice: params?.allowMultipleAnswers ? true : undefined, public_voters: params?.isAnonymous === false ? true : undefined, quiz: params?.type === "quiz" ? true : undefined };
|
|
572
690
|
const media = { _: "inputMediaPoll", poll, correct_answers: params?.correctOptionIndex !== undefined ? [(0, _1_utilities_js_1.encodeText)(String(params.correctOptionIndex))] : undefined, solution, solution_entities: solutionEntities };
|
|
573
|
-
const result = await
|
|
691
|
+
const result = await this.#c.invoke({
|
|
574
692
|
_: "messages.sendMedia",
|
|
575
693
|
peer,
|
|
576
694
|
random_id: randomId,
|
|
577
695
|
silent,
|
|
578
696
|
noforwards,
|
|
579
697
|
reply_markup: replyMarkup,
|
|
580
|
-
reply_to: await
|
|
698
|
+
reply_to: await this.#constructReplyTo(params),
|
|
581
699
|
send_as: sendAs,
|
|
582
700
|
media,
|
|
583
701
|
message: "",
|
|
@@ -589,26 +707,26 @@ class MessageManager {
|
|
|
589
707
|
return (0, _3_types_js_2.assertMessageType)(message, "poll");
|
|
590
708
|
}
|
|
591
709
|
async editMessageReplyMarkup(chatId, messageId, params) {
|
|
592
|
-
|
|
593
|
-
const result = await
|
|
710
|
+
this.#checkParams(params);
|
|
711
|
+
const result = await this.#c.invoke({
|
|
594
712
|
_: "messages.editMessage",
|
|
595
713
|
id: (0, _0_utilities_js_1.checkMessageId)(messageId),
|
|
596
|
-
peer: await
|
|
597
|
-
reply_markup: await
|
|
714
|
+
peer: await this.#c.getInputPeer(chatId),
|
|
715
|
+
reply_markup: await this.#constructReplyMarkup(params),
|
|
598
716
|
}, { businessConnectionId: params?.businessConnectionId });
|
|
599
717
|
const message_ = (await this.updatesToMessages(chatId, result))[0];
|
|
600
718
|
return message_;
|
|
601
719
|
}
|
|
602
720
|
async editInlineMessageReplyMarkup(inlineMessageId, params) {
|
|
603
721
|
const id = await (0, _3_types_js_2.deserializeInlineMessageId)(inlineMessageId);
|
|
604
|
-
await
|
|
722
|
+
await this.#c.invoke({
|
|
605
723
|
_: "messages.editInlineBotMessage",
|
|
606
724
|
id,
|
|
607
|
-
reply_markup: await
|
|
725
|
+
reply_markup: await this.#constructReplyMarkup(params),
|
|
608
726
|
}, { dc: (0, _3_transport_js_1.getDc)(id.dc_id) });
|
|
609
727
|
}
|
|
610
728
|
async editMessageText(chatId, messageId, text, params) {
|
|
611
|
-
|
|
729
|
+
this.#checkParams(params);
|
|
612
730
|
{
|
|
613
731
|
const message = await this.getMessage(chatId, messageId);
|
|
614
732
|
if (!message) {
|
|
@@ -622,36 +740,37 @@ class MessageManager {
|
|
|
622
740
|
if (!message) {
|
|
623
741
|
throw new _0_errors_js_1.InputError("Message text cannot be empty.");
|
|
624
742
|
}
|
|
625
|
-
if (params?.linkPreview && params.linkPreview.type
|
|
743
|
+
if (params?.linkPreview && params.linkPreview.type !== "input") {
|
|
626
744
|
throw new _0_errors_js_1.InputError("Expected link preview of type input.");
|
|
627
745
|
}
|
|
628
|
-
const noWebpage = params?.linkPreview && params.linkPreview.type
|
|
746
|
+
const noWebpage = params?.linkPreview && params.linkPreview.type === "input" && params.linkPreview.disable ? true : undefined;
|
|
629
747
|
const invertMedia = params?.linkPreview?.aboveText ? true : undefined;
|
|
630
748
|
let media = undefined;
|
|
631
749
|
if (!noWebpage && params?.linkPreview?.url) {
|
|
632
750
|
media = { _: "inputMediaWebPage", url: params.linkPreview.url, force_large_media: params.linkPreview.largeMedia ? true : undefined, force_small_media: params.linkPreview.smallMedia ? true : undefined, optional: message.length ? undefined : true };
|
|
633
751
|
}
|
|
634
|
-
const result = await
|
|
752
|
+
const result = await this.#c.invoke({
|
|
635
753
|
_: "messages.editMessage",
|
|
636
754
|
id: (0, _0_utilities_js_1.checkMessageId)(messageId),
|
|
637
|
-
peer: await
|
|
755
|
+
peer: await this.#c.getInputPeer(chatId),
|
|
638
756
|
entities,
|
|
639
757
|
message,
|
|
640
758
|
media,
|
|
641
759
|
no_webpage: noWebpage,
|
|
642
760
|
invert_media: invertMedia,
|
|
643
|
-
reply_markup: await
|
|
761
|
+
reply_markup: await this.#constructReplyMarkup(params),
|
|
644
762
|
}, { businessConnectionId: params?.businessConnectionId });
|
|
645
763
|
const message_ = (await this.updatesToMessages(chatId, result))[0];
|
|
646
764
|
return (0, _3_types_js_2.assertMessageType)(message_, "text");
|
|
647
765
|
}
|
|
766
|
+
static #CAPTIONABLE_MESSAGE_TYPES = ["photo", "document", "video", "animation", "voice", "audio", "video"];
|
|
648
767
|
async editMessageCaption(chatId, messageId, params) {
|
|
649
768
|
let canHaveCaption = false;
|
|
650
769
|
const message_ = await this.getMessage(chatId, messageId);
|
|
651
770
|
if (!message_) {
|
|
652
771
|
throw new _0_errors_js_1.InputError("Message not found.");
|
|
653
772
|
}
|
|
654
|
-
for (const type of
|
|
773
|
+
for (const type of MessageManager.#CAPTIONABLE_MESSAGE_TYPES) {
|
|
655
774
|
if ((0, _3_types_js_1.isMessageType)(message_, type)) {
|
|
656
775
|
canHaveCaption = true;
|
|
657
776
|
}
|
|
@@ -660,24 +779,133 @@ class MessageManager {
|
|
|
660
779
|
throw new _0_errors_js_1.InputError("The referenced message cannot have a caption.");
|
|
661
780
|
}
|
|
662
781
|
const [message, entities] = await this.parseText(params?.caption ?? "", params);
|
|
663
|
-
const result = await
|
|
782
|
+
const result = await this.#c.invoke({
|
|
664
783
|
_: "messages.editMessage",
|
|
665
784
|
id: (0, _0_utilities_js_1.checkMessageId)(messageId),
|
|
666
|
-
peer: await
|
|
785
|
+
peer: await this.#c.getInputPeer(chatId),
|
|
667
786
|
entities: message ? entities : [],
|
|
668
787
|
message,
|
|
669
|
-
reply_markup: await
|
|
788
|
+
reply_markup: await this.#constructReplyMarkup(params),
|
|
670
789
|
}, { businessConnectionId: params?.businessConnectionId });
|
|
671
790
|
return (await this.updatesToMessages(chatId, result))[0];
|
|
672
791
|
}
|
|
792
|
+
async #editInlineMessageTextInner(inlineMessageId, text, params, allowEmpty = true) {
|
|
793
|
+
this.#checkParams(params);
|
|
794
|
+
const [message, entities] = await this.parseText(text, params);
|
|
795
|
+
if (!allowEmpty && !message) {
|
|
796
|
+
throw new _0_errors_js_1.InputError("Message text cannot be empty.");
|
|
797
|
+
}
|
|
798
|
+
const id = await (0, _3_types_js_2.deserializeInlineMessageId)(inlineMessageId);
|
|
799
|
+
if (params?.linkPreview && params.linkPreview.type !== "input") {
|
|
800
|
+
throw new _0_errors_js_1.InputError("Expected link preview of type input.");
|
|
801
|
+
}
|
|
802
|
+
const noWebpage = params?.linkPreview && params.linkPreview.type === "input" && params.linkPreview.disable ? true : undefined;
|
|
803
|
+
const invertMedia = params?.linkPreview?.aboveText ? true : undefined;
|
|
804
|
+
let media = undefined;
|
|
805
|
+
if (!noWebpage && params?.linkPreview?.url) {
|
|
806
|
+
media = { _: "inputMediaWebPage", url: params.linkPreview.url, force_large_media: params.linkPreview.largeMedia ? true : undefined, force_small_media: params.linkPreview.smallMedia ? true : undefined, optional: message.length ? undefined : true };
|
|
807
|
+
}
|
|
808
|
+
await this.#c.invoke({
|
|
809
|
+
_: "messages.editInlineBotMessage",
|
|
810
|
+
id,
|
|
811
|
+
entities,
|
|
812
|
+
message,
|
|
813
|
+
media,
|
|
814
|
+
no_webpage: noWebpage,
|
|
815
|
+
invert_media: invertMedia,
|
|
816
|
+
reply_markup: await this.#constructReplyMarkup(params),
|
|
817
|
+
}, { dc: (0, _3_transport_js_1.getDc)(id.dc_id) });
|
|
818
|
+
}
|
|
673
819
|
async editInlineMessageText(inlineMessageId, text, params) {
|
|
674
|
-
await
|
|
820
|
+
await this.#editInlineMessageTextInner(inlineMessageId, text, params, false);
|
|
675
821
|
}
|
|
676
822
|
async editInlineMessageCaption(inlineMessageId, params) {
|
|
677
|
-
await
|
|
823
|
+
await this.#editInlineMessageTextInner(inlineMessageId, params?.caption ?? "", params);
|
|
824
|
+
}
|
|
825
|
+
async #resolveInputMediaInner(document, media, fileType, otherAttribs) {
|
|
826
|
+
let media_ = null;
|
|
827
|
+
const spoiler = "hasSpoiler" in media && media.hasSpoiler ? true : undefined;
|
|
828
|
+
if (typeof document === "string") {
|
|
829
|
+
const fileId = this.resolveFileId(document, fileType);
|
|
830
|
+
if (fileId !== null) {
|
|
831
|
+
media_ = { _: "inputMediaDocument", id: { ...fileId, _: "inputDocument" }, spoiler, query: otherAttribs.find((v) => _2_tl_js_1.Api.is("documentAttributeSticker", v))?.alt || undefined };
|
|
832
|
+
}
|
|
833
|
+
}
|
|
834
|
+
if (media_ === null) {
|
|
835
|
+
if (typeof document === "string" && (0, _0_utilities_js_1.isHttpUrl)(document)) {
|
|
836
|
+
media_ = { _: "inputMediaDocumentExternal", url: document, spoiler };
|
|
837
|
+
}
|
|
838
|
+
else {
|
|
839
|
+
let mimeType;
|
|
840
|
+
const file = await this.#c.fileManager.upload(document, media, (name) => {
|
|
841
|
+
mimeType = media?.mimeType ?? (0, _0_deps_js_1.contentType)(name.split(".").slice(-1)[0]) ?? FALLBACK_MIME_TYPE;
|
|
842
|
+
if (name.endsWith(".tgs") && fileType === _3_types_js_2.FileType.Document) {
|
|
843
|
+
name += "-";
|
|
844
|
+
}
|
|
845
|
+
return name;
|
|
846
|
+
});
|
|
847
|
+
if (_2_tl_js_1.Api.is("inputFileStoryDocument", file)) {
|
|
848
|
+
(0, _0_deps_js_1.unreachable)();
|
|
849
|
+
}
|
|
850
|
+
let thumb = undefined;
|
|
851
|
+
if ("thumbnail" in media && media.thumbnail) {
|
|
852
|
+
thumb = await this.#c.fileManager.upload(media.thumbnail, { chunkSize: media?.chunkSize, signal: media?.signal });
|
|
853
|
+
}
|
|
854
|
+
media_ = { _: "inputMediaUploadedDocument", file, thumb, spoiler, attributes: [{ _: "documentAttributeFilename", file_name: file.name }, ...otherAttribs], mime_type: mimeType, force_file: fileType === _3_types_js_2.FileType.Document ? true : undefined };
|
|
855
|
+
}
|
|
856
|
+
}
|
|
857
|
+
return media_;
|
|
858
|
+
}
|
|
859
|
+
async #resolveInputMedia(media) {
|
|
860
|
+
if ("animation" in media) {
|
|
861
|
+
return await this.#resolveInputMediaInner(media.animation, media, _3_types_js_2.FileType.Animation, [
|
|
862
|
+
{ _: "documentAttributeAnimated" },
|
|
863
|
+
{ _: "documentAttributeVideo", supports_streaming: true, w: media?.width ?? 0, h: media?.height ?? 0, duration: media?.duration ?? 0 },
|
|
864
|
+
]);
|
|
865
|
+
}
|
|
866
|
+
else if ("audio" in media) {
|
|
867
|
+
return await this.#resolveInputMediaInner(media.audio, media, _3_types_js_2.FileType.Audio, [
|
|
868
|
+
{ _: "documentAttributeAudio", duration: media?.duration ?? 0, performer: media?.performer, title: media?.title },
|
|
869
|
+
]);
|
|
870
|
+
}
|
|
871
|
+
else if ("document" in media) {
|
|
872
|
+
return await this.#resolveInputMediaInner(media.document, media, _3_types_js_2.FileType.Document, []);
|
|
873
|
+
}
|
|
874
|
+
else if ("photo" in media) {
|
|
875
|
+
let media_ = null;
|
|
876
|
+
const spoiler = media.hasSpoiler ? true : undefined;
|
|
877
|
+
const ttl_seconds = "selfDestruct" in media && media.selfDestruct !== undefined ? (0, _3_types_js_1.selfDestructOptionToInt)(media.selfDestruct) : undefined;
|
|
878
|
+
if (typeof media.photo === "string") {
|
|
879
|
+
const fileId = this.resolveFileId(media.photo, [_3_types_js_2.FileType.Photo, _3_types_js_2.FileType.ProfilePhoto]);
|
|
880
|
+
if (fileId !== null) {
|
|
881
|
+
media_ = { _: "inputMediaPhoto", id: { ...fileId, _: "inputPhoto" }, spoiler, ttl_seconds };
|
|
882
|
+
}
|
|
883
|
+
}
|
|
884
|
+
if (media_ === null) {
|
|
885
|
+
if (typeof media.photo === "string" && (0, _0_utilities_js_1.isHttpUrl)(media.photo)) {
|
|
886
|
+
media_ = { _: "inputMediaPhotoExternal", url: media.photo, spoiler };
|
|
887
|
+
}
|
|
888
|
+
else {
|
|
889
|
+
const file = await this.#c.fileManager.upload(media.photo, media, null, false);
|
|
890
|
+
media_ = { _: "inputMediaUploadedPhoto", file, spoiler, ttl_seconds };
|
|
891
|
+
}
|
|
892
|
+
}
|
|
893
|
+
return media_;
|
|
894
|
+
}
|
|
895
|
+
else if ("video" in media) {
|
|
896
|
+
const ttl_seconds = "selfDestruct" in media && media.selfDestruct !== undefined ? (0, _3_types_js_1.selfDestructOptionToInt)(media.selfDestruct) : undefined;
|
|
897
|
+
const media_ = await this.#resolveInputMediaInner(media.video, media, _3_types_js_2.FileType.Video, [
|
|
898
|
+
{ _: "documentAttributeVideo", supports_streaming: media?.supportsStreaming ? true : undefined, w: media?.width ?? 0, h: media?.height ?? 0, duration: media?.duration ?? 0 },
|
|
899
|
+
]);
|
|
900
|
+
media_.ttl_seconds = ttl_seconds;
|
|
901
|
+
return media_;
|
|
902
|
+
}
|
|
903
|
+
else {
|
|
904
|
+
(0, _0_deps_js_1.unreachable)();
|
|
905
|
+
}
|
|
678
906
|
}
|
|
679
907
|
async editMessageMedia(chatId, messageId, media, params) {
|
|
680
|
-
|
|
908
|
+
this.#checkParams(params);
|
|
681
909
|
const message = await this.getMessage(chatId, messageId);
|
|
682
910
|
if (!message) {
|
|
683
911
|
throw new _0_errors_js_1.InputError("Message not found.");
|
|
@@ -686,12 +914,12 @@ class MessageManager {
|
|
|
686
914
|
throw new _0_errors_js_1.InputError("Unexpected message type.");
|
|
687
915
|
}
|
|
688
916
|
const [text, entities] = media.caption !== undefined ? await this.parseText(media.caption, { entities: media.captionEntities, parseMode: media.parseMode }) : ["", []];
|
|
689
|
-
const result = await
|
|
917
|
+
const result = await this.#c.invoke({
|
|
690
918
|
_: "messages.editMessage",
|
|
691
|
-
peer: await
|
|
919
|
+
peer: await this.#c.getInputPeer(chatId),
|
|
692
920
|
id: messageId,
|
|
693
|
-
media: await
|
|
694
|
-
reply_markup: await
|
|
921
|
+
media: await this.#resolveInputMedia(media),
|
|
922
|
+
reply_markup: await this.#constructReplyMarkup(params),
|
|
695
923
|
message: text,
|
|
696
924
|
entities,
|
|
697
925
|
}, { businessConnectionId: params?.businessConnectionId });
|
|
@@ -699,66 +927,69 @@ class MessageManager {
|
|
|
699
927
|
return message_;
|
|
700
928
|
}
|
|
701
929
|
async editInlineMessageMedia(inlineMessageId, media, params) {
|
|
702
|
-
|
|
703
|
-
|
|
930
|
+
this.#checkParams(params);
|
|
931
|
+
this.#c.storage.assertBot("editInlineMessageMedia");
|
|
704
932
|
const id = await (0, _3_types_js_2.deserializeInlineMessageId)(inlineMessageId);
|
|
705
|
-
await
|
|
933
|
+
await this.#c.invoke({
|
|
706
934
|
_: "messages.editInlineBotMessage",
|
|
707
935
|
id,
|
|
708
|
-
media: await
|
|
709
|
-
reply_markup: await
|
|
936
|
+
media: await this.#resolveInputMedia(media),
|
|
937
|
+
reply_markup: await this.#constructReplyMarkup(params),
|
|
710
938
|
}, { dc: (0, _3_transport_js_1.getDc)(id.dc_id) });
|
|
711
939
|
}
|
|
712
940
|
async deleteMessages(chatId, messageIds, params) {
|
|
713
941
|
(0, _0_utilities_js_1.checkArray)(messageIds, _0_utilities_js_1.checkMessageId);
|
|
714
|
-
const peer = await
|
|
942
|
+
const peer = await this.#c.getInputPeer(chatId);
|
|
715
943
|
if ((0, _0_utilities_js_1.canBeInputChannel)(peer)) {
|
|
716
|
-
await
|
|
944
|
+
await this.#c.invoke({ _: "channels.deleteMessages", channel: (0, _0_utilities_js_1.toInputChannel)(peer), id: messageIds });
|
|
717
945
|
}
|
|
718
946
|
else {
|
|
719
|
-
await
|
|
947
|
+
await this.#c.invoke({ _: "messages.deleteMessages", id: messageIds, revoke: params?.onlyForMe ? undefined : true });
|
|
720
948
|
}
|
|
721
949
|
}
|
|
722
950
|
async deleteScheduledMessages(chatId, messageIds) {
|
|
723
|
-
|
|
951
|
+
this.#c.storage.assertUser("sendScheduledMessage");
|
|
724
952
|
(0, _0_utilities_js_1.checkArray)(messageIds, _0_utilities_js_1.checkMessageId);
|
|
725
|
-
const peer = await
|
|
726
|
-
await
|
|
953
|
+
const peer = await this.#c.getInputPeer(chatId);
|
|
954
|
+
await this.#c.invoke({ _: "messages.deleteScheduledMessages", peer, id: messageIds });
|
|
727
955
|
}
|
|
728
956
|
async deleteScheduledMessage(chatId, messageId) {
|
|
729
|
-
|
|
957
|
+
this.#c.storage.assertUser("deleteScheduledMessage");
|
|
730
958
|
return await this.deleteScheduledMessages(chatId, [messageId]);
|
|
731
959
|
}
|
|
732
960
|
async sendScheduledMessages(chatId, messageIds) {
|
|
733
|
-
|
|
961
|
+
this.#c.storage.assertUser("sendScheduledMessages");
|
|
734
962
|
(0, _0_utilities_js_1.checkArray)(messageIds, _0_utilities_js_1.checkMessageId);
|
|
735
|
-
const peer = await
|
|
736
|
-
const result = await
|
|
963
|
+
const peer = await this.#c.getInputPeer(chatId);
|
|
964
|
+
const result = await this.#c.invoke({ _: "messages.sendScheduledMessages", peer, id: messageIds });
|
|
737
965
|
return await this.updatesToMessages(chatId, result);
|
|
738
966
|
}
|
|
739
967
|
async sendScheduledMessage(chatId, messageId) {
|
|
740
|
-
|
|
968
|
+
this.#c.storage.assertUser("sendScheduledMessage");
|
|
741
969
|
return (await this.sendScheduledMessages(chatId, [messageId]))[0];
|
|
742
970
|
}
|
|
743
971
|
async deleteChatMemberMessages(chatId, memberId) {
|
|
744
|
-
|
|
745
|
-
const channel = await
|
|
746
|
-
const participant = await
|
|
747
|
-
await
|
|
972
|
+
this.#c.storage.assertUser("deleteChatMemberMessages");
|
|
973
|
+
const channel = await this.#c.getInputChannel(chatId);
|
|
974
|
+
const participant = await this.#c.getInputPeer(memberId);
|
|
975
|
+
await this.#c.invoke({ _: "channels.deleteParticipantHistory", channel, participant });
|
|
748
976
|
}
|
|
749
977
|
async pinMessage(chatId, messageId, params) {
|
|
750
|
-
|
|
751
|
-
await
|
|
978
|
+
this.#checkParams(params);
|
|
979
|
+
await this.#c.invoke({ _: "messages.updatePinnedMessage", peer: await this.#c.getInputPeer(chatId), id: (0, _0_utilities_js_1.checkMessageId)(messageId), silent: params?.disableNotification ? true : undefined, pm_oneside: params?.bothSides ? undefined : true });
|
|
752
980
|
}
|
|
753
981
|
async unpinMessage(chatId, messageId, params) {
|
|
754
|
-
|
|
755
|
-
await
|
|
982
|
+
this.#checkParams(params);
|
|
983
|
+
await this.#c.invoke({ _: "messages.updatePinnedMessage", peer: await this.#c.getInputPeer(chatId), id: (0, _0_utilities_js_1.checkMessageId)(messageId), unpin: true }, { businessConnectionId: params?.businessConnectionId });
|
|
756
984
|
}
|
|
757
985
|
async unpinMessages(chatId) {
|
|
758
|
-
await
|
|
986
|
+
await this.#c.invoke({ _: "messages.unpinAllMessages", peer: await this.#c.getInputPeer(chatId) });
|
|
987
|
+
}
|
|
988
|
+
async #sendReaction(chatId, messageId, reactions, params) {
|
|
989
|
+
await this.#c.invoke({ _: "messages.sendReaction", peer: await this.#c.getInputPeer(chatId), msg_id: (0, _0_utilities_js_1.checkMessageId)(messageId), reaction: reactions.map((v) => (0, _3_types_js_2.reactionToTlObject)(v)), big: params?.big ? true : undefined, add_to_recent: params?.addToRecents ? true : undefined });
|
|
759
990
|
}
|
|
760
991
|
async setReactions(chatId, messageId, reactions, params) {
|
|
761
|
-
await
|
|
992
|
+
await this.#sendReaction(chatId, messageId, reactions, params);
|
|
762
993
|
}
|
|
763
994
|
async addReaction(chatId, messageId, reaction, params) {
|
|
764
995
|
const message = await this.getMessage(chatId, messageId);
|
|
@@ -782,7 +1013,7 @@ class MessageManager {
|
|
|
782
1013
|
const chosenReactions = (message.reactions ?? []).filter((v) => v.chosen);
|
|
783
1014
|
for (const r of chosenReactions) {
|
|
784
1015
|
if ((0, _3_types_js_2.reactionEqual)(r.reaction, reaction)) {
|
|
785
|
-
const reactions = chosenReactions.filter((v) => v
|
|
1016
|
+
const reactions = chosenReactions.filter((v) => v !== r).map((v) => v.reaction);
|
|
786
1017
|
await this.setReactions(chatId, messageId, reactions);
|
|
787
1018
|
break;
|
|
788
1019
|
}
|
|
@@ -795,7 +1026,7 @@ class MessageManager {
|
|
|
795
1026
|
if (_2_tl_js_1.Api.is("updateNewMessage", update) || _2_tl_js_1.Api.is("updateNewChannelMessage", update) || _2_tl_js_1.Api.is("updateEditMessage", update) || _2_tl_js_1.Api.is("updateEditChannelMessage", update)) {
|
|
796
1027
|
if (_2_tl_js_1.Api.is("message", update.message) || _2_tl_js_1.Api.is("messageService", update.message)) {
|
|
797
1028
|
const chatId = _2_tl_js_1.Api.peerToChatId(update.message.peer_id);
|
|
798
|
-
await
|
|
1029
|
+
await this.#c.messageStorage.setMessage(chatId, update.message.id, update.message);
|
|
799
1030
|
}
|
|
800
1031
|
}
|
|
801
1032
|
if (_2_tl_js_1.Api.isOneOf([
|
|
@@ -811,13 +1042,13 @@ class MessageManager {
|
|
|
811
1042
|
const isOutgoing = update.message.out;
|
|
812
1043
|
let shouldIgnore = false;
|
|
813
1044
|
if (isOutgoing) {
|
|
814
|
-
if (
|
|
815
|
-
|
|
1045
|
+
if (this.#c.outgoingMessages === null) {
|
|
1046
|
+
this.#c.outgoingMessages = this.#c.storage.accountType === "user" ? "all" : "business";
|
|
816
1047
|
}
|
|
817
|
-
if (
|
|
1048
|
+
if (this.#c.outgoingMessages === "none") {
|
|
818
1049
|
shouldIgnore = true;
|
|
819
1050
|
}
|
|
820
|
-
else if (
|
|
1051
|
+
else if (this.#c.outgoingMessages === "business") {
|
|
821
1052
|
if (!_2_tl_js_1.Api.is("updateBotNewBusinessMessage", update) && !_2_tl_js_1.Api.is("updateBotEditBusinessMessage", update)) {
|
|
822
1053
|
shouldIgnore = true;
|
|
823
1054
|
}
|
|
@@ -842,7 +1073,7 @@ class MessageManager {
|
|
|
842
1073
|
if (_2_tl_js_1.Api.is("updateDeleteMessages", update)) {
|
|
843
1074
|
const deletedMessages = new Array();
|
|
844
1075
|
for (const messageId of update.messages) {
|
|
845
|
-
const chatId = await
|
|
1076
|
+
const chatId = await this.#c.messageStorage.getMessageChat(messageId);
|
|
846
1077
|
if (chatId) {
|
|
847
1078
|
deletedMessages.push({ chatId, messageId });
|
|
848
1079
|
}
|
|
@@ -855,8 +1086,8 @@ class MessageManager {
|
|
|
855
1086
|
const chatId = _2_tl_js_1.Api.getChannelChatId(update.channel_id);
|
|
856
1087
|
const deletedMessages = new Array();
|
|
857
1088
|
for (const messageId of update.messages) {
|
|
858
|
-
const message = await
|
|
859
|
-
if (message
|
|
1089
|
+
const message = await this.#c.messageStorage.getMessage(chatId, messageId);
|
|
1090
|
+
if (message !== null) {
|
|
860
1091
|
deletedMessages.push({ chatId, messageId });
|
|
861
1092
|
}
|
|
862
1093
|
}
|
|
@@ -874,13 +1105,13 @@ class MessageManager {
|
|
|
874
1105
|
}
|
|
875
1106
|
if (_2_tl_js_1.Api.is("updateTranscribedAudio", update)) {
|
|
876
1107
|
const voiceTranscription = (0, _3_types_js_1.constructVoiceTranscription)(update);
|
|
877
|
-
await
|
|
1108
|
+
await this.#c.messageStorage.setVoiceTranscription(voiceTranscription);
|
|
878
1109
|
return { voiceTranscription };
|
|
879
1110
|
}
|
|
880
1111
|
return null;
|
|
881
1112
|
}
|
|
882
1113
|
async sendChatAction(chatId, action, params) {
|
|
883
|
-
|
|
1114
|
+
this.#checkParams(params);
|
|
884
1115
|
let action_;
|
|
885
1116
|
switch (action) {
|
|
886
1117
|
case "type":
|
|
@@ -919,11 +1150,27 @@ class MessageManager {
|
|
|
919
1150
|
default:
|
|
920
1151
|
throw new _0_errors_js_1.InputError(`Invalid chat action: ${action}`);
|
|
921
1152
|
}
|
|
922
|
-
await
|
|
1153
|
+
await this.#c.invoke({ _: "messages.setTyping", peer: await this.#c.getInputPeer(chatId), action: action_, top_msg_id: params?.messageThreadId }, { businessConnectionId: params?.businessConnectionId });
|
|
923
1154
|
}
|
|
924
|
-
async searchMessages(
|
|
925
|
-
|
|
926
|
-
const
|
|
1155
|
+
async searchMessages(params) {
|
|
1156
|
+
this.#c.storage.assertUser("searchMessages");
|
|
1157
|
+
const peer = params?.chatId === undefined ? { _: "inputPeerEmpty" } : await this.#c.getInputPeer(params.chatId);
|
|
1158
|
+
const query = params?.query ?? "";
|
|
1159
|
+
const result = await this.#c.invoke({
|
|
1160
|
+
_: "messages.search",
|
|
1161
|
+
peer,
|
|
1162
|
+
q: query,
|
|
1163
|
+
add_offset: params?.addOffset ?? 0,
|
|
1164
|
+
filter: (0, _0_message_search_filter_js_1.messageSearchFilterToTlObject)(params?.filter ?? "empty"),
|
|
1165
|
+
hash: 0n,
|
|
1166
|
+
limit: (0, _0_utilities_js_1.getLimit)(params?.limit),
|
|
1167
|
+
max_date: 0,
|
|
1168
|
+
max_id: 0,
|
|
1169
|
+
min_date: 0,
|
|
1170
|
+
min_id: 0,
|
|
1171
|
+
offset_id: params?.offset ? params.offset : 0,
|
|
1172
|
+
from_id: params?.from ? await this.#c.getInputPeer(params.from) : undefined,
|
|
1173
|
+
});
|
|
927
1174
|
if (!("messages" in result)) {
|
|
928
1175
|
(0, _0_deps_js_1.unreachable)();
|
|
929
1176
|
}
|
|
@@ -935,25 +1182,25 @@ class MessageManager {
|
|
|
935
1182
|
return messages;
|
|
936
1183
|
}
|
|
937
1184
|
async blockUser(userId) {
|
|
938
|
-
|
|
939
|
-
const id = await
|
|
940
|
-
await
|
|
1185
|
+
this.#c.storage.assertUser("blockUser");
|
|
1186
|
+
const id = await this.#c.getInputPeer(userId);
|
|
1187
|
+
await this.#c.invoke({ _: "contacts.block", id });
|
|
941
1188
|
}
|
|
942
1189
|
async unblockUser(userId) {
|
|
943
|
-
|
|
944
|
-
const id = await
|
|
945
|
-
await
|
|
1190
|
+
this.#c.storage.assertUser("unblockUser");
|
|
1191
|
+
const id = await this.#c.getInputPeer(userId);
|
|
1192
|
+
await this.#c.invoke({ _: "contacts.unblock", id });
|
|
946
1193
|
}
|
|
947
1194
|
async setChatStickerSet(chatId, setName) {
|
|
948
|
-
const channel = await
|
|
949
|
-
await
|
|
1195
|
+
const channel = await this.#c.getInputChannel(chatId);
|
|
1196
|
+
await this.#c.invoke({ _: "channels.setStickers", channel, stickerset: { _: "inputStickerSetShortName", short_name: setName } });
|
|
950
1197
|
}
|
|
951
1198
|
async deleteChatStickerSet(chatId) {
|
|
952
|
-
const channel = await
|
|
953
|
-
await
|
|
1199
|
+
const channel = await this.#c.getInputChannel(chatId);
|
|
1200
|
+
await this.#c.invoke({ _: "channels.setStickers", channel, stickerset: { _: "inputStickerSetEmpty" } });
|
|
954
1201
|
}
|
|
955
1202
|
async stopPoll(chatId, messageId, params) {
|
|
956
|
-
|
|
1203
|
+
this.#checkParams(params);
|
|
957
1204
|
const message = await this.getMessage(chatId, messageId);
|
|
958
1205
|
if (!message) {
|
|
959
1206
|
throw new _0_errors_js_1.InputError("Message not found.");
|
|
@@ -964,26 +1211,26 @@ class MessageManager {
|
|
|
964
1211
|
if (message.poll.isClosed) {
|
|
965
1212
|
throw new _0_errors_js_1.InputError("Poll is already stopped.");
|
|
966
1213
|
}
|
|
967
|
-
const result = await
|
|
1214
|
+
const result = await this.#c.invoke({
|
|
968
1215
|
_: "messages.editMessage",
|
|
969
|
-
peer: await
|
|
1216
|
+
peer: await this.#c.getInputPeer(chatId),
|
|
970
1217
|
id: messageId,
|
|
971
1218
|
media: ({ _: "inputMediaPoll", poll: ({ _: "poll", id: BigInt(message.poll.id), closed: true, question: { _: "textWithEntities", text: "", entities: [] }, answers: [] }) }),
|
|
972
|
-
reply_markup: await
|
|
1219
|
+
reply_markup: await this.#constructReplyMarkup(params),
|
|
973
1220
|
}, { businessConnectionId: params?.businessConnectionId });
|
|
974
1221
|
const message_ = (await this.updatesToMessages(chatId, result))[0];
|
|
975
1222
|
return (0, _3_types_js_2.assertMessageType)(message_, "poll").poll;
|
|
976
1223
|
}
|
|
977
1224
|
async editMessageLiveLocation(chatId, messageId, latitude, longitude, params) {
|
|
978
|
-
|
|
1225
|
+
this.#checkParams(params);
|
|
979
1226
|
const message = await this.getMessage(chatId, messageId);
|
|
980
1227
|
if (message && "location" in message && message.location.livePeriod) {
|
|
981
|
-
const result = await
|
|
1228
|
+
const result = await this.#c.invoke({
|
|
982
1229
|
_: "messages.editMessage",
|
|
983
|
-
peer: await
|
|
1230
|
+
peer: await this.#c.getInputPeer(chatId),
|
|
984
1231
|
id: messageId,
|
|
985
1232
|
media: ({ _: "inputMediaGeoLive", geo_point: ({ _: "inputGeoPoint", lat: latitude, long: longitude, accuracy_radius: params?.horizontalAccuracy }), heading: params?.heading, proximity_notification_radius: params?.proximityAlertRadius }),
|
|
986
|
-
reply_markup: await
|
|
1233
|
+
reply_markup: await this.#constructReplyMarkup(params),
|
|
987
1234
|
}, { businessConnectionId: params?.businessConnectionId });
|
|
988
1235
|
const message = (await this.updatesToMessages(chatId, result))[0];
|
|
989
1236
|
return (0, _3_types_js_2.assertMessageType)(message, "location");
|
|
@@ -991,19 +1238,19 @@ class MessageManager {
|
|
|
991
1238
|
(0, _0_deps_js_1.unreachable)();
|
|
992
1239
|
}
|
|
993
1240
|
async editInlineMessageLiveLocation(inlineMessageId, latitude, longitude, params) {
|
|
994
|
-
|
|
995
|
-
|
|
1241
|
+
this.#checkParams(params);
|
|
1242
|
+
this.#c.storage.assertBot("editInlineMessageLiveLocation");
|
|
996
1243
|
const id = await (0, _3_types_js_2.deserializeInlineMessageId)(inlineMessageId);
|
|
997
|
-
await
|
|
1244
|
+
await this.#c.invoke({
|
|
998
1245
|
_: "messages.editInlineBotMessage",
|
|
999
1246
|
id,
|
|
1000
1247
|
media: ({ _: "inputMediaGeoLive", geo_point: ({ _: "inputGeoPoint", lat: latitude, long: longitude, accuracy_radius: params?.horizontalAccuracy }), heading: params?.heading, proximity_notification_radius: params?.proximityAlertRadius }),
|
|
1001
|
-
reply_markup: await
|
|
1248
|
+
reply_markup: await this.#constructReplyMarkup(params),
|
|
1002
1249
|
}, { dc: (0, _3_transport_js_1.getDc)(id.dc_id) });
|
|
1003
1250
|
}
|
|
1004
1251
|
async sendInvoice(chatId, title, description, payload, currency, prices, params) {
|
|
1005
|
-
|
|
1006
|
-
|
|
1252
|
+
this.#c.storage.assertBot("sendInvoice");
|
|
1253
|
+
this.#checkParams(params);
|
|
1007
1254
|
if (title.length < 1) {
|
|
1008
1255
|
throw new _0_errors_js_1.InputError("Invoice title cannot be empty.");
|
|
1009
1256
|
}
|
|
@@ -1030,7 +1277,7 @@ class MessageManager {
|
|
|
1030
1277
|
phone_to_provider: params?.sendPhoneNumberToProvider || undefined,
|
|
1031
1278
|
flexible: params?.flexible || undefined,
|
|
1032
1279
|
};
|
|
1033
|
-
const message = await
|
|
1280
|
+
const message = await this.#sendMedia(chatId, {
|
|
1034
1281
|
_: "inputMediaInvoice",
|
|
1035
1282
|
title,
|
|
1036
1283
|
description,
|
|
@@ -1056,7 +1303,7 @@ class MessageManager {
|
|
|
1056
1303
|
return (0, _3_types_js_2.assertMessageType)(message, "invoice");
|
|
1057
1304
|
}
|
|
1058
1305
|
async sendMediaGroup(chatId, media, params) {
|
|
1059
|
-
|
|
1306
|
+
this.#checkParams(params);
|
|
1060
1307
|
{
|
|
1061
1308
|
if (!Array.isArray(media) || !media.length) {
|
|
1062
1309
|
throw new _0_errors_js_1.InputError("Media group must not be empty.");
|
|
@@ -1067,13 +1314,13 @@ class MessageManager {
|
|
|
1067
1314
|
for (const media_ of media) {
|
|
1068
1315
|
// deno-lint-ignore no-explicit-any
|
|
1069
1316
|
const thisMediaType = media_?.animation !== undefined ? "animation" : media_?.audio !== undefined ? "audio" : media_?.photo !== undefined ? "photo" : media_?.video !== undefined ? "video" : "document";
|
|
1070
|
-
if (thisMediaType
|
|
1317
|
+
if (thisMediaType === "animation") {
|
|
1071
1318
|
throw new _0_errors_js_1.InputError("Media groups cannot consist of animations.");
|
|
1072
1319
|
}
|
|
1073
|
-
if ((firstMediaType
|
|
1320
|
+
if ((firstMediaType === "video" || firstMediaType === "photo") && (thisMediaType !== "video" && thisMediaType !== "photo")) {
|
|
1074
1321
|
throw new _0_errors_js_1.InputError(`Media of the type ${firstMediaType} cannot be mixed with those of the type ${thisMediaType}.`);
|
|
1075
1322
|
}
|
|
1076
|
-
if (firstMediaType
|
|
1323
|
+
if (firstMediaType !== "video" && firstMediaType !== "photo" && firstMediaType !== thisMediaType) {
|
|
1077
1324
|
throw new _0_errors_js_1.InputError(`Media of the type ${firstMediaType} cannot be mixed with other types.`);
|
|
1078
1325
|
}
|
|
1079
1326
|
}
|
|
@@ -1082,25 +1329,25 @@ class MessageManager {
|
|
|
1082
1329
|
for (const v of media) {
|
|
1083
1330
|
const randomId = (0, _1_utilities_js_1.getRandomId)();
|
|
1084
1331
|
const [message, entities] = v.caption !== undefined ? await this.parseText(v.caption, { entities: v.captionEntities, parseMode: v.parseMode }) : ["", []];
|
|
1085
|
-
multiMedia.push({ _: "inputSingleMedia", message, entities, random_id: randomId, media: await
|
|
1332
|
+
multiMedia.push({ _: "inputSingleMedia", message, entities, random_id: randomId, media: await this.#resolveInputMedia(v) });
|
|
1086
1333
|
}
|
|
1087
|
-
const peer = await
|
|
1334
|
+
const peer = await this.#c.getInputPeer(chatId);
|
|
1088
1335
|
for (const [i, media_] of multiMedia.entries()) {
|
|
1089
1336
|
if (_2_tl_js_1.Api.is("inputMediaUploadedPhoto", media_.media)) {
|
|
1090
|
-
const result = _2_tl_js_1.Api.as("messageMediaPhoto", await
|
|
1337
|
+
const result = _2_tl_js_1.Api.as("messageMediaPhoto", await this.#c.invoke({ _: "messages.uploadMedia", media: media_.media, peer }));
|
|
1091
1338
|
const photo = _2_tl_js_1.Api.as("photo", result.photo);
|
|
1092
1339
|
multiMedia[i] = { ...media_, media: { _: "inputMediaPhoto", id: { ...photo, _: "inputPhoto" } } };
|
|
1093
1340
|
}
|
|
1094
1341
|
else if (_2_tl_js_1.Api.is("inputMediaUploadedDocument", media_.media)) {
|
|
1095
|
-
const result = _2_tl_js_1.Api.as("messageMediaDocument", await
|
|
1342
|
+
const result = _2_tl_js_1.Api.as("messageMediaDocument", await this.#c.invoke({ _: "messages.uploadMedia", media: media_.media, peer }));
|
|
1096
1343
|
const document = _2_tl_js_1.Api.as("document", result.document);
|
|
1097
1344
|
multiMedia[i] = { ...media_, media: { _: "inputMediaDocument", id: { ...document, _: "inputDocument" } } };
|
|
1098
1345
|
}
|
|
1099
1346
|
}
|
|
1100
1347
|
const silent = params?.disableNotification ? true : undefined;
|
|
1101
1348
|
const noforwards = params?.protectContent ? true : undefined;
|
|
1102
|
-
const sendAs = params?.sendAs ? await
|
|
1103
|
-
const result = await
|
|
1349
|
+
const sendAs = params?.sendAs ? await this.#c.getInputPeer(params.sendAs) : undefined;
|
|
1350
|
+
const result = await this.#c.invoke({
|
|
1104
1351
|
_: "messages.sendMultiMedia",
|
|
1105
1352
|
peer,
|
|
1106
1353
|
multi_media: multiMedia,
|
|
@@ -1108,19 +1355,19 @@ class MessageManager {
|
|
|
1108
1355
|
noforwards,
|
|
1109
1356
|
silent,
|
|
1110
1357
|
send_as: sendAs,
|
|
1111
|
-
reply_to: await
|
|
1358
|
+
reply_to: await this.#constructReplyTo(params),
|
|
1112
1359
|
allow_paid_floodskip: params?.paidBroadcast ? true : undefined,
|
|
1113
1360
|
});
|
|
1114
1361
|
return await this.updatesToMessages(chatId, result);
|
|
1115
1362
|
}
|
|
1116
1363
|
async readMessages(chatId, untilMessageId) {
|
|
1117
|
-
|
|
1118
|
-
const peer = await
|
|
1364
|
+
this.#c.storage.assertUser("readMessages");
|
|
1365
|
+
const peer = await this.#c.getInputPeer(chatId);
|
|
1119
1366
|
const max_id = untilMessageId;
|
|
1120
|
-
await
|
|
1367
|
+
await this.#c.invoke({ _: "messages.readHistory", peer, max_id });
|
|
1121
1368
|
}
|
|
1122
1369
|
async startBot(botId, params) {
|
|
1123
|
-
|
|
1370
|
+
this.#c.storage.assertUser("startBot");
|
|
1124
1371
|
const start_param = params?.deeplink?.trim() || "";
|
|
1125
1372
|
if (params?.chatId !== undefined && !start_param) {
|
|
1126
1373
|
throw new _0_errors_js_1.InputError("deeplink cannot be unspecified while chatId is specified.");
|
|
@@ -1128,31 +1375,47 @@ class MessageManager {
|
|
|
1128
1375
|
if (!params?.deeplink) {
|
|
1129
1376
|
return await this.sendMessage(botId, "/start");
|
|
1130
1377
|
}
|
|
1131
|
-
const bot = await
|
|
1132
|
-
const peer = await
|
|
1133
|
-
const result = await
|
|
1378
|
+
const bot = await this.#c.getInputUser(botId);
|
|
1379
|
+
const peer = await this.#c.getInputPeer(params?.chatId || botId);
|
|
1380
|
+
const result = await this.#c.invoke({ _: "messages.startBot", bot, peer, random_id: (0, _1_utilities_js_1.getRandomId)(), start_param });
|
|
1134
1381
|
return (await this.updatesToMessages(botId, result))[0];
|
|
1135
1382
|
}
|
|
1136
1383
|
async transcribeVoice(chatId, messageId) {
|
|
1137
|
-
|
|
1384
|
+
this.#c.storage.assertUser("transcribeVoice");
|
|
1138
1385
|
const message = await this.getMessage(chatId, messageId);
|
|
1139
|
-
if (message
|
|
1386
|
+
if (message === null) {
|
|
1140
1387
|
throw new _0_errors_js_1.InputError("Message not found.");
|
|
1141
1388
|
}
|
|
1142
1389
|
if (!(0, _3_types_js_1.isMessageType)(message, "voice")) {
|
|
1143
1390
|
throw new _0_errors_js_1.InputError("Message not voice.");
|
|
1144
1391
|
}
|
|
1145
|
-
const cachedTranscription = await
|
|
1392
|
+
const cachedTranscription = await this.#getCachedVoiceTranscription(message);
|
|
1146
1393
|
if (cachedTranscription) {
|
|
1147
1394
|
return cachedTranscription;
|
|
1148
1395
|
}
|
|
1149
|
-
const peer = await
|
|
1150
|
-
const result = await
|
|
1151
|
-
return await
|
|
1396
|
+
const peer = await this.#c.getInputPeer(chatId);
|
|
1397
|
+
const result = await this.#c.invoke({ _: "messages.transcribeAudio", peer, msg_id: messageId });
|
|
1398
|
+
return await this.#cacheVoiceTranscription(message, (0, _3_types_js_1.constructVoiceTranscription)(result));
|
|
1399
|
+
}
|
|
1400
|
+
async #getCachedVoiceTranscription(message) {
|
|
1401
|
+
const reference = await this.#c.messageStorage.getVoiceTranscriptionReference(message.chat.id, message.id, (0, _1_utilities_js_1.fromUnixTimestamp)(message.editDate ?? message.date));
|
|
1402
|
+
if (!reference) {
|
|
1403
|
+
return null;
|
|
1404
|
+
}
|
|
1405
|
+
const voiceTranscription = await this.#c.messageStorage.getVoiceTranscription(reference);
|
|
1406
|
+
if (!voiceTranscription || !voiceTranscription.done) {
|
|
1407
|
+
return null;
|
|
1408
|
+
}
|
|
1409
|
+
return voiceTranscription;
|
|
1410
|
+
}
|
|
1411
|
+
async #cacheVoiceTranscription(message, voiceTranscription) {
|
|
1412
|
+
await this.#c.messageStorage.setVoiceTranscriptionReference(message.chat.id, message.id, (0, _1_utilities_js_1.fromUnixTimestamp)(message.editDate ?? message.date), BigInt(voiceTranscription.id));
|
|
1413
|
+
await this.#c.messageStorage.setVoiceTranscription(voiceTranscription);
|
|
1414
|
+
return voiceTranscription;
|
|
1152
1415
|
}
|
|
1153
1416
|
async resolveMessageLink(link) {
|
|
1154
|
-
const parseResult =
|
|
1155
|
-
if (parseResult
|
|
1417
|
+
const parseResult = MessageManager.parseMessageLink(link);
|
|
1418
|
+
if (parseResult === null) {
|
|
1156
1419
|
throw new _0_errors_js_1.InputError("Invalid messsage link.");
|
|
1157
1420
|
}
|
|
1158
1421
|
const [chatId, messageId] = parseResult;
|
|
@@ -1181,10 +1444,10 @@ class MessageManager {
|
|
|
1181
1444
|
throw err;
|
|
1182
1445
|
}
|
|
1183
1446
|
}
|
|
1184
|
-
if (url.protocol
|
|
1447
|
+
if (url.protocol !== "http:" && url.protocol !== "https:") {
|
|
1185
1448
|
return null;
|
|
1186
1449
|
}
|
|
1187
|
-
if (url.host
|
|
1450
|
+
if (url.host !== "t.me") {
|
|
1188
1451
|
return null;
|
|
1189
1452
|
}
|
|
1190
1453
|
const parts = url.pathname.split("/").filter((v) => v);
|
|
@@ -1195,7 +1458,7 @@ class MessageManager {
|
|
|
1195
1458
|
return null;
|
|
1196
1459
|
}
|
|
1197
1460
|
let peer, id;
|
|
1198
|
-
if (parts[0]
|
|
1461
|
+
if (parts[0] === "c") {
|
|
1199
1462
|
if (parts.length < 3 || parts.length > 4) {
|
|
1200
1463
|
return null;
|
|
1201
1464
|
}
|
|
@@ -1222,7 +1485,7 @@ class MessageManager {
|
|
|
1222
1485
|
}
|
|
1223
1486
|
if (typeof peer === "string") {
|
|
1224
1487
|
try {
|
|
1225
|
-
if ((0, _0_utilities_js_1.getUsername)(peer)
|
|
1488
|
+
if ((0, _0_utilities_js_1.getUsername)(peer) !== peer) {
|
|
1226
1489
|
return null;
|
|
1227
1490
|
}
|
|
1228
1491
|
}
|
|
@@ -1237,21 +1500,53 @@ class MessageManager {
|
|
|
1237
1500
|
}
|
|
1238
1501
|
return [peer, id];
|
|
1239
1502
|
}
|
|
1503
|
+
async getStickerSet(name) {
|
|
1504
|
+
if (name.includes("/")) {
|
|
1505
|
+
let valid = false;
|
|
1506
|
+
try {
|
|
1507
|
+
const url = new URL(name);
|
|
1508
|
+
const pathname = "/addstickers/";
|
|
1509
|
+
valid = (url.protocol === "http:" || url.protocol === "https:") && url.hostname === "t.me" && url.pathname.startsWith(pathname) && url.pathname.length > _3_errors_js_1.PackShortNameInvalid.length;
|
|
1510
|
+
if (valid) {
|
|
1511
|
+
name = url.pathname.slice(pathname.length);
|
|
1512
|
+
if (name.endsWith("/")) {
|
|
1513
|
+
name = name.slice(0, -1);
|
|
1514
|
+
if (name === "") {
|
|
1515
|
+
valid = false;
|
|
1516
|
+
}
|
|
1517
|
+
}
|
|
1518
|
+
}
|
|
1519
|
+
}
|
|
1520
|
+
catch (err) {
|
|
1521
|
+
if (err instanceof TypeError) {
|
|
1522
|
+
valid = false;
|
|
1523
|
+
}
|
|
1524
|
+
else {
|
|
1525
|
+
throw err;
|
|
1526
|
+
}
|
|
1527
|
+
}
|
|
1528
|
+
if (!valid) {
|
|
1529
|
+
throw new _0_errors_js_1.InputError("Invalid sticker set name or link.");
|
|
1530
|
+
}
|
|
1531
|
+
}
|
|
1532
|
+
const result = await this.#c.invoke({ _: "messages.getStickerSet", hash: 0, stickerset: { _: "inputStickerSetShortName", short_name: name } });
|
|
1533
|
+
return (0, _3_types_js_1.constructStickerSet)(result);
|
|
1534
|
+
}
|
|
1240
1535
|
async openMiniApp(botId, chatId, params) {
|
|
1241
|
-
|
|
1536
|
+
this.#c.storage.assertUser("openMiniApp");
|
|
1242
1537
|
const from_bot_menu = params?.fromMenu ? true : undefined;
|
|
1243
1538
|
const silent = params?.disableNotification ? true : undefined;
|
|
1244
1539
|
const compact = params?.mode === "compact" ? true : undefined;
|
|
1245
1540
|
const fullscreen = params?.mode === "fullscreen" ? true : undefined;
|
|
1246
|
-
const peer = await
|
|
1247
|
-
const bot = await
|
|
1541
|
+
const peer = await this.#c.getInputPeer(chatId);
|
|
1542
|
+
const bot = await this.#c.getInputUser(botId);
|
|
1248
1543
|
const url = params?.url;
|
|
1249
1544
|
const start_param = params?.startParameter;
|
|
1250
1545
|
const theme_params = params?.themeParameters ? { _: "dataJSON", data: params.themeParameters } : undefined;
|
|
1251
|
-
const platform =
|
|
1252
|
-
const reply_to = await
|
|
1253
|
-
const send_as = params?.sendAs ? await
|
|
1254
|
-
const result = await
|
|
1546
|
+
const platform = this.#c.langPack ?? "";
|
|
1547
|
+
const reply_to = await this.#constructReplyTo(params);
|
|
1548
|
+
const send_as = params?.sendAs ? await this.#c.getInputPeer(params.sendAs) : undefined;
|
|
1549
|
+
const result = await this.#c.invoke({
|
|
1255
1550
|
_: "messages.requestWebView",
|
|
1256
1551
|
from_bot_menu,
|
|
1257
1552
|
silent,
|
|
@@ -1268,244 +1563,63 @@ class MessageManager {
|
|
|
1268
1563
|
});
|
|
1269
1564
|
return (0, _3_types_js_1.constructMiniAppInfo)(result);
|
|
1270
1565
|
}
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
__classPrivateFieldGet(this, _MessageManager_c, "f").storage.assertBot("businessConnectionId");
|
|
1279
|
-
}
|
|
1280
|
-
if (params && "sendAs" in params && params.sendAs !== undefined) {
|
|
1281
|
-
__classPrivateFieldGet(this, _MessageManager_c, "f").storage.assertUser("sendAs");
|
|
1282
|
-
}
|
|
1283
|
-
if (params && "sendAt" in params && params.sendAt !== undefined) {
|
|
1284
|
-
__classPrivateFieldGet(this, _MessageManager_c, "f").storage.assertUser("businessConsendAtnectionId");
|
|
1285
|
-
}
|
|
1286
|
-
}, _MessageManager_constructReplyMarkup = async function _MessageManager_constructReplyMarkup(params) {
|
|
1287
|
-
if (params?.replyMarkup) {
|
|
1288
|
-
__classPrivateFieldGet(this, _MessageManager_c, "f").storage.assertBot("replyMarkup");
|
|
1289
|
-
return await (0, _3_types_js_2.replyMarkupToTlObject)(params.replyMarkup, this.usernameResolver.bind(this));
|
|
1290
|
-
}
|
|
1291
|
-
}, _MessageManager_resolveSendAs = async function _MessageManager_resolveSendAs(params) {
|
|
1292
|
-
const sendAs = params?.sendAs;
|
|
1293
|
-
if (sendAs !== undefined) {
|
|
1294
|
-
__classPrivateFieldGet(this, _MessageManager_c, "f").storage.assertUser("sendAs");
|
|
1295
|
-
return sendAs ? await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(sendAs) : undefined;
|
|
1296
|
-
}
|
|
1297
|
-
}, _MessageManager_constructReplyTo = async function _MessageManager_constructReplyTo(params) {
|
|
1298
|
-
const topMsgId = params?.messageThreadId;
|
|
1299
|
-
if (!params?.replyTo) {
|
|
1300
|
-
if (topMsgId) {
|
|
1301
|
-
return { _: "inputReplyToMessage", reply_to_msg_id: topMsgId };
|
|
1302
|
-
}
|
|
1303
|
-
else {
|
|
1304
|
-
return undefined;
|
|
1305
|
-
}
|
|
1306
|
-
}
|
|
1307
|
-
if ("messageId" in params.replyTo) {
|
|
1308
|
-
return { _: "inputReplyToMessage", reply_to_msg_id: params.replyTo.messageId, top_msg_id: topMsgId, quote_text: params.replyTo.quote?.text, quote_entities: await Promise.all(params.replyTo.quote?.entities.map((v) => (0, _3_types_js_2.messageEntityToTlObject)(v, __classPrivateFieldGet(this, _MessageManager_c, "f").getEntity)) ?? []), quote_offset: params.replyTo.quote?.offset };
|
|
1309
|
-
}
|
|
1310
|
-
else {
|
|
1311
|
-
return { _: "inputReplyToStory", peer: await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(params.replyTo.chatId), story_id: params.replyTo.storyId };
|
|
1312
|
-
}
|
|
1313
|
-
}, _MessageManager_sendDocumentInner = async function _MessageManager_sendDocumentInner(chatId, document, params, fileType, otherAttribs, urlSupported = true, expectedMimeTypes) {
|
|
1314
|
-
let media = null;
|
|
1315
|
-
const spoiler = params?.hasSpoiler ? true : undefined;
|
|
1316
|
-
const ttl_seconds = params && "selfDestruct" in params && typeof params.selfDestruct !== undefined ? (0, _3_types_js_1.selfDestructOptionToInt)(params.selfDestruct) : undefined;
|
|
1317
|
-
if (typeof document === "string") {
|
|
1318
|
-
const fileId = this.resolveFileId(document, fileType);
|
|
1319
|
-
if (fileId != null) {
|
|
1320
|
-
media = { _: "inputMediaDocument", id: { ...fileId, _: "inputDocument" }, spoiler, query: otherAttribs.find((v) => _2_tl_js_1.Api.is("documentAttributeSticker", v))?.alt || undefined, ttl_seconds };
|
|
1566
|
+
async getSavedMessages(chatId, params) {
|
|
1567
|
+
this.#c.storage.assertUser("getSavedMessages");
|
|
1568
|
+
const peer = await this.#c.getInputPeer(chatId);
|
|
1569
|
+
const limit = (0, _0_utilities_js_1.getLimit)(params?.limit);
|
|
1570
|
+
let offsetId = params?.offsetId ?? 0;
|
|
1571
|
+
if (offsetId < 0) {
|
|
1572
|
+
offsetId = 0;
|
|
1321
1573
|
}
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
if (!urlSupported) {
|
|
1326
|
-
throw new _0_errors_js_1.InputError("URL not supported.");
|
|
1327
|
-
}
|
|
1328
|
-
media = { _: "inputMediaDocumentExternal", url: document, spoiler, ttl_seconds };
|
|
1574
|
+
let offsetDate = params?.offsetDate ?? 0;
|
|
1575
|
+
if (offsetDate < 0) {
|
|
1576
|
+
offsetDate = 0;
|
|
1329
1577
|
}
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
(0, _0_deps_js_1.unreachable)();
|
|
1344
|
-
}
|
|
1345
|
-
let thumb = undefined;
|
|
1346
|
-
if (params?.thumbnail) {
|
|
1347
|
-
thumb = await __classPrivateFieldGet(this, _MessageManager_c, "f").fileManager.upload(params.thumbnail, { chunkSize: params?.chunkSize, signal: params?.signal });
|
|
1348
|
-
}
|
|
1349
|
-
media = { _: "inputMediaUploadedDocument", file, thumb, spoiler, attributes: [{ _: "documentAttributeFilename", file_name: file.name }, ...otherAttribs], mime_type: mimeType, force_file: fileType == _3_types_js_2.FileType.Document ? true : undefined, ttl_seconds };
|
|
1350
|
-
}
|
|
1351
|
-
}
|
|
1352
|
-
const message = await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_sendMedia).call(this, chatId, media, params);
|
|
1353
|
-
return message;
|
|
1354
|
-
}, _MessageManager_sendMedia = async function _MessageManager_sendMedia(chatId, media, params) {
|
|
1355
|
-
if (params?.starCount !== undefined) {
|
|
1356
|
-
if (params.starCount <= 0) {
|
|
1357
|
-
throw new _0_errors_js_1.InputError("starCount cannot be zero or negative");
|
|
1358
|
-
}
|
|
1359
|
-
media = { _: "inputMediaPaidMedia", stars_amount: BigInt(params.starCount), extended_media: [media] };
|
|
1360
|
-
}
|
|
1361
|
-
const peer = await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId);
|
|
1362
|
-
const randomId = (0, _1_utilities_js_1.getRandomId)();
|
|
1363
|
-
const silent = params?.disableNotification ? true : undefined;
|
|
1364
|
-
const noforwards = params?.protectContent ? true : undefined;
|
|
1365
|
-
const sendAs = params?.sendAs ? await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(params.sendAs) : undefined;
|
|
1366
|
-
const replyMarkup = await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_constructReplyMarkup).call(this, params);
|
|
1367
|
-
const caption_ = params?.caption;
|
|
1368
|
-
const parseResult = caption_ !== undefined ? await this.parseText(caption_, { parseMode: params?.parseMode, entities: params?.captionEntities }) : undefined;
|
|
1369
|
-
const caption = parseResult === undefined ? undefined : parseResult[0];
|
|
1370
|
-
const captionEntities = parseResult === undefined ? undefined : parseResult[1];
|
|
1371
|
-
const result = await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({
|
|
1372
|
-
_: "messages.sendMedia",
|
|
1373
|
-
peer,
|
|
1374
|
-
random_id: randomId,
|
|
1375
|
-
silent,
|
|
1376
|
-
noforwards,
|
|
1377
|
-
reply_markup: replyMarkup,
|
|
1378
|
-
reply_to: await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_constructReplyTo).call(this, params),
|
|
1379
|
-
send_as: sendAs,
|
|
1380
|
-
media,
|
|
1381
|
-
message: caption ?? "",
|
|
1382
|
-
entities: captionEntities,
|
|
1383
|
-
effect: params?.effectId ? BigInt(params.effectId) : undefined,
|
|
1384
|
-
schedule_date: params?.sendAt,
|
|
1385
|
-
allow_paid_floodskip: params?.paidBroadcast ? true : undefined,
|
|
1386
|
-
}, { businessConnectionId: params?.businessConnectionId });
|
|
1387
|
-
return (await this.updatesToMessages(chatId, result, params?.businessConnectionId))[0];
|
|
1388
|
-
}, _MessageManager_editInlineMessageTextInner = async function _MessageManager_editInlineMessageTextInner(inlineMessageId, text, params, allowEmpty = true) {
|
|
1389
|
-
__classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_checkParams).call(this, params);
|
|
1390
|
-
const [message, entities] = await this.parseText(text, params);
|
|
1391
|
-
if (!allowEmpty && !message) {
|
|
1392
|
-
throw new _0_errors_js_1.InputError("Message text cannot be empty.");
|
|
1393
|
-
}
|
|
1394
|
-
const id = await (0, _3_types_js_2.deserializeInlineMessageId)(inlineMessageId);
|
|
1395
|
-
if (params?.linkPreview && params.linkPreview.type != "input") {
|
|
1396
|
-
throw new _0_errors_js_1.InputError("Expected link preview of type input.");
|
|
1397
|
-
}
|
|
1398
|
-
const noWebpage = params?.linkPreview && params.linkPreview.type == "input" && params.linkPreview.disable ? true : undefined;
|
|
1399
|
-
const invertMedia = params?.linkPreview?.aboveText ? true : undefined;
|
|
1400
|
-
let media = undefined;
|
|
1401
|
-
if (!noWebpage && params?.linkPreview?.url) {
|
|
1402
|
-
media = { _: "inputMediaWebPage", url: params.linkPreview.url, force_large_media: params.linkPreview.largeMedia ? true : undefined, force_small_media: params.linkPreview.smallMedia ? true : undefined, optional: message.length ? undefined : true };
|
|
1403
|
-
}
|
|
1404
|
-
await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({
|
|
1405
|
-
_: "messages.editInlineBotMessage",
|
|
1406
|
-
id,
|
|
1407
|
-
entities,
|
|
1408
|
-
message,
|
|
1409
|
-
media,
|
|
1410
|
-
no_webpage: noWebpage,
|
|
1411
|
-
invert_media: invertMedia,
|
|
1412
|
-
reply_markup: await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_constructReplyMarkup).call(this, params),
|
|
1413
|
-
}, { dc: (0, _3_transport_js_1.getDc)(id.dc_id) });
|
|
1414
|
-
}, _MessageManager_resolveInputMediaInner = async function _MessageManager_resolveInputMediaInner(document, media, fileType, otherAttribs) {
|
|
1415
|
-
let media_ = null;
|
|
1416
|
-
const spoiler = "hasSpoiler" in media && media.hasSpoiler ? true : undefined;
|
|
1417
|
-
if (typeof document === "string") {
|
|
1418
|
-
const fileId = this.resolveFileId(document, fileType);
|
|
1419
|
-
if (fileId != null) {
|
|
1420
|
-
media_ = { _: "inputMediaDocument", id: { ...fileId, _: "inputDocument" }, spoiler, query: otherAttribs.find((v) => _2_tl_js_1.Api.is("documentAttributeSticker", v))?.alt || undefined };
|
|
1421
|
-
}
|
|
1422
|
-
}
|
|
1423
|
-
if (media_ == null) {
|
|
1424
|
-
if (typeof document === "string" && (0, _0_utilities_js_1.isHttpUrl)(document)) {
|
|
1425
|
-
media_ = { _: "inputMediaDocumentExternal", url: document, spoiler };
|
|
1578
|
+
const result = await this.#c.invoke({
|
|
1579
|
+
_: "messages.getSavedHistory",
|
|
1580
|
+
peer,
|
|
1581
|
+
limit,
|
|
1582
|
+
offset_id: offsetId,
|
|
1583
|
+
offset_date: offsetDate,
|
|
1584
|
+
add_offset: params?.addOffset ?? 0,
|
|
1585
|
+
hash: 0n,
|
|
1586
|
+
max_id: 0,
|
|
1587
|
+
min_id: 0,
|
|
1588
|
+
});
|
|
1589
|
+
if (!("messages" in result)) {
|
|
1590
|
+
(0, _0_deps_js_1.unreachable)();
|
|
1426
1591
|
}
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
const
|
|
1430
|
-
|
|
1431
|
-
if (name.endsWith(".tgs") && fileType == _3_types_js_2.FileType.Document) {
|
|
1432
|
-
name += "-";
|
|
1433
|
-
}
|
|
1434
|
-
return name;
|
|
1435
|
-
});
|
|
1436
|
-
if (_2_tl_js_1.Api.is("inputFileStoryDocument", file)) {
|
|
1437
|
-
(0, _0_deps_js_1.unreachable)();
|
|
1438
|
-
}
|
|
1439
|
-
let thumb = undefined;
|
|
1440
|
-
if ("thumbnail" in media && media.thumbnail) {
|
|
1441
|
-
thumb = await __classPrivateFieldGet(this, _MessageManager_c, "f").fileManager.upload(media.thumbnail, { chunkSize: media?.chunkSize, signal: media?.signal });
|
|
1442
|
-
}
|
|
1443
|
-
media_ = { _: "inputMediaUploadedDocument", file, thumb, spoiler, attributes: [{ _: "documentAttributeFilename", file_name: file.name }, ...otherAttribs], mime_type: mimeType, force_file: fileType == _3_types_js_2.FileType.Document ? true : undefined };
|
|
1592
|
+
const messages = new Array();
|
|
1593
|
+
for (const message_ of result.messages) {
|
|
1594
|
+
const message = await this.constructMessage(message_, false);
|
|
1595
|
+
messages.push(message);
|
|
1444
1596
|
}
|
|
1597
|
+
return messages;
|
|
1445
1598
|
}
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
{ _: "documentAttributeVideo", supports_streaming: true, w: media?.width ?? 0, h: media?.height ?? 0, duration: media?.duration ?? 0 },
|
|
1452
|
-
]);
|
|
1453
|
-
}
|
|
1454
|
-
else if ("audio" in media) {
|
|
1455
|
-
return await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_resolveInputMediaInner).call(this, media.audio, media, _3_types_js_2.FileType.Audio, [
|
|
1456
|
-
{ _: "documentAttributeAudio", duration: media?.duration ?? 0, performer: media?.performer, title: media?.title },
|
|
1457
|
-
]);
|
|
1458
|
-
}
|
|
1459
|
-
else if ("document" in media) {
|
|
1460
|
-
return await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_resolveInputMediaInner).call(this, media.document, media, _3_types_js_2.FileType.Document, []);
|
|
1461
|
-
}
|
|
1462
|
-
else if ("photo" in media) {
|
|
1463
|
-
let media_ = null;
|
|
1464
|
-
const spoiler = media.hasSpoiler ? true : undefined;
|
|
1465
|
-
const ttl_seconds = "selfDestruct" in media && media.selfDestruct !== undefined ? (0, _3_types_js_1.selfDestructOptionToInt)(media.selfDestruct) : undefined;
|
|
1466
|
-
if (typeof media.photo === "string") {
|
|
1467
|
-
const fileId = this.resolveFileId(media.photo, [_3_types_js_2.FileType.Photo, _3_types_js_2.FileType.ProfilePhoto]);
|
|
1468
|
-
if (fileId != null) {
|
|
1469
|
-
media_ = { _: "inputMediaPhoto", id: { ...fileId, _: "inputPhoto" }, spoiler, ttl_seconds };
|
|
1470
|
-
}
|
|
1471
|
-
}
|
|
1472
|
-
if (media_ == null) {
|
|
1473
|
-
if (typeof media.photo === "string" && (0, _0_utilities_js_1.isHttpUrl)(media.photo)) {
|
|
1474
|
-
media_ = { _: "inputMediaPhotoExternal", url: media.photo, spoiler };
|
|
1475
|
-
}
|
|
1476
|
-
else {
|
|
1477
|
-
const file = await __classPrivateFieldGet(this, _MessageManager_c, "f").fileManager.upload(media.photo, media, null, false);
|
|
1478
|
-
media_ = { _: "inputMediaUploadedPhoto", file, spoiler, ttl_seconds };
|
|
1479
|
-
}
|
|
1599
|
+
async getSavedChats(params) {
|
|
1600
|
+
const limit = (0, _0_utilities_js_1.getLimit)(params?.limit);
|
|
1601
|
+
let offsetId = params?.offsetId ?? 0;
|
|
1602
|
+
if (offsetId < 0) {
|
|
1603
|
+
offsetId = 0;
|
|
1480
1604
|
}
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
return null;
|
|
1500
|
-
}
|
|
1501
|
-
const voiceTranscription = await __classPrivateFieldGet(this, _MessageManager_c, "f").messageStorage.getVoiceTranscription(reference);
|
|
1502
|
-
if (!voiceTranscription || !voiceTranscription.done) {
|
|
1503
|
-
return null;
|
|
1605
|
+
let offsetDate = params?.offsetDate ?? 0;
|
|
1606
|
+
if (offsetDate < 0) {
|
|
1607
|
+
offsetDate = 0;
|
|
1608
|
+
}
|
|
1609
|
+
let offsetPeer = { _: "inputPeerEmpty" };
|
|
1610
|
+
if (params?.offsetChatId !== undefined) {
|
|
1611
|
+
offsetPeer = await this.#c.getInputPeer(params.offsetChatId);
|
|
1612
|
+
}
|
|
1613
|
+
const result = await this.#c.invoke({
|
|
1614
|
+
_: "messages.getSavedDialogs",
|
|
1615
|
+
hash: 0n,
|
|
1616
|
+
limit,
|
|
1617
|
+
offset_date: offsetDate,
|
|
1618
|
+
offset_id: offsetId,
|
|
1619
|
+
offset_peer: offsetPeer,
|
|
1620
|
+
exclude_pinned: params?.excludePinned || undefined,
|
|
1621
|
+
});
|
|
1622
|
+
return (0, _3_types_js_1.constructSavedChats)(result, this.#c.getEntity, this.getMessage.bind(this), this.#c.fileManager.getStickerSetName.bind(this.#c.fileManager));
|
|
1504
1623
|
}
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
await __classPrivateFieldGet(this, _MessageManager_c, "f").messageStorage.setVoiceTranscriptionReference(message.chat.id, message.id, (0, _1_utilities_js_1.fromUnixTimestamp)(message.editDate ?? message.date), BigInt(voiceTranscription.id));
|
|
1508
|
-
await __classPrivateFieldGet(this, _MessageManager_c, "f").messageStorage.setVoiceTranscription(voiceTranscription);
|
|
1509
|
-
return voiceTranscription;
|
|
1510
|
-
};
|
|
1511
|
-
_MessageManager_CAPTIONABLE_MESSAGE_TYPES = { value: ["photo", "document", "video", "animation", "voice", "audio", "video"] };
|
|
1624
|
+
}
|
|
1625
|
+
exports.MessageManager = MessageManager;
|