@mtkruto/node 0.1.800 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/0_deps.d.ts +2 -0
- package/esm/0_deps.d.ts.map +1 -1
- package/esm/0_deps.js +2 -1
- package/esm/2_tl.d.ts +7 -8
- package/esm/2_tl.d.ts.map +1 -1
- package/esm/2_tl.js +7 -8
- package/esm/3_errors.d.ts +519 -515
- package/esm/3_errors.d.ts.map +1 -1
- package/esm/3_errors.js +527 -512
- package/esm/3_transport.d.ts +1 -0
- package/esm/3_transport.d.ts.map +1 -1
- package/esm/3_transport.js +1 -0
- package/esm/4_errors.d.ts +7 -7
- package/esm/4_errors.d.ts.map +1 -1
- package/esm/4_errors.js +5 -5
- package/esm/client/0_client_abstract.d.ts +1 -21
- package/esm/client/0_client_abstract.d.ts.map +1 -1
- package/esm/client/0_client_abstract.js +17 -15
- package/esm/client/0_message.d.ts +3 -3
- package/esm/client/0_message.d.ts.map +1 -1
- package/esm/client/0_message.js +4 -20
- package/esm/client/0_params.d.ts +1 -1
- package/esm/client/0_params.d.ts.map +1 -1
- package/esm/client/0_password.d.ts +2 -2
- package/esm/client/0_password.d.ts.map +1 -1
- package/esm/client/0_password.js +3 -8
- package/esm/client/0_storage_operations.d.ts +23 -23
- package/esm/client/0_storage_operations.d.ts.map +1 -1
- package/esm/client/0_storage_operations.js +13 -12
- package/esm/client/0_utilities.d.ts.map +1 -1
- package/esm/client/0_utilities.js +13 -10
- package/esm/client/1_client_encrypted.d.ts +3 -5
- package/esm/client/1_client_encrypted.d.ts.map +1 -1
- package/esm/client/1_client_encrypted.js +44 -28
- package/esm/client/1_client_plain.d.ts +2 -2
- package/esm/client/1_client_plain.d.ts.map +1 -1
- package/esm/client/1_client_plain.js +27 -19
- package/esm/client/1_types.d.ts +9 -22
- package/esm/client/1_types.d.ts.map +1 -1
- package/esm/client/2_account_manager.d.ts +2 -2
- package/esm/client/2_account_manager.js +16 -16
- package/esm/client/2_bot_info_manager.d.ts.map +1 -1
- package/esm/client/2_bot_info_manager.js +7 -6
- package/esm/client/2_business_connection_manager.d.ts +3 -3
- package/esm/client/2_business_connection_manager.d.ts.map +1 -1
- package/esm/client/2_business_connection_manager.js +6 -5
- package/esm/client/2_file_manager.d.ts +4 -4
- package/esm/client/2_file_manager.d.ts.map +1 -1
- package/esm/client/2_file_manager.js +26 -23
- package/esm/client/2_reaction_manager.d.ts +3 -3
- package/esm/client/2_reaction_manager.d.ts.map +1 -1
- package/esm/client/2_reaction_manager.js +16 -10
- package/esm/client/2_update_manager.d.ts +11 -11
- package/esm/client/2_update_manager.d.ts.map +1 -1
- package/esm/client/2_update_manager.js +185 -164
- package/esm/client/3_message_manager.d.ts +8 -9
- package/esm/client/3_message_manager.d.ts.map +1 -1
- package/esm/client/3_message_manager.js +205 -474
- package/esm/client/3_video_chat_manager.d.ts +3 -3
- package/esm/client/3_video_chat_manager.d.ts.map +1 -1
- package/esm/client/3_video_chat_manager.js +26 -36
- package/esm/client/4_callback_query_manager.d.ts +3 -3
- package/esm/client/4_callback_query_manager.d.ts.map +1 -1
- package/esm/client/4_callback_query_manager.js +5 -16
- package/esm/client/4_chat_list_manager.d.ts +5 -4
- package/esm/client/4_chat_list_manager.d.ts.map +1 -1
- package/esm/client/4_chat_list_manager.js +56 -34
- package/esm/client/4_inline_query_manager.d.ts +3 -3
- package/esm/client/4_inline_query_manager.d.ts.map +1 -1
- package/esm/client/4_inline_query_manager.js +6 -15
- package/esm/client/4_story_manager.d.ts +3 -3
- package/esm/client/4_story_manager.d.ts.map +1 -1
- package/esm/client/4_story_manager.js +15 -32
- package/esm/client/5_client.d.ts +10 -12
- package/esm/client/5_client.d.ts.map +1 -1
- package/esm/client/5_client.js +60 -114
- package/esm/{tl/7_message.d.ts → connection/1_connection_tcp.d.ts} +14 -12
- package/esm/connection/1_connection_tcp.d.ts.map +1 -0
- package/esm/connection/1_connection_tcp.js +169 -0
- package/esm/deps/deno.land/std@0.224.0/io/_constants.d.ts +3 -0
- package/esm/deps/deno.land/std@0.224.0/io/_constants.d.ts.map +1 -0
- package/esm/deps/deno.land/std@0.224.0/io/_constants.js +4 -0
- package/esm/deps/deno.land/std@0.224.0/io/iterate_reader.d.ts +70 -0
- package/esm/deps/deno.land/std@0.224.0/io/iterate_reader.d.ts.map +1 -0
- package/esm/deps/deno.land/std@0.224.0/io/iterate_reader.js +86 -0
- package/esm/deps/deno.land/std@0.224.0/io/types.d.ts +95 -0
- package/esm/deps/deno.land/std@0.224.0/io/types.d.ts.map +1 -0
- package/esm/deps/deno.land/std@0.224.0/io/types.js +3 -0
- package/esm/deps/deno.land/std@0.224.0/io/write_all.d.ts +39 -0
- package/esm/deps/deno.land/std@0.224.0/io/write_all.d.ts.map +1 -0
- package/esm/deps/deno.land/std@0.224.0/io/write_all.js +49 -0
- package/esm/deps/raw.githubusercontent.com/MTKruto/socks5/main/client.d.ts +45 -0
- package/esm/deps/raw.githubusercontent.com/MTKruto/socks5/main/client.d.ts.map +1 -0
- package/esm/deps/raw.githubusercontent.com/MTKruto/socks5/main/client.js +253 -0
- package/esm/deps/raw.githubusercontent.com/MTKruto/socks5/main/deps.d.ts +3 -0
- package/esm/deps/raw.githubusercontent.com/MTKruto/socks5/main/deps.d.ts.map +1 -0
- package/esm/deps/raw.githubusercontent.com/MTKruto/socks5/main/deps.js +1 -0
- package/esm/deps/raw.githubusercontent.com/MTKruto/socks5/main/utils.d.ts +3 -0
- package/esm/deps/raw.githubusercontent.com/MTKruto/socks5/main/utils.d.ts.map +1 -0
- package/esm/deps/raw.githubusercontent.com/MTKruto/socks5/main/utils.js +13 -0
- package/esm/mod.d.ts +0 -1
- package/esm/mod.d.ts.map +1 -1
- package/esm/mod.js +0 -1
- package/esm/tl/0_api.d.ts +14813 -0
- package/esm/tl/0_api.d.ts.map +1 -0
- package/esm/tl/0_api.js +23222 -0
- package/esm/tl/1_utilities.d.ts +32 -0
- package/esm/tl/1_utilities.d.ts.map +1 -0
- package/esm/tl/1_utilities.js +65 -0
- package/esm/tl/1_utilities_test.d.ts.map +1 -0
- package/esm/tl/2_deserialize.d.ts +23 -0
- package/esm/tl/2_deserialize.d.ts.map +1 -0
- package/esm/tl/{3_deserialize.js → 2_deserialize.js} +16 -17
- package/esm/tl/2_serialize.d.ts +22 -0
- package/esm/tl/2_serialize.d.ts.map +1 -0
- package/esm/tl/2_serialize.js +160 -0
- package/esm/tl/2_serialize_test.d.ts.map +1 -0
- package/esm/tl/{4_tl_reader.d.ts → 3_tl_reader.d.ts} +3 -3
- package/esm/tl/3_tl_reader.d.ts.map +1 -0
- package/esm/tl/{4_tl_reader.js → 3_tl_reader.js} +5 -5
- package/esm/tl/3_utilities.d.ts +5 -5
- package/esm/tl/3_utilities.d.ts.map +1 -1
- package/esm/tl/3_utilities.js +9 -10
- package/esm/tl/4_rpc_result.d.ts +27 -0
- package/esm/tl/4_rpc_result.d.ts.map +1 -0
- package/esm/tl/4_rpc_result.js +28 -0
- package/{script/tl/5_tl_writer.d.ts → esm/tl/4_tl_writer.d.ts} +2 -2
- package/esm/tl/4_tl_writer.d.ts.map +1 -0
- package/esm/tl/{5_tl_writer.js → 4_tl_writer.js} +4 -4
- package/esm/tl/5_message.d.ts +39 -0
- package/esm/tl/5_message.d.ts.map +1 -0
- package/esm/tl/5_message.js +98 -0
- package/esm/tl/5_message_test.d.ts.map +1 -0
- package/esm/transport/3_transport_provider_tcp.d.ts +14 -0
- package/esm/transport/3_transport_provider_tcp.d.ts.map +1 -0
- package/esm/transport/3_transport_provider_tcp.js +15 -0
- package/esm/types/0_birthday.d.ts +2 -2
- package/esm/types/0_birthday.d.ts.map +1 -1
- package/esm/types/0_callback_query_answer.d.ts +2 -2
- package/esm/types/0_callback_query_answer.d.ts.map +1 -1
- package/esm/types/0_chat_administrator_rights.d.ts +3 -3
- package/esm/types/0_chat_administrator_rights.d.ts.map +1 -1
- package/esm/types/0_chat_administrator_rights.js +1 -11
- package/esm/types/0_chat_member_rights.d.ts +3 -3
- package/esm/types/0_chat_member_rights.d.ts.map +1 -1
- package/esm/types/0_chat_member_rights.js +3 -3
- package/esm/types/0_chat_photo.d.ts +2 -2
- package/esm/types/0_chat_photo.d.ts.map +1 -1
- package/esm/types/0_chat_photo.js +2 -2
- package/esm/types/0_contact.d.ts +2 -2
- package/esm/types/0_contact.d.ts.map +1 -1
- package/esm/types/0_dice.d.ts +2 -2
- package/esm/types/0_dice.d.ts.map +1 -1
- package/esm/types/0_giveaway_parameters.d.ts +2 -2
- package/esm/types/0_giveaway_parameters.d.ts.map +1 -1
- package/esm/types/0_giveaway_parameters.js +3 -3
- package/esm/types/0_link_preview.d.ts +2 -2
- package/esm/types/0_link_preview.d.ts.map +1 -1
- package/esm/types/0_live_stream_channel.d.ts +2 -2
- package/esm/types/0_live_stream_channel.d.ts.map +1 -1
- package/esm/types/0_location.d.ts +2 -2
- package/esm/types/0_location.d.ts.map +1 -1
- package/esm/types/0_location.js +5 -5
- package/esm/types/0_mask_position.d.ts +2 -2
- package/esm/types/0_mask_position.d.ts.map +1 -1
- package/esm/types/0_message_entity.d.ts +3 -3
- package/esm/types/0_message_entity.d.ts.map +1 -1
- package/esm/types/0_message_entity.js +42 -42
- package/esm/types/0_message_search_filter.d.ts +2 -2
- package/esm/types/0_message_search_filter.d.ts.map +1 -1
- package/esm/types/0_message_search_filter.js +14 -15
- package/esm/types/0_opening_hours.d.ts +2 -2
- package/esm/types/0_opening_hours.d.ts.map +1 -1
- package/esm/types/0_poll_option.d.ts +2 -2
- package/esm/types/0_poll_option.d.ts.map +1 -1
- package/esm/types/0_reaction.d.ts +3 -3
- package/esm/types/0_reaction.d.ts.map +1 -1
- package/esm/types/0_reaction.js +4 -4
- package/esm/types/0_restriction_reason.d.ts +2 -2
- package/esm/types/0_restriction_reason.d.ts.map +1 -1
- package/esm/types/0_thumbnail.d.ts +2 -2
- package/esm/types/0_thumbnail.d.ts.map +1 -1
- package/esm/types/0_thumbnail.js +3 -3
- package/esm/types/0_video_chat.d.ts +2 -2
- package/esm/types/0_video_chat.d.ts.map +1 -1
- package/esm/types/0_video_chat.js +2 -2
- package/esm/types/0_voice.d.ts +2 -2
- package/esm/types/0_voice.d.ts.map +1 -1
- package/esm/types/1_animation.d.ts +2 -2
- package/esm/types/1_animation.d.ts.map +1 -1
- package/esm/types/1_animation.js +2 -2
- package/esm/types/1_audio.d.ts +2 -2
- package/esm/types/1_audio.d.ts.map +1 -1
- package/esm/types/1_audio.js +2 -2
- package/esm/types/1_bot_command_scope.d.ts +9 -2
- package/esm/types/1_bot_command_scope.d.ts.map +1 -1
- package/esm/types/1_bot_command_scope.js +9 -9
- package/esm/types/1_chat_p.d.ts +5 -5
- package/esm/types/1_chat_p.d.ts.map +1 -1
- package/esm/types/1_chat_p.js +6 -6
- package/esm/types/1_document.d.ts +2 -2
- package/esm/types/1_document.d.ts.map +1 -1
- package/esm/types/1_document.js +2 -2
- package/esm/types/1_giveaway.d.ts +2 -2
- package/esm/types/1_giveaway.d.ts.map +1 -1
- package/esm/types/1_keyboard_button.d.ts +3 -3
- package/esm/types/1_keyboard_button.d.ts.map +1 -1
- package/esm/types/1_keyboard_button.js +18 -45
- package/esm/types/1_message_reaction.d.ts +2 -2
- package/esm/types/1_message_reaction.d.ts.map +1 -1
- package/esm/types/1_message_reaction.js +5 -5
- package/esm/types/1_photo.d.ts +5 -5
- package/esm/types/1_photo.d.ts.map +1 -1
- package/esm/types/1_photo.js +4 -4
- package/esm/types/1_poll.d.ts +2 -2
- package/esm/types/1_poll.d.ts.map +1 -1
- package/esm/types/1_reaction_count.d.ts +2 -2
- package/esm/types/1_reaction_count.d.ts.map +1 -1
- package/esm/types/1_reply_quote.d.ts +2 -2
- package/esm/types/1_reply_quote.d.ts.map +1 -1
- package/esm/types/1_sticker.d.ts +3 -3
- package/esm/types/1_sticker.d.ts.map +1 -1
- package/esm/types/1_sticker.js +9 -9
- package/esm/types/1_story_privacy.d.ts +3 -3
- package/esm/types/1_story_privacy.d.ts.map +1 -1
- package/esm/types/1_story_privacy.js +14 -14
- package/esm/types/1_story_reaction.d.ts +2 -2
- package/esm/types/1_story_reaction.d.ts.map +1 -1
- package/esm/types/1_user.d.ts +2 -2
- package/esm/types/1_user.d.ts.map +1 -1
- package/esm/types/1_user.js +2 -2
- package/esm/types/1_venue.d.ts +2 -2
- package/esm/types/1_venue.d.ts.map +1 -1
- package/esm/types/1_venue.js +2 -2
- package/esm/types/1_video.d.ts +2 -2
- package/esm/types/1_video.d.ts.map +1 -1
- package/esm/types/1_video.js +2 -2
- package/esm/types/1_video_note.d.ts +2 -2
- package/esm/types/1_video_note.d.ts.map +1 -1
- package/esm/types/1_video_note.js +2 -2
- package/esm/types/2_business_connection.d.ts +2 -2
- package/esm/types/2_business_connection.d.ts.map +1 -1
- package/esm/types/2_business_connection.js +1 -2
- package/esm/types/2_chat.d.ts +2 -2
- package/esm/types/2_chat.d.ts.map +1 -1
- package/esm/types/2_chat.js +11 -11
- package/esm/types/2_chat_member.d.ts +2 -2
- package/esm/types/2_chat_member.d.ts.map +1 -1
- package/esm/types/2_chat_member.js +10 -10
- package/esm/types/2_chosen_inline_result.d.ts +2 -2
- package/esm/types/2_chosen_inline_result.d.ts.map +1 -1
- package/esm/types/2_chosen_inline_result.js +5 -5
- package/esm/types/2_game.d.ts +2 -2
- package/esm/types/2_game.d.ts.map +1 -1
- package/esm/types/2_game.js +4 -4
- package/esm/types/2_inactive_chat.d.ts +2 -2
- package/esm/types/2_inactive_chat.d.ts.map +1 -1
- package/esm/types/2_inactive_chat.js +2 -2
- package/esm/types/2_inline_keyboard_button.d.ts +3 -3
- package/esm/types/2_inline_keyboard_button.d.ts.map +1 -1
- package/esm/types/2_inline_keyboard_button.js +15 -21
- package/esm/types/2_inline_query.d.ts +2 -2
- package/esm/types/2_inline_query.d.ts.map +1 -1
- package/esm/types/2_inline_query.js +8 -8
- package/esm/types/2_invite_link.d.ts +2 -2
- package/esm/types/2_invite_link.d.ts.map +1 -1
- package/esm/types/2_invite_link.js +1 -2
- package/esm/types/2_message_reaction_count.d.ts +2 -2
- package/esm/types/2_message_reaction_count.d.ts.map +1 -1
- package/esm/types/2_message_reactions.d.ts +2 -2
- package/esm/types/2_message_reactions.d.ts.map +1 -1
- package/esm/types/2_message_reactions.js +2 -2
- package/esm/types/2_story_content.d.ts +2 -2
- package/esm/types/2_story_content.d.ts.map +1 -1
- package/esm/types/2_story_content.js +6 -6
- package/esm/types/2_story_interactions.d.ts +2 -2
- package/esm/types/2_story_interactions.d.ts.map +1 -1
- package/esm/types/2_story_interactive_area.d.ts +3 -3
- package/esm/types/2_story_interactive_area.d.ts.map +1 -1
- package/esm/types/2_story_interactive_area.js +19 -29
- package/esm/types/3_chat_member_updated.d.ts +2 -2
- package/esm/types/3_chat_member_updated.d.ts.map +1 -1
- package/esm/types/3_chat_member_updated.js +7 -7
- package/esm/types/3_reply_markup.d.ts +3 -3
- package/esm/types/3_reply_markup.d.ts.map +1 -1
- package/esm/types/3_reply_markup.js +12 -22
- package/esm/types/3_story.d.ts +2 -2
- package/esm/types/3_story.d.ts.map +1 -1
- package/esm/types/4_inline_query_result.d.ts +3 -3
- package/esm/types/4_inline_query_result.d.ts.map +1 -1
- package/esm/types/4_inline_query_result.js +53 -161
- package/esm/types/4_message.d.ts +3 -3
- package/esm/types/4_message.d.ts.map +1 -1
- package/esm/types/4_message.js +68 -59
- package/esm/types/5_callback_query.d.ts +3 -3
- package/esm/types/5_callback_query.d.ts.map +1 -1
- package/esm/types/5_callback_query.js +5 -5
- package/esm/types/5_chat_list_item.d.ts +3 -3
- package/esm/types/5_chat_list_item.d.ts.map +1 -1
- package/esm/types/5_chat_list_item.js +2 -2
- package/esm/types/5_inline_query_answer.d.ts +2 -2
- package/esm/types/5_inline_query_answer.d.ts.map +1 -1
- package/esm/types/_file_id.d.ts +2 -2
- package/esm/types/_file_id.d.ts.map +1 -1
- package/esm/types/_file_id.js +4 -4
- package/esm/types/_getters.d.ts +7 -7
- package/esm/types/_getters.d.ts.map +1 -1
- package/package.json +1 -1
- package/script/0_deps.d.ts +2 -0
- package/script/0_deps.d.ts.map +1 -1
- package/script/0_deps.js +5 -2
- package/script/2_tl.d.ts +7 -8
- package/script/2_tl.d.ts.map +1 -1
- package/script/2_tl.js +20 -11
- package/script/3_errors.d.ts +519 -515
- package/script/3_errors.d.ts.map +1 -1
- package/script/3_errors.js +543 -514
- package/script/3_transport.d.ts +1 -0
- package/script/3_transport.d.ts.map +1 -1
- package/script/3_transport.js +1 -0
- package/script/4_errors.d.ts +7 -7
- package/script/4_errors.d.ts.map +1 -1
- package/script/4_errors.js +6 -6
- package/script/client/0_client_abstract.d.ts +1 -21
- package/script/client/0_client_abstract.d.ts.map +1 -1
- package/script/client/0_client_abstract.js +41 -16
- package/script/client/0_message.d.ts +3 -3
- package/script/client/0_message.d.ts.map +1 -1
- package/script/client/0_message.js +3 -19
- package/script/client/0_params.d.ts +1 -1
- package/script/client/0_params.d.ts.map +1 -1
- package/script/client/0_password.d.ts +2 -2
- package/script/client/0_password.d.ts.map +1 -1
- package/script/client/0_password.js +2 -7
- package/script/client/0_storage_operations.d.ts +23 -23
- package/script/client/0_storage_operations.d.ts.map +1 -1
- package/script/client/0_storage_operations.js +12 -11
- package/script/client/0_utilities.d.ts.map +1 -1
- package/script/client/0_utilities.js +12 -9
- package/script/client/1_client_encrypted.d.ts +3 -5
- package/script/client/1_client_encrypted.d.ts.map +1 -1
- package/script/client/1_client_encrypted.js +42 -26
- package/script/client/1_client_plain.d.ts +2 -2
- package/script/client/1_client_plain.d.ts.map +1 -1
- package/script/client/1_client_plain.js +25 -17
- package/script/client/1_types.d.ts +9 -22
- package/script/client/1_types.d.ts.map +1 -1
- package/script/client/2_account_manager.d.ts +2 -2
- package/script/client/2_account_manager.js +15 -15
- package/script/client/2_bot_info_manager.d.ts.map +1 -1
- package/script/client/2_bot_info_manager.js +7 -6
- package/script/client/2_business_connection_manager.d.ts +3 -3
- package/script/client/2_business_connection_manager.d.ts.map +1 -1
- package/script/client/2_business_connection_manager.js +5 -4
- package/script/client/2_file_manager.d.ts +4 -4
- package/script/client/2_file_manager.d.ts.map +1 -1
- package/script/client/2_file_manager.js +25 -22
- package/script/client/2_reaction_manager.d.ts +3 -3
- package/script/client/2_reaction_manager.d.ts.map +1 -1
- package/script/client/2_reaction_manager.js +15 -9
- package/script/client/2_update_manager.d.ts +11 -11
- package/script/client/2_update_manager.d.ts.map +1 -1
- package/script/client/2_update_manager.js +183 -162
- package/script/client/3_message_manager.d.ts +8 -9
- package/script/client/3_message_manager.d.ts.map +1 -1
- package/script/client/3_message_manager.js +204 -473
- package/script/client/3_video_chat_manager.d.ts +3 -3
- package/script/client/3_video_chat_manager.d.ts.map +1 -1
- package/script/client/3_video_chat_manager.js +25 -35
- package/script/client/4_callback_query_manager.d.ts +3 -3
- package/script/client/4_callback_query_manager.d.ts.map +1 -1
- package/script/client/4_callback_query_manager.js +4 -15
- package/script/client/4_chat_list_manager.d.ts +5 -4
- package/script/client/4_chat_list_manager.d.ts.map +1 -1
- package/script/client/4_chat_list_manager.js +54 -32
- package/script/client/4_inline_query_manager.d.ts +3 -3
- package/script/client/4_inline_query_manager.d.ts.map +1 -1
- package/script/client/4_inline_query_manager.js +5 -14
- package/script/client/4_story_manager.d.ts +3 -3
- package/script/client/4_story_manager.d.ts.map +1 -1
- package/script/client/4_story_manager.js +14 -31
- package/script/client/5_client.d.ts +10 -12
- package/script/client/5_client.d.ts.map +1 -1
- package/script/client/5_client.js +59 -113
- package/{esm/tl/6_rpc_result.d.ts → script/connection/1_connection_tcp.d.ts} +14 -10
- package/script/connection/1_connection_tcp.d.ts.map +1 -0
- package/script/connection/1_connection_tcp.js +196 -0
- package/script/deps/deno.land/std@0.224.0/io/_constants.d.ts +3 -0
- package/script/deps/deno.land/std@0.224.0/io/_constants.d.ts.map +1 -0
- package/script/deps/deno.land/std@0.224.0/io/_constants.js +7 -0
- package/script/deps/deno.land/std@0.224.0/io/iterate_reader.d.ts +70 -0
- package/script/deps/deno.land/std@0.224.0/io/iterate_reader.d.ts.map +1 -0
- package/script/deps/deno.land/std@0.224.0/io/iterate_reader.js +91 -0
- package/script/deps/deno.land/std@0.224.0/io/types.d.ts +95 -0
- package/script/deps/deno.land/std@0.224.0/io/types.d.ts.map +1 -0
- package/script/deps/deno.land/std@0.224.0/io/types.js +4 -0
- package/script/deps/deno.land/std@0.224.0/io/write_all.d.ts +39 -0
- package/script/deps/deno.land/std@0.224.0/io/write_all.d.ts.map +1 -0
- package/script/deps/deno.land/std@0.224.0/io/write_all.js +54 -0
- package/script/deps/raw.githubusercontent.com/MTKruto/socks5/main/client.d.ts +45 -0
- package/script/deps/raw.githubusercontent.com/MTKruto/socks5/main/client.d.ts.map +1 -0
- package/script/deps/raw.githubusercontent.com/MTKruto/socks5/main/client.js +280 -0
- package/script/deps/raw.githubusercontent.com/MTKruto/socks5/main/deps.d.ts +3 -0
- package/script/deps/raw.githubusercontent.com/MTKruto/socks5/main/deps.d.ts.map +1 -0
- package/script/deps/raw.githubusercontent.com/MTKruto/socks5/main/deps.js +5 -0
- package/script/deps/raw.githubusercontent.com/MTKruto/socks5/main/utils.d.ts +3 -0
- package/script/deps/raw.githubusercontent.com/MTKruto/socks5/main/utils.d.ts.map +1 -0
- package/script/deps/raw.githubusercontent.com/MTKruto/socks5/main/utils.js +40 -0
- package/script/mod.d.ts +0 -1
- package/script/mod.d.ts.map +1 -1
- package/script/mod.js +0 -1
- package/script/tl/0_api.d.ts +14813 -0
- package/script/tl/0_api.d.ts.map +1 -0
- package/script/tl/0_api.js +23248 -0
- package/script/tl/1_utilities.d.ts +32 -0
- package/script/tl/1_utilities.d.ts.map +1 -0
- package/script/tl/1_utilities.js +76 -0
- package/script/tl/1_utilities_test.d.ts.map +1 -0
- package/script/tl/2_deserialize.d.ts +23 -0
- package/script/tl/2_deserialize.d.ts.map +1 -0
- package/script/tl/{3_deserialize.js → 2_deserialize.js} +19 -20
- package/script/tl/2_serialize.d.ts +22 -0
- package/script/tl/2_serialize.d.ts.map +1 -0
- package/script/tl/2_serialize.js +164 -0
- package/script/tl/2_serialize_test.d.ts.map +1 -0
- package/script/tl/{4_tl_reader.d.ts → 3_tl_reader.d.ts} +3 -3
- package/script/tl/3_tl_reader.d.ts.map +1 -0
- package/script/tl/{4_tl_reader.js → 3_tl_reader.js} +5 -5
- package/script/tl/3_utilities.d.ts +5 -5
- package/script/tl/3_utilities.d.ts.map +1 -1
- package/script/tl/3_utilities.js +9 -10
- package/script/tl/4_rpc_result.d.ts +27 -0
- package/script/tl/4_rpc_result.d.ts.map +1 -0
- package/{esm/tl/8_message_container.d.ts → script/tl/4_rpc_result.js} +12 -12
- package/{esm/tl/5_tl_writer.d.ts → script/tl/4_tl_writer.d.ts} +2 -2
- package/script/tl/4_tl_writer.d.ts.map +1 -0
- package/script/tl/{5_tl_writer.js → 4_tl_writer.js} +4 -4
- package/script/tl/5_message.d.ts +39 -0
- package/script/tl/5_message.d.ts.map +1 -0
- package/script/tl/5_message.js +106 -0
- package/script/tl/5_message_test.d.ts.map +1 -0
- package/script/transport/3_transport_provider_tcp.d.ts +14 -0
- package/script/transport/3_transport_provider_tcp.d.ts.map +1 -0
- package/script/transport/3_transport_provider_tcp.js +19 -0
- package/script/types/0_birthday.d.ts +2 -2
- package/script/types/0_birthday.d.ts.map +1 -1
- package/script/types/0_callback_query_answer.d.ts +2 -2
- package/script/types/0_callback_query_answer.d.ts.map +1 -1
- package/script/types/0_chat_administrator_rights.d.ts +3 -3
- package/script/types/0_chat_administrator_rights.d.ts.map +1 -1
- package/script/types/0_chat_administrator_rights.js +1 -11
- package/script/types/0_chat_member_rights.d.ts +3 -3
- package/script/types/0_chat_member_rights.d.ts.map +1 -1
- package/script/types/0_chat_member_rights.js +3 -3
- package/script/types/0_chat_photo.d.ts +2 -2
- package/script/types/0_chat_photo.d.ts.map +1 -1
- package/script/types/0_chat_photo.js +1 -1
- package/script/types/0_contact.d.ts +2 -2
- package/script/types/0_contact.d.ts.map +1 -1
- package/script/types/0_dice.d.ts +2 -2
- package/script/types/0_dice.d.ts.map +1 -1
- package/script/types/0_giveaway_parameters.d.ts +2 -2
- package/script/types/0_giveaway_parameters.d.ts.map +1 -1
- package/script/types/0_giveaway_parameters.js +2 -2
- package/script/types/0_link_preview.d.ts +2 -2
- package/script/types/0_link_preview.d.ts.map +1 -1
- package/script/types/0_live_stream_channel.d.ts +2 -2
- package/script/types/0_live_stream_channel.d.ts.map +1 -1
- package/script/types/0_location.d.ts +2 -2
- package/script/types/0_location.d.ts.map +1 -1
- package/script/types/0_location.js +4 -4
- package/script/types/0_mask_position.d.ts +2 -2
- package/script/types/0_mask_position.d.ts.map +1 -1
- package/script/types/0_message_entity.d.ts +3 -3
- package/script/types/0_message_entity.d.ts.map +1 -1
- package/script/types/0_message_entity.js +41 -41
- package/script/types/0_message_search_filter.d.ts +2 -2
- package/script/types/0_message_search_filter.d.ts.map +1 -1
- package/script/types/0_message_search_filter.js +14 -15
- package/script/types/0_opening_hours.d.ts +2 -2
- package/script/types/0_opening_hours.d.ts.map +1 -1
- package/script/types/0_poll_option.d.ts +2 -2
- package/script/types/0_poll_option.d.ts.map +1 -1
- package/script/types/0_reaction.d.ts +3 -3
- package/script/types/0_reaction.d.ts.map +1 -1
- package/script/types/0_reaction.js +3 -3
- package/script/types/0_restriction_reason.d.ts +2 -2
- package/script/types/0_restriction_reason.d.ts.map +1 -1
- package/script/types/0_thumbnail.d.ts +2 -2
- package/script/types/0_thumbnail.d.ts.map +1 -1
- package/script/types/0_thumbnail.js +2 -2
- package/script/types/0_video_chat.d.ts +2 -2
- package/script/types/0_video_chat.d.ts.map +1 -1
- package/script/types/0_video_chat.js +1 -1
- package/script/types/0_voice.d.ts +2 -2
- package/script/types/0_voice.d.ts.map +1 -1
- package/script/types/1_animation.d.ts +2 -2
- package/script/types/1_animation.d.ts.map +1 -1
- package/script/types/1_animation.js +1 -1
- package/script/types/1_audio.d.ts +2 -2
- package/script/types/1_audio.d.ts.map +1 -1
- package/script/types/1_audio.js +1 -1
- package/script/types/1_bot_command_scope.d.ts +9 -2
- package/script/types/1_bot_command_scope.d.ts.map +1 -1
- package/script/types/1_bot_command_scope.js +8 -8
- package/script/types/1_chat_p.d.ts +5 -5
- package/script/types/1_chat_p.d.ts.map +1 -1
- package/script/types/1_chat_p.js +5 -5
- package/script/types/1_document.d.ts +2 -2
- package/script/types/1_document.d.ts.map +1 -1
- package/script/types/1_document.js +1 -1
- package/script/types/1_giveaway.d.ts +2 -2
- package/script/types/1_giveaway.d.ts.map +1 -1
- package/script/types/1_keyboard_button.d.ts +3 -3
- package/script/types/1_keyboard_button.d.ts.map +1 -1
- package/script/types/1_keyboard_button.js +17 -44
- package/script/types/1_message_reaction.d.ts +2 -2
- package/script/types/1_message_reaction.d.ts.map +1 -1
- package/script/types/1_message_reaction.js +4 -4
- package/script/types/1_photo.d.ts +5 -5
- package/script/types/1_photo.d.ts.map +1 -1
- package/script/types/1_photo.js +3 -3
- package/script/types/1_poll.d.ts +2 -2
- package/script/types/1_poll.d.ts.map +1 -1
- package/script/types/1_reaction_count.d.ts +2 -2
- package/script/types/1_reaction_count.d.ts.map +1 -1
- package/script/types/1_reply_quote.d.ts +2 -2
- package/script/types/1_reply_quote.d.ts.map +1 -1
- package/script/types/1_sticker.d.ts +3 -3
- package/script/types/1_sticker.d.ts.map +1 -1
- package/script/types/1_sticker.js +8 -8
- package/script/types/1_story_privacy.d.ts +3 -3
- package/script/types/1_story_privacy.d.ts.map +1 -1
- package/script/types/1_story_privacy.js +13 -13
- package/script/types/1_story_reaction.d.ts +2 -2
- package/script/types/1_story_reaction.d.ts.map +1 -1
- package/script/types/1_user.d.ts +2 -2
- package/script/types/1_user.d.ts.map +1 -1
- package/script/types/1_user.js +1 -1
- package/script/types/1_venue.d.ts +2 -2
- package/script/types/1_venue.d.ts.map +1 -1
- package/script/types/1_venue.js +1 -1
- package/script/types/1_video.d.ts +2 -2
- package/script/types/1_video.d.ts.map +1 -1
- package/script/types/1_video.js +1 -1
- package/script/types/1_video_note.d.ts +2 -2
- package/script/types/1_video_note.d.ts.map +1 -1
- package/script/types/1_video_note.js +1 -1
- package/script/types/2_business_connection.d.ts +2 -2
- package/script/types/2_business_connection.d.ts.map +1 -1
- package/script/types/2_business_connection.js +1 -2
- package/script/types/2_chat.d.ts +2 -2
- package/script/types/2_chat.d.ts.map +1 -1
- package/script/types/2_chat.js +10 -10
- package/script/types/2_chat_member.d.ts +2 -2
- package/script/types/2_chat_member.d.ts.map +1 -1
- package/script/types/2_chat_member.js +9 -9
- package/script/types/2_chosen_inline_result.d.ts +2 -2
- package/script/types/2_chosen_inline_result.d.ts.map +1 -1
- package/script/types/2_chosen_inline_result.js +4 -4
- package/script/types/2_game.d.ts +2 -2
- package/script/types/2_game.d.ts.map +1 -1
- package/script/types/2_game.js +3 -3
- package/script/types/2_inactive_chat.d.ts +2 -2
- package/script/types/2_inactive_chat.d.ts.map +1 -1
- package/script/types/2_inactive_chat.js +1 -1
- package/script/types/2_inline_keyboard_button.d.ts +3 -3
- package/script/types/2_inline_keyboard_button.d.ts.map +1 -1
- package/script/types/2_inline_keyboard_button.js +14 -20
- package/script/types/2_inline_query.d.ts +2 -2
- package/script/types/2_inline_query.d.ts.map +1 -1
- package/script/types/2_inline_query.js +7 -7
- package/script/types/2_invite_link.d.ts +2 -2
- package/script/types/2_invite_link.d.ts.map +1 -1
- package/script/types/2_invite_link.js +1 -2
- package/script/types/2_message_reaction_count.d.ts +2 -2
- package/script/types/2_message_reaction_count.d.ts.map +1 -1
- package/script/types/2_message_reactions.d.ts +2 -2
- package/script/types/2_message_reactions.d.ts.map +1 -1
- package/script/types/2_message_reactions.js +1 -1
- package/script/types/2_story_content.d.ts +2 -2
- package/script/types/2_story_content.d.ts.map +1 -1
- package/script/types/2_story_content.js +5 -5
- package/script/types/2_story_interactions.d.ts +2 -2
- package/script/types/2_story_interactions.d.ts.map +1 -1
- package/script/types/2_story_interactive_area.d.ts +3 -3
- package/script/types/2_story_interactive_area.d.ts.map +1 -1
- package/script/types/2_story_interactive_area.js +18 -28
- package/script/types/3_chat_member_updated.d.ts +2 -2
- package/script/types/3_chat_member_updated.d.ts.map +1 -1
- package/script/types/3_chat_member_updated.js +6 -6
- package/script/types/3_reply_markup.d.ts +3 -3
- package/script/types/3_reply_markup.d.ts.map +1 -1
- package/script/types/3_reply_markup.js +11 -21
- package/script/types/3_story.d.ts +2 -2
- package/script/types/3_story.d.ts.map +1 -1
- package/script/types/4_inline_query_result.d.ts +3 -3
- package/script/types/4_inline_query_result.d.ts.map +1 -1
- package/script/types/4_inline_query_result.js +52 -160
- package/script/types/4_message.d.ts +3 -3
- package/script/types/4_message.d.ts.map +1 -1
- package/script/types/4_message.js +67 -58
- package/script/types/5_callback_query.d.ts +3 -3
- package/script/types/5_callback_query.d.ts.map +1 -1
- package/script/types/5_callback_query.js +4 -4
- package/script/types/5_chat_list_item.d.ts +3 -3
- package/script/types/5_chat_list_item.d.ts.map +1 -1
- package/script/types/5_chat_list_item.js +1 -1
- package/script/types/5_inline_query_answer.d.ts +2 -2
- package/script/types/5_inline_query_answer.d.ts.map +1 -1
- package/script/types/_file_id.d.ts +2 -2
- package/script/types/_file_id.d.ts.map +1 -1
- package/script/types/_file_id.js +3 -3
- package/script/types/_getters.d.ts +7 -7
- package/script/types/_getters.d.ts.map +1 -1
- package/esm/tl/1_tl_object.d.ts +0 -64
- package/esm/tl/1_tl_object.d.ts.map +0 -1
- package/esm/tl/1_tl_object.js +0 -221
- package/esm/tl/1_tl_object_test.d.ts.map +0 -1
- package/esm/tl/2_types.d.ts +0 -28060
- package/esm/tl/2_types.d.ts.map +0 -1
- package/esm/tl/2_types.js +0 -68685
- package/esm/tl/2_types_test.d.ts.map +0 -1
- package/esm/tl/3_deserialize.d.ts +0 -23
- package/esm/tl/3_deserialize.d.ts.map +0 -1
- package/esm/tl/3_functions.d.ts +0 -14094
- package/esm/tl/3_functions.d.ts.map +0 -1
- package/esm/tl/3_functions.js +0 -28475
- package/esm/tl/3_functions_test.d.ts.map +0 -1
- package/esm/tl/4_tl_reader.d.ts.map +0 -1
- package/esm/tl/5_tl_writer.d.ts.map +0 -1
- package/esm/tl/6_rpc_result.d.ts.map +0 -1
- package/esm/tl/6_rpc_result.js +0 -49
- package/esm/tl/7_message.d.ts.map +0 -1
- package/esm/tl/7_message.js +0 -90
- package/esm/tl/7_message_test.d.ts.map +0 -1
- package/esm/tl/8_message_container.d.ts.map +0 -1
- package/esm/tl/8_message_container.js +0 -72
- package/script/tl/1_tl_object.d.ts +0 -64
- package/script/tl/1_tl_object.d.ts.map +0 -1
- package/script/tl/1_tl_object.js +0 -228
- package/script/tl/1_tl_object_test.d.ts.map +0 -1
- package/script/tl/2_types.d.ts +0 -28060
- package/script/tl/2_types.d.ts.map +0 -1
- package/script/tl/2_types.js +0 -70558
- package/script/tl/2_types_test.d.ts.map +0 -1
- package/script/tl/3_deserialize.d.ts +0 -23
- package/script/tl/3_deserialize.d.ts.map +0 -1
- package/script/tl/3_functions.d.ts +0 -14094
- package/script/tl/3_functions.d.ts.map +0 -1
- package/script/tl/3_functions.js +0 -29121
- package/script/tl/3_functions_test.d.ts.map +0 -1
- package/script/tl/4_tl_reader.d.ts.map +0 -1
- package/script/tl/5_tl_writer.d.ts.map +0 -1
- package/script/tl/6_rpc_result.d.ts +0 -30
- package/script/tl/6_rpc_result.d.ts.map +0 -1
- package/script/tl/6_rpc_result.js +0 -53
- package/script/tl/7_message.d.ts +0 -32
- package/script/tl/7_message.d.ts.map +0 -1
- package/script/tl/7_message.js +0 -95
- package/script/tl/7_message_test.d.ts.map +0 -1
- package/script/tl/8_message_container.d.ts +0 -32
- package/script/tl/8_message_container.d.ts.map +0 -1
- package/script/tl/8_message_container.js +0 -76
|
@@ -32,7 +32,7 @@ var _MessageManager_instances, _MessageManager_c, _MessageManager_LresolveFileId
|
|
|
32
32
|
import { contentType, unreachable } from "../0_deps.js";
|
|
33
33
|
import { InputError } from "../0_errors.js";
|
|
34
34
|
import { getLogger, getRandomId, toUnixTimestamp } from "../1_utilities.js";
|
|
35
|
-
import { as,
|
|
35
|
+
import { as, getChannelChatId, is, peerToChatId } from "../2_tl.js";
|
|
36
36
|
import { constructChatMemberUpdated, constructInviteLink, deserializeFileId, selfDestructOptionToInt } from "../3_types.js";
|
|
37
37
|
import { assertMessageType, chatMemberRightsToTlObject, constructChatMember, constructMessage as constructMessage_, deserializeInlineMessageId, FileType, messageEntityToTlObject, reactionEqual, reactionToTlObject, replyMarkupToTlObject } from "../3_types.js";
|
|
38
38
|
import { messageSearchFilterToTlObject } from "../types/0_message_search_filter.js";
|
|
@@ -53,8 +53,8 @@ export class MessageManager {
|
|
|
53
53
|
configurable: true,
|
|
54
54
|
writable: true,
|
|
55
55
|
value: async (v) => {
|
|
56
|
-
const inputPeer = await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(v).then((v) =>
|
|
57
|
-
return
|
|
56
|
+
const inputPeer = await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(v).then((v) => as("inputPeerUser", v));
|
|
57
|
+
return { ...inputPeer, _: "inputUser" };
|
|
58
58
|
}
|
|
59
59
|
});
|
|
60
60
|
__classPrivateFieldSet(this, _MessageManager_c, c, "f");
|
|
@@ -79,21 +79,19 @@ export class MessageManager {
|
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
81
|
if (shouldFetch) {
|
|
82
|
-
if (peer
|
|
83
|
-
messages_ = await __classPrivateFieldGet(this, _MessageManager_c, "f").
|
|
84
|
-
channel: new types.InputChannel(peer),
|
|
85
|
-
id: messageIds.map((v) => new types.InputMessageID({ id: v })),
|
|
86
|
-
}).then((v) => v[as](types.messages.ChannelMessages).messages);
|
|
82
|
+
if (is("inputPeerChannel", peer)) {
|
|
83
|
+
messages_ = await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({ _: "channels.getMessages", channel: ({ ...peer, _: "inputChannel" }), id: messageIds.map((v) => ({ _: "inputMessageID", id: v })) }).then((v) => as("messages.channelMessages", v).messages);
|
|
87
84
|
}
|
|
88
85
|
else {
|
|
89
|
-
messages_ = await __classPrivateFieldGet(this, _MessageManager_c, "f").
|
|
90
|
-
|
|
91
|
-
|
|
86
|
+
messages_ = await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({
|
|
87
|
+
_: "messages.getMessages",
|
|
88
|
+
id: messageIds.map((v) => ({ _: "inputMessageID", id: v })),
|
|
89
|
+
}).then((v) => as("messages.messages", v).messages);
|
|
92
90
|
}
|
|
93
91
|
}
|
|
94
92
|
const messages = new Array();
|
|
95
93
|
for (const message_ of messages_) {
|
|
96
|
-
if (message_
|
|
94
|
+
if (is("messageEmpty", message_)) {
|
|
97
95
|
continue;
|
|
98
96
|
}
|
|
99
97
|
const message = await this.constructMessage(message_);
|
|
@@ -156,18 +154,7 @@ export class MessageManager {
|
|
|
156
154
|
}
|
|
157
155
|
async forwardMessages(from, to, messageIds, params) {
|
|
158
156
|
checkArray(messageIds, checkMessageId);
|
|
159
|
-
const result = await __classPrivateFieldGet(this, _MessageManager_c, "f").
|
|
160
|
-
from_peer: await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(from),
|
|
161
|
-
to_peer: await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(to),
|
|
162
|
-
id: messageIds,
|
|
163
|
-
random_id: messageIds.map(() => getRandomId()),
|
|
164
|
-
silent: params?.disableNotification || undefined,
|
|
165
|
-
top_msg_id: params?.messageThreadId,
|
|
166
|
-
noforwards: params?.disableNotification || undefined,
|
|
167
|
-
send_as: params?.sendAs ? await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(params.sendAs) : undefined,
|
|
168
|
-
drop_author: params?.dropSenderName || undefined,
|
|
169
|
-
drop_media_captions: params?.dropCaption || undefined,
|
|
170
|
-
});
|
|
157
|
+
const result = await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({ _: "messages.forwardMessages", from_peer: await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(from), to_peer: await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(to), id: messageIds, random_id: messageIds.map(() => getRandomId()), silent: params?.disableNotification || undefined, top_msg_id: params?.messageThreadId, noforwards: params?.disableNotification || undefined, send_as: params?.sendAs ? await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(params.sendAs) : undefined, drop_author: params?.dropSenderName || undefined, drop_media_captions: params?.dropCaption || undefined });
|
|
171
158
|
return await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_updatesToMessages).call(this, to, result);
|
|
172
159
|
}
|
|
173
160
|
async getHistory(chatId, params) {
|
|
@@ -188,16 +175,7 @@ export class MessageManager {
|
|
|
188
175
|
if (messages.length > 0) {
|
|
189
176
|
offsetId = messages[messages.length - 1].id; // TODO: track id of oldest message and don't send requests for it
|
|
190
177
|
}
|
|
191
|
-
const result = await __classPrivateFieldGet(this, _MessageManager_c, "f").
|
|
192
|
-
peer: peer,
|
|
193
|
-
offset_id: offsetId,
|
|
194
|
-
offset_date: 0,
|
|
195
|
-
add_offset: 0,
|
|
196
|
-
limit,
|
|
197
|
-
max_id: 0,
|
|
198
|
-
min_id: 0,
|
|
199
|
-
hash: 0n,
|
|
200
|
-
});
|
|
178
|
+
const result = await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({ _: "messages.getHistory", peer: peer, offset_id: offsetId, offset_date: 0, add_offset: 0, limit, max_id: 0, min_id: 0, hash: 0n });
|
|
201
179
|
if (!("messages" in result)) {
|
|
202
180
|
unreachable();
|
|
203
181
|
}
|
|
@@ -219,10 +197,12 @@ export class MessageManager {
|
|
|
219
197
|
const sendAs = await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_resolveSendAs).call(this, params);
|
|
220
198
|
let result;
|
|
221
199
|
if (!noWebpage && params?.linkPreview?.url) {
|
|
222
|
-
result = await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke(
|
|
200
|
+
result = await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({
|
|
201
|
+
_: "messages.sendMedia",
|
|
223
202
|
peer,
|
|
224
203
|
random_id: randomId,
|
|
225
|
-
media:
|
|
204
|
+
media: ({
|
|
205
|
+
_: "inputMediaWebPage",
|
|
226
206
|
url: params.linkPreview.url,
|
|
227
207
|
force_large_media: params.linkPreview.largeMedia ? true : undefined,
|
|
228
208
|
force_small_media: params.linkPreview.smallMedia ? true : undefined,
|
|
@@ -236,10 +216,11 @@ export class MessageManager {
|
|
|
236
216
|
send_as: sendAs,
|
|
237
217
|
entities,
|
|
238
218
|
reply_markup: replyMarkup,
|
|
239
|
-
}
|
|
219
|
+
}, params?.businessConnectionId);
|
|
240
220
|
}
|
|
241
221
|
else {
|
|
242
|
-
result = await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke(
|
|
222
|
+
result = await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({
|
|
223
|
+
_: "messages.sendMessage",
|
|
243
224
|
peer,
|
|
244
225
|
random_id: randomId,
|
|
245
226
|
message,
|
|
@@ -251,7 +232,7 @@ export class MessageManager {
|
|
|
251
232
|
send_as: sendAs,
|
|
252
233
|
entities,
|
|
253
234
|
reply_markup: replyMarkup,
|
|
254
|
-
}
|
|
235
|
+
}, params?.businessConnectionId);
|
|
255
236
|
}
|
|
256
237
|
const message_ = await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_updatesToMessages).call(this, chatId, result, params?.businessConnectionId).then((v) => v[0]);
|
|
257
238
|
return assertMessageType(message_, "text");
|
|
@@ -261,9 +242,10 @@ export class MessageManager {
|
|
|
261
242
|
const randomId = getRandomId();
|
|
262
243
|
const silent = params?.disableNotification ? true : undefined;
|
|
263
244
|
const noforwards = params?.protectContent ? true : undefined;
|
|
264
|
-
const sendAs = params?.sendAs ? await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(params.sendAs) : undefined;
|
|
245
|
+
const sendAs = params?.sendAs ? await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(params.sendAs) : undefined;
|
|
265
246
|
const replyMarkup = await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_constructReplyMarkup).call(this, params);
|
|
266
|
-
const result = await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke(
|
|
247
|
+
const result = await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({
|
|
248
|
+
_: "messages.sendMedia",
|
|
267
249
|
peer,
|
|
268
250
|
random_id: randomId,
|
|
269
251
|
silent,
|
|
@@ -271,8 +253,10 @@ export class MessageManager {
|
|
|
271
253
|
reply_to: await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_constructReplyTo).call(this, params),
|
|
272
254
|
send_as: sendAs,
|
|
273
255
|
reply_markup: replyMarkup,
|
|
274
|
-
media:
|
|
275
|
-
|
|
256
|
+
media: ({
|
|
257
|
+
_: "inputMediaVenue",
|
|
258
|
+
geo_point: ({
|
|
259
|
+
_: "inputGeoPoint",
|
|
276
260
|
lat: latitude,
|
|
277
261
|
long: longitude,
|
|
278
262
|
}),
|
|
@@ -283,7 +267,7 @@ export class MessageManager {
|
|
|
283
267
|
provider: "foursquare",
|
|
284
268
|
}),
|
|
285
269
|
message: "",
|
|
286
|
-
}
|
|
270
|
+
}, params?.businessConnectionId);
|
|
287
271
|
const message = await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_updatesToMessages).call(this, chatId, result, params?.businessConnectionId).then((v) => v[0]);
|
|
288
272
|
return assertMessageType(message, "venue");
|
|
289
273
|
}
|
|
@@ -292,9 +276,10 @@ export class MessageManager {
|
|
|
292
276
|
const randomId = getRandomId();
|
|
293
277
|
const silent = params?.disableNotification ? true : undefined;
|
|
294
278
|
const noforwards = params?.protectContent ? true : undefined;
|
|
295
|
-
const sendAs = params?.sendAs ? await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(params.sendAs) : undefined;
|
|
279
|
+
const sendAs = params?.sendAs ? await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(params.sendAs) : undefined;
|
|
296
280
|
const replyMarkup = await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_constructReplyMarkup).call(this, params);
|
|
297
|
-
const result = await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke(
|
|
281
|
+
const result = await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({
|
|
282
|
+
_: "messages.sendMedia",
|
|
298
283
|
peer,
|
|
299
284
|
random_id: randomId,
|
|
300
285
|
silent,
|
|
@@ -302,14 +287,15 @@ export class MessageManager {
|
|
|
302
287
|
reply_to: await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_constructReplyTo).call(this, params),
|
|
303
288
|
send_as: sendAs,
|
|
304
289
|
reply_markup: replyMarkup,
|
|
305
|
-
media:
|
|
290
|
+
media: ({
|
|
291
|
+
_: "inputMediaContact",
|
|
306
292
|
phone_number: number,
|
|
307
293
|
first_name: firstName,
|
|
308
294
|
last_name: params?.lastName ?? "",
|
|
309
295
|
vcard: params?.vcard ?? "",
|
|
310
296
|
}),
|
|
311
297
|
message: "",
|
|
312
|
-
}
|
|
298
|
+
}, params?.businessConnectionId);
|
|
313
299
|
const message = await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_updatesToMessages).call(this, chatId, result, params?.businessConnectionId).then((v) => v[0]);
|
|
314
300
|
return assertMessageType(message, "contact");
|
|
315
301
|
}
|
|
@@ -318,9 +304,10 @@ export class MessageManager {
|
|
|
318
304
|
const randomId = getRandomId();
|
|
319
305
|
const silent = params?.disableNotification ? true : undefined;
|
|
320
306
|
const noforwards = params?.protectContent ? true : undefined;
|
|
321
|
-
const sendAs = params?.sendAs ? await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(params.sendAs) : undefined;
|
|
307
|
+
const sendAs = params?.sendAs ? await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(params.sendAs) : undefined;
|
|
322
308
|
const replyMarkup = await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_constructReplyMarkup).call(this, params);
|
|
323
|
-
const result = await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke(
|
|
309
|
+
const result = await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({
|
|
310
|
+
_: "messages.sendMedia",
|
|
324
311
|
peer,
|
|
325
312
|
random_id: randomId,
|
|
326
313
|
silent,
|
|
@@ -328,11 +315,12 @@ export class MessageManager {
|
|
|
328
315
|
reply_to: await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_constructReplyTo).call(this, params),
|
|
329
316
|
send_as: sendAs,
|
|
330
317
|
reply_markup: replyMarkup,
|
|
331
|
-
media:
|
|
318
|
+
media: ({
|
|
319
|
+
_: "inputMediaDice",
|
|
332
320
|
emoticon: params?.emoji ?? "🎲",
|
|
333
321
|
}),
|
|
334
322
|
message: "",
|
|
335
|
-
}
|
|
323
|
+
}, params?.businessConnectionId);
|
|
336
324
|
const message = await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_updatesToMessages).call(this, chatId, result, params?.businessConnectionId).then((v) => v[0]);
|
|
337
325
|
return assertMessageType(message, "dice");
|
|
338
326
|
}
|
|
@@ -341,9 +329,10 @@ export class MessageManager {
|
|
|
341
329
|
const randomId = getRandomId();
|
|
342
330
|
const silent = params?.disableNotification ? true : undefined;
|
|
343
331
|
const noforwards = params?.protectContent ? true : undefined;
|
|
344
|
-
const sendAs = params?.sendAs ? await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(params.sendAs) : undefined;
|
|
332
|
+
const sendAs = params?.sendAs ? await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(params.sendAs) : undefined;
|
|
345
333
|
const replyMarkup = await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_constructReplyMarkup).call(this, params);
|
|
346
|
-
const result = await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke(
|
|
334
|
+
const result = await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({
|
|
335
|
+
_: "messages.sendMedia",
|
|
347
336
|
peer,
|
|
348
337
|
random_id: randomId,
|
|
349
338
|
silent,
|
|
@@ -352,8 +341,10 @@ export class MessageManager {
|
|
|
352
341
|
send_as: sendAs,
|
|
353
342
|
reply_markup: replyMarkup,
|
|
354
343
|
media: params?.livePeriod !== undefined
|
|
355
|
-
?
|
|
356
|
-
|
|
344
|
+
? ({
|
|
345
|
+
_: "inputMediaGeoLive",
|
|
346
|
+
geo_point: ({
|
|
347
|
+
_: "inputGeoPoint",
|
|
357
348
|
lat: latitude,
|
|
358
349
|
long: longitude,
|
|
359
350
|
accuracy_radius: params?.horizontalAccuracy,
|
|
@@ -362,68 +353,48 @@ export class MessageManager {
|
|
|
362
353
|
period: params.livePeriod,
|
|
363
354
|
proximity_notification_radius: params?.proximityAlertRadius,
|
|
364
355
|
})
|
|
365
|
-
:
|
|
366
|
-
|
|
356
|
+
: ({
|
|
357
|
+
_: "inputMediaGeoPoint",
|
|
358
|
+
geo_point: ({
|
|
359
|
+
_: "inputGeoPoint",
|
|
367
360
|
lat: latitude,
|
|
368
361
|
long: longitude,
|
|
369
362
|
accuracy_radius: params?.horizontalAccuracy,
|
|
370
363
|
}),
|
|
371
364
|
}),
|
|
372
365
|
message: "",
|
|
373
|
-
}
|
|
366
|
+
}, params?.businessConnectionId);
|
|
374
367
|
const message = await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_updatesToMessages).call(this, chatId, result, params?.businessConnectionId).then((v) => v[0]);
|
|
375
368
|
return assertMessageType(message, "location");
|
|
376
369
|
}
|
|
377
370
|
async sendVideoNote(chatId, audio, params) {
|
|
378
371
|
const message = await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_sendDocumentInner).call(this, chatId, audio, params, FileType.VideoNote, [
|
|
379
|
-
|
|
380
|
-
round_message: true,
|
|
381
|
-
w: params?.length ?? 0,
|
|
382
|
-
h: params?.length ?? 0,
|
|
383
|
-
duration: params?.duration ?? 0,
|
|
384
|
-
}),
|
|
372
|
+
{ _: "documentAttributeVideo", round_message: true, w: params?.length ?? 0, h: params?.length ?? 0, duration: params?.duration ?? 0 },
|
|
385
373
|
], false);
|
|
386
374
|
return assertMessageType(message, "videoNote");
|
|
387
375
|
}
|
|
388
376
|
async sendAudio(chatId, audio, params) {
|
|
389
377
|
const message = await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_sendDocumentInner).call(this, chatId, audio, params, FileType.Audio, [
|
|
390
|
-
|
|
391
|
-
duration: params?.duration ?? 0,
|
|
392
|
-
performer: params?.performer,
|
|
393
|
-
title: params?.title,
|
|
394
|
-
}),
|
|
378
|
+
{ _: "documentAttributeAudio", duration: params?.duration ?? 0, performer: params?.performer, title: params?.title },
|
|
395
379
|
]);
|
|
396
380
|
return assertMessageType(message, "audio");
|
|
397
381
|
}
|
|
398
382
|
async sendVoice(chatId, voice, params) {
|
|
399
383
|
const message = await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_sendDocumentInner).call(this, chatId, voice, params, FileType.VoiceNote, [
|
|
400
|
-
|
|
401
|
-
voice: true,
|
|
402
|
-
duration: params?.duration ?? 0,
|
|
403
|
-
}),
|
|
384
|
+
{ _: "documentAttributeAudio", voice: true, duration: params?.duration ?? 0 },
|
|
404
385
|
]);
|
|
405
386
|
return assertMessageType(message, "voice");
|
|
406
387
|
}
|
|
407
388
|
async sendAnimation(chatId, animation, params) {
|
|
408
389
|
const message = await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_sendDocumentInner).call(this, chatId, animation, params, FileType.Animation, [
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
supports_streaming: true,
|
|
412
|
-
w: params?.width ?? 0,
|
|
413
|
-
h: params?.height ?? 0,
|
|
414
|
-
duration: params?.duration ?? 0,
|
|
415
|
-
}),
|
|
390
|
+
{ _: "documentAttributeAnimated" },
|
|
391
|
+
{ _: "documentAttributeVideo", supports_streaming: true, w: params?.width ?? 0, h: params?.height ?? 0, duration: params?.duration ?? 0 },
|
|
416
392
|
]);
|
|
417
393
|
return assertMessageType(message, "animation");
|
|
418
394
|
}
|
|
419
395
|
async sendVideo(chatId, video, params) {
|
|
420
396
|
const message = await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_sendDocumentInner).call(this, chatId, video, params, FileType.Video, [
|
|
421
|
-
|
|
422
|
-
supports_streaming: params?.supportsStreaming ? true : undefined,
|
|
423
|
-
w: params?.width ?? 0,
|
|
424
|
-
h: params?.height ?? 0,
|
|
425
|
-
duration: params?.duration ?? 0,
|
|
426
|
-
}),
|
|
397
|
+
{ _: "documentAttributeVideo", supports_streaming: params?.supportsStreaming ? true : undefined, w: params?.width ?? 0, h: params?.height ?? 0, duration: params?.duration ?? 0 },
|
|
427
398
|
]);
|
|
428
399
|
return assertMessageType(message, "video");
|
|
429
400
|
}
|
|
@@ -432,7 +403,7 @@ export class MessageManager {
|
|
|
432
403
|
return assertMessageType(message, "document");
|
|
433
404
|
}
|
|
434
405
|
async sendSticker(chatId, sticker, params) {
|
|
435
|
-
const message = await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_sendDocumentInner).call(this, chatId, sticker, params, FileType.Sticker, [
|
|
406
|
+
const message = await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_sendDocumentInner).call(this, chatId, sticker, params, FileType.Sticker, [{ _: "documentAttributeSticker", alt: params?.emoji || "", stickerset: { _: "inputStickerSetEmpty" } }], undefined, STICKER_MIME_TYPES);
|
|
436
407
|
return assertMessageType(message, "sticker");
|
|
437
408
|
}
|
|
438
409
|
async sendPhoto(chatId, photo, params) {
|
|
@@ -442,28 +413,16 @@ export class MessageManager {
|
|
|
442
413
|
if (typeof photo === "string") {
|
|
443
414
|
const fileId = this.resolveFileId(photo, [FileType.Photo, FileType.ProfilePhoto]);
|
|
444
415
|
if (fileId != null) {
|
|
445
|
-
media =
|
|
446
|
-
id: new types.InputPhoto(fileId),
|
|
447
|
-
spoiler,
|
|
448
|
-
ttl_seconds,
|
|
449
|
-
});
|
|
416
|
+
media = { _: "inputMediaPhoto", id: { ...fileId, _: "inputPhoto" }, spoiler, ttl_seconds };
|
|
450
417
|
}
|
|
451
418
|
}
|
|
452
419
|
if (media == null) {
|
|
453
420
|
if (typeof photo === "string" && isHttpUrl(photo)) {
|
|
454
|
-
media =
|
|
455
|
-
url: photo,
|
|
456
|
-
spoiler,
|
|
457
|
-
ttl_seconds: (params && "selfDestruct" in params && params.selfDestruct !== undefined) ? selfDestructOptionToInt(params.selfDestruct) : undefined,
|
|
458
|
-
});
|
|
421
|
+
media = { _: "inputMediaPhotoExternal", url: photo, spoiler, ttl_seconds: (params && "selfDestruct" in params && params.selfDestruct !== undefined) ? selfDestructOptionToInt(params.selfDestruct) : undefined };
|
|
459
422
|
}
|
|
460
423
|
else {
|
|
461
424
|
const file = await __classPrivateFieldGet(this, _MessageManager_c, "f").fileManager.upload(photo, params, null, false);
|
|
462
|
-
media =
|
|
463
|
-
file,
|
|
464
|
-
spoiler,
|
|
465
|
-
ttl_seconds: (params && "selfDestruct" in params && params.selfDestruct !== undefined) ? selfDestructOptionToInt(params.selfDestruct) : undefined,
|
|
466
|
-
});
|
|
425
|
+
media = { _: "inputMediaUploadedPhoto", file, spoiler, ttl_seconds: (params && "selfDestruct" in params && params.selfDestruct !== undefined) ? selfDestructOptionToInt(params.selfDestruct) : undefined };
|
|
467
426
|
}
|
|
468
427
|
}
|
|
469
428
|
const message = await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_sendMedia).call(this, chatId, media, params);
|
|
@@ -502,31 +461,17 @@ export class MessageManager {
|
|
|
502
461
|
const randomId = getRandomId();
|
|
503
462
|
const silent = params?.disableNotification ? true : undefined;
|
|
504
463
|
const noforwards = params?.protectContent ? true : undefined;
|
|
505
|
-
const sendAs = params?.sendAs ? await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(params.sendAs) : undefined;
|
|
464
|
+
const sendAs = params?.sendAs ? await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(params.sendAs) : undefined;
|
|
506
465
|
const replyMarkup = await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_constructReplyMarkup).call(this, params);
|
|
507
466
|
const explanation = params?.explanation;
|
|
508
467
|
const parseResult = explanation !== undefined ? await this.parseText(explanation, { parseMode: params?.explanationParseMode, entities: params?.explanationEntities }) : undefined;
|
|
509
468
|
const solution = parseResult === undefined ? undefined : parseResult[0];
|
|
510
469
|
const solutionEntities = parseResult === undefined ? undefined : parseResult[1];
|
|
511
|
-
const answers = options.map((v, i) =>
|
|
512
|
-
const poll =
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
closed: params?.isClosed ? true : undefined,
|
|
517
|
-
close_date: params?.closeDate ? toUnixTimestamp(params.closeDate) : undefined,
|
|
518
|
-
close_period: params?.openPeriod ? params.openPeriod : undefined,
|
|
519
|
-
multiple_choice: params?.allowMultipleAnswers ? true : undefined,
|
|
520
|
-
public_voters: params?.isAnonymous === false ? true : undefined,
|
|
521
|
-
quiz: params?.type == "quiz" ? true : undefined,
|
|
522
|
-
});
|
|
523
|
-
const media = new types.InputMediaPoll({
|
|
524
|
-
poll,
|
|
525
|
-
correct_answers: params?.correctOptionIndex ? [new Uint8Array([params.correctOptionIndex])] : undefined,
|
|
526
|
-
solution,
|
|
527
|
-
solution_entities: solutionEntities,
|
|
528
|
-
});
|
|
529
|
-
const result = await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke(new functions.messages.sendMedia({
|
|
470
|
+
const answers = options.map((v, i) => ({ _: "pollAnswer", option: new Uint8Array([i]), text: v }));
|
|
471
|
+
const poll = { _: "poll", id: getRandomId(), answers, question, closed: params?.isClosed ? true : undefined, close_date: params?.closeDate ? toUnixTimestamp(params.closeDate) : undefined, close_period: params?.openPeriod ? params.openPeriod : undefined, multiple_choice: params?.allowMultipleAnswers ? true : undefined, public_voters: params?.isAnonymous === false ? true : undefined, quiz: params?.type == "quiz" ? true : undefined };
|
|
472
|
+
const media = { _: "inputMediaPoll", poll, correct_answers: params?.correctOptionIndex ? [new Uint8Array([params.correctOptionIndex])] : undefined, solution, solution_entities: solutionEntities };
|
|
473
|
+
const result = await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({
|
|
474
|
+
_: "messages.sendMedia",
|
|
530
475
|
peer,
|
|
531
476
|
random_id: randomId,
|
|
532
477
|
silent,
|
|
@@ -536,25 +481,18 @@ export class MessageManager {
|
|
|
536
481
|
send_as: sendAs,
|
|
537
482
|
media,
|
|
538
483
|
message: "",
|
|
539
|
-
}
|
|
484
|
+
}, params?.businessConnectionId);
|
|
540
485
|
const message = await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_updatesToMessages).call(this, chatId, result, params?.businessConnectionId).then((v) => v[0]);
|
|
541
486
|
return assertMessageType(message, "poll");
|
|
542
487
|
}
|
|
543
488
|
async editMessageReplyMarkup(chatId, messageId, params) {
|
|
544
|
-
const result = await __classPrivateFieldGet(this, _MessageManager_c, "f").
|
|
545
|
-
id: checkMessageId(messageId),
|
|
546
|
-
peer: await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId),
|
|
547
|
-
reply_markup: await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_constructReplyMarkup).call(this, params),
|
|
548
|
-
});
|
|
489
|
+
const result = await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({ _: "messages.editMessage", id: checkMessageId(messageId), peer: await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId), reply_markup: await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_constructReplyMarkup).call(this, params) });
|
|
549
490
|
const message_ = await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_updatesToMessages).call(this, chatId, result).then((v) => v[0]);
|
|
550
491
|
return message_;
|
|
551
492
|
}
|
|
552
493
|
async editInlineMessageReplyMarkup(inlineMessageId, params) {
|
|
553
494
|
const id = deserializeInlineMessageId(inlineMessageId);
|
|
554
|
-
await __classPrivateFieldGet(this, _MessageManager_c, "f").
|
|
555
|
-
id,
|
|
556
|
-
reply_markup: await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_constructReplyMarkup).call(this, params),
|
|
557
|
-
});
|
|
495
|
+
await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({ _: "messages.editInlineBotMessage", id, reply_markup: await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_constructReplyMarkup).call(this, params) });
|
|
558
496
|
}
|
|
559
497
|
async editMessageText(chatId, messageId, text, params) {
|
|
560
498
|
const [message, entities] = await this.parseText(text, params);
|
|
@@ -562,23 +500,9 @@ export class MessageManager {
|
|
|
562
500
|
const invertMedia = params?.linkPreview?.aboveText ? true : undefined;
|
|
563
501
|
let media = undefined;
|
|
564
502
|
if (!noWebpage && params?.linkPreview?.url) {
|
|
565
|
-
media =
|
|
566
|
-
url: params.linkPreview.url,
|
|
567
|
-
force_large_media: params.linkPreview.largeMedia ? true : undefined,
|
|
568
|
-
force_small_media: params.linkPreview.smallMedia ? true : undefined,
|
|
569
|
-
optional: message.length ? undefined : true,
|
|
570
|
-
});
|
|
503
|
+
media = { _: "inputMediaWebPage", url: params.linkPreview.url, force_large_media: params.linkPreview.largeMedia ? true : undefined, force_small_media: params.linkPreview.smallMedia ? true : undefined, optional: message.length ? undefined : true };
|
|
571
504
|
}
|
|
572
|
-
const result = await __classPrivateFieldGet(this, _MessageManager_c, "f").
|
|
573
|
-
id: checkMessageId(messageId),
|
|
574
|
-
peer: await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId),
|
|
575
|
-
entities,
|
|
576
|
-
message,
|
|
577
|
-
media,
|
|
578
|
-
no_webpage: noWebpage,
|
|
579
|
-
invert_media: invertMedia,
|
|
580
|
-
reply_markup: await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_constructReplyMarkup).call(this, params),
|
|
581
|
-
});
|
|
505
|
+
const result = await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({ _: "messages.editMessage", id: checkMessageId(messageId), peer: await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId), entities, message, media, no_webpage: noWebpage, invert_media: invertMedia, reply_markup: await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_constructReplyMarkup).call(this, params) });
|
|
582
506
|
const message_ = await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_updatesToMessages).call(this, chatId, result).then((v) => v[0]);
|
|
583
507
|
return assertMessageType(message_, "text");
|
|
584
508
|
}
|
|
@@ -589,22 +513,9 @@ export class MessageManager {
|
|
|
589
513
|
const invertMedia = params?.linkPreview?.aboveText ? true : undefined;
|
|
590
514
|
let media = undefined;
|
|
591
515
|
if (!noWebpage && params?.linkPreview?.url) {
|
|
592
|
-
media =
|
|
593
|
-
url: params.linkPreview.url,
|
|
594
|
-
force_large_media: params.linkPreview.largeMedia ? true : undefined,
|
|
595
|
-
force_small_media: params.linkPreview.smallMedia ? true : undefined,
|
|
596
|
-
optional: message.length ? undefined : true,
|
|
597
|
-
});
|
|
516
|
+
media = { _: "inputMediaWebPage", url: params.linkPreview.url, force_large_media: params.linkPreview.largeMedia ? true : undefined, force_small_media: params.linkPreview.smallMedia ? true : undefined, optional: message.length ? undefined : true };
|
|
598
517
|
}
|
|
599
|
-
await __classPrivateFieldGet(this, _MessageManager_c, "f").
|
|
600
|
-
id,
|
|
601
|
-
entities,
|
|
602
|
-
message,
|
|
603
|
-
media,
|
|
604
|
-
no_webpage: noWebpage,
|
|
605
|
-
invert_media: invertMedia,
|
|
606
|
-
reply_markup: await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_constructReplyMarkup).call(this, params),
|
|
607
|
-
});
|
|
518
|
+
await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({ _: "messages.editInlineBotMessage", id, entities, message, media, no_webpage: noWebpage, invert_media: invertMedia, reply_markup: await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_constructReplyMarkup).call(this, params) });
|
|
608
519
|
}
|
|
609
520
|
async editMessageMedia(chatId, messageId, media, params) {
|
|
610
521
|
const message = await this.getMessage(chatId, messageId);
|
|
@@ -614,63 +525,41 @@ export class MessageManager {
|
|
|
614
525
|
if (!("animation" in message) && !("audio" in message) && !("document" in message) && !("photo" in message) && !("video" in message)) {
|
|
615
526
|
throw new InputError("Unexpected message type.");
|
|
616
527
|
}
|
|
617
|
-
const result = await __classPrivateFieldGet(this, _MessageManager_c, "f").
|
|
618
|
-
peer: await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId),
|
|
619
|
-
id: messageId,
|
|
620
|
-
media: await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_resolveInputMedia).call(this, media),
|
|
621
|
-
reply_markup: await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_constructReplyMarkup).call(this, params),
|
|
622
|
-
});
|
|
528
|
+
const result = await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({ _: "messages.editMessage", peer: await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId), id: messageId, media: await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_resolveInputMedia).call(this, media), reply_markup: await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_constructReplyMarkup).call(this, params) });
|
|
623
529
|
const message_ = await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_updatesToMessages).call(this, chatId, result).then((v) => v[0]);
|
|
624
530
|
return message_;
|
|
625
531
|
}
|
|
626
532
|
async editInlineMessageMedia(inlineMessageId, media, params) {
|
|
627
533
|
await __classPrivateFieldGet(this, _MessageManager_c, "f").storage.assertBot("editInlineMessageMedia");
|
|
628
534
|
const id = deserializeInlineMessageId(inlineMessageId);
|
|
629
|
-
await __classPrivateFieldGet(this, _MessageManager_c, "f").
|
|
630
|
-
id,
|
|
631
|
-
media: await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_resolveInputMedia).call(this, media),
|
|
632
|
-
reply_markup: await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_constructReplyMarkup).call(this, params),
|
|
633
|
-
});
|
|
535
|
+
await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({ _: "messages.editInlineBotMessage", id, media: await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_resolveInputMedia).call(this, media), reply_markup: await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_constructReplyMarkup).call(this, params) });
|
|
634
536
|
}
|
|
635
537
|
async deleteMessages(chatId, messageIds, params) {
|
|
636
538
|
checkArray(messageIds, checkMessageId);
|
|
637
539
|
const peer = await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId);
|
|
638
|
-
if (peer
|
|
639
|
-
await __classPrivateFieldGet(this, _MessageManager_c, "f").
|
|
540
|
+
if (is("inputPeerChannel", peer)) {
|
|
541
|
+
await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({ _: "channels.deleteMessages", channel: { ...peer, _: "inputChannel" }, id: messageIds });
|
|
640
542
|
}
|
|
641
543
|
else {
|
|
642
|
-
await __classPrivateFieldGet(this, _MessageManager_c, "f").
|
|
544
|
+
await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({ _: "messages.deleteMessages", id: messageIds, revoke: params?.onlyForMe ? undefined : true });
|
|
643
545
|
}
|
|
644
546
|
}
|
|
645
547
|
async deleteChatMemberMessages(chatId, memberId) {
|
|
646
548
|
const channel = await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputChannel(chatId);
|
|
647
549
|
const participant = await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(memberId);
|
|
648
|
-
await __classPrivateFieldGet(this, _MessageManager_c, "f").
|
|
550
|
+
await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({ _: "channels.deleteParticipantHistory", channel, participant });
|
|
649
551
|
}
|
|
650
552
|
async pinMessage(chatId, messageId, params) {
|
|
651
|
-
await __classPrivateFieldGet(this, _MessageManager_c, "f").
|
|
652
|
-
peer: await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId),
|
|
653
|
-
id: checkMessageId(messageId),
|
|
654
|
-
silent: params?.disableNotification ? true : undefined,
|
|
655
|
-
pm_oneside: params?.bothSides ? undefined : true,
|
|
656
|
-
});
|
|
553
|
+
await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({ _: "messages.updatePinnedMessage", peer: await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId), id: checkMessageId(messageId), silent: params?.disableNotification ? true : undefined, pm_oneside: params?.bothSides ? undefined : true });
|
|
657
554
|
}
|
|
658
555
|
async unpinMessage(chatId, messageId) {
|
|
659
|
-
await __classPrivateFieldGet(this, _MessageManager_c, "f").
|
|
660
|
-
peer: await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId),
|
|
661
|
-
id: checkMessageId(messageId),
|
|
662
|
-
unpin: true,
|
|
663
|
-
});
|
|
556
|
+
await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({ _: "messages.updatePinnedMessage", peer: await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId), id: checkMessageId(messageId), unpin: true });
|
|
664
557
|
}
|
|
665
558
|
async unpinMessages(chatId) {
|
|
666
|
-
await __classPrivateFieldGet(this, _MessageManager_c, "f").
|
|
559
|
+
await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({ _: "messages.unpinAllMessages", peer: await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId) });
|
|
667
560
|
}
|
|
668
561
|
async setAvailableReactions(chatId, availableReactions) {
|
|
669
|
-
|
|
670
|
-
await __classPrivateFieldGet(this, _MessageManager_c, "f").api.messages.setChatAvailableReactions({
|
|
671
|
-
peer: await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId),
|
|
672
|
-
available_reactions: availableReactions == "none" ? new types.ChatReactionsNone() : availableReactions == "all" ? new types.ChatReactionsAll() : Array.isArray(availableReactions) ? new types.ChatReactionsSome({ reactions: availableReactions.map((v) => v.type == "emoji" ? new types.ReactionEmoji({ emoticon: v.emoji }) : new types.ReactionCustomEmoji({ document_id: BigInt(v.id) })) }) : unreachable(),
|
|
673
|
-
});
|
|
562
|
+
await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({ _: "messages.setChatAvailableReactions", peer: await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId), available_reactions: availableReactions == "none" ? { _: "chatReactionsNone" } : availableReactions == "all" ? { _: "chatReactionsAll" } : Array.isArray(availableReactions) ? ({ _: "chatReactionsSome", reactions: availableReactions.map((v) => v.type == "emoji" ? ({ _: "reactionEmoji", emoticon: v.emoji }) : ({ _: "reactionCustomEmoji", document_id: BigInt(v.id) })) }) : unreachable() });
|
|
674
563
|
}
|
|
675
564
|
async setReactions(chatId, messageId, reactions, params) {
|
|
676
565
|
await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_sendReaction).call(this, chatId, messageId, reactions, params);
|
|
@@ -704,32 +593,32 @@ export class MessageManager {
|
|
|
704
593
|
}
|
|
705
594
|
}
|
|
706
595
|
static canHandleUpdate(update) {
|
|
707
|
-
return update
|
|
708
|
-
update
|
|
709
|
-
update
|
|
710
|
-
update
|
|
711
|
-
update
|
|
712
|
-
update
|
|
713
|
-
update
|
|
714
|
-
update
|
|
715
|
-
update
|
|
716
|
-
update
|
|
717
|
-
update
|
|
596
|
+
return is("updateNewMessage", update) ||
|
|
597
|
+
is("updateNewChannelMessage", update) ||
|
|
598
|
+
is("updateEditMessage", update) ||
|
|
599
|
+
is("updateEditChannelMessage", update) ||
|
|
600
|
+
is("updateBotNewBusinessMessage", update) ||
|
|
601
|
+
is("updateBotEditBusinessMessage", update) ||
|
|
602
|
+
is("updateBotDeleteBusinessMessage", update) ||
|
|
603
|
+
is("updateDeleteMessages", update) ||
|
|
604
|
+
is("updateDeleteChannelMessages", update) ||
|
|
605
|
+
is("updateChannelParticipant", update) ||
|
|
606
|
+
is("updateChatParticipant", update);
|
|
718
607
|
}
|
|
719
608
|
async handleUpdate(update) {
|
|
720
|
-
if (update
|
|
721
|
-
if (update.message
|
|
609
|
+
if (is("updateNewMessage", update) || is("updateNewChannelMessage", update) || is("updateEditMessage", update) || is("updateEditChannelMessage", update)) {
|
|
610
|
+
if (is("message", update.message) || is("messageService", update.message)) {
|
|
722
611
|
const chatId = peerToChatId(update.message.peer_id);
|
|
723
612
|
await __classPrivateFieldGet(this, _MessageManager_c, "f").messageStorage.setMessage(chatId, update.message.id, update.message);
|
|
724
613
|
}
|
|
725
614
|
}
|
|
726
|
-
if (update
|
|
727
|
-
update
|
|
728
|
-
update
|
|
729
|
-
update
|
|
730
|
-
update
|
|
731
|
-
update
|
|
732
|
-
if (!(update.message
|
|
615
|
+
if (is("updateNewMessage", update) ||
|
|
616
|
+
is("updateNewChannelMessage", update) ||
|
|
617
|
+
is("updateEditMessage", update) ||
|
|
618
|
+
is("updateEditChannelMessage", update) ||
|
|
619
|
+
is("updateBotNewBusinessMessage", update) ||
|
|
620
|
+
is("updateBotEditBusinessMessage", update)) {
|
|
621
|
+
if (!(is("messageEmpty", update.message))) {
|
|
733
622
|
const isOutgoing = update.message.out;
|
|
734
623
|
let shouldIgnore = isOutgoing ? (await __classPrivateFieldGet(this, _MessageManager_c, "f").storage.getAccountType()) == "user" ? false : true : false;
|
|
735
624
|
if (__classPrivateFieldGet(this, _MessageManager_c, "f").ignoreOutgoing != null && isOutgoing) {
|
|
@@ -738,16 +627,16 @@ export class MessageManager {
|
|
|
738
627
|
if (!shouldIgnore) {
|
|
739
628
|
const business = "connection_id" in update ? { connectionId: update.connection_id, replyToMessage: update.reply_to_message } : undefined;
|
|
740
629
|
const message = await this.constructMessage(update.message, undefined, business);
|
|
741
|
-
if (update
|
|
742
|
-
return
|
|
630
|
+
if (is("updateNewMessage", update) || is("updateNewChannelMessage", update) || is("updateBotNewBusinessMessage", update)) {
|
|
631
|
+
return { message };
|
|
743
632
|
}
|
|
744
633
|
else {
|
|
745
|
-
return
|
|
634
|
+
return { editedMessage: message };
|
|
746
635
|
}
|
|
747
636
|
}
|
|
748
637
|
}
|
|
749
638
|
}
|
|
750
|
-
if (update
|
|
639
|
+
if (is("updateDeleteMessages", update)) {
|
|
751
640
|
const deletedMessages = new Array();
|
|
752
641
|
for (const messageId of update.messages) {
|
|
753
642
|
const chatId = await __classPrivateFieldGet(this, _MessageManager_c, "f").messageStorage.getMessageChat(messageId);
|
|
@@ -759,7 +648,7 @@ export class MessageManager {
|
|
|
759
648
|
return { deletedMessages };
|
|
760
649
|
}
|
|
761
650
|
}
|
|
762
|
-
else if (update
|
|
651
|
+
else if (is("updateDeleteChannelMessages", update)) {
|
|
763
652
|
const chatId = getChannelChatId(update.channel_id);
|
|
764
653
|
const deletedMessages = new Array();
|
|
765
654
|
for (const messageId of update.messages) {
|
|
@@ -770,12 +659,12 @@ export class MessageManager {
|
|
|
770
659
|
}
|
|
771
660
|
return { deletedMessages };
|
|
772
661
|
}
|
|
773
|
-
else if (update
|
|
662
|
+
else if (is("updateBotDeleteBusinessMessage", update)) {
|
|
774
663
|
const chatId = peerToChatId(update.peer);
|
|
775
664
|
const deletedMessages = update.messages.map((v) => ({ chatId, messageId: v }));
|
|
776
665
|
return { deletedMessages, businessConnectionId: update.connection_id };
|
|
777
666
|
}
|
|
778
|
-
if (update
|
|
667
|
+
if (is("updateChannelParticipant", update) || is("updateChatParticipant", update)) {
|
|
779
668
|
const chatMember = await constructChatMemberUpdated(update, __classPrivateFieldGet(this, _MessageManager_c, "f").getEntity);
|
|
780
669
|
const selfId = await __classPrivateFieldGet(this, _MessageManager_c, "f").getSelfId();
|
|
781
670
|
if (chatMember.oldChatMember.user.id == selfId) {
|
|
@@ -791,76 +680,76 @@ export class MessageManager {
|
|
|
791
680
|
let action_;
|
|
792
681
|
switch (action) {
|
|
793
682
|
case "type":
|
|
794
|
-
action_ =
|
|
683
|
+
action_ = { _: "sendMessageTypingAction" };
|
|
795
684
|
break;
|
|
796
685
|
case "uploadPhoto":
|
|
797
|
-
action_ =
|
|
686
|
+
action_ = { _: "sendMessageUploadPhotoAction", progress: 0 };
|
|
798
687
|
break;
|
|
799
688
|
case "recordVideo":
|
|
800
|
-
action_ =
|
|
689
|
+
action_ = { _: "sendMessageRecordVideoAction" };
|
|
801
690
|
break;
|
|
802
691
|
case "uploadVideo":
|
|
803
|
-
action_ =
|
|
692
|
+
action_ = { _: "sendMessageRecordVideoAction" };
|
|
804
693
|
break;
|
|
805
694
|
case "recordVoice":
|
|
806
|
-
action_ =
|
|
695
|
+
action_ = { _: "sendMessageRecordAudioAction" };
|
|
807
696
|
break;
|
|
808
697
|
case "uploadAudio":
|
|
809
|
-
action_ =
|
|
698
|
+
action_ = { _: "sendMessageUploadAudioAction", progress: 0 };
|
|
810
699
|
break;
|
|
811
700
|
case "uploadDocument":
|
|
812
|
-
action_ =
|
|
701
|
+
action_ = { _: "sendMessageUploadDocumentAction", progress: 0 };
|
|
813
702
|
break;
|
|
814
703
|
case "chooseSticker":
|
|
815
|
-
action_ =
|
|
704
|
+
action_ = { _: "sendMessageChooseStickerAction" };
|
|
816
705
|
break;
|
|
817
706
|
case "findLocation":
|
|
818
|
-
action_ =
|
|
707
|
+
action_ = { _: "sendMessageGeoLocationAction" };
|
|
819
708
|
break;
|
|
820
709
|
case "recordVideoNote":
|
|
821
|
-
action_ =
|
|
710
|
+
action_ = { _: "sendMessageRecordRoundAction" };
|
|
822
711
|
break;
|
|
823
712
|
case "uploadVideoNote":
|
|
824
|
-
action_ =
|
|
713
|
+
action_ = { _: "sendMessageUploadRoundAction", progress: 0 };
|
|
825
714
|
break;
|
|
826
715
|
default:
|
|
827
716
|
throw new InputError(`Invalid chat action: ${action}`);
|
|
828
717
|
}
|
|
829
|
-
await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke(
|
|
718
|
+
await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({ _: "messages.setTyping", peer: await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId), action: action_, top_msg_id: params?.messageThreadId }, params?.businessConnectionId);
|
|
830
719
|
}
|
|
831
720
|
async deleteChatPhoto(chatId) {
|
|
832
721
|
const peer = await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId);
|
|
833
|
-
if (!(peer
|
|
722
|
+
if (!(is("inputPeerChannel", peer)) && !(is("inputPeerChat", peer))) {
|
|
834
723
|
unreachable();
|
|
835
724
|
}
|
|
836
|
-
if (peer
|
|
837
|
-
await __classPrivateFieldGet(this, _MessageManager_c, "f").
|
|
725
|
+
if (is("inputPeerChannel", peer)) {
|
|
726
|
+
await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({ _: "channels.editPhoto", channel: { ...peer, _: "inputChannel" }, photo: { _: "inputChatPhotoEmpty" } });
|
|
838
727
|
}
|
|
839
|
-
else if (peer
|
|
840
|
-
await __classPrivateFieldGet(this, _MessageManager_c, "f").
|
|
728
|
+
else if (is("inputPeerChat", peer)) {
|
|
729
|
+
await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({ _: "messages.editChatPhoto", chat_id: peer.chat_id, photo: { _: "inputChatPhotoEmpty" } });
|
|
841
730
|
}
|
|
842
731
|
}
|
|
843
732
|
async setChatPhoto(chatId, photo, params) {
|
|
844
733
|
const peer = await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId);
|
|
845
|
-
if (!(peer
|
|
734
|
+
if (!(is("inputPeerChannel", peer)) && !(is("inputPeerChat", peer))) {
|
|
846
735
|
unreachable();
|
|
847
736
|
}
|
|
848
737
|
const file = await __classPrivateFieldGet(this, _MessageManager_c, "f").fileManager.upload(photo, params);
|
|
849
|
-
const photo_ =
|
|
850
|
-
if (peer
|
|
851
|
-
await __classPrivateFieldGet(this, _MessageManager_c, "f").
|
|
738
|
+
const photo_ = { _: "inputChatUploadedPhoto", file };
|
|
739
|
+
if (is("inputPeerChannel", peer)) {
|
|
740
|
+
await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({ _: "channels.editPhoto", channel: { ...peer, _: "inputChannel" }, photo: photo_ });
|
|
852
741
|
}
|
|
853
|
-
else if (peer
|
|
854
|
-
await __classPrivateFieldGet(this, _MessageManager_c, "f").
|
|
742
|
+
else if (is("inputPeerChat", peer)) {
|
|
743
|
+
await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({ _: "messages.editChatPhoto", chat_id: peer.chat_id, photo: photo_ });
|
|
855
744
|
}
|
|
856
745
|
}
|
|
857
746
|
async banChatMember(chatId, memberId, params) {
|
|
858
747
|
const chat = await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId);
|
|
859
|
-
if (!(chat
|
|
748
|
+
if (!(is("inputPeerChannel", chat)) && !(is("inputPeerChat", chat))) {
|
|
860
749
|
throw new InputError("Expected a channel, supergroup, or group ID.");
|
|
861
750
|
}
|
|
862
751
|
const member = await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(memberId);
|
|
863
|
-
if (chat
|
|
752
|
+
if (is("inputPeerChannel", chat)) {
|
|
864
753
|
if (params?.deleteMessages) {
|
|
865
754
|
try {
|
|
866
755
|
await this.deleteChatMemberMessages(chatId, memberId);
|
|
@@ -869,11 +758,13 @@ export class MessageManager {
|
|
|
869
758
|
//
|
|
870
759
|
}
|
|
871
760
|
}
|
|
872
|
-
await __classPrivateFieldGet(this, _MessageManager_c, "f").
|
|
873
|
-
|
|
761
|
+
await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({
|
|
762
|
+
_: "channels.editBanned",
|
|
763
|
+
channel: { ...chat, _: "inputChannel" },
|
|
874
764
|
participant: member,
|
|
875
|
-
banned_rights:
|
|
876
|
-
|
|
765
|
+
banned_rights: ({
|
|
766
|
+
_: "chatBannedRights",
|
|
767
|
+
until_date: params?.untilDate ? toUnixTimestamp(params.untilDate) : 0,
|
|
877
768
|
view_messages: true,
|
|
878
769
|
send_messages: true,
|
|
879
770
|
send_media: true,
|
|
@@ -885,69 +776,22 @@ export class MessageManager {
|
|
|
885
776
|
}),
|
|
886
777
|
});
|
|
887
778
|
}
|
|
888
|
-
else if (chat
|
|
889
|
-
if (!(member
|
|
779
|
+
else if (is("inputPeerChat", chat)) {
|
|
780
|
+
if (!(is("inputPeerUser", member))) {
|
|
890
781
|
throw new InputError(`Invalid user ID: ${memberId}`);
|
|
891
782
|
}
|
|
892
|
-
await __classPrivateFieldGet(this, _MessageManager_c, "f").
|
|
893
|
-
chat_id: chat.chat_id,
|
|
894
|
-
user_id: new types.InputUser(member),
|
|
895
|
-
revoke_history: params?.deleteMessages ? true : undefined,
|
|
896
|
-
});
|
|
783
|
+
await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({ _: "messages.deleteChatUser", chat_id: chat.chat_id, user_id: { ...member, _: "inputUser" }, revoke_history: params?.deleteMessages ? true : undefined });
|
|
897
784
|
}
|
|
898
785
|
}
|
|
899
786
|
async unbanChatMember(chatId, memberId) {
|
|
900
787
|
const channel = await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputChannel(chatId);
|
|
901
788
|
const member = await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(memberId);
|
|
902
|
-
await __classPrivateFieldGet(this, _MessageManager_c, "f").
|
|
903
|
-
channel,
|
|
904
|
-
participant: member,
|
|
905
|
-
banned_rights: new types.ChatBannedRights({ until_date: 0 }),
|
|
906
|
-
});
|
|
789
|
+
await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({ _: "channels.editBanned", channel, participant: member, banned_rights: ({ _: "chatBannedRights", until_date: 0 }) });
|
|
907
790
|
}
|
|
908
791
|
async setChatMemberRights(chatId, memberId, params) {
|
|
909
792
|
const channel = await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputChannel(chatId);
|
|
910
793
|
const member = await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(memberId);
|
|
911
|
-
await __classPrivateFieldGet(this, _MessageManager_c, "f").
|
|
912
|
-
channel,
|
|
913
|
-
participant: member,
|
|
914
|
-
banned_rights: chatMemberRightsToTlObject(params?.rights, params?.untilDate),
|
|
915
|
-
});
|
|
916
|
-
}
|
|
917
|
-
async getChatAdministrators(chatId) {
|
|
918
|
-
const peer = await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId);
|
|
919
|
-
if (peer instanceof types.InputPeerChannel) {
|
|
920
|
-
const channel = new types.InputChannel(peer);
|
|
921
|
-
const participants = await __classPrivateFieldGet(this, _MessageManager_c, "f").api.channels.getParticipants({
|
|
922
|
-
channel,
|
|
923
|
-
filter: new types.ChannelParticipantsAdmins(),
|
|
924
|
-
offset: 0,
|
|
925
|
-
limit: 100,
|
|
926
|
-
hash: 0n,
|
|
927
|
-
});
|
|
928
|
-
if (participants instanceof types.channels.ChannelParticipantsNotModified) {
|
|
929
|
-
unreachable();
|
|
930
|
-
}
|
|
931
|
-
const chatMembers = new Array();
|
|
932
|
-
for (const p of participants.participants) {
|
|
933
|
-
chatMembers.push(await constructChatMember(p, __classPrivateFieldGet(this, _MessageManager_c, "f").getEntity));
|
|
934
|
-
}
|
|
935
|
-
return chatMembers;
|
|
936
|
-
}
|
|
937
|
-
else if (peer instanceof types.InputPeerChat) {
|
|
938
|
-
const fullChat = await __classPrivateFieldGet(this, _MessageManager_c, "f").api.messages.getFullChat(peer); // TODO: full chat cache
|
|
939
|
-
if (!(fullChat.full_chat instanceof types.ChatFull) || !(fullChat.full_chat.participants instanceof types.ChatParticipants)) {
|
|
940
|
-
unreachable();
|
|
941
|
-
}
|
|
942
|
-
const chatMembers = new Array();
|
|
943
|
-
for (const p of fullChat.full_chat.participants.participants) {
|
|
944
|
-
chatMembers.push(await constructChatMember(p, __classPrivateFieldGet(this, _MessageManager_c, "f").getEntity));
|
|
945
|
-
}
|
|
946
|
-
return chatMembers;
|
|
947
|
-
}
|
|
948
|
-
else {
|
|
949
|
-
unreachable();
|
|
950
|
-
}
|
|
794
|
+
await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({ _: "channels.editBanned", channel, participant: member, banned_rights: chatMemberRightsToTlObject(params?.rights, params?.untilDate) });
|
|
951
795
|
}
|
|
952
796
|
async enableJoinRequests(chatId) {
|
|
953
797
|
await __classPrivateFieldGet(this, _MessageManager_c, "f").storage.assertUser("enableJoinRequests");
|
|
@@ -958,20 +802,7 @@ export class MessageManager {
|
|
|
958
802
|
await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_toggleJoinRequests).call(this, chatId, false);
|
|
959
803
|
}
|
|
960
804
|
async searchMessages(chatId, query, params) {
|
|
961
|
-
const result = await __classPrivateFieldGet(this, _MessageManager_c, "f").
|
|
962
|
-
peer: await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId),
|
|
963
|
-
q: query,
|
|
964
|
-
add_offset: 0,
|
|
965
|
-
filter: messageSearchFilterToTlObject(params?.filter ?? "empty"),
|
|
966
|
-
hash: 0n,
|
|
967
|
-
limit: params?.limit ?? 100,
|
|
968
|
-
max_date: 0,
|
|
969
|
-
max_id: 0,
|
|
970
|
-
min_date: 0,
|
|
971
|
-
min_id: 0,
|
|
972
|
-
offset_id: params?.after ? params.after : 0,
|
|
973
|
-
from_id: params?.from ? await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(params.from) : undefined,
|
|
974
|
-
});
|
|
805
|
+
const result = await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({ _: "messages.search", peer: await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId), q: query, add_offset: 0, filter: messageSearchFilterToTlObject(params?.filter ?? "empty"), hash: 0n, limit: params?.limit ?? 100, max_date: 0, max_id: 0, min_date: 0, min_id: 0, offset_id: params?.after ? params.after : 0, from_id: params?.from ? await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(params.from) : undefined });
|
|
975
806
|
if (!("messages" in result)) {
|
|
976
807
|
unreachable();
|
|
977
808
|
}
|
|
@@ -984,44 +815,31 @@ export class MessageManager {
|
|
|
984
815
|
}
|
|
985
816
|
async setBoostsRequiredToCircumventRestrictions(chatId, boosts) {
|
|
986
817
|
const channel = await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputChannel(chatId);
|
|
987
|
-
await __classPrivateFieldGet(this, _MessageManager_c, "f").
|
|
818
|
+
await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({ _: "channels.setBoostsToUnblockRestrictions", channel, boosts });
|
|
988
819
|
}
|
|
989
820
|
async createInviteLink(chatId, params) {
|
|
990
821
|
if (params?.requireApproval && params?.limit) {
|
|
991
822
|
throw new InputError("requireApproval cannot be true while limit is specified.");
|
|
992
823
|
}
|
|
993
|
-
const result = await __classPrivateFieldGet(this, _MessageManager_c, "f").
|
|
994
|
-
|
|
995
|
-
title: params?.title,
|
|
996
|
-
expire_date: params?.expireAt ? toUnixTimestamp(params.expireAt) : undefined,
|
|
997
|
-
request_needed: params?.requireApproval ? true : undefined,
|
|
998
|
-
usage_limit: params?.limit,
|
|
999
|
-
});
|
|
1000
|
-
return await constructInviteLink(result[as](types.ChatInviteExported), __classPrivateFieldGet(this, _MessageManager_c, "f").getEntity);
|
|
824
|
+
const result = await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({ _: "messages.exportChatInvite", peer: await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId), title: params?.title, expire_date: params?.expireAt ? toUnixTimestamp(params.expireAt) : undefined, request_needed: params?.requireApproval ? true : undefined, usage_limit: params?.limit });
|
|
825
|
+
return await constructInviteLink(as("chatInviteExported", result), __classPrivateFieldGet(this, _MessageManager_c, "f").getEntity);
|
|
1001
826
|
}
|
|
1002
827
|
async getCreatedInviteLinks(chatId, params) {
|
|
1003
828
|
await __classPrivateFieldGet(this, _MessageManager_c, "f").storage.assertUser("getCreatedInviteLinks");
|
|
1004
|
-
const { invites } = await __classPrivateFieldGet(this, _MessageManager_c, "f").
|
|
1005
|
-
|
|
1006
|
-
revoked: params?.revoked ? true : undefined,
|
|
1007
|
-
admin_id: params?.by ? await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputUser(params.by) : new types.InputUserEmpty(),
|
|
1008
|
-
limit: params?.limit ?? 100,
|
|
1009
|
-
offset_date: params?.afterDate ? toUnixTimestamp(params.afterDate) : undefined,
|
|
1010
|
-
offset_link: params?.afterInviteLink,
|
|
1011
|
-
});
|
|
1012
|
-
return await Promise.all(invites.map((v) => v[as](types.ChatInviteExported)).map((v) => constructInviteLink(v, __classPrivateFieldGet(this, _MessageManager_c, "f").getEntity)));
|
|
829
|
+
const { invites } = await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({ _: "messages.getExportedChatInvites", peer: await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId), revoked: params?.revoked ? true : undefined, admin_id: params?.by ? await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputUser(params.by) : { _: "inputUserEmpty" }, limit: params?.limit ?? 100, offset_date: params?.afterDate ? toUnixTimestamp(params.afterDate) : undefined, offset_link: params?.afterInviteLink });
|
|
830
|
+
return await Promise.all(invites.map((v) => as("chatInviteExported", v)).map((v) => constructInviteLink(v, __classPrivateFieldGet(this, _MessageManager_c, "f").getEntity)));
|
|
1013
831
|
}
|
|
1014
832
|
async joinChat(chatId) {
|
|
1015
833
|
await __classPrivateFieldGet(this, _MessageManager_c, "f").storage.assertUser("joinChat");
|
|
1016
834
|
const peer = await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId);
|
|
1017
|
-
if (peer
|
|
835
|
+
if (is("inputPeerUser", peer)) {
|
|
1018
836
|
throw new InputError("Cannot join private chats.");
|
|
1019
837
|
}
|
|
1020
|
-
else if (peer
|
|
1021
|
-
await __classPrivateFieldGet(this, _MessageManager_c, "f").
|
|
838
|
+
else if (is("inputPeerChannel", peer)) {
|
|
839
|
+
await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({ _: "channels.joinChannel", channel: { ...peer, _: "inputChannel" } });
|
|
1022
840
|
}
|
|
1023
|
-
else if (peer
|
|
1024
|
-
await __classPrivateFieldGet(this, _MessageManager_c, "f").
|
|
841
|
+
else if (is("inputPeerChat", peer)) {
|
|
842
|
+
await __classPrivateFieldGet(this, _MessageManager_c, "f").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
|
|
1025
843
|
}
|
|
1026
844
|
else {
|
|
1027
845
|
unreachable();
|
|
@@ -1029,14 +847,14 @@ export class MessageManager {
|
|
|
1029
847
|
}
|
|
1030
848
|
async leaveChat(chatId) {
|
|
1031
849
|
const peer = await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId);
|
|
1032
|
-
if (peer
|
|
850
|
+
if (is("inputPeerUser", peer)) {
|
|
1033
851
|
throw new InputError("Cannot leave private chats.");
|
|
1034
852
|
}
|
|
1035
|
-
else if (peer
|
|
1036
|
-
await __classPrivateFieldGet(this, _MessageManager_c, "f").
|
|
853
|
+
else if (is("inputPeerChannel", peer)) {
|
|
854
|
+
await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({ _: "channels.leaveChannel", channel: { ...peer, _: "inputChannel" } });
|
|
1037
855
|
}
|
|
1038
|
-
else if (peer
|
|
1039
|
-
await __classPrivateFieldGet(this, _MessageManager_c, "f").
|
|
856
|
+
else if (is("inputPeerChat", peer)) {
|
|
857
|
+
await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({ _: "messages.deleteChatUser", chat_id: peer.chat_id, user_id: { _: "inputUserSelf" } }); // TODO: use potential high-level method for adding participants to chats
|
|
1040
858
|
}
|
|
1041
859
|
else {
|
|
1042
860
|
unreachable();
|
|
@@ -1045,32 +863,29 @@ export class MessageManager {
|
|
|
1045
863
|
async blockUser(userId) {
|
|
1046
864
|
await __classPrivateFieldGet(this, _MessageManager_c, "f").storage.assertUser("blockUser");
|
|
1047
865
|
const id = await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(userId);
|
|
1048
|
-
if (!(id
|
|
866
|
+
if (!(is("user", id))) {
|
|
1049
867
|
throw new InputError("Only users can be blocked or unblocked.");
|
|
1050
868
|
}
|
|
1051
|
-
await __classPrivateFieldGet(this, _MessageManager_c, "f").
|
|
869
|
+
await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({ _: "contacts.block", id });
|
|
1052
870
|
}
|
|
1053
871
|
async unblockUser(userId) {
|
|
1054
872
|
await __classPrivateFieldGet(this, _MessageManager_c, "f").storage.assertUser("unblockUser");
|
|
1055
873
|
const id = await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(userId);
|
|
1056
|
-
if (!(id
|
|
874
|
+
if (!(is("user", id))) {
|
|
1057
875
|
throw new InputError("Only users can be blocked or unblocked.");
|
|
1058
876
|
}
|
|
1059
|
-
await __classPrivateFieldGet(this, _MessageManager_c, "f").
|
|
877
|
+
await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({ _: "contacts.unblock", id });
|
|
1060
878
|
}
|
|
1061
879
|
async getChatMember(chatId, userId) {
|
|
1062
880
|
const peer = await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId);
|
|
1063
|
-
if (peer
|
|
1064
|
-
const { participant } = await __classPrivateFieldGet(this, _MessageManager_c, "f").
|
|
1065
|
-
channel: new types.InputChannel(peer),
|
|
1066
|
-
participant: await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(userId),
|
|
1067
|
-
});
|
|
881
|
+
if (is("inputPeerChannel", peer)) {
|
|
882
|
+
const { participant } = await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({ _: "channels.getParticipant", channel: { ...peer, _: "inputChannel" }, participant: await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(userId) });
|
|
1068
883
|
return await constructChatMember(participant, __classPrivateFieldGet(this, _MessageManager_c, "f").getEntity);
|
|
1069
884
|
}
|
|
1070
|
-
else if (peer
|
|
885
|
+
else if (is("inputPeerChat", peer)) {
|
|
1071
886
|
const user = await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputUser(userId);
|
|
1072
|
-
const fullChat = await __classPrivateFieldGet(this, _MessageManager_c, "f").
|
|
1073
|
-
const participant = fullChat.participants
|
|
887
|
+
const fullChat = await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({ ...peer, _: "messages.getFullChat" }).then((v) => as("chatFull", v.full_chat));
|
|
888
|
+
const participant = as("chatParticipants", fullChat.participants).participants.find((v) => v.user_id == user.user_id);
|
|
1074
889
|
return await constructChatMember(participant, __classPrivateFieldGet(this, _MessageManager_c, "f").getEntity);
|
|
1075
890
|
}
|
|
1076
891
|
else {
|
|
@@ -1079,11 +894,11 @@ export class MessageManager {
|
|
|
1079
894
|
}
|
|
1080
895
|
async setChatStickerSet(chatId, setName) {
|
|
1081
896
|
const channel = await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputChannel(chatId);
|
|
1082
|
-
await __classPrivateFieldGet(this, _MessageManager_c, "f").
|
|
897
|
+
await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({ _: "channels.setStickers", channel, stickerset: { _: "inputStickerSetShortName", short_name: setName } });
|
|
1083
898
|
}
|
|
1084
899
|
async deleteChatStickerSet(chatId) {
|
|
1085
900
|
const channel = await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputChannel(chatId);
|
|
1086
|
-
await __classPrivateFieldGet(this, _MessageManager_c, "f").
|
|
901
|
+
await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({ _: "channels.setStickers", channel, stickerset: { _: "inputStickerSetEmpty" } });
|
|
1087
902
|
}
|
|
1088
903
|
async stopPoll(chatId, messageId, params) {
|
|
1089
904
|
const message = await this.getMessage(chatId, messageId);
|
|
@@ -1096,39 +911,14 @@ export class MessageManager {
|
|
|
1096
911
|
if (message.poll.isClosed) {
|
|
1097
912
|
throw new InputError("Poll is already stopped.");
|
|
1098
913
|
}
|
|
1099
|
-
const result = await __classPrivateFieldGet(this, _MessageManager_c, "f").
|
|
1100
|
-
peer: await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId),
|
|
1101
|
-
id: messageId,
|
|
1102
|
-
media: new types.InputMediaPoll({
|
|
1103
|
-
poll: new types.Poll({
|
|
1104
|
-
id: BigInt(message.poll.id),
|
|
1105
|
-
closed: true,
|
|
1106
|
-
question: "",
|
|
1107
|
-
answers: [],
|
|
1108
|
-
}),
|
|
1109
|
-
}),
|
|
1110
|
-
reply_markup: await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_constructReplyMarkup).call(this, params),
|
|
1111
|
-
});
|
|
914
|
+
const result = await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({ _: "messages.editMessage", peer: await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId), id: messageId, media: ({ _: "inputMediaPoll", poll: ({ _: "poll", id: BigInt(message.poll.id), closed: true, question: "", answers: [] }) }), reply_markup: await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_constructReplyMarkup).call(this, params) });
|
|
1112
915
|
const message_ = await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_updatesToMessages).call(this, chatId, result).then((v) => v[0]);
|
|
1113
916
|
return assertMessageType(message_, "poll").poll;
|
|
1114
917
|
}
|
|
1115
918
|
async editMessageLiveLocation(chatId, messageId, latitude, longitude, params) {
|
|
1116
919
|
const message = await this.getMessage(chatId, messageId);
|
|
1117
920
|
if (message && "location" in message && message.location.livePeriod) {
|
|
1118
|
-
const result = await __classPrivateFieldGet(this, _MessageManager_c, "f").
|
|
1119
|
-
peer: await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId),
|
|
1120
|
-
id: messageId,
|
|
1121
|
-
media: new types.InputMediaGeoLive({
|
|
1122
|
-
geo_point: new types.InputGeoPoint({
|
|
1123
|
-
lat: latitude,
|
|
1124
|
-
long: longitude,
|
|
1125
|
-
accuracy_radius: params?.horizontalAccuracy,
|
|
1126
|
-
}),
|
|
1127
|
-
heading: params?.heading,
|
|
1128
|
-
proximity_notification_radius: params?.proximityAlertRadius,
|
|
1129
|
-
}),
|
|
1130
|
-
reply_markup: await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_constructReplyMarkup).call(this, params),
|
|
1131
|
-
});
|
|
921
|
+
const result = await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({ _: "messages.editMessage", peer: await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId), id: messageId, media: ({ _: "inputMediaGeoLive", geo_point: ({ _: "inputGeoPoint", lat: latitude, long: longitude, accuracy_radius: params?.horizontalAccuracy }), heading: params?.heading, proximity_notification_radius: params?.proximityAlertRadius }), reply_markup: await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_constructReplyMarkup).call(this, params) });
|
|
1132
922
|
const message = await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_updatesToMessages).call(this, chatId, result).then((v) => v[0]);
|
|
1133
923
|
return assertMessageType(message, "location");
|
|
1134
924
|
}
|
|
@@ -1137,43 +927,31 @@ export class MessageManager {
|
|
|
1137
927
|
async editInlineMessageLiveLocation(inlineMessageId, latitude, longitude, params) {
|
|
1138
928
|
await __classPrivateFieldGet(this, _MessageManager_c, "f").storage.assertBot("editInlineMessageLiveLocation");
|
|
1139
929
|
const id = deserializeInlineMessageId(inlineMessageId);
|
|
1140
|
-
await __classPrivateFieldGet(this, _MessageManager_c, "f").
|
|
1141
|
-
id,
|
|
1142
|
-
media: new types.InputMediaGeoLive({
|
|
1143
|
-
geo_point: new types.InputGeoPoint({
|
|
1144
|
-
lat: latitude,
|
|
1145
|
-
long: longitude,
|
|
1146
|
-
accuracy_radius: params?.horizontalAccuracy,
|
|
1147
|
-
}),
|
|
1148
|
-
heading: params?.heading,
|
|
1149
|
-
proximity_notification_radius: params?.proximityAlertRadius,
|
|
1150
|
-
}),
|
|
1151
|
-
reply_markup: await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_constructReplyMarkup).call(this, params),
|
|
1152
|
-
});
|
|
930
|
+
await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({ _: "messages.editInlineBotMessage", id, media: ({ _: "inputMediaGeoLive", geo_point: ({ _: "inputGeoPoint", lat: latitude, long: longitude, accuracy_radius: params?.horizontalAccuracy }), heading: params?.heading, proximity_notification_radius: params?.proximityAlertRadius }), reply_markup: await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_constructReplyMarkup).call(this, params) });
|
|
1153
931
|
}
|
|
1154
932
|
}
|
|
1155
933
|
_MessageManager_c = new WeakMap(), _MessageManager_LresolveFileId = new WeakMap(), _MessageManager_instances = new WeakSet(), _MessageManager_updatesToMessages = async function _MessageManager_updatesToMessages(chatId, updates, businessConnectionId) {
|
|
1156
934
|
const messages = new Array();
|
|
1157
|
-
if (updates
|
|
935
|
+
if (is("updates", updates)) {
|
|
1158
936
|
for (const update of updates.updates) {
|
|
1159
|
-
if ("message" in update && update.message
|
|
937
|
+
if ("message" in update && is("messageEmpty", update.message)) {
|
|
1160
938
|
continue;
|
|
1161
939
|
}
|
|
1162
|
-
if (update
|
|
940
|
+
if (is("updateNewMessage", update) || is("updateEditMessage", update)) {
|
|
1163
941
|
messages.push(await this.constructMessage(update.message));
|
|
1164
942
|
}
|
|
1165
|
-
else if (update
|
|
943
|
+
else if (is("updateNewChannelMessage", update) || is("updateEditChannelMessage", update)) {
|
|
1166
944
|
messages.push(await this.constructMessage(update.message));
|
|
1167
945
|
}
|
|
1168
|
-
else if (update
|
|
946
|
+
else if (is("updateBotNewBusinessMessage", update)) {
|
|
1169
947
|
messages.push(await this.constructMessage(update.message, false, { connectionId: businessConnectionId ?? update.connection_id, replyToMessage: update.reply_to_message }));
|
|
1170
948
|
}
|
|
1171
|
-
else if (update
|
|
949
|
+
else if (is("updateBotEditBusinessMessage", update)) {
|
|
1172
950
|
messages.push(await this.constructMessage(update.message, false, { connectionId: businessConnectionId ?? update.connection_id, replyToMessage: update.reply_to_message }));
|
|
1173
951
|
}
|
|
1174
952
|
}
|
|
1175
953
|
}
|
|
1176
|
-
else if (updates
|
|
954
|
+
else if (is("updateShortSentMessage", updates)) {
|
|
1177
955
|
const message = await this.getMessage(chatId, updates.id);
|
|
1178
956
|
if (message != null) {
|
|
1179
957
|
messages.push(message);
|
|
@@ -1194,7 +972,7 @@ _MessageManager_c = new WeakMap(), _MessageManager_LresolveFileId = new WeakMap(
|
|
|
1194
972
|
}, _MessageManager_constructReplyTo = async function _MessageManager_constructReplyTo(params) {
|
|
1195
973
|
const topMsgId = params?.messageThreadId;
|
|
1196
974
|
const replyToMsgId = params?.replyToMessageId;
|
|
1197
|
-
return replyToMsgId !== undefined ?
|
|
975
|
+
return replyToMsgId !== undefined ? ({ _: "inputReplyToMessage", reply_to_msg_id: replyToMsgId, top_msg_id: topMsgId, quote_text: params?.replyQuote?.text, quote_entities: await Promise.all(params?.replyQuote?.entities.map((v) => messageEntityToTlObject(v, __classPrivateFieldGet(this, _MessageManager_c, "f").getEntity)) ?? []), quote_offset: params?.replyQuote?.offset }) : undefined;
|
|
1198
976
|
}, _MessageManager_sendDocumentInner = async function _MessageManager_sendDocumentInner(chatId, document, params, fileType, otherAttribs, urlSupported = true, expectedMimeTypes) {
|
|
1199
977
|
let media = null;
|
|
1200
978
|
const spoiler = params?.hasSpoiler ? true : undefined;
|
|
@@ -1202,12 +980,7 @@ _MessageManager_c = new WeakMap(), _MessageManager_LresolveFileId = new WeakMap(
|
|
|
1202
980
|
if (typeof document === "string") {
|
|
1203
981
|
const fileId = this.resolveFileId(document, fileType);
|
|
1204
982
|
if (fileId != null) {
|
|
1205
|
-
media =
|
|
1206
|
-
id: new types.InputDocument(fileId),
|
|
1207
|
-
spoiler,
|
|
1208
|
-
query: otherAttribs.find((v) => v instanceof types.DocumentAttributeSticker)?.alt || undefined,
|
|
1209
|
-
ttl_seconds,
|
|
1210
|
-
});
|
|
983
|
+
media = { _: "inputMediaDocument", id: { ...fileId, _: "inputDocument" }, spoiler, query: otherAttribs.find((v) => is("documentAttributeSticker", v))?.alt || undefined, ttl_seconds };
|
|
1211
984
|
}
|
|
1212
985
|
}
|
|
1213
986
|
if (media == null) {
|
|
@@ -1215,7 +988,7 @@ _MessageManager_c = new WeakMap(), _MessageManager_LresolveFileId = new WeakMap(
|
|
|
1215
988
|
if (!urlSupported) {
|
|
1216
989
|
throw new InputError("URL not supported.");
|
|
1217
990
|
}
|
|
1218
|
-
media =
|
|
991
|
+
media = { _: "inputMediaDocumentExternal", url: document, spoiler, ttl_seconds };
|
|
1219
992
|
}
|
|
1220
993
|
else {
|
|
1221
994
|
let mimeType;
|
|
@@ -1233,15 +1006,7 @@ _MessageManager_c = new WeakMap(), _MessageManager_LresolveFileId = new WeakMap(
|
|
|
1233
1006
|
if (params?.thumbnail) {
|
|
1234
1007
|
thumb = await __classPrivateFieldGet(this, _MessageManager_c, "f").fileManager.upload(params.thumbnail, { chunkSize: params?.chunkSize, signal: params?.signal });
|
|
1235
1008
|
}
|
|
1236
|
-
media =
|
|
1237
|
-
file,
|
|
1238
|
-
thumb,
|
|
1239
|
-
spoiler,
|
|
1240
|
-
attributes: [new types.DocumentAttributeFilename({ file_name: file.name }), ...otherAttribs],
|
|
1241
|
-
mime_type: mimeType,
|
|
1242
|
-
force_file: fileType == FileType.Document ? true : undefined,
|
|
1243
|
-
ttl_seconds,
|
|
1244
|
-
});
|
|
1009
|
+
media = { _: "inputMediaUploadedDocument", file, thumb, spoiler, attributes: [{ _: "documentAttributeFilename", file_name: file.name }, ...otherAttribs], mime_type: mimeType, force_file: fileType == FileType.Document ? true : undefined, ttl_seconds };
|
|
1245
1010
|
}
|
|
1246
1011
|
}
|
|
1247
1012
|
const message = await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_sendMedia).call(this, chatId, media, params);
|
|
@@ -1251,13 +1016,14 @@ _MessageManager_c = new WeakMap(), _MessageManager_LresolveFileId = new WeakMap(
|
|
|
1251
1016
|
const randomId = getRandomId();
|
|
1252
1017
|
const silent = params?.disableNotification ? true : undefined;
|
|
1253
1018
|
const noforwards = params?.protectContent ? true : undefined;
|
|
1254
|
-
const sendAs = params?.sendAs ? await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(params.sendAs) : undefined;
|
|
1019
|
+
const sendAs = params?.sendAs ? await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(params.sendAs) : undefined;
|
|
1255
1020
|
const replyMarkup = await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_constructReplyMarkup).call(this, params);
|
|
1256
1021
|
const caption_ = params?.caption;
|
|
1257
1022
|
const parseResult = caption_ !== undefined ? await this.parseText(caption_, { parseMode: params?.parseMode, entities: params?.captionEntities }) : undefined;
|
|
1258
1023
|
const caption = parseResult === undefined ? undefined : parseResult[0];
|
|
1259
1024
|
const captionEntities = parseResult === undefined ? undefined : parseResult[1];
|
|
1260
|
-
const result = await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke(
|
|
1025
|
+
const result = await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({
|
|
1026
|
+
_: "messages.sendMedia",
|
|
1261
1027
|
peer,
|
|
1262
1028
|
random_id: randomId,
|
|
1263
1029
|
silent,
|
|
@@ -1268,7 +1034,7 @@ _MessageManager_c = new WeakMap(), _MessageManager_LresolveFileId = new WeakMap(
|
|
|
1268
1034
|
media,
|
|
1269
1035
|
message: caption ?? "",
|
|
1270
1036
|
entities: captionEntities,
|
|
1271
|
-
}
|
|
1037
|
+
}, params?.businessConnectionId);
|
|
1272
1038
|
return await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_updatesToMessages).call(this, chatId, result, params?.businessConnectionId).then((v) => v[0]);
|
|
1273
1039
|
}, _MessageManager_resolveInputMediaInner = async function _MessageManager_resolveInputMediaInner(document, media, fileType, otherAttribs) {
|
|
1274
1040
|
let media_ = null;
|
|
@@ -1276,16 +1042,12 @@ _MessageManager_c = new WeakMap(), _MessageManager_LresolveFileId = new WeakMap(
|
|
|
1276
1042
|
if (typeof document === "string") {
|
|
1277
1043
|
const fileId = this.resolveFileId(document, fileType);
|
|
1278
1044
|
if (fileId != null) {
|
|
1279
|
-
media_ =
|
|
1280
|
-
id: new types.InputDocument(fileId),
|
|
1281
|
-
spoiler,
|
|
1282
|
-
query: otherAttribs.find((v) => v instanceof types.DocumentAttributeSticker)?.alt || undefined,
|
|
1283
|
-
});
|
|
1045
|
+
media_ = { _: "inputMediaDocument", id: { ...fileId, _: "inputDocument" }, spoiler, query: otherAttribs.find((v) => is("documentAttributeSticker", v))?.alt || undefined };
|
|
1284
1046
|
}
|
|
1285
1047
|
}
|
|
1286
1048
|
if (media_ == null) {
|
|
1287
1049
|
if (typeof document === "string" && isHttpUrl(document)) {
|
|
1288
|
-
media_ =
|
|
1050
|
+
media_ = { _: "inputMediaDocumentExternal", url: document, spoiler };
|
|
1289
1051
|
}
|
|
1290
1052
|
else {
|
|
1291
1053
|
let mimeType;
|
|
@@ -1300,36 +1062,20 @@ _MessageManager_c = new WeakMap(), _MessageManager_LresolveFileId = new WeakMap(
|
|
|
1300
1062
|
if ("thumbnail" in media && media.thumbnail) {
|
|
1301
1063
|
thumb = await __classPrivateFieldGet(this, _MessageManager_c, "f").fileManager.upload(media.thumbnail, { chunkSize: media?.chunkSize, signal: media?.signal });
|
|
1302
1064
|
}
|
|
1303
|
-
media_ =
|
|
1304
|
-
file,
|
|
1305
|
-
thumb,
|
|
1306
|
-
spoiler,
|
|
1307
|
-
attributes: [new types.DocumentAttributeFilename({ file_name: file.name }), ...otherAttribs],
|
|
1308
|
-
mime_type: mimeType,
|
|
1309
|
-
force_file: fileType == FileType.Document ? true : undefined,
|
|
1310
|
-
});
|
|
1065
|
+
media_ = { _: "inputMediaUploadedDocument", file, thumb, spoiler, attributes: [{ _: "documentAttributeFilename", file_name: file.name }, ...otherAttribs], mime_type: mimeType, force_file: fileType == FileType.Document ? true : undefined };
|
|
1311
1066
|
}
|
|
1312
1067
|
}
|
|
1313
1068
|
return media_;
|
|
1314
1069
|
}, _MessageManager_resolveInputMedia = async function _MessageManager_resolveInputMedia(media) {
|
|
1315
1070
|
if ("animation" in media) {
|
|
1316
1071
|
return await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_resolveInputMediaInner).call(this, media.animation, media, FileType.Animation, [
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
supports_streaming: true,
|
|
1320
|
-
w: media?.width ?? 0,
|
|
1321
|
-
h: media?.height ?? 0,
|
|
1322
|
-
duration: media?.duration ?? 0,
|
|
1323
|
-
}),
|
|
1072
|
+
{ _: "documentAttributeAnimated" },
|
|
1073
|
+
{ _: "documentAttributeVideo", supports_streaming: true, w: media?.width ?? 0, h: media?.height ?? 0, duration: media?.duration ?? 0 },
|
|
1324
1074
|
]);
|
|
1325
1075
|
}
|
|
1326
1076
|
else if ("audio" in media) {
|
|
1327
1077
|
return await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_resolveInputMediaInner).call(this, media.audio, media, FileType.Audio, [
|
|
1328
|
-
|
|
1329
|
-
duration: media?.duration ?? 0,
|
|
1330
|
-
performer: media?.performer,
|
|
1331
|
-
title: media?.title,
|
|
1332
|
-
}),
|
|
1078
|
+
{ _: "documentAttributeAudio", duration: media?.duration ?? 0, performer: media?.performer, title: media?.title },
|
|
1333
1079
|
]);
|
|
1334
1080
|
}
|
|
1335
1081
|
else if ("document" in media) {
|
|
@@ -1342,20 +1088,16 @@ _MessageManager_c = new WeakMap(), _MessageManager_LresolveFileId = new WeakMap(
|
|
|
1342
1088
|
if (typeof media.photo === "string") {
|
|
1343
1089
|
const fileId = this.resolveFileId(media.photo, [FileType.Photo, FileType.ProfilePhoto]);
|
|
1344
1090
|
if (fileId != null) {
|
|
1345
|
-
media_ =
|
|
1346
|
-
id: new types.InputPhoto(fileId),
|
|
1347
|
-
spoiler,
|
|
1348
|
-
ttl_seconds,
|
|
1349
|
-
});
|
|
1091
|
+
media_ = { _: "inputMediaPhoto", id: { ...fileId, _: "inputPhoto" }, spoiler, ttl_seconds };
|
|
1350
1092
|
}
|
|
1351
1093
|
}
|
|
1352
1094
|
if (media_ == null) {
|
|
1353
1095
|
if (typeof media.photo === "string" && isHttpUrl(media.photo)) {
|
|
1354
|
-
media_ =
|
|
1096
|
+
media_ = { _: "inputMediaPhotoExternal", url: media.photo, spoiler };
|
|
1355
1097
|
}
|
|
1356
1098
|
else {
|
|
1357
1099
|
const file = await __classPrivateFieldGet(this, _MessageManager_c, "f").fileManager.upload(media.photo, media, null, false);
|
|
1358
|
-
media_ =
|
|
1100
|
+
media_ = { _: "inputMediaUploadedPhoto", file, spoiler, ttl_seconds };
|
|
1359
1101
|
}
|
|
1360
1102
|
}
|
|
1361
1103
|
return media_;
|
|
@@ -1363,12 +1105,7 @@ _MessageManager_c = new WeakMap(), _MessageManager_LresolveFileId = new WeakMap(
|
|
|
1363
1105
|
else if ("video" in media) {
|
|
1364
1106
|
const ttl_seconds = "selfDestruct" in media && media.selfDestruct !== undefined ? selfDestructOptionToInt(media.selfDestruct) : undefined;
|
|
1365
1107
|
const media_ = await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_resolveInputMediaInner).call(this, media.video, media, FileType.Video, [
|
|
1366
|
-
|
|
1367
|
-
supports_streaming: media?.supportsStreaming ? true : undefined,
|
|
1368
|
-
w: media?.width ?? 0,
|
|
1369
|
-
h: media?.height ?? 0,
|
|
1370
|
-
duration: media?.duration ?? 0,
|
|
1371
|
-
}),
|
|
1108
|
+
{ _: "documentAttributeVideo", supports_streaming: media?.supportsStreaming ? true : undefined, w: media?.width ?? 0, h: media?.height ?? 0, duration: media?.duration ?? 0 },
|
|
1372
1109
|
]);
|
|
1373
1110
|
media_.ttl_seconds = ttl_seconds;
|
|
1374
1111
|
return media_;
|
|
@@ -1377,14 +1114,8 @@ _MessageManager_c = new WeakMap(), _MessageManager_LresolveFileId = new WeakMap(
|
|
|
1377
1114
|
unreachable();
|
|
1378
1115
|
}
|
|
1379
1116
|
}, _MessageManager_sendReaction = async function _MessageManager_sendReaction(chatId, messageId, reactions, params) {
|
|
1380
|
-
await __classPrivateFieldGet(this, _MessageManager_c, "f").
|
|
1381
|
-
peer: await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId),
|
|
1382
|
-
msg_id: checkMessageId(messageId),
|
|
1383
|
-
reaction: reactions.map((v) => reactionToTlObject(v)),
|
|
1384
|
-
big: params?.big ? true : undefined,
|
|
1385
|
-
add_to_recent: params?.addToRecents ? true : undefined,
|
|
1386
|
-
});
|
|
1117
|
+
await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({ _: "messages.sendReaction", peer: await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId), msg_id: checkMessageId(messageId), reaction: reactions.map((v) => reactionToTlObject(v)), big: params?.big ? true : undefined, add_to_recent: params?.addToRecents ? true : undefined });
|
|
1387
1118
|
}, _MessageManager_toggleJoinRequests = async function _MessageManager_toggleJoinRequests(chatId, enabled) {
|
|
1388
1119
|
const channel = await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputChannel(chatId);
|
|
1389
|
-
await __classPrivateFieldGet(this, _MessageManager_c, "f").
|
|
1120
|
+
await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({ _: "channels.toggleJoinRequest", channel, enabled });
|
|
1390
1121
|
};
|