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