@mtkruto/node 0.67.1 → 0.68.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_errors.js +2 -6
- package/esm/3_errors.js +2 -12
- package/esm/3_transport.d.ts +3 -3
- package/esm/3_transport.js +3 -3
- package/esm/3_types.d.ts +8 -7
- package/esm/3_types.d.ts.map +1 -1
- package/esm/3_types.js +8 -7
- 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_filters_test.d.ts.map +1 -1
- package/esm/client/0_markdown_test.d.ts.map +1 -1
- package/esm/client/0_params.d.ts +2 -0
- 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_test.d.ts.map +1 -1
- package/esm/client/0_storage_operations.js +143 -155
- package/esm/client/0_storage_operations_test.d.ts.map +1 -1
- package/esm/client/0_utilities.d.ts +1 -1
- package/esm/client/0_utilities_test.d.ts.map +1 -1
- package/esm/client/1_client_plain.js +4 -22
- package/esm/client/1_composer.js +8 -21
- package/esm/client/2_account_manager.js +85 -97
- package/esm/client/2_bot_info_manager.js +26 -38
- package/esm/client/2_business_connection_manager.js +10 -23
- package/esm/client/2_client_encrypted.js +194 -211
- package/esm/client/2_file_manager.d.ts +4 -3
- package/esm/client/2_file_manager.d.ts.map +1 -1
- package/esm/client/2_file_manager.js +268 -224
- package/esm/client/2_file_manager_test.d.ts.map +1 -1
- package/esm/client/2_network_statistics_manager.js +8 -21
- package/esm/client/2_payment_manager.js +7 -20
- package/esm/client/2_reaction_manager.js +7 -20
- package/esm/client/2_translations_manager.js +97 -107
- package/esm/client/2_update_manager.js +764 -759
- 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 +1 -1
- package/esm/client/3_message_manager.js +441 -448
- package/esm/client/3_message_manager_test.d.ts.map +1 -1
- package/esm/client/3_video_chat_manager.d.ts +1 -1
- package/esm/client/3_video_chat_manager.js +57 -68
- package/esm/client/4_callback_query_manager.js +18 -30
- package/esm/client/4_chat_list_manager.js +322 -318
- package/esm/client/4_chat_manager.js +118 -131
- package/esm/client/4_forum_manager.js +67 -73
- package/esm/client/4_gift_manager.js +16 -29
- package/esm/client/4_inline_query_manager.js +16 -28
- package/esm/client/4_link_preview_manager.js +6 -19
- package/esm/client/4_poll_manager.js +44 -57
- package/esm/client/4_story_manager.js +41 -53
- package/esm/client/5_client.d.ts +7 -0
- package/esm/client/5_client.d.ts.map +1 -1
- package/esm/client/5_client.js +1271 -1290
- package/esm/connection/1_connection_tcp.node.js +48 -65
- 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/esm/deps/jsr.io/@std/assert/1.0.13/equals.js +4 -4
- package/esm/deps/jsr.io/@std/async/1.0.13/mux_async_iterator.js +31 -47
- package/esm/deps/jsr.io/@std/async/1.0.13/tee.js +11 -34
- 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/build_message.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/internal/1.0.10/diff.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/internal/1.0.10/diff_str.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/internal/1.0.10/format.d.ts +29 -0
- package/esm/deps/jsr.io/@std/internal/1.0.10/format.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/internal/1.0.10/format.js +70 -0
- package/esm/deps/jsr.io/@std/internal/1.0.10/styles.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/internal/1.0.10/types.d.ts.map +1 -0
- package/esm/mod.js +2 -12
- package/esm/session/0_session_state.js +12 -38
- package/esm/session/1_session.js +49 -72
- package/esm/session/2_session_encrypted.js +324 -320
- package/esm/storage/1_utilities_test.d.ts.map +1 -1
- package/esm/storage/2_storage_indexed_db.js +26 -44
- package/esm/storage/2_storage_local_storage.node.js +12 -25
- package/esm/storage/2_storage_memory.js +24 -41
- package/esm/storage/2_storage_session_storage.js +3 -16
- package/esm/tl/0_utilities_test.d.ts.map +1 -1
- package/esm/tl/1_tl_reader.js +80 -88
- package/esm/tl/1_tl_reader_test.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/2_telegram.d.ts +9 -10
- package/esm/tl/2_telegram.d.ts.map +1 -1
- package/esm/tl/2_telegram.js +10 -10
- package/esm/transport/0_transport.js +1 -8
- package/esm/transport/1_transport_abridged.js +11 -24
- package/esm/transport/1_transport_intermediate.js +10 -23
- package/{script/transport/2_transport_provider.d.ts → esm/transport/1_transport_provider.d.ts} +1 -1
- package/esm/transport/{2_transport_provider.d.ts.map → 1_transport_provider.d.ts.map} +1 -1
- package/{script/transport/3_transport_provider_tcp.d.ts → esm/transport/2_transport_provider_tcp.d.ts} +2 -2
- package/esm/transport/{3_transport_provider_tcp.d.ts.map → 2_transport_provider_tcp.d.ts.map} +1 -1
- package/esm/transport/{3_transport_provider_tcp.js → 2_transport_provider_tcp.js} +1 -1
- package/esm/transport/{3_transport_provider_web_socket.d.ts → 2_transport_provider_web_socket.d.ts} +2 -2
- package/esm/transport/2_transport_provider_web_socket.d.ts.map +1 -0
- package/esm/transport/{3_transport_provider_web_socket.js → 2_transport_provider_web_socket.js} +1 -1
- 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/{2_inline_keyboard_button.d.ts → 1_inline_keyboard_button.d.ts} +1 -1
- package/esm/types/{2_inline_keyboard_button.d.ts.map → 1_inline_keyboard_button.d.ts.map} +1 -1
- package/esm/types/1_sticker.d.ts +1 -1
- package/esm/types/1_sticker.d.ts.map +1 -1
- package/esm/types/2_chat.d.ts.map +1 -1
- package/esm/types/2_poll_answer.d.ts +19 -0
- 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.map +1 -1
- package/esm/types/{3_reply_markup.d.ts → 2_reply_markup.d.ts} +2 -2
- package/esm/types/{3_reply_markup.d.ts.map → 2_reply_markup.d.ts.map} +1 -1
- package/esm/types/{3_reply_markup.js → 2_reply_markup.js} +1 -1
- package/esm/types/2_story_interactive_area.d.ts.map +1 -1
- package/esm/types/3_chat_member_updated.d.ts.map +1 -1
- package/esm/types/3_story.d.ts.map +1 -1
- package/esm/types/5_message.d.ts +1 -1
- package/esm/types/5_message.d.ts.map +1 -1
- package/esm/types/5_message.js +1 -1
- package/esm/types/6_inline_query_result.d.ts +1 -1
- package/esm/types/6_inline_query_result.js +1 -1
- package/esm/types/7_update.d.ts +21 -2
- package/esm/types/7_update.d.ts.map +1 -1
- 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_test.d.ts.map +1 -1
- package/esm/utilities/0_hash.d.ts +2 -2
- package/esm/utilities/0_hash.d.ts.map +1 -1
- package/esm/utilities/0_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_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_base64.d.ts +1 -1
- package/esm/utilities/1_base64.d.ts.map +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_math_test.d.ts.map +1 -1
- package/esm/utilities/2_queue.js +29 -47
- package/package.json +1 -1
- package/script/0_errors.js +2 -6
- package/script/2_tl.js +17 -7
- package/script/3_errors.js +2 -12
- package/script/3_transport.d.ts +3 -3
- package/script/3_transport.js +3 -3
- package/script/3_types.d.ts +8 -7
- package/script/3_types.d.ts.map +1 -1
- package/script/3_types.js +8 -7
- package/script/4_constants.js +17 -7
- 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_filters_test.d.ts.map +1 -1
- package/script/client/0_markdown_test.d.ts.map +1 -1
- package/script/client/0_params.d.ts +2 -0
- 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 +17 -7
- package/script/client/0_password_test.d.ts.map +1 -1
- package/script/client/0_storage_operations.js +143 -155
- package/script/client/0_storage_operations_test.d.ts.map +1 -1
- package/script/client/0_utilities.d.ts +1 -1
- package/script/client/0_utilities_test.d.ts.map +1 -1
- package/script/client/1_client_plain.js +4 -22
- package/script/client/1_composer.js +8 -21
- package/script/client/2_account_manager.js +85 -97
- package/script/client/2_bot_info_manager.js +26 -38
- package/script/client/2_business_connection_manager.js +10 -23
- package/script/client/2_client_encrypted.js +195 -212
- package/script/client/2_file_manager.d.ts +4 -3
- package/script/client/2_file_manager.d.ts.map +1 -1
- package/script/client/2_file_manager.js +285 -231
- package/script/client/2_file_manager_test.d.ts.map +1 -1
- package/script/client/2_network_statistics_manager.js +8 -21
- package/script/client/2_payment_manager.js +7 -20
- package/script/client/2_reaction_manager.js +7 -20
- package/script/client/2_translations_manager.js +98 -108
- package/script/client/2_update_manager.js +764 -759
- 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 +1 -1
- package/script/client/3_message_manager.js +441 -448
- package/script/client/3_message_manager_test.d.ts.map +1 -1
- package/script/client/3_video_chat_manager.d.ts +1 -1
- package/script/client/3_video_chat_manager.js +57 -68
- package/script/client/4_callback_query_manager.js +18 -30
- package/script/client/4_chat_list_manager.js +322 -318
- package/script/client/4_chat_manager.js +118 -131
- package/script/client/4_forum_manager.js +67 -73
- package/script/client/4_gift_manager.js +16 -29
- package/script/client/4_inline_query_manager.js +16 -28
- package/script/client/4_link_preview_manager.js +6 -19
- package/script/client/4_poll_manager.js +44 -57
- package/script/client/4_story_manager.js +41 -53
- package/script/client/5_client.d.ts +7 -0
- package/script/client/5_client.d.ts.map +1 -1
- package/script/client/5_client.js +1271 -1290
- package/script/connection/1_connection_tcp.node.js +48 -65
- 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/script/deps/jsr.io/@std/assert/1.0.13/equal.js +17 -7
- package/script/deps/jsr.io/@std/assert/1.0.13/equals.js +4 -4
- package/script/deps/jsr.io/@std/async/1.0.13/delay.js +17 -7
- package/script/deps/jsr.io/@std/async/1.0.13/mux_async_iterator.js +31 -47
- package/script/deps/jsr.io/@std/async/1.0.13/tee.js +11 -34
- 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/build_message.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/internal/1.0.10/diff.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/internal/1.0.10/diff_str.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/internal/1.0.10/format.d.ts +29 -0
- package/script/deps/jsr.io/@std/internal/1.0.10/format.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/internal/1.0.10/format.js +106 -0
- package/script/deps/jsr.io/@std/internal/1.0.10/styles.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/styles.js +17 -7
- package/script/deps/jsr.io/@std/internal/1.0.10/types.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/path/1.1.0/_os.js +17 -7
- package/script/mod.js +19 -19
- package/script/session/0_session_state.js +12 -38
- package/script/session/1_session.js +66 -79
- package/script/session/2_session_encrypted.js +325 -321
- package/script/storage/1_utilities_test.d.ts.map +1 -1
- package/script/storage/2_storage_indexed_db.js +26 -44
- package/script/storage/2_storage_local_storage.node.js +12 -25
- package/script/storage/2_storage_memory.js +24 -41
- package/script/storage/2_storage_session_storage.js +3 -16
- package/script/tl/0_utilities_test.d.ts.map +1 -1
- package/script/tl/1_tl_reader.js +81 -89
- package/script/tl/1_tl_reader_test.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/2_telegram.d.ts +9 -10
- package/script/tl/2_telegram.d.ts.map +1 -1
- package/script/tl/2_telegram.js +32 -10
- package/script/transport/0_obfuscation.js +17 -7
- package/script/transport/0_transport.js +1 -8
- package/script/transport/1_transport_abridged.js +11 -24
- package/script/transport/1_transport_intermediate.js +10 -23
- package/{esm/transport/2_transport_provider.d.ts → script/transport/1_transport_provider.d.ts} +1 -1
- package/script/transport/{2_transport_provider.d.ts.map → 1_transport_provider.d.ts.map} +1 -1
- package/{esm/transport/3_transport_provider_tcp.d.ts → script/transport/2_transport_provider_tcp.d.ts} +2 -2
- package/script/transport/{3_transport_provider_tcp.d.ts.map → 2_transport_provider_tcp.d.ts.map} +1 -1
- package/script/transport/{3_transport_provider_tcp.js → 2_transport_provider_tcp.js} +3 -3
- package/script/transport/{3_transport_provider_web_socket.d.ts → 2_transport_provider_web_socket.d.ts} +2 -2
- package/script/transport/2_transport_provider_web_socket.d.ts.map +1 -0
- package/script/transport/{3_transport_provider_web_socket.js → 2_transport_provider_web_socket.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/{2_inline_keyboard_button.d.ts → 1_inline_keyboard_button.d.ts} +1 -1
- package/script/types/{2_inline_keyboard_button.d.ts.map → 1_inline_keyboard_button.d.ts.map} +1 -1
- package/script/types/1_sticker.d.ts +1 -1
- package/script/types/1_sticker.d.ts.map +1 -1
- package/script/types/2_chat.d.ts.map +1 -1
- package/script/types/2_poll_answer.d.ts +19 -0
- 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.map +1 -1
- package/script/types/{3_reply_markup.d.ts → 2_reply_markup.d.ts} +2 -2
- package/script/types/{3_reply_markup.d.ts.map → 2_reply_markup.d.ts.map} +1 -1
- package/script/types/{3_reply_markup.js → 2_reply_markup.js} +3 -3
- package/script/types/2_story_interactive_area.d.ts.map +1 -1
- package/script/types/3_chat_member_updated.d.ts.map +1 -1
- package/script/types/3_story.d.ts.map +1 -1
- package/script/types/5_message.d.ts +1 -1
- package/script/types/5_message.d.ts.map +1 -1
- package/script/types/5_message.js +2 -2
- package/script/types/6_inline_query_result.d.ts +1 -1
- package/script/types/6_inline_query_result.js +4 -4
- package/script/types/7_update.d.ts +21 -2
- package/script/types/7_update.d.ts.map +1 -1
- package/script/utilities/0_bigint.js +17 -7
- 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_test.d.ts.map +1 -1
- package/script/utilities/0_env.js +17 -7
- 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.js +17 -7
- 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_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 +17 -7
- package/script/utilities/1_base64.d.ts +1 -1
- package/script/utilities/1_base64.d.ts.map +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_math_test.d.ts.map +1 -1
- package/script/utilities/2_queue.js +30 -48
- package/esm/deps/jsr.io/@std/internal/1.0.9/build_message.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/internal/1.0.9/diff.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/internal/1.0.9/diff_str.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/internal/1.0.9/format.d.ts +0 -2
- package/esm/deps/jsr.io/@std/internal/1.0.9/format.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/internal/1.0.9/format.js +0 -37
- package/esm/deps/jsr.io/@std/internal/1.0.9/styles.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/internal/1.0.9/types.d.ts.map +0 -1
- package/esm/transport/3_transport_provider_web_socket.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/internal/1.0.9/build_message.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/internal/1.0.9/diff.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/internal/1.0.9/diff_str.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/internal/1.0.9/format.d.ts +0 -2
- package/script/deps/jsr.io/@std/internal/1.0.9/format.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/internal/1.0.9/format.js +0 -63
- package/script/deps/jsr.io/@std/internal/1.0.9/styles.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/internal/1.0.9/types.d.ts.map +0 -1
- package/script/transport/3_transport_provider_web_socket.d.ts.map +0 -1
- /package/esm/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/build_message.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/build_message.js +0 -0
- /package/esm/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/diff.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/diff.js +0 -0
- /package/esm/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/diff_str.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/diff_str.js +0 -0
- /package/esm/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/styles.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/styles.js +0 -0
- /package/esm/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/types.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/types.js +0 -0
- /package/esm/transport/{2_transport_provider.js → 1_transport_provider.js} +0 -0
- /package/esm/types/{2_inline_keyboard_button.js → 1_inline_keyboard_button.js} +0 -0
- /package/script/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/build_message.d.ts +0 -0
- /package/script/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/build_message.js +0 -0
- /package/script/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/diff.d.ts +0 -0
- /package/script/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/diff.js +0 -0
- /package/script/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/diff_str.d.ts +0 -0
- /package/script/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/diff_str.js +0 -0
- /package/script/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/styles.d.ts +0 -0
- /package/script/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/types.d.ts +0 -0
- /package/script/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/types.js +0 -0
- /package/script/transport/{2_transport_provider.js → 1_transport_provider.js} +0 -0
- /package/script/types/{2_inline_keyboard_button.js → 1_inline_keyboard_button.js} +0 -0
|
@@ -21,7 +21,7 @@ import { Api } from "../2_tl.js";
|
|
|
21
21
|
export declare const resolve: () => Promise<void>;
|
|
22
22
|
export declare function isHttpUrl(string: string): boolean;
|
|
23
23
|
export declare function getUsername(string: string): string;
|
|
24
|
-
export declare function getChatListId(chatList: string):
|
|
24
|
+
export declare function getChatListId(chatList: string): 1 | 0;
|
|
25
25
|
export declare function checkMessageId(messageId: number): number;
|
|
26
26
|
export declare function checkStoryId(storyId: number): number;
|
|
27
27
|
export declare function checkPollOption(option: string): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"0_utilities_test.d.ts","sourceRoot":"","sources":["../../src/client/0_utilities_test.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"0_utilities_test.d.ts","sourceRoot":"","sources":["../../src/client/0_utilities_test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,2BAA2B,CAAC"}
|
|
@@ -18,18 +18,6 @@
|
|
|
18
18
|
* You should have received a copy of the GNU Lesser General Public License
|
|
19
19
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
20
20
|
*/
|
|
21
|
-
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
22
|
-
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
23
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
24
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
25
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
26
|
-
};
|
|
27
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
28
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
29
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
30
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
31
|
-
};
|
|
32
|
-
var _ClientPlain_publicKeys;
|
|
33
21
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
34
22
|
exports.ClientPlain = void 0;
|
|
35
23
|
const _0_deps_js_1 = require("../0_deps.js");
|
|
@@ -45,16 +33,11 @@ const LcreateAuthKey = L.branch("createAuthKey");
|
|
|
45
33
|
* An MTProto client for making plain connections. Most users won't need to interact with this. Used internally for creating authorization keys.
|
|
46
34
|
*/
|
|
47
35
|
class ClientPlain extends _0_client_abstract_js_1.ClientAbstract {
|
|
36
|
+
#publicKeys;
|
|
37
|
+
session;
|
|
48
38
|
constructor(dc, params) {
|
|
49
39
|
super();
|
|
50
|
-
|
|
51
|
-
Object.defineProperty(this, "session", {
|
|
52
|
-
enumerable: true,
|
|
53
|
-
configurable: true,
|
|
54
|
-
writable: true,
|
|
55
|
-
value: void 0
|
|
56
|
-
});
|
|
57
|
-
__classPrivateFieldSet(this, _ClientPlain_publicKeys, params?.publicKeys ?? _4_constants_js_1.PUBLIC_KEYS, "f");
|
|
40
|
+
this.#publicKeys = params?.publicKeys ?? _4_constants_js_1.PUBLIC_KEYS;
|
|
58
41
|
this.session = new _4_session_js_1.SessionPlain(dc, params);
|
|
59
42
|
}
|
|
60
43
|
async invoke(function_) {
|
|
@@ -92,7 +75,7 @@ class ClientPlain extends _0_client_abstract_js_1.ClientAbstract {
|
|
|
92
75
|
let publicKeyFingerprint;
|
|
93
76
|
let publicKey;
|
|
94
77
|
for (const fingerprint of resPq.server_public_key_fingerprints) {
|
|
95
|
-
const maybePublicKey =
|
|
78
|
+
const maybePublicKey = this.#publicKeys.find(([k]) => (k == fingerprint));
|
|
96
79
|
if (maybePublicKey) {
|
|
97
80
|
publicKeyFingerprint = fingerprint;
|
|
98
81
|
publicKey = maybePublicKey[1];
|
|
@@ -167,4 +150,3 @@ class ClientPlain extends _0_client_abstract_js_1.ClientAbstract {
|
|
|
167
150
|
}
|
|
168
151
|
}
|
|
169
152
|
exports.ClientPlain = ClientPlain;
|
|
170
|
-
_ClientPlain_publicKeys = new WeakMap();
|
|
@@ -18,18 +18,6 @@
|
|
|
18
18
|
* You should have received a copy of the GNU Lesser General Public License
|
|
19
19
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
20
20
|
*/
|
|
21
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
22
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
23
|
-
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");
|
|
24
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
25
|
-
};
|
|
26
|
-
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
27
|
-
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
28
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
29
|
-
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");
|
|
30
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
31
|
-
};
|
|
32
|
-
var _Composer_handle, _Composer_prefixes;
|
|
33
21
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
34
22
|
exports.Composer = void 0;
|
|
35
23
|
exports.flatten = flatten;
|
|
@@ -58,23 +46,23 @@ function skip(_ctx, next) {
|
|
|
58
46
|
return next();
|
|
59
47
|
}
|
|
60
48
|
class Composer {
|
|
49
|
+
#handle;
|
|
50
|
+
#prefixes;
|
|
61
51
|
set prefixes(value) {
|
|
62
|
-
if (
|
|
52
|
+
if (this.#prefixes !== undefined) {
|
|
63
53
|
throw new _0_errors_js_1.InputError("Prefixes already set");
|
|
64
54
|
}
|
|
65
|
-
|
|
55
|
+
this.#prefixes = value;
|
|
66
56
|
}
|
|
67
57
|
constructor(...middleware) {
|
|
68
|
-
|
|
69
|
-
_Composer_prefixes.set(this, void 0);
|
|
70
|
-
__classPrivateFieldSet(this, _Composer_handle, middleware.length == 0 ? skip : middleware.map(flatten).reduce(concat), "f");
|
|
58
|
+
this.#handle = middleware.length == 0 ? skip : middleware.map(flatten).reduce(concat);
|
|
71
59
|
}
|
|
72
60
|
middleware() {
|
|
73
|
-
return
|
|
61
|
+
return this.#handle;
|
|
74
62
|
}
|
|
75
63
|
use(...middleware) {
|
|
76
64
|
const composer = new Composer(...middleware);
|
|
77
|
-
|
|
65
|
+
this.#handle = concat(this.#handle, flatten(composer));
|
|
78
66
|
return composer;
|
|
79
67
|
}
|
|
80
68
|
branch(predicate, trueHandler_, falseHandler_) {
|
|
@@ -102,7 +90,7 @@ class Composer {
|
|
|
102
90
|
command(commands, ...middleware) {
|
|
103
91
|
const commands__ = typeof commands === "object" && "names" in commands ? commands.names : commands;
|
|
104
92
|
const commands_ = Array.isArray(commands__) ? commands__ : [commands__];
|
|
105
|
-
const prefixes_ = typeof commands === "object" && "prefixes" in commands ? commands.prefixes : (
|
|
93
|
+
const prefixes_ = typeof commands === "object" && "prefixes" in commands ? commands.prefixes : (this.#prefixes ?? []);
|
|
106
94
|
const prefixes = Array.isArray(prefixes_) ? prefixes_ : [prefixes_];
|
|
107
95
|
for (const left of prefixes) {
|
|
108
96
|
for (const right of prefixes) {
|
|
@@ -172,4 +160,3 @@ class Composer {
|
|
|
172
160
|
}
|
|
173
161
|
}
|
|
174
162
|
exports.Composer = Composer;
|
|
175
|
-
_Composer_handle = new WeakMap(), _Composer_prefixes = new WeakMap();
|
|
@@ -18,18 +18,6 @@
|
|
|
18
18
|
* You should have received a copy of the GNU Lesser General Public License
|
|
19
19
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
20
20
|
*/
|
|
21
|
-
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
22
|
-
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
23
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
24
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
25
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
26
|
-
};
|
|
27
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
28
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
29
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
30
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
31
|
-
};
|
|
32
|
-
var _AccountManager_instances, _AccountManager_c, _AccountManager_toggleUsername, _AccountManager_getUserFull;
|
|
33
21
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
34
22
|
exports.AccountManager = void 0;
|
|
35
23
|
const _0_deps_js_1 = require("../0_deps.js");
|
|
@@ -38,99 +26,113 @@ const _2_tl_js_1 = require("../2_tl.js");
|
|
|
38
26
|
const _3_types_js_1 = require("../3_types.js");
|
|
39
27
|
const _0_utilities_js_1 = require("./0_utilities.js");
|
|
40
28
|
class AccountManager {
|
|
29
|
+
#c;
|
|
41
30
|
constructor(c) {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
31
|
+
this.#c = c;
|
|
32
|
+
}
|
|
33
|
+
async #toggleUsername(id, username, active) {
|
|
34
|
+
const peer = await this.#c.getInputPeer(id);
|
|
35
|
+
if (_2_tl_js_1.Api.is("inputPeerSelf", peer)) {
|
|
36
|
+
await this.#c.invoke({ _: "account.toggleUsername", username, active });
|
|
37
|
+
}
|
|
38
|
+
else if ((0, _0_utilities_js_1.canBeInputUser)(peer)) {
|
|
39
|
+
await this.#c.invoke({ _: "bots.toggleUsername", bot: (0, _0_utilities_js_1.toInputUser)(peer), username, active });
|
|
40
|
+
}
|
|
41
|
+
else if ((0, _0_utilities_js_1.canBeInputChannel)(peer)) {
|
|
42
|
+
await this.#c.invoke({ _: "channels.toggleUsername", channel: (0, _0_utilities_js_1.toInputChannel)(peer), username, active });
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
(0, _0_deps_js_1.unreachable)();
|
|
46
|
+
}
|
|
45
47
|
}
|
|
46
48
|
async showUsername(id, username) {
|
|
47
|
-
|
|
48
|
-
await
|
|
49
|
+
this.#c.storage.assertUser("showUsername");
|
|
50
|
+
await this.#toggleUsername(id, username, true);
|
|
49
51
|
}
|
|
50
52
|
async hideUsername(id, username) {
|
|
51
|
-
|
|
52
|
-
await
|
|
53
|
+
this.#c.storage.assertUser("hideUsername");
|
|
54
|
+
await this.#toggleUsername(id, username, false);
|
|
53
55
|
}
|
|
54
56
|
async reorderUsernames(id, order) {
|
|
55
|
-
|
|
56
|
-
const peer = await
|
|
57
|
+
this.#c.storage.assertUser("reorderUsernames");
|
|
58
|
+
const peer = await this.#c.getInputPeer(id);
|
|
57
59
|
if (_2_tl_js_1.Api.is("inputPeerSelf", peer)) {
|
|
58
|
-
return await
|
|
60
|
+
return await this.#c.invoke({ _: "account.reorderUsernames", order });
|
|
59
61
|
}
|
|
60
62
|
else if ((0, _0_utilities_js_1.canBeInputUser)(peer)) {
|
|
61
|
-
return await
|
|
63
|
+
return await this.#c.invoke({ _: "bots.reorderUsernames", bot: (0, _0_utilities_js_1.toInputUser)(peer), order });
|
|
62
64
|
}
|
|
63
65
|
else if ((0, _0_utilities_js_1.canBeInputChannel)(peer)) {
|
|
64
|
-
return await
|
|
66
|
+
return await this.#c.invoke({ _: "channels.reorderUsernames", channel: (0, _0_utilities_js_1.toInputChannel)(peer), order });
|
|
65
67
|
}
|
|
66
68
|
else {
|
|
67
69
|
(0, _0_deps_js_1.unreachable)();
|
|
68
70
|
}
|
|
69
71
|
}
|
|
70
72
|
async hideUsernames(id) {
|
|
71
|
-
|
|
72
|
-
const peer = await
|
|
73
|
+
this.#c.storage.assertUser("hideUsernames");
|
|
74
|
+
const peer = await this.#c.getInputPeer(id);
|
|
73
75
|
if ((0, _0_utilities_js_1.canBeInputChannel)(peer)) {
|
|
74
|
-
return await
|
|
76
|
+
return await this.#c.invoke({ _: "channels.deactivateAllUsernames", channel: (0, _0_utilities_js_1.toInputChannel)(peer) });
|
|
75
77
|
}
|
|
76
78
|
else {
|
|
77
79
|
(0, _0_deps_js_1.unreachable)();
|
|
78
80
|
}
|
|
79
81
|
}
|
|
80
82
|
async getInactiveChats() {
|
|
81
|
-
|
|
82
|
-
const { chats, dates } = await
|
|
83
|
+
this.#c.storage.assertUser("getInactiveChats");
|
|
84
|
+
const { chats, dates } = await this.#c.invoke({ _: "channels.getInactiveChannels" });
|
|
83
85
|
return chats.map((v, i) => (0, _3_types_js_1.constructInactiveChat)(v, dates[i]));
|
|
84
86
|
}
|
|
85
87
|
async setOnline(online) {
|
|
86
|
-
|
|
87
|
-
await
|
|
88
|
+
this.#c.storage.assertUser("setOnline");
|
|
89
|
+
await this.#c.invoke({ _: "account.updateStatus", offline: !online });
|
|
88
90
|
}
|
|
89
91
|
async setEmojiStatus(id, params) {
|
|
90
|
-
|
|
92
|
+
this.#c.storage.assertUser("setEmojiStatus");
|
|
91
93
|
const document_id = BigInt(id);
|
|
92
94
|
const until = params?.until;
|
|
93
95
|
const emoji_status = { _: "emojiStatus", document_id, until };
|
|
94
|
-
await
|
|
96
|
+
await this.#c.invoke({ _: "account.updateEmojiStatus", emoji_status });
|
|
95
97
|
}
|
|
96
98
|
async setUserEmojiStatus(userId, id, params) {
|
|
97
|
-
|
|
98
|
-
const user_id = await
|
|
99
|
+
this.#c.storage.assertBot("setUserEmojiStatus");
|
|
100
|
+
const user_id = await this.#c.getInputUser(userId);
|
|
99
101
|
const document_id = BigInt(id);
|
|
100
102
|
const until = params?.until;
|
|
101
103
|
const emoji_status = { _: "emojiStatus", document_id, until };
|
|
102
|
-
await
|
|
104
|
+
await this.#c.invoke({ _: "bots.updateUserEmojiStatus", user_id, emoji_status });
|
|
103
105
|
}
|
|
104
106
|
async setBotCanSetEmojiStatus(botId, canSetEmojiStatus) {
|
|
105
|
-
|
|
106
|
-
const bot = await
|
|
107
|
+
this.#c.storage.assertUser("setBotCanSetEmojiStatus");
|
|
108
|
+
const bot = await this.#c.getInputUser(botId);
|
|
107
109
|
const enabled = canSetEmojiStatus;
|
|
108
|
-
await
|
|
110
|
+
await this.#c.invoke({ _: "bots.toggleUserEmojiStatusPermission", bot, enabled });
|
|
109
111
|
}
|
|
110
112
|
async getContacts() {
|
|
111
|
-
|
|
112
|
-
const result = await
|
|
113
|
+
this.#c.storage.assertUser("getContacts");
|
|
114
|
+
const result = await this.#c.invoke({ _: "contacts.getContacts", hash: 0n });
|
|
113
115
|
if (!_2_tl_js_1.Api.is("contacts.contacts", result)) {
|
|
114
116
|
(0, _0_deps_js_1.unreachable)();
|
|
115
117
|
}
|
|
116
118
|
return result.users.map((v) => _2_tl_js_1.Api.is("user", v) ? (0, _3_types_js_1.constructUser)(v) : null).filter((v) => v != null);
|
|
117
119
|
}
|
|
118
120
|
async deleteContacts(userIds) {
|
|
119
|
-
|
|
120
|
-
const id = await Promise.all(userIds.map((v) =>
|
|
121
|
-
await
|
|
121
|
+
this.#c.storage.assertUser("deleteContacts");
|
|
122
|
+
const id = await Promise.all(userIds.map((v) => this.#c.getInputUser(v)));
|
|
123
|
+
await this.#c.invoke({ _: "contacts.deleteContacts", id });
|
|
122
124
|
}
|
|
123
125
|
async deleteContact(userId) {
|
|
124
|
-
|
|
126
|
+
this.#c.storage.assertUser("deleteContact");
|
|
125
127
|
await this.deleteContacts([userId]);
|
|
126
128
|
}
|
|
127
129
|
async addContact(userId, params) {
|
|
128
|
-
|
|
129
|
-
const id = await
|
|
130
|
+
this.#c.storage.assertUser("addContact");
|
|
131
|
+
const id = await this.#c.getInputUser(userId);
|
|
130
132
|
if (!_2_tl_js_1.Api.is("inputPeerUser", id)) {
|
|
131
133
|
(0, _0_deps_js_1.unreachable)();
|
|
132
134
|
}
|
|
133
|
-
const user = await
|
|
135
|
+
const user = await this.#c.getEntity(_2_tl_js_1.Api.inputPeerToPeer(id));
|
|
134
136
|
if (!user || !("first_name" in user)) {
|
|
135
137
|
(0, _0_deps_js_1.unreachable)();
|
|
136
138
|
}
|
|
@@ -138,13 +140,31 @@ class AccountManager {
|
|
|
138
140
|
const last_name = params?.lastName ?? user.last_name ?? "";
|
|
139
141
|
const phone = "";
|
|
140
142
|
const add_phone_privacy_exception = params?.sharePhoneNumber ? true : undefined;
|
|
141
|
-
await
|
|
143
|
+
await this.#c.invoke({ _: "contacts.addContact", add_phone_privacy_exception, id, first_name, last_name, phone });
|
|
144
|
+
}
|
|
145
|
+
async #getUserFull(chatId) {
|
|
146
|
+
const inputPeer = await this.#c.getInputPeer(chatId);
|
|
147
|
+
const chatId_ = await this.#c.getInputPeerChatId(inputPeer);
|
|
148
|
+
let fullChat = await this.#c.storage.getFullChat(chatId_);
|
|
149
|
+
if (fullChat != null) {
|
|
150
|
+
if (!_2_tl_js_1.Api.is("userFull", fullChat)) {
|
|
151
|
+
(0, _0_deps_js_1.unreachable)();
|
|
152
|
+
}
|
|
153
|
+
return fullChat;
|
|
154
|
+
}
|
|
155
|
+
if ((0, _0_utilities_js_1.canBeInputUser)(inputPeer)) {
|
|
156
|
+
fullChat = (await this.#c.invoke({ _: "users.getFullUser", id: (0, _0_utilities_js_1.toInputUser)(inputPeer) })).full_user;
|
|
157
|
+
}
|
|
158
|
+
else {
|
|
159
|
+
(0, _0_deps_js_1.unreachable)();
|
|
160
|
+
}
|
|
161
|
+
return fullChat;
|
|
142
162
|
}
|
|
143
163
|
async updateProfile(params) {
|
|
144
|
-
|
|
145
|
-
const selfId = await
|
|
146
|
-
const userFull = await
|
|
147
|
-
const entity = await
|
|
164
|
+
this.#c.storage.assertUser("updateProfile");
|
|
165
|
+
const selfId = await this.#c.getSelfId();
|
|
166
|
+
const userFull = await this.#getUserFull(selfId);
|
|
167
|
+
const entity = await this.#c.getEntity(_2_tl_js_1.Api.chatIdToPeer(selfId));
|
|
148
168
|
if (!_2_tl_js_1.Api.is("user", entity)) {
|
|
149
169
|
(0, _0_deps_js_1.unreachable)();
|
|
150
170
|
}
|
|
@@ -170,33 +190,33 @@ class AccountManager {
|
|
|
170
190
|
if (!params?.firstName && !params?.lastName && !params?.bio) {
|
|
171
191
|
throw new _0_errors_js_1.InputError("At least one parameter must be specified.");
|
|
172
192
|
}
|
|
173
|
-
await
|
|
193
|
+
await this.#c.invoke({ _: "account.updateProfile", first_name: params.firstName, last_name: params.lastName, about: params.bio });
|
|
174
194
|
}
|
|
175
195
|
async setBirthday(params) {
|
|
176
|
-
|
|
196
|
+
this.#c.storage.assertUser("setBirthday");
|
|
177
197
|
const birthday = params?.birthday ? (0, _3_types_js_1.birthdayToTlObject)(params.birthday) : undefined;
|
|
178
|
-
await
|
|
198
|
+
await this.#c.invoke({ _: "account.updateBirthday", birthday });
|
|
179
199
|
}
|
|
180
200
|
async setPersonalChannel(params) {
|
|
181
|
-
|
|
201
|
+
this.#c.storage.assertUser("setPersonalChannel");
|
|
182
202
|
let channel = { _: "inputChannelEmpty" };
|
|
183
203
|
if (params?.chatId) {
|
|
184
|
-
channel = await
|
|
204
|
+
channel = await this.#c.getInputChannel(params.chatId);
|
|
185
205
|
}
|
|
186
|
-
await
|
|
206
|
+
await this.#c.invoke({ _: "account.updatePersonalChannel", channel });
|
|
187
207
|
}
|
|
188
208
|
async setNameColor(color, params) {
|
|
189
|
-
|
|
209
|
+
this.#c.storage.assertUser("setNameColor");
|
|
190
210
|
const background_emoji_id = params?.customEmojiId ? BigInt(params.customEmojiId) : undefined;
|
|
191
|
-
await
|
|
211
|
+
await this.#c.invoke({ _: "account.updateColor", color, background_emoji_id });
|
|
192
212
|
}
|
|
193
213
|
async setProfileColor(color, params) {
|
|
194
|
-
|
|
214
|
+
this.#c.storage.assertUser("setProfileColor");
|
|
195
215
|
const background_emoji_id = params?.customEmojiId ? BigInt(params.customEmojiId) : undefined;
|
|
196
|
-
await
|
|
216
|
+
await this.#c.invoke({ _: "account.updateColor", for_profile: true, color, background_emoji_id });
|
|
197
217
|
}
|
|
198
218
|
async setLocation(params) {
|
|
199
|
-
|
|
219
|
+
this.#c.storage.assertUser("setLocation");
|
|
200
220
|
let address = params?.address;
|
|
201
221
|
if (typeof address === "string") {
|
|
202
222
|
address = address.trim();
|
|
@@ -211,39 +231,7 @@ class AccountManager {
|
|
|
211
231
|
if (params?.latitude && params.longitude) {
|
|
212
232
|
geo_point = { _: "inputGeoPoint", lat: params.latitude, long: params.longitude };
|
|
213
233
|
}
|
|
214
|
-
await
|
|
234
|
+
await this.#c.invoke({ _: "account.updateBusinessLocation", address, geo_point });
|
|
215
235
|
}
|
|
216
236
|
}
|
|
217
237
|
exports.AccountManager = AccountManager;
|
|
218
|
-
_AccountManager_c = new WeakMap(), _AccountManager_instances = new WeakSet(), _AccountManager_toggleUsername = async function _AccountManager_toggleUsername(id, username, active) {
|
|
219
|
-
const peer = await __classPrivateFieldGet(this, _AccountManager_c, "f").getInputPeer(id);
|
|
220
|
-
if (_2_tl_js_1.Api.is("inputPeerSelf", peer)) {
|
|
221
|
-
await __classPrivateFieldGet(this, _AccountManager_c, "f").invoke({ _: "account.toggleUsername", username, active });
|
|
222
|
-
}
|
|
223
|
-
else if ((0, _0_utilities_js_1.canBeInputUser)(peer)) {
|
|
224
|
-
await __classPrivateFieldGet(this, _AccountManager_c, "f").invoke({ _: "bots.toggleUsername", bot: (0, _0_utilities_js_1.toInputUser)(peer), username, active });
|
|
225
|
-
}
|
|
226
|
-
else if ((0, _0_utilities_js_1.canBeInputChannel)(peer)) {
|
|
227
|
-
await __classPrivateFieldGet(this, _AccountManager_c, "f").invoke({ _: "channels.toggleUsername", channel: (0, _0_utilities_js_1.toInputChannel)(peer), username, active });
|
|
228
|
-
}
|
|
229
|
-
else {
|
|
230
|
-
(0, _0_deps_js_1.unreachable)();
|
|
231
|
-
}
|
|
232
|
-
}, _AccountManager_getUserFull = async function _AccountManager_getUserFull(chatId) {
|
|
233
|
-
const inputPeer = await __classPrivateFieldGet(this, _AccountManager_c, "f").getInputPeer(chatId);
|
|
234
|
-
const chatId_ = await __classPrivateFieldGet(this, _AccountManager_c, "f").getInputPeerChatId(inputPeer);
|
|
235
|
-
let fullChat = await __classPrivateFieldGet(this, _AccountManager_c, "f").storage.getFullChat(chatId_);
|
|
236
|
-
if (fullChat != null) {
|
|
237
|
-
if (!_2_tl_js_1.Api.is("userFull", fullChat)) {
|
|
238
|
-
(0, _0_deps_js_1.unreachable)();
|
|
239
|
-
}
|
|
240
|
-
return fullChat;
|
|
241
|
-
}
|
|
242
|
-
if ((0, _0_utilities_js_1.canBeInputUser)(inputPeer)) {
|
|
243
|
-
fullChat = (await __classPrivateFieldGet(this, _AccountManager_c, "f").invoke({ _: "users.getFullUser", id: (0, _0_utilities_js_1.toInputUser)(inputPeer) })).full_user;
|
|
244
|
-
}
|
|
245
|
-
else {
|
|
246
|
-
(0, _0_deps_js_1.unreachable)();
|
|
247
|
-
}
|
|
248
|
-
return fullChat;
|
|
249
|
-
};
|
|
@@ -18,73 +18,61 @@
|
|
|
18
18
|
* You should have received a copy of the GNU Lesser General Public License
|
|
19
19
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
20
20
|
*/
|
|
21
|
-
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
22
|
-
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
23
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
24
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
25
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
26
|
-
};
|
|
27
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
28
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
29
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
30
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
31
|
-
};
|
|
32
|
-
var _BotInfoManager_instances, _BotInfoManager_c, _BotInfoManager_setMyInfo, _BotInfoManager_getMyInfo;
|
|
33
21
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
34
22
|
exports.BotInfoManager = void 0;
|
|
35
23
|
const _3_types_js_1 = require("../3_types.js");
|
|
36
24
|
class BotInfoManager {
|
|
25
|
+
#c;
|
|
37
26
|
constructor(c) {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
27
|
+
this.#c = c;
|
|
28
|
+
}
|
|
29
|
+
async #setMyInfo(info) {
|
|
30
|
+
await this.#c.invoke({ _: "bots.setBotInfo", ...info });
|
|
41
31
|
}
|
|
42
32
|
async setMyDescription(params) {
|
|
43
|
-
|
|
44
|
-
await
|
|
33
|
+
this.#c.storage.assertBot("setMyDescription");
|
|
34
|
+
await this.#setMyInfo({ description: params?.description, lang_code: params?.languageCode ?? "" });
|
|
45
35
|
}
|
|
46
36
|
async setMyName(params) {
|
|
47
|
-
|
|
48
|
-
await
|
|
37
|
+
this.#c.storage.assertBot("setMyName");
|
|
38
|
+
await this.#setMyInfo({ name: params?.name, lang_code: params?.languageCode ?? "" });
|
|
49
39
|
}
|
|
50
40
|
async setMyShortDescription(params) {
|
|
51
|
-
|
|
52
|
-
await
|
|
41
|
+
this.#c.storage.assertBot("setMyShortDescription");
|
|
42
|
+
await this.#setMyInfo({ about: params?.shortDescription, lang_code: params?.languageCode ?? "" });
|
|
43
|
+
}
|
|
44
|
+
#getMyInfo(languageCode) {
|
|
45
|
+
return this.#c.invoke({ _: "bots.getBotInfo", lang_code: languageCode ?? "" });
|
|
53
46
|
}
|
|
54
47
|
async getMyDescription(params) {
|
|
55
|
-
|
|
56
|
-
return (await
|
|
48
|
+
this.#c.storage.assertBot("getMyDescription");
|
|
49
|
+
return (await this.#getMyInfo(params?.languageCode)).description;
|
|
57
50
|
}
|
|
58
51
|
async getMyName(params) {
|
|
59
|
-
|
|
60
|
-
return (await
|
|
52
|
+
this.#c.storage.assertBot("getMyName");
|
|
53
|
+
return (await this.#getMyInfo(params?.languageCode)).description;
|
|
61
54
|
}
|
|
62
55
|
async getMyShortDescription(params) {
|
|
63
|
-
|
|
64
|
-
return (await
|
|
56
|
+
this.#c.storage.assertBot("getMyShortDescription");
|
|
57
|
+
return (await this.#getMyInfo(params?.languageCode)).about;
|
|
65
58
|
}
|
|
66
59
|
async getMyCommands(params) {
|
|
67
|
-
|
|
68
|
-
const commands_ = await
|
|
60
|
+
this.#c.storage.assertBot("getMyCommands");
|
|
61
|
+
const commands_ = await this.#c.invoke({
|
|
69
62
|
_: "bots.getBotCommands",
|
|
70
63
|
lang_code: params?.languageCode ?? "",
|
|
71
|
-
scope: await (0, _3_types_js_1.botCommandScopeToTlObject)(params?.scope ?? { type: "default" },
|
|
64
|
+
scope: await (0, _3_types_js_1.botCommandScopeToTlObject)(params?.scope ?? { type: "default" }, this.#c.getInputPeer),
|
|
72
65
|
});
|
|
73
66
|
return commands_.map((v) => ({ command: v.command, description: v.description }));
|
|
74
67
|
}
|
|
75
68
|
async setMyCommands(commands, params) {
|
|
76
|
-
|
|
77
|
-
await
|
|
69
|
+
this.#c.storage.assertBot("setMyCommands");
|
|
70
|
+
await this.#c.invoke({
|
|
78
71
|
_: "bots.setBotCommands",
|
|
79
72
|
commands: commands.map((v) => ({ ...v, _: "botCommand" })),
|
|
80
73
|
lang_code: params?.languageCode ?? "",
|
|
81
|
-
scope: await (0, _3_types_js_1.botCommandScopeToTlObject)(params?.scope ?? { type: "default" },
|
|
74
|
+
scope: await (0, _3_types_js_1.botCommandScopeToTlObject)(params?.scope ?? { type: "default" }, this.#c.getInputPeer),
|
|
82
75
|
});
|
|
83
76
|
}
|
|
84
77
|
}
|
|
85
78
|
exports.BotInfoManager = BotInfoManager;
|
|
86
|
-
_BotInfoManager_c = new WeakMap(), _BotInfoManager_instances = new WeakSet(), _BotInfoManager_setMyInfo = async function _BotInfoManager_setMyInfo(info) {
|
|
87
|
-
await __classPrivateFieldGet(this, _BotInfoManager_c, "f").invoke({ _: "bots.setBotInfo", ...info });
|
|
88
|
-
}, _BotInfoManager_getMyInfo = function _BotInfoManager_getMyInfo(languageCode) {
|
|
89
|
-
return __classPrivateFieldGet(this, _BotInfoManager_c, "f").invoke({ _: "bots.getBotInfo", lang_code: languageCode ?? "" });
|
|
90
|
-
};
|
|
@@ -18,18 +18,6 @@
|
|
|
18
18
|
* You should have received a copy of the GNU Lesser General Public License
|
|
19
19
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
20
20
|
*/
|
|
21
|
-
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
22
|
-
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
23
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
24
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
25
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
26
|
-
};
|
|
27
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
28
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
29
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
30
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
31
|
-
};
|
|
32
|
-
var _BusinessConnectionManager_c;
|
|
33
21
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
34
22
|
exports.BusinessConnectionManager = void 0;
|
|
35
23
|
const _2_tl_js_1 = require("../2_tl.js");
|
|
@@ -38,21 +26,21 @@ const businessConnectionManagerUpdates = [
|
|
|
38
26
|
"updateBotBusinessConnect",
|
|
39
27
|
];
|
|
40
28
|
class BusinessConnectionManager {
|
|
29
|
+
#c;
|
|
41
30
|
constructor(c) {
|
|
42
|
-
|
|
43
|
-
__classPrivateFieldSet(this, _BusinessConnectionManager_c, c, "f");
|
|
31
|
+
this.#c = c;
|
|
44
32
|
}
|
|
45
33
|
async getBusinessConnection(id) {
|
|
46
|
-
const connection_ = await
|
|
34
|
+
const connection_ = await this.#c.messageStorage.getBusinessConnection(id);
|
|
47
35
|
if (!connection_) {
|
|
48
|
-
const connection_ = await
|
|
36
|
+
const connection_ = await this.#c.invoke({ _: "account.getBotBusinessConnection", connection_id: id })
|
|
49
37
|
.then((v) => _2_tl_js_1.Api.as("updates", v))
|
|
50
38
|
.then((v) => _2_tl_js_1.Api.as("updateBotBusinessConnect", v.updates[0]).connection);
|
|
51
|
-
await
|
|
52
|
-
return await (0, _3_types_js_1.constructBusinessConnection)(connection_,
|
|
39
|
+
await this.#c.messageStorage.setBusinessConnection(id, connection_);
|
|
40
|
+
return await (0, _3_types_js_1.constructBusinessConnection)(connection_, this.#c.getEntity);
|
|
53
41
|
}
|
|
54
42
|
else {
|
|
55
|
-
return await (0, _3_types_js_1.constructBusinessConnection)(connection_,
|
|
43
|
+
return await (0, _3_types_js_1.constructBusinessConnection)(connection_, this.#c.getEntity);
|
|
56
44
|
}
|
|
57
45
|
}
|
|
58
46
|
canHandleUpdate(update) {
|
|
@@ -60,14 +48,13 @@ class BusinessConnectionManager {
|
|
|
60
48
|
}
|
|
61
49
|
async handleUpdate(update) {
|
|
62
50
|
if (update.connection.disabled) {
|
|
63
|
-
await
|
|
51
|
+
await this.#c.messageStorage.setBusinessConnection(update.connection.connection_id, null);
|
|
64
52
|
}
|
|
65
53
|
else {
|
|
66
|
-
await
|
|
54
|
+
await this.#c.messageStorage.setBusinessConnection(update.connection.connection_id, update.connection);
|
|
67
55
|
}
|
|
68
|
-
const businessConnection = await (0, _3_types_js_1.constructBusinessConnection)(update.connection,
|
|
56
|
+
const businessConnection = await (0, _3_types_js_1.constructBusinessConnection)(update.connection, this.#c.getEntity);
|
|
69
57
|
return { businessConnection };
|
|
70
58
|
}
|
|
71
59
|
}
|
|
72
60
|
exports.BusinessConnectionManager = BusinessConnectionManager;
|
|
73
|
-
_BusinessConnectionManager_c = new WeakMap();
|