@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
|
@@ -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 _ChatManager_instances, _ChatManager_c, _ChatManager_toggleJoinRequests, _ChatManager_toggleSlowMode;
|
|
33
21
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
34
22
|
exports.ChatManager = void 0;
|
|
35
23
|
const _0_deps_js_1 = require("../0_deps.js");
|
|
@@ -46,18 +34,17 @@ const chatManagerUpdates = [
|
|
|
46
34
|
"updateBotChatInviteRequester",
|
|
47
35
|
];
|
|
48
36
|
class ChatManager {
|
|
37
|
+
#c;
|
|
49
38
|
constructor(c) {
|
|
50
|
-
|
|
51
|
-
_ChatManager_c.set(this, void 0);
|
|
52
|
-
__classPrivateFieldSet(this, _ChatManager_c, c, "f");
|
|
39
|
+
this.#c = c;
|
|
53
40
|
}
|
|
54
41
|
canHandleUpdate(update) {
|
|
55
42
|
return _2_tl_js_1.Api.isOneOf(chatManagerUpdates, update);
|
|
56
43
|
}
|
|
57
44
|
async handleUpdate(update) {
|
|
58
45
|
if (_2_tl_js_1.Api.is("updateChannelParticipant", update) || _2_tl_js_1.Api.is("updateChatParticipant", update)) {
|
|
59
|
-
const chatMember = await (0, _3_types_js_1.constructChatMemberUpdated)(update,
|
|
60
|
-
const selfId = await
|
|
46
|
+
const chatMember = await (0, _3_types_js_1.constructChatMemberUpdated)(update, this.#c.getEntity);
|
|
47
|
+
const selfId = await this.#c.getSelfId();
|
|
61
48
|
if (chatMember.oldChatMember.user.id == selfId) {
|
|
62
49
|
return { myChatMember: chatMember };
|
|
63
50
|
}
|
|
@@ -66,51 +53,56 @@ class ChatManager {
|
|
|
66
53
|
}
|
|
67
54
|
}
|
|
68
55
|
if (_2_tl_js_1.Api.is("updateBotChatInviteRequester", update)) {
|
|
69
|
-
const joinRequest = await (0, _3_types_js_1.constructJoinRequest)(update,
|
|
56
|
+
const joinRequest = await (0, _3_types_js_1.constructJoinRequest)(update, this.#c.getEntity);
|
|
70
57
|
return { joinRequest };
|
|
71
58
|
}
|
|
72
59
|
return null;
|
|
73
60
|
}
|
|
61
|
+
// JOIN REQUESTS //
|
|
62
|
+
async #toggleJoinRequests(chatId, enabled) {
|
|
63
|
+
const channel = await this.#c.getInputChannel(chatId);
|
|
64
|
+
await this.#c.invoke({ _: "channels.toggleJoinRequest", channel, enabled });
|
|
65
|
+
}
|
|
74
66
|
async approveJoinRequest(chatId, userId) {
|
|
75
|
-
await
|
|
67
|
+
await this.#c.invoke({
|
|
76
68
|
_: "messages.hideChatJoinRequest",
|
|
77
|
-
peer: await
|
|
78
|
-
user_id: await
|
|
69
|
+
peer: await this.#c.getInputPeer(chatId),
|
|
70
|
+
user_id: await this.#c.getInputUser(userId),
|
|
79
71
|
approved: true,
|
|
80
72
|
});
|
|
81
73
|
}
|
|
82
74
|
async declineJoinRequest(chatId, userId) {
|
|
83
|
-
await
|
|
75
|
+
await this.#c.invoke({
|
|
84
76
|
_: "messages.hideChatJoinRequest",
|
|
85
|
-
peer: await
|
|
86
|
-
user_id: await
|
|
77
|
+
peer: await this.#c.getInputPeer(chatId),
|
|
78
|
+
user_id: await this.#c.getInputUser(userId),
|
|
87
79
|
});
|
|
88
80
|
}
|
|
89
81
|
async approveJoinRequests(chatId, params) {
|
|
90
|
-
|
|
91
|
-
await
|
|
82
|
+
this.#c.storage.assertUser("approveJoinRequests");
|
|
83
|
+
await this.#c.invoke({
|
|
92
84
|
_: "messages.hideAllChatJoinRequests",
|
|
93
|
-
peer: await
|
|
85
|
+
peer: await this.#c.getInputPeer(chatId),
|
|
94
86
|
approved: true,
|
|
95
87
|
link: params?.inviteLink,
|
|
96
88
|
});
|
|
97
89
|
}
|
|
98
90
|
async declineJoinRequests(chatId, params) {
|
|
99
|
-
|
|
100
|
-
await
|
|
91
|
+
this.#c.storage.assertUser("declineJoinRequests");
|
|
92
|
+
await this.#c.invoke({
|
|
101
93
|
_: "messages.hideAllChatJoinRequests",
|
|
102
|
-
peer: await
|
|
94
|
+
peer: await this.#c.getInputPeer(chatId),
|
|
103
95
|
link: params?.inviteLink,
|
|
104
96
|
});
|
|
105
97
|
}
|
|
106
98
|
async getJoinRequests(chatId, params) {
|
|
107
|
-
|
|
99
|
+
this.#c.storage.assertUser("getJoinRequests");
|
|
108
100
|
if (typeof params?.inviteLink === "string" && typeof params?.search === "string") {
|
|
109
101
|
throw new _0_errors_js_1.InputError("inviteLink and search cannot be specified together.");
|
|
110
102
|
}
|
|
111
|
-
const peer = await
|
|
112
|
-
const offset_user = params?.fromUserId ? await
|
|
113
|
-
const { importers } = await
|
|
103
|
+
const peer = await this.#c.getInputPeer(chatId);
|
|
104
|
+
const offset_user = params?.fromUserId ? await this.#c.getInputUser(params.fromUserId) : { _: "inputUserEmpty" };
|
|
105
|
+
const { importers } = await this.#c.invoke({
|
|
114
106
|
_: "messages.getChatInviteImporters",
|
|
115
107
|
requested: true,
|
|
116
108
|
peer,
|
|
@@ -121,48 +113,48 @@ class ChatManager {
|
|
|
121
113
|
limit: (0, _0_utilities_js_1.getLimit)(params?.limit),
|
|
122
114
|
});
|
|
123
115
|
const peer_ = (0, _2_telegram_js_1.inputPeerToPeer)(peer);
|
|
124
|
-
return await Promise.all(importers.map((v) => (0, _3_types_js_1.constructJoinRequest2)(peer_, v,
|
|
116
|
+
return await Promise.all(importers.map((v) => (0, _3_types_js_1.constructJoinRequest2)(peer_, v, this.#c.getEntity)));
|
|
125
117
|
}
|
|
126
118
|
// INVITE LINKS //
|
|
127
119
|
async createInviteLink(chatId, params) {
|
|
128
120
|
if (params?.requireApproval && params?.limit) {
|
|
129
121
|
throw new _0_errors_js_1.InputError("requireApproval cannot be true while limit is specified.");
|
|
130
122
|
}
|
|
131
|
-
const result = await
|
|
132
|
-
return await (0, _3_types_js_1.constructInviteLink)(_2_tl_js_1.Api.as("chatInviteExported", result),
|
|
123
|
+
const result = await this.#c.invoke({ _: "messages.exportChatInvite", peer: await this.#c.getInputPeer(chatId), title: params?.title, expire_date: params?.expireAt, request_needed: params?.requireApproval ? true : undefined, usage_limit: params?.limit });
|
|
124
|
+
return await (0, _3_types_js_1.constructInviteLink)(_2_tl_js_1.Api.as("chatInviteExported", result), this.#c.getEntity);
|
|
133
125
|
}
|
|
134
126
|
async getCreatedInviteLinks(chatId, params) {
|
|
135
|
-
|
|
136
|
-
const { invites } = await
|
|
137
|
-
return await Promise.all(invites.map((v) => _2_tl_js_1.Api.as("chatInviteExported", v)).map((v) => (0, _3_types_js_1.constructInviteLink)(v,
|
|
127
|
+
this.#c.storage.assertUser("getCreatedInviteLinks");
|
|
128
|
+
const { invites } = await this.#c.invoke({ _: "messages.getExportedChatInvites", peer: await this.#c.getInputPeer(chatId), revoked: params?.revoked ? true : undefined, admin_id: params?.by ? await this.#c.getInputUser(params.by) : { _: "inputUserEmpty" }, limit: (0, _0_utilities_js_1.getLimit)(params?.limit), offset_date: params?.afterDate, offset_link: params?.afterInviteLink });
|
|
129
|
+
return await Promise.all(invites.map((v) => _2_tl_js_1.Api.as("chatInviteExported", v)).map((v) => (0, _3_types_js_1.constructInviteLink)(v, this.#c.getEntity)));
|
|
138
130
|
}
|
|
139
131
|
// JOINING AND LEAVING CHATS //
|
|
140
132
|
async joinChat(chatId) {
|
|
141
|
-
|
|
142
|
-
const peer = await
|
|
133
|
+
this.#c.storage.assertUser("joinChat");
|
|
134
|
+
const peer = await this.#c.getInputPeer(chatId);
|
|
143
135
|
if ((0, _0_utilities_js_1.canBeInputUser)(peer)) {
|
|
144
136
|
throw new _0_errors_js_1.InputError("Cannot join private chats.");
|
|
145
137
|
}
|
|
146
138
|
else if ((0, _0_utilities_js_1.canBeInputChannel)(peer)) {
|
|
147
|
-
await
|
|
139
|
+
await this.#c.invoke({ _: "channels.joinChannel", channel: (0, _0_utilities_js_1.toInputChannel)(peer) });
|
|
148
140
|
}
|
|
149
141
|
else if (_2_tl_js_1.Api.is("inputPeerChat", peer)) {
|
|
150
|
-
await
|
|
142
|
+
await this.#c.invoke({ _: "messages.addChatUser", chat_id: peer.chat_id, user_id: { _: "inputUserSelf" }, fwd_limit: 0 }); // TODO: use potential high-level method for adding participants to chats
|
|
151
143
|
}
|
|
152
144
|
else {
|
|
153
145
|
(0, _0_deps_js_1.unreachable)();
|
|
154
146
|
}
|
|
155
147
|
}
|
|
156
148
|
async leaveChat(chatId) {
|
|
157
|
-
const peer = await
|
|
149
|
+
const peer = await this.#c.getInputPeer(chatId);
|
|
158
150
|
if ((0, _0_utilities_js_1.canBeInputUser)(peer)) {
|
|
159
151
|
throw new _0_errors_js_1.InputError("Cannot leave private chats.");
|
|
160
152
|
}
|
|
161
153
|
else if ((0, _0_utilities_js_1.canBeInputChannel)(peer)) {
|
|
162
|
-
await
|
|
154
|
+
await this.#c.invoke({ _: "channels.leaveChannel", channel: (0, _0_utilities_js_1.toInputChannel)(peer) });
|
|
163
155
|
}
|
|
164
156
|
else if (_2_tl_js_1.Api.is("inputPeerChat", peer)) {
|
|
165
|
-
await
|
|
157
|
+
await this.#c.invoke({ _: "messages.deleteChatUser", chat_id: peer.chat_id, user_id: { _: "inputUserSelf" } }); // TODO: use potential high-level method for adding participants to chats
|
|
166
158
|
}
|
|
167
159
|
else {
|
|
168
160
|
(0, _0_deps_js_1.unreachable)();
|
|
@@ -170,21 +162,21 @@ class ChatManager {
|
|
|
170
162
|
}
|
|
171
163
|
// RESTRICTING, BANNING, AND UNBANNING CHAT MEMBERS //
|
|
172
164
|
async banChatMember(chatId, memberId, params) {
|
|
173
|
-
const chat = await
|
|
165
|
+
const chat = await this.#c.getInputPeer(chatId);
|
|
174
166
|
if (!(_2_tl_js_1.Api.is("inputPeerChannel", chat)) && !(_2_tl_js_1.Api.is("inputPeerChat", chat))) {
|
|
175
167
|
throw new _0_errors_js_1.InputError("Expected a channel, supergroup, or group ID.");
|
|
176
168
|
}
|
|
177
|
-
const member = await
|
|
169
|
+
const member = await this.#c.getInputPeer(memberId);
|
|
178
170
|
if (_2_tl_js_1.Api.is("inputPeerChannel", chat)) {
|
|
179
171
|
if (params?.deleteMessages) {
|
|
180
172
|
try {
|
|
181
|
-
await
|
|
173
|
+
await this.#c.messageManager.deleteChatMemberMessages(chatId, memberId);
|
|
182
174
|
}
|
|
183
175
|
catch {
|
|
184
176
|
//
|
|
185
177
|
}
|
|
186
178
|
}
|
|
187
|
-
await
|
|
179
|
+
await this.#c.invoke({
|
|
188
180
|
_: "channels.editBanned",
|
|
189
181
|
channel: { ...chat, _: "inputChannel" },
|
|
190
182
|
participant: member,
|
|
@@ -206,178 +198,182 @@ class ChatManager {
|
|
|
206
198
|
if (!(0, _0_utilities_js_1.canBeInputUser)(member)) {
|
|
207
199
|
throw new _0_errors_js_1.InputError(`Invalid user ID: ${memberId}`);
|
|
208
200
|
}
|
|
209
|
-
await
|
|
201
|
+
await this.#c.invoke({ _: "messages.deleteChatUser", chat_id: chat.chat_id, user_id: (0, _0_utilities_js_1.toInputUser)(member), revoke_history: params?.deleteMessages ? true : undefined });
|
|
210
202
|
}
|
|
211
203
|
}
|
|
212
204
|
async unbanChatMember(chatId, memberId) {
|
|
213
|
-
const channel = await
|
|
214
|
-
const member = await
|
|
215
|
-
await
|
|
205
|
+
const channel = await this.#c.getInputChannel(chatId);
|
|
206
|
+
const member = await this.#c.getInputPeer(memberId);
|
|
207
|
+
await this.#c.invoke({ _: "channels.editBanned", channel, participant: member, banned_rights: ({ _: "chatBannedRights", until_date: 0 }) });
|
|
216
208
|
}
|
|
217
209
|
async setChatMemberRights(chatId, memberId, params) {
|
|
218
|
-
const channel = await
|
|
219
|
-
const member = await
|
|
220
|
-
await
|
|
210
|
+
const channel = await this.#c.getInputChannel(chatId);
|
|
211
|
+
const member = await this.#c.getInputPeer(memberId);
|
|
212
|
+
await this.#c.invoke({ _: "channels.editBanned", channel, participant: member, banned_rights: (0, _3_types_js_2.chatMemberRightsToTlObject)(params?.rights, params?.until) });
|
|
221
213
|
}
|
|
222
214
|
// CHAT SETTINGS //
|
|
223
215
|
async setAvailableReactions(chatId, availableReactions) {
|
|
224
|
-
await
|
|
216
|
+
await this.#c.invoke({ _: "messages.setChatAvailableReactions", peer: await this.#c.getInputPeer(chatId), available_reactions: availableReactions == "none" ? { _: "chatReactionsNone" } : availableReactions == "all" ? { _: "chatReactionsAll" } : Array.isArray(availableReactions) ? ({ _: "chatReactionsSome", reactions: availableReactions.map((v) => (0, _3_types_js_2.reactionToTlObject)(v)) }) : (0, _0_deps_js_1.unreachable)() });
|
|
225
217
|
}
|
|
226
218
|
async setBoostsRequiredToCircumventRestrictions(chatId, boosts) {
|
|
227
|
-
|
|
228
|
-
const channel = await
|
|
229
|
-
await
|
|
219
|
+
this.#c.storage.assertUser("setBoostsRequiredToCircumventRestrictions");
|
|
220
|
+
const channel = await this.#c.getInputChannel(chatId);
|
|
221
|
+
await this.#c.invoke({ _: "channels.setBoostsToUnblockRestrictions", channel, boosts });
|
|
230
222
|
}
|
|
231
223
|
async enableJoinRequests(chatId) {
|
|
232
|
-
|
|
233
|
-
await
|
|
224
|
+
this.#c.storage.assertUser("enableJoinRequests");
|
|
225
|
+
await this.#toggleJoinRequests(chatId, true);
|
|
234
226
|
}
|
|
235
227
|
async disableJoinRequests(chatId) {
|
|
236
|
-
|
|
237
|
-
await
|
|
228
|
+
this.#c.storage.assertUser("disableJoinRequests");
|
|
229
|
+
await this.#toggleJoinRequests(chatId, false);
|
|
238
230
|
}
|
|
239
231
|
async setChatStickerSet(chatId, setName) {
|
|
240
|
-
const channel = await
|
|
241
|
-
await
|
|
232
|
+
const channel = await this.#c.getInputChannel(chatId);
|
|
233
|
+
await this.#c.invoke({ _: "channels.setStickers", channel, stickerset: { _: "inputStickerSetShortName", short_name: setName } });
|
|
242
234
|
}
|
|
243
235
|
async deleteChatStickerSet(chatId) {
|
|
244
|
-
const channel = await
|
|
245
|
-
await
|
|
236
|
+
const channel = await this.#c.getInputChannel(chatId);
|
|
237
|
+
await this.#c.invoke({ _: "channels.setStickers", channel, stickerset: { _: "inputStickerSetEmpty" } });
|
|
246
238
|
}
|
|
247
239
|
// CHAT PHOTOS //
|
|
248
240
|
async deleteChatPhoto(chatId) {
|
|
249
|
-
const peer = await
|
|
241
|
+
const peer = await this.#c.getInputPeer(chatId);
|
|
250
242
|
if (!((0, _0_utilities_js_1.canBeInputChannel)(peer)) && !(_2_tl_js_1.Api.is("inputPeerChat", peer))) {
|
|
251
243
|
(0, _0_deps_js_1.unreachable)();
|
|
252
244
|
}
|
|
253
245
|
if ((0, _0_utilities_js_1.canBeInputChannel)(peer)) {
|
|
254
|
-
await
|
|
246
|
+
await this.#c.invoke({ _: "channels.editPhoto", channel: (0, _0_utilities_js_1.toInputChannel)(peer), photo: { _: "inputChatPhotoEmpty" } });
|
|
255
247
|
}
|
|
256
248
|
else if (_2_tl_js_1.Api.is("inputPeerChat", peer)) {
|
|
257
|
-
await
|
|
249
|
+
await this.#c.invoke({ _: "messages.editChatPhoto", chat_id: peer.chat_id, photo: { _: "inputChatPhotoEmpty" } });
|
|
258
250
|
}
|
|
259
251
|
}
|
|
260
252
|
async setChatPhoto(chatId, photo, params) {
|
|
261
|
-
const peer = await
|
|
253
|
+
const peer = await this.#c.getInputPeer(chatId);
|
|
262
254
|
if (!((0, _0_utilities_js_1.canBeInputChannel)(peer)) && !(_2_tl_js_1.Api.is("inputPeerChat", peer))) {
|
|
263
255
|
(0, _0_deps_js_1.unreachable)();
|
|
264
256
|
}
|
|
265
|
-
const file = await
|
|
257
|
+
const file = await this.#c.fileManager.upload(photo, params);
|
|
266
258
|
const photo_ = { _: "inputChatUploadedPhoto", file };
|
|
267
259
|
if ((0, _0_utilities_js_1.canBeInputChannel)(peer)) {
|
|
268
|
-
await
|
|
260
|
+
await this.#c.invoke({ _: "channels.editPhoto", channel: (0, _0_utilities_js_1.toInputChannel)(peer), photo: photo_ });
|
|
269
261
|
}
|
|
270
262
|
else if (_2_tl_js_1.Api.is("inputPeerChat", peer)) {
|
|
271
|
-
await
|
|
263
|
+
await this.#c.invoke({ _: "messages.editChatPhoto", chat_id: peer.chat_id, photo: photo_ });
|
|
272
264
|
}
|
|
273
265
|
}
|
|
274
266
|
// INVITING MEMBERS //
|
|
275
267
|
async addChatMember(chatId, userId, params) {
|
|
276
|
-
|
|
277
|
-
const chat = await
|
|
268
|
+
this.#c.storage.assertUser("addChatMember");
|
|
269
|
+
const chat = await this.#c.getInputPeer(chatId);
|
|
278
270
|
if (_2_tl_js_1.Api.isOneOf(["inputPeerEmpty", "inputPeerSelf", "inputPeerUser", "inputPeerUserFromMessage"], chat)) {
|
|
279
271
|
throw new _0_errors_js_1.InputError("Cannot add members to private chats");
|
|
280
272
|
}
|
|
281
|
-
const user = await
|
|
273
|
+
const user = await this.#c.getInputUser(userId);
|
|
282
274
|
if (_2_tl_js_1.Api.is("inputPeerChat", chat)) {
|
|
283
|
-
const result = await
|
|
275
|
+
const result = await this.#c.invoke({ _: "messages.addChatUser", chat_id: chat.chat_id, user_id: user, fwd_limit: params?.historyLimit ?? 0 });
|
|
284
276
|
return result.missing_invitees.map(_3_types_js_1.constructFailedInvitation);
|
|
285
277
|
}
|
|
286
278
|
else if (_2_tl_js_1.Api.is("inputPeerChannel", chat)) {
|
|
287
|
-
const result = await
|
|
279
|
+
const result = await this.#c.invoke({ _: "channels.inviteToChannel", channel: { ...chat, _: "inputChannel" }, users: [user] });
|
|
288
280
|
return result.missing_invitees.map(_3_types_js_1.constructFailedInvitation);
|
|
289
281
|
}
|
|
290
282
|
(0, _0_deps_js_1.unreachable)();
|
|
291
283
|
}
|
|
292
284
|
async addChatMembers(chatId, userIds) {
|
|
293
|
-
|
|
294
|
-
const chat = await
|
|
285
|
+
this.#c.storage.assertUser("addChatMembers");
|
|
286
|
+
const chat = await this.#c.getInputPeer(chatId);
|
|
295
287
|
if (_2_tl_js_1.Api.isOneOf(["inputPeerEmpty", "inputPeerSelf", "inputPeerUser", "inputPeerUserFromMessage"], chat)) {
|
|
296
288
|
throw new _0_errors_js_1.InputError("Cannot add members to private chats");
|
|
297
289
|
}
|
|
298
290
|
const users = new Array();
|
|
299
291
|
for (const userId of userIds) {
|
|
300
|
-
users.push(await
|
|
292
|
+
users.push(await this.#c.getInputUser(userId));
|
|
301
293
|
}
|
|
302
294
|
if (_2_tl_js_1.Api.is("inputPeerChat", chat)) {
|
|
303
295
|
throw new _0_errors_js_1.InputError("addChatMembers cannot be used with basic groups");
|
|
304
296
|
}
|
|
305
297
|
else if ((0, _0_utilities_js_1.canBeInputChannel)(chat)) {
|
|
306
|
-
const result = await
|
|
298
|
+
const result = await this.#c.invoke({ _: "channels.inviteToChannel", channel: (0, _0_utilities_js_1.toInputChannel)(chat), users });
|
|
307
299
|
return result.missing_invitees.map(_3_types_js_1.constructFailedInvitation);
|
|
308
300
|
}
|
|
309
301
|
(0, _0_deps_js_1.unreachable)();
|
|
310
302
|
}
|
|
303
|
+
async #toggleSlowMode(chatId, seconds) {
|
|
304
|
+
const channel = await this.#c.getInputChannel(chatId);
|
|
305
|
+
await this.#c.invoke({ _: "channels.toggleSlowMode", channel, seconds });
|
|
306
|
+
}
|
|
311
307
|
async disableSlowMode(chatId) {
|
|
312
|
-
|
|
313
|
-
await
|
|
308
|
+
this.#c.storage.assertUser("disableSlowMode");
|
|
309
|
+
await this.#toggleSlowMode(chatId, 0);
|
|
314
310
|
}
|
|
315
311
|
async setSlowMode(chatId, duration) {
|
|
316
|
-
|
|
312
|
+
this.#c.storage.assertUser("setSlowMode");
|
|
317
313
|
const seconds = (0, _3_types_js_1.slowModeDurationToSeconds)(duration);
|
|
318
314
|
if (seconds > 1) {
|
|
319
315
|
throw new _0_errors_js_1.InputError("Invalid slow mode duration.");
|
|
320
316
|
}
|
|
321
|
-
await
|
|
317
|
+
await this.#toggleSlowMode(chatId, seconds);
|
|
322
318
|
}
|
|
323
319
|
async setChatTitle(chatId, title) {
|
|
324
|
-
const peer = await
|
|
320
|
+
const peer = await this.#c.getInputPeer(chatId);
|
|
325
321
|
if (_2_tl_js_1.Api.is("inputPeerChat", peer)) {
|
|
326
|
-
await
|
|
322
|
+
await this.#c.invoke({ _: "messages.editChatTitle", chat_id: peer.chat_id, title });
|
|
327
323
|
}
|
|
328
324
|
else if ((0, _0_utilities_js_1.canBeInputChannel)(peer)) {
|
|
329
325
|
const channel = (0, _0_utilities_js_1.toInputChannel)(peer);
|
|
330
|
-
await
|
|
326
|
+
await this.#c.invoke({ _: "channels.editTitle", channel, title });
|
|
331
327
|
}
|
|
332
328
|
else {
|
|
333
329
|
throw new _0_errors_js_1.InputError("A chat or channel identifier was expected.");
|
|
334
330
|
}
|
|
335
331
|
}
|
|
336
332
|
async setChatDescription(chatId, description) {
|
|
337
|
-
const peer = await
|
|
333
|
+
const peer = await this.#c.getInputPeer(chatId);
|
|
338
334
|
if ((0, _0_utilities_js_1.canBeInputUser)(peer)) {
|
|
339
335
|
throw new _0_errors_js_1.InputError("A chat or channel identifier was expected.");
|
|
340
336
|
}
|
|
341
|
-
await
|
|
337
|
+
await this.#c.invoke({ _: "messages.editChatAbout", peer, about: description });
|
|
342
338
|
}
|
|
343
339
|
async setMemberListVisibility(chatId, visible) {
|
|
344
|
-
|
|
345
|
-
const channel = await
|
|
340
|
+
this.#c.storage.assertUser("setMemberListVisible");
|
|
341
|
+
const channel = await this.#c.getInputChannel(chatId);
|
|
346
342
|
const enabled = !visible;
|
|
347
|
-
await
|
|
343
|
+
await this.#c.invoke({ _: "channels.toggleParticipantsHidden", channel, enabled });
|
|
348
344
|
}
|
|
349
345
|
async setTopicsEnabled(chatId, enabled) {
|
|
350
|
-
|
|
351
|
-
const channel = await
|
|
352
|
-
await
|
|
346
|
+
this.#c.storage.assertUser("setTopicsEnabled");
|
|
347
|
+
const channel = await this.#c.getInputChannel(chatId);
|
|
348
|
+
await this.#c.invoke({ _: "channels.toggleForum", channel, enabled });
|
|
353
349
|
}
|
|
354
350
|
async setAntispamEnabled(chatId, enabled) {
|
|
355
|
-
|
|
356
|
-
const channel = await
|
|
357
|
-
await
|
|
351
|
+
this.#c.storage.assertUser("setTopicsEnabled");
|
|
352
|
+
const channel = await this.#c.getInputChannel(chatId);
|
|
353
|
+
await this.#c.invoke({ _: "channels.toggleAntiSpam", channel, enabled });
|
|
358
354
|
}
|
|
359
355
|
async setSignaturesEnabled(chatId, enabled, params) {
|
|
360
|
-
|
|
361
|
-
const channel = await
|
|
362
|
-
await
|
|
356
|
+
this.#c.storage.assertUser("setSignaturesEnabled");
|
|
357
|
+
const channel = await this.#c.getInputChannel(chatId);
|
|
358
|
+
await this.#c.invoke({ _: "channels.toggleSignatures", channel, signatures_enabled: enabled ? true : undefined, profiles_enabled: params?.showAuthorProfile ? true : undefined });
|
|
363
359
|
}
|
|
364
360
|
async deleteChat(chatId) {
|
|
365
|
-
|
|
366
|
-
const peer = await
|
|
361
|
+
this.#c.storage.assertUser("deleteChat");
|
|
362
|
+
const peer = await this.#c.getInputPeer(chatId);
|
|
367
363
|
if (_2_tl_js_1.Api.is("inputPeerChat", peer)) {
|
|
368
|
-
await
|
|
364
|
+
await this.#c.invoke({ _: "messages.deleteChat", chat_id: peer.chat_id });
|
|
369
365
|
}
|
|
370
366
|
else if ((0, _0_utilities_js_1.canBeInputChannel)(peer)) {
|
|
371
367
|
const channel = (0, _0_utilities_js_1.toInputChannel)(peer);
|
|
372
|
-
await
|
|
368
|
+
await this.#c.invoke({ _: "channels.deleteChannel", channel });
|
|
373
369
|
}
|
|
374
370
|
else {
|
|
375
371
|
throw new _0_errors_js_1.InputError("A chat or channel identifier was expected.");
|
|
376
372
|
}
|
|
377
373
|
}
|
|
378
374
|
async getDiscussionChatSuggestions() {
|
|
379
|
-
|
|
380
|
-
const { chats } = await
|
|
375
|
+
this.#c.storage.assertUser("getDiscussionChatSuggestions");
|
|
376
|
+
const { chats } = await this.#c.invoke({ _: "channels.getGroupsForDiscussion" });
|
|
381
377
|
return chats
|
|
382
378
|
.map((v) => {
|
|
383
379
|
if (!_2_tl_js_1.Api.isOneOf(["chat", "channel"], v)) {
|
|
@@ -390,30 +386,21 @@ class ChatManager {
|
|
|
390
386
|
.filter((v) => v != null);
|
|
391
387
|
}
|
|
392
388
|
async setDiscussionChat(chatId, discussionChatId) {
|
|
393
|
-
|
|
394
|
-
const [broadcast, group] = await Promise.all([
|
|
395
|
-
await
|
|
389
|
+
this.#c.storage.assertUser("setDiscussionChat");
|
|
390
|
+
const [broadcast, group] = await Promise.all([this.#c.getInputChannel(chatId), this.#c.getInputChannel(discussionChatId)]);
|
|
391
|
+
await this.#c.invoke({ _: "channels.setDiscussionGroup", broadcast, group });
|
|
396
392
|
}
|
|
397
393
|
async transferChatOwnership(chatId, userId, password) {
|
|
398
|
-
|
|
399
|
-
const user_id = await
|
|
394
|
+
this.#c.storage.assertUser("transferChat");
|
|
395
|
+
const user_id = await this.#c.getInputUser(userId);
|
|
400
396
|
const isSelf = _2_tl_js_1.Api.is("inputUserSelf", user_id);
|
|
401
|
-
if (isSelf || _2_tl_js_1.Api.peerToChatId(user_id) == await
|
|
397
|
+
if (isSelf || _2_tl_js_1.Api.peerToChatId(user_id) == await this.#c.getSelfId()) {
|
|
402
398
|
throw new _0_errors_js_1.InputError("A user ID except that of the current one was expected.");
|
|
403
399
|
}
|
|
404
|
-
const channel = await
|
|
405
|
-
const ap = await
|
|
400
|
+
const channel = await this.#c.getInputChannel(chatId);
|
|
401
|
+
const ap = await this.#c.invoke({ _: "account.getPassword" });
|
|
406
402
|
const password_ = await (0, _0_password_js_1.checkPassword)(password, ap);
|
|
407
|
-
await
|
|
403
|
+
await this.#c.invoke({ _: "channels.editCreator", channel, user_id, password: password_ });
|
|
408
404
|
}
|
|
409
405
|
}
|
|
410
406
|
exports.ChatManager = ChatManager;
|
|
411
|
-
_ChatManager_c = new WeakMap(), _ChatManager_instances = new WeakSet(), _ChatManager_toggleJoinRequests =
|
|
412
|
-
// JOIN REQUESTS //
|
|
413
|
-
async function _ChatManager_toggleJoinRequests(chatId, enabled) {
|
|
414
|
-
const channel = await __classPrivateFieldGet(this, _ChatManager_c, "f").getInputChannel(chatId);
|
|
415
|
-
await __classPrivateFieldGet(this, _ChatManager_c, "f").invoke({ _: "channels.toggleJoinRequest", channel, enabled });
|
|
416
|
-
}, _ChatManager_toggleSlowMode = async function _ChatManager_toggleSlowMode(chatId, seconds) {
|
|
417
|
-
const channel = await __classPrivateFieldGet(this, _ChatManager_c, "f").getInputChannel(chatId);
|
|
418
|
-
await __classPrivateFieldGet(this, _ChatManager_c, "f").invoke({ _: "channels.toggleSlowMode", channel, seconds });
|
|
419
|
-
};
|