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