@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
@@ -19,7 +19,7 @@
19
19
  */
20
20
  import { unreachable } from "../0_deps.js";
21
21
  import { cleanObject, fromUnixTimestamp, getLogger, ZERO_CHANNEL_ID } from "../1_utilities.js";
22
- import { as, types } from "../2_tl.js";
22
+ import { as, is } from "../2_tl.js";
23
23
  import { FileType, toUniqueFileId } from "./_file_id.js";
24
24
  import { serializeFileId } from "./_file_id.js";
25
25
  import { constructContact } from "./0_contact.js";
@@ -95,7 +95,7 @@ export function assertMessageType(message, type) {
95
95
  return message;
96
96
  }
97
97
  async function getSender(message_, getEntity) {
98
- if (message_.from_id instanceof types.PeerUser) {
98
+ if (is("peerUser", message_.from_id)) {
99
99
  const entity = await getEntity(message_.from_id);
100
100
  if (entity) {
101
101
  return { from: constructUser(entity) };
@@ -104,7 +104,7 @@ async function getSender(message_, getEntity) {
104
104
  unreachable();
105
105
  }
106
106
  }
107
- else if (message_.from_id instanceof types.PeerChannel) {
107
+ else if (is("peerChannel", message_.from_id)) {
108
108
  const entity = await getEntity(message_.from_id);
109
109
  if (entity) {
110
110
  return { senderChat: constructChatP(entity) };
@@ -113,9 +113,18 @@ async function getSender(message_, getEntity) {
113
113
  unreachable();
114
114
  }
115
115
  }
116
+ else if (is("peerUser", message_.peer_id)) {
117
+ const entity = await getEntity(message_.peer_id);
118
+ if (entity) {
119
+ return { from: constructUser(entity) };
120
+ }
121
+ else {
122
+ unreachable();
123
+ }
124
+ }
116
125
  }
117
126
  async function getReply(message_, chat, getMessage) {
118
- if (getMessage && message_.reply_to instanceof types.MessageReplyHeader && message_.reply_to.reply_to_msg_id) {
127
+ if (getMessage && is("messageReplyHeader", message_.reply_to) && message_.reply_to.reply_to_msg_id) {
119
128
  let isTopicMessage = false;
120
129
  if (message_.reply_to.forum_topic) {
121
130
  isTopicMessage = true;
@@ -139,11 +148,11 @@ async function constructServiceMessage(message_, chat, getEntity, getMessage) {
139
148
  isTopicMessage: false,
140
149
  };
141
150
  Object.assign(message, await getSender(message_, getEntity));
142
- if (message_.action instanceof types.MessageActionChatAddUser || message_.action instanceof types.MessageActionChatJoinedByLink || message_.action instanceof types.MessageActionChatJoinedByRequest) {
151
+ if (is("messageActionChatAddUser", message_.action) || is("messageActionChatJoinedByLink", message_.action) || is("messageActionChatJoinedByRequest", message_.action)) {
143
152
  const newChatMembers = new Array();
144
153
  const users = "users" in message_.action ? message_.action.users : [message_.from_id && "user_id" in message_.from_id ? message_.from_id.user_id : unreachable()];
145
154
  for (const user_ of users) {
146
- const entity = await getEntity(new types.PeerUser({ user_id: user_ }));
155
+ const entity = await getEntity({ _: "peerUser", user_id: user_ });
147
156
  if (entity) {
148
157
  const user = constructUser(entity);
149
158
  newChatMembers.push(user);
@@ -154,31 +163,31 @@ async function constructServiceMessage(message_, chat, getEntity, getMessage) {
154
163
  }
155
164
  return { ...message, newChatMembers };
156
165
  }
157
- else if (message_.action instanceof types.MessageActionChatDeleteUser) {
158
- const entity = await getEntity(new types.PeerUser({ user_id: message_.action.user_id }));
166
+ else if (is("messageActionChatDeleteUser", message_.action)) {
167
+ const entity = await getEntity({ _: "peerUser", user_id: message_.action.user_id });
159
168
  if (entity) {
160
169
  const user = constructUser(entity);
161
170
  const leftChatMember = user;
162
171
  return { ...message, leftChatMember };
163
172
  }
164
173
  }
165
- else if (message_.action instanceof types.MessageActionChatEditTitle) {
174
+ else if (is("messageActionChatEditTitle", message_.action)) {
166
175
  const newChatTitle = message_.action.title;
167
176
  return { ...message, newChatTitle };
168
177
  }
169
- else if (message_.action instanceof types.MessageActionChatEditPhoto) {
170
- const newChatPhoto = constructPhoto(message_.action.photo[as](types.Photo));
178
+ else if (is("messageActionChatEditPhoto", message_.action)) {
179
+ const newChatPhoto = constructPhoto(as("photo", message_.action.photo));
171
180
  return { ...message, newChatPhoto };
172
181
  }
173
- else if (message_.action instanceof types.MessageActionChatDeletePhoto) {
182
+ else if (is("messageActionChatDeletePhoto", message_.action)) {
174
183
  const deletedChatPhoto = true;
175
184
  return { ...message, deletedChatPhoto };
176
185
  }
177
- else if (message_.action instanceof types.MessageActionChatCreate) {
186
+ else if (is("messageActionChatCreate", message_.action)) {
178
187
  const groupCreated = true;
179
188
  const newChatMembers = new Array();
180
189
  for (const user_ of message_.action.users) {
181
- const entity = await getEntity(new types.PeerUser({ user_id: user_ }));
190
+ const entity = await getEntity({ _: "peerUser", user_id: user_ });
182
191
  if (entity) {
183
192
  const user = constructUser(entity);
184
193
  newChatMembers.push(user);
@@ -186,7 +195,7 @@ async function constructServiceMessage(message_, chat, getEntity, getMessage) {
186
195
  }
187
196
  return { ...message, groupCreated, newChatMembers };
188
197
  }
189
- else if (message_.action instanceof types.MessageActionChannelCreate) {
198
+ else if (is("messageActionChannelCreate", message_.action)) {
190
199
  if (message.chat.type == "channel") {
191
200
  const channelCreated = true;
192
201
  return { ...message, channelCreated };
@@ -199,32 +208,32 @@ async function constructServiceMessage(message_, chat, getEntity, getMessage) {
199
208
  // unreachable();
200
209
  }
201
210
  }
202
- else if (message_.action instanceof types.MessageActionChatMigrateTo) {
211
+ else if (is("messageActionChatMigrateTo", message_.action)) {
203
212
  const chatMigratedTo = ZERO_CHANNEL_ID + Number(-message_.action.channel_id);
204
213
  return { ...message, chatMigratedTo };
205
214
  }
206
- else if (message_.action instanceof types.MessageActionChannelMigrateFrom) {
215
+ else if (is("messageActionChannelMigrateFrom", message_.action)) {
207
216
  const chatMigratedFrom = Number(-message_.action.chat_id);
208
217
  return { ...message, chatMigratedFrom };
209
218
  }
210
- else if (message_.action instanceof types.MessageActionPinMessage) {
219
+ else if (is("messageActionPinMessage", message_.action)) {
211
220
  const { replyToMessage } = await getReply(message_, chat, getMessage);
212
221
  if (replyToMessage) {
213
222
  const pinnedMessage = replyToMessage;
214
223
  return { ...message, pinnedMessage };
215
224
  }
216
225
  }
217
- else if (message_.action instanceof types.MessageActionRequestedPeer) {
218
- const user = message_.action.peers[0][as](types.PeerUser);
226
+ else if (is("messageActionRequestedPeer", message_.action)) {
227
+ const user = as("peerUser", message_.action.peers[0]);
219
228
  const userShared = { requestId: message_.action.button_id, userId: Number(user.user_id) };
220
229
  return { ...message, userShared };
221
230
  }
222
- else if (message_.action instanceof types.MessageActionBotAllowed) {
223
- const miniAppName = message_.action.app ? message_.action.app[as](types.BotApp).title : undefined;
231
+ else if (is("messageActionBotAllowed", message_.action)) {
232
+ const miniAppName = message_.action.app ? as("botApp", message_.action.app).title : undefined;
224
233
  const writeAccessAllowed = { miniAppName };
225
234
  return { ...message, writeAccessAllowed };
226
235
  }
227
- else if (message_.action instanceof types.MessageActionTopicCreate) {
236
+ else if (is("messageActionTopicCreate", message_.action)) {
228
237
  const forumTopicCreated = {
229
238
  name: message_.action.title,
230
239
  iconColor: "#" + message_.action.icon_color.toString(16).padStart(6, "0"),
@@ -232,7 +241,7 @@ async function constructServiceMessage(message_, chat, getEntity, getMessage) {
232
241
  };
233
242
  return { ...message, forumTopicCreated };
234
243
  }
235
- else if (message_.action instanceof types.MessageActionTopicEdit) {
244
+ else if (is("messageActionTopicEdit", message_.action)) {
236
245
  if (message_.action.closed) {
237
246
  const forumTopicClosed = true;
238
247
  return { ...message, forumTopicClosed };
@@ -249,11 +258,11 @@ async function constructServiceMessage(message_, chat, getEntity, getMessage) {
249
258
  return { ...message, forumTopicReopened };
250
259
  }
251
260
  }
252
- else if (message_.action instanceof types.MessageActionGroupCallScheduled) {
261
+ else if (is("messageActionGroupCallScheduled", message_.action)) {
253
262
  const videoChatScheduled = { startDate: new Date(message_.action.schedule_date * 1000) };
254
263
  return { ...message, videoChatScheduled };
255
264
  }
256
- else if (message_.action instanceof types.MessageActionGroupCall) {
265
+ else if (is("messageActionGroupCall", message_.action)) {
257
266
  if (message_.action.duration) {
258
267
  const videoChatEnded = { duration: message_.action.duration };
259
268
  return { ...message, videoChatEnded };
@@ -263,19 +272,19 @@ async function constructServiceMessage(message_, chat, getEntity, getMessage) {
263
272
  return { ...message, videoChatStarted };
264
273
  }
265
274
  }
266
- else if (message_.action instanceof types.MessageActionSetMessagesTTL) {
275
+ else if (is("messageActionSetMessagesTTL", message_.action)) {
267
276
  const newAutoDeleteTime = message_.action.period || 0;
268
277
  return { ...message, newAutoDeleteTime };
269
278
  }
270
279
  return { ...message, unsupported: true };
271
280
  }
272
281
  export async function constructMessage(message_, getEntity, getMessage, getStickerSetName, getReply_ = true, business) {
273
- if (!(message_ instanceof types.Message) && !(message_ instanceof types.MessageService)) {
282
+ if (!(is("message", message_)) && !(is("messageService", message_))) {
274
283
  unreachable();
275
284
  }
276
285
  let link;
277
286
  let chat_ = null;
278
- if (message_.peer_id instanceof types.PeerUser) {
287
+ if (is("peerUser", message_.peer_id)) {
279
288
  const entity = await getEntity(message_.peer_id);
280
289
  if (entity) {
281
290
  chat_ = constructChatP(entity);
@@ -284,7 +293,7 @@ export async function constructMessage(message_, getEntity, getMessage, getStick
284
293
  unreachable();
285
294
  }
286
295
  }
287
- else if (message_.peer_id instanceof types.PeerChat) {
296
+ else if (is("peerChat", message_.peer_id)) {
288
297
  const entity = await getEntity(message_.peer_id);
289
298
  if (entity) {
290
299
  chat_ = constructChatP(entity);
@@ -293,7 +302,7 @@ export async function constructMessage(message_, getEntity, getMessage, getStick
293
302
  unreachable();
294
303
  }
295
304
  }
296
- else if (message_.peer_id instanceof types.PeerChannel) {
305
+ else if (is("peerChannel", message_.peer_id)) {
297
306
  link = `https://t.me/c/${message_.peer_id.channel_id}/${message_.id}`;
298
307
  const entity = await getEntity(message_.peer_id);
299
308
  if (entity) {
@@ -306,7 +315,7 @@ export async function constructMessage(message_, getEntity, getMessage, getStick
306
315
  else {
307
316
  unreachable();
308
317
  }
309
- if (message_ instanceof types.MessageService) {
318
+ if (is("messageService", message_)) {
310
319
  return await constructServiceMessage(message_, chat_, getEntity, getMessage);
311
320
  }
312
321
  const message = {
@@ -317,7 +326,7 @@ export async function constructMessage(message_, getEntity, getMessage, getStick
317
326
  date: fromUnixTimestamp(message_.date),
318
327
  views: message_.views,
319
328
  forwards: message_.forwards,
320
- isTopicMessage: message_.reply_to && message_.reply_to instanceof types.MessageReplyHeader && message_.reply_to.reply_to_top_id ? true : false,
329
+ isTopicMessage: message_.reply_to && is("messageReplyHeader", message_.reply_to) && message_.reply_to.reply_to_top_id ? true : false,
321
330
  hasProtectedContent: message_.noforwards || false,
322
331
  senderBoostCount: message_.from_boosts_applied,
323
332
  };
@@ -325,7 +334,7 @@ export async function constructMessage(message_, getEntity, getMessage, getStick
325
334
  const recentReactions = message_.reactions.recent_reactions ?? [];
326
335
  message.reactions = message_.reactions.results.map((v) => constructMessageReaction(v, recentReactions));
327
336
  }
328
- if (message_.reply_to instanceof types.MessageReplyHeader && message_.reply_to.reply_to_msg_id) {
337
+ if (is("messageReplyHeader", message_.reply_to) && message_.reply_to.reply_to_msg_id) {
329
338
  if (message_.reply_to.quote) {
330
339
  message.replyQuote = constructReplyQuote(message_.reply_to.quote_text, message_.reply_to.quote_offset, message_.reply_to.quote_entities);
331
340
  }
@@ -346,7 +355,7 @@ export async function constructMessage(message_, getEntity, getMessage, getStick
346
355
  message.replyMarkup = constructReplyMarkup(message_.reply_markup);
347
356
  }
348
357
  if (message_.via_bot_id != undefined) {
349
- const viaBot = await getEntity(new types.PeerUser({ user_id: message_.via_bot_id }));
358
+ const viaBot = await getEntity({ _: "peerUser", user_id: message_.via_bot_id });
350
359
  if (viaBot) {
351
360
  message.viaBot = constructUser(viaBot);
352
361
  }
@@ -355,7 +364,7 @@ export async function constructMessage(message_, getEntity, getMessage, getStick
355
364
  }
356
365
  }
357
366
  if (message_.via_business_bot_id != undefined) {
358
- const viaBusinessBot = await getEntity(new types.PeerUser({ user_id: message_.via_business_bot_id }));
367
+ const viaBusinessBot = await getEntity({ _: "peerUser", user_id: message_.via_business_bot_id });
359
368
  if (viaBusinessBot) {
360
369
  message.viaBusinessBot = constructUser(viaBusinessBot);
361
370
  }
@@ -366,25 +375,25 @@ export async function constructMessage(message_, getEntity, getMessage, getStick
366
375
  if (message_.post_author != undefined) {
367
376
  message.authorSignature = message_.post_author;
368
377
  }
369
- if (message_.fwd_from instanceof types.MessageFwdHeader) {
378
+ if (is("messageFwdHeader", message_.fwd_from)) {
370
379
  message.isAutomaticForward = message_.fwd_from.saved_from_peer != undefined && message_.fwd_from.saved_from_msg_id != undefined;
371
380
  message.forwardSenderName = message_.fwd_from.from_name;
372
381
  message.forwardId = message_.fwd_from.channel_post;
373
382
  message.forwardSignature = message_.fwd_from.post_author;
374
383
  message.forwardDate = fromUnixTimestamp(message_.fwd_from.date);
375
- if (message_.fwd_from.from_id instanceof types.PeerUser) {
384
+ if (is("peerUser", message_.fwd_from.from_id)) {
376
385
  const entity = await getEntity(message_.fwd_from.from_id);
377
386
  if (entity) {
378
387
  message.forwardFrom = constructUser(entity);
379
388
  }
380
389
  }
381
- else if (message_.fwd_from.from_id instanceof types.PeerChat) {
390
+ else if (is("peerChat", message_.fwd_from.from_id)) {
382
391
  const entity = await getEntity(message_.fwd_from.from_id);
383
392
  if (entity) {
384
393
  message.forwardFromChat = constructChatP(entity);
385
394
  }
386
395
  }
387
- else if (message_.fwd_from.from_id instanceof types.PeerChannel) {
396
+ else if (is("peerChannel", message_.fwd_from.from_id)) {
388
397
  const entity = await getEntity(message_.fwd_from.from_id);
389
398
  if (entity) {
390
399
  message.forwardFromChat = constructChatP(entity);
@@ -410,35 +419,35 @@ export async function constructMessage(message_, getEntity, getMessage, getStick
410
419
  caption: message_.message,
411
420
  captionEntities: message_.entities?.map(constructMessageEntity).filter((v) => !!v) ?? [],
412
421
  };
413
- if (message_.media instanceof types.MessageMediaPhoto || message_.media instanceof types.MessageMediaDocument) {
422
+ if (is("messageMediaPhoto", message_.media) || is("messageMediaDocument", message_.media)) {
414
423
  messageMedia.hasMediaSpoiler = message_.media.spoiler || false;
415
424
  }
416
425
  let m = null;
417
- if (message_.media instanceof types.MessageMediaPhoto) {
426
+ if (is("messageMediaPhoto", message_.media)) {
418
427
  if (!message_.media.photo) {
419
428
  unreachable();
420
429
  }
421
- const photo = constructPhoto(message_.media.photo[as](types.Photo));
430
+ const photo = constructPhoto(as("photo", message_.media.photo));
422
431
  m = { ...messageMedia, photo };
423
432
  }
424
- else if (message_.media instanceof types.MessageMediaDice) {
433
+ else if (is("messageMediaDice", message_.media)) {
425
434
  const dice = constructDice(message_.media);
426
435
  m = { ...message, dice };
427
436
  }
428
- else if (message_.media instanceof types.MessageMediaDocument) {
437
+ else if (is("messageMediaDocument", message_.media)) {
429
438
  const { document } = message_.media;
430
- if (document instanceof types.Document) {
439
+ if (is("document", document)) {
431
440
  const getFileId = (type) => ({
432
441
  type,
433
442
  dcId: document.dc_id,
434
443
  fileReference: document.file_reference,
435
444
  location: { type: "common", id: document.id, accessHash: document.access_hash },
436
445
  });
437
- const animated = document.attributes.find((v) => v instanceof types.DocumentAttributeAnimated);
438
- const audio = document.attributes.find((v) => v instanceof types.DocumentAttributeAudio);
439
- const fileName = document.attributes.find((v) => v instanceof types.DocumentAttributeFilename);
440
- const sticker = document.attributes.find((v) => v instanceof types.DocumentAttributeSticker);
441
- const video = document.attributes.find((v) => v instanceof types.DocumentAttributeVideo);
446
+ const animated = document.attributes.find((v) => is("documentAttributeAnimated", v));
447
+ const audio = document.attributes.find((v) => is("documentAttributeAudio", v));
448
+ const fileName = document.attributes.find((v) => is("documentAttributeFilename", v));
449
+ const sticker = document.attributes.find((v) => is("documentAttributeSticker", v));
450
+ const video = document.attributes.find((v) => is("documentAttributeVideo", v));
442
451
  if (animated) {
443
452
  const fileId = getFileId(FileType.Animation);
444
453
  const animation = constructAnimation(document, video, fileName, serializeFileId(fileId), toUniqueFileId(fileId));
@@ -475,32 +484,32 @@ export async function constructMessage(message_, getEntity, getMessage, getStick
475
484
  }
476
485
  else {
477
486
  const fileId = getFileId(FileType.Document);
478
- const document_ = constructDocument(document, fileName ?? new types.DocumentAttributeFilename({ file_name: "Unknown" }), serializeFileId(fileId), toUniqueFileId(fileId));
487
+ const document_ = constructDocument(document, fileName ?? ({ _: "documentAttributeFilename", file_name: "Unknown" }), serializeFileId(fileId), toUniqueFileId(fileId));
479
488
  m = { ...messageMedia, document: document_ };
480
489
  }
481
490
  }
482
491
  }
483
- else if (message_.media instanceof types.MessageMediaContact) {
492
+ else if (is("messageMediaContact", message_.media)) {
484
493
  const contact = constructContact(message_.media);
485
494
  m = { ...messageMedia, contact };
486
495
  }
487
- else if (message_.media instanceof types.MessageMediaGame) {
496
+ else if (is("messageMediaGame", message_.media)) {
488
497
  const game = constructGame(message_.media);
489
498
  m = { ...message, game };
490
499
  }
491
- else if (message_.media instanceof types.MessageMediaPoll) {
500
+ else if (is("messageMediaPoll", message_.media)) {
492
501
  const poll = constructPoll(message_.media);
493
502
  m = { ...message, poll };
494
503
  }
495
- else if (message_.media instanceof types.MessageMediaVenue) {
504
+ else if (is("messageMediaVenue", message_.media)) {
496
505
  const venue = constructVenue(message_.media);
497
506
  m = { ...message, venue };
498
507
  }
499
- else if (message_.media instanceof types.MessageMediaGeo || message_.media instanceof types.MessageMediaGeoLive) {
508
+ else if (is("messageMediaGeo", message_.media) || is("messageMediaGeoLive", message_.media)) {
500
509
  const location = constructLocation(message_.media);
501
510
  m = { ...message, location };
502
511
  }
503
- else if (message_.media instanceof types.MessageMediaWebPage) {
512
+ else if (is("messageMediaWebPage", message_.media)) {
504
513
  const linkPreview = constructLinkPreview(message_.media, message_.invert_media);
505
514
  if (message_.message) {
506
515
  m = { ...messageText, linkPreview };
@@ -509,7 +518,7 @@ export async function constructMessage(message_, getEntity, getMessage, getStick
509
518
  m = { ...message, linkPreview: { ...linkPreview, url: linkPreview.url ? linkPreview.url : unreachable() } };
510
519
  }
511
520
  }
512
- else if (message_.media instanceof types.MessageMediaGiveaway) {
521
+ else if (is("messageMediaGiveaway", message_.media)) {
513
522
  const giveaway = constructGiveaway(message_.media);
514
523
  m = { ...message, giveaway };
515
524
  }
@@ -17,7 +17,7 @@
17
17
  * You should have received a copy of the GNU Lesser General Public License
18
18
  * along with this program. If not, see <https://www.gnu.org/licenses/>.
19
19
  */
20
- import { enums, types } from "../2_tl.js";
20
+ import { Api } from "../2_tl.js";
21
21
  import { EntityGetter } from "./_getters.js";
22
22
  import { User } from "./1_user.js";
23
23
  import { Message, MessageGetter } from "./4_message.js";
@@ -38,6 +38,6 @@ export interface CallbackQuery {
38
38
  /** The short name of the game to be returned. */
39
39
  gameShortName?: string;
40
40
  }
41
- export declare function deserializeInlineMessageId(inlineMessageId: string): enums.InputBotInlineMessageID;
42
- export declare function constructCallbackQuery(callbackQuery: types.UpdateBotCallbackQuery | types.UpdateInlineBotCallbackQuery, getEntity: EntityGetter, getMessage: MessageGetter): Promise<CallbackQuery>;
41
+ export declare function deserializeInlineMessageId(inlineMessageId: string): Api.InputBotInlineMessageID;
42
+ export declare function constructCallbackQuery(callbackQuery: Api.updateBotCallbackQuery | Api.updateInlineBotCallbackQuery, getEntity: EntityGetter, getMessage: MessageGetter): Promise<CallbackQuery>;
43
43
  //# sourceMappingURL=5_callback_query.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"5_callback_query.d.ts","sourceRoot":"","sources":["../../src/types/5_callback_query.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAKH,OAAO,EAAE,KAAK,EAAqC,KAAK,EAAE,MAAM,YAAY,CAAC;AAC7E,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAiB,IAAI,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAExD,iCAAiC;AACjC,MAAM,WAAW,aAAa;IAC5B,4CAA4C;IAC5C,EAAE,EAAE,MAAM,CAAC;IACX,4CAA4C;IAC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CACxB;AAGD,wBAAgB,0BAA0B,CAAC,eAAe,EAAE,MAAM,GAAG,GAAG,CAAC,uBAAuB,CAa/F;AAED,wBAAsB,sBAAsB,CAAC,aAAa,EAAE,GAAG,CAAC,sBAAsB,GAAG,GAAG,CAAC,4BAA4B,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC,CAmBrM"}
@@ -20,7 +20,7 @@
20
20
  import { unreachable } from "../0_deps.js";
21
21
  import { InputError } from "../0_errors.js";
22
22
  import { base64DecodeUrlSafe, base64EncodeUrlSafe, cleanObject } from "../1_utilities.js";
23
- import { peerToChatId, serialize, TLReader, types } from "../2_tl.js";
23
+ import { is, peerToChatId, serialize, TLReader } from "../2_tl.js";
24
24
  import { constructUser } from "./1_user.js";
25
25
  const ERR_INVALID_INLINE_MESSAGE_ID = new InputError("Invalid inline message ID");
26
26
  export function deserializeInlineMessageId(inlineMessageId) {
@@ -28,7 +28,7 @@ export function deserializeInlineMessageId(inlineMessageId) {
28
28
  const buffer = base64DecodeUrlSafe(inlineMessageId);
29
29
  const reader = new TLReader(buffer);
30
30
  const object = reader.readObject();
31
- if (object instanceof types.InputBotInlineMessageID || object instanceof types.InputBotInlineMessageID64) {
31
+ if (is("inputBotInlineMessageID64", object) || is("inputBotInlineMessageID", object)) {
32
32
  return object;
33
33
  }
34
34
  }
@@ -38,7 +38,7 @@ export function deserializeInlineMessageId(inlineMessageId) {
38
38
  throw ERR_INVALID_INLINE_MESSAGE_ID;
39
39
  }
40
40
  export async function constructCallbackQuery(callbackQuery, getEntity, getMessage) {
41
- const user_ = await getEntity(new types.PeerUser({ user_id: callbackQuery.user_id }));
41
+ const user_ = await getEntity({ _: "peerUser", user_id: callbackQuery.user_id });
42
42
  if (!user_) {
43
43
  unreachable();
44
44
  }
@@ -47,7 +47,7 @@ export async function constructCallbackQuery(callbackQuery, getEntity, getMessag
47
47
  const gameShortName = callbackQuery.game_short_name;
48
48
  const data = callbackQuery.data !== undefined ? new TextDecoder().decode(callbackQuery.data) : undefined;
49
49
  const chatInstance = callbackQuery.chat_instance == 0n ? "" : String(callbackQuery.chat_instance);
50
- if (callbackQuery instanceof types.UpdateBotCallbackQuery) {
50
+ if (is("updateBotCallbackQuery", callbackQuery)) {
51
51
  const message = await getMessage(peerToChatId(callbackQuery.peer), Number(callbackQuery.msg_id));
52
52
  if (message == null) {
53
53
  unreachable();
@@ -55,6 +55,6 @@ export async function constructCallbackQuery(callbackQuery, getEntity, getMessag
55
55
  return cleanObject({ id, from: user, message, chatInstance, data, gameShortName });
56
56
  }
57
57
  else {
58
- return cleanObject({ id, from: user, inlineMessageId: base64EncodeUrlSafe(callbackQuery.msg_id[serialize]()), chatInstance, data, gameShortName });
58
+ return cleanObject({ id, from: user, inlineMessageId: base64EncodeUrlSafe(serialize(callbackQuery.msg_id)), chatInstance, data, gameShortName });
59
59
  }
60
60
  }
@@ -17,7 +17,7 @@
17
17
  * You should have received a copy of the GNU Lesser General Public License
18
18
  * along with this program. If not, see <https://www.gnu.org/licenses/>.
19
19
  */
20
- import { enums, types } from "../2_tl.js";
20
+ import { Api } from "../2_tl.js";
21
21
  import { EntityGetter } from "./_getters.js";
22
22
  import { ChatP } from "./1_chat_p.js";
23
23
  import { StickerSetNameGetter } from "./1_sticker.js";
@@ -30,7 +30,7 @@ export interface ChatListItem {
30
30
  }
31
31
  export declare function getChatListItemOrder(lastMessage: Omit<Message, "replyToMessage"> | undefined, pinned: number): string;
32
32
  export declare function constructChatListItem(chatId: number, pinned: number, lastMessageId: number, getEntity: EntityGetter, getMessage: MessageGetter): Promise<ChatListItem | null>;
33
- export declare function constructChatListItem2(entity: types.User | types.Chat | types.ChatForbidden | types.Channel | types.ChannelForbidden, pinned: number, lastMessage: Omit<Message, "replyToMessage"> | undefined): ChatListItem;
33
+ export declare function constructChatListItem2(entity: Api.user | Api.chat | Api.chatForbidden | Api.channel | Api.channelForbidden, pinned: number, lastMessage: Omit<Message, "replyToMessage"> | undefined): ChatListItem;
34
34
  export declare function constructChatListItem3(chatId: number, pinned: number, lastMessage: Omit<Message, "replyToMessage"> | undefined, getEntity: EntityGetter): Promise<ChatListItem | null>;
35
- export declare function constructChatListItem4(dialog: enums.Dialog, dialogs: types.messages.Dialogs | types.messages.DialogsSlice, pinnedChats: number[], getEntity: EntityGetter, getMessage: MessageGetter, getStickerSetName: StickerSetNameGetter): Promise<ChatListItem>;
35
+ export declare function constructChatListItem4(dialog: Api.Dialog, dialogs: Api.messages_dialogs | Api.messages_dialogsSlice, pinnedChats: number[], getEntity: EntityGetter, getMessage: MessageGetter, getStickerSetName: StickerSetNameGetter): Promise<ChatListItem>;
36
36
  //# sourceMappingURL=5_chat_list_item.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"5_chat_list_item.d.ts","sourceRoot":"","sources":["../../src/types/5_chat_list_item.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,EAAgB,KAAK,EAAgB,KAAK,EAAE,MAAM,YAAY,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,KAAK,EAAkB,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAoB,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE1E,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,KAAK,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,IAAI,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAC;CAC/C;AAED,wBAAgB,oBAAoB,CAAC,WAAW,EAAE,IAAI,CAAC,OAAO,EAAE,gBAAgB,CAAC,GAAG,SAAS,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAMrH;AAED,wBAAsB,qBAAqB,CAAC,MAAM,EAAE,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S,EAAE,YAAY,EAAE,UAAU,EAAE,aAAa,EAAE,iBAAiB,EAAE,oBAAoB,GAAG,OAAO,CAAC,YAAY,CAAC,CAqBrQ"}
@@ -18,7 +18,7 @@
18
18
  * along with this program. If not, see <https://www.gnu.org/licenses/>.
19
19
  */
20
20
  import { unreachable } from "../0_deps.js";
21
- import { chatIdToPeer, peerToChatId, types } from "../2_tl.js";
21
+ import { chatIdToPeer, is, peerToChatId } from "../2_tl.js";
22
22
  import { constructChatP } from "./1_chat_p.js";
23
23
  import { constructMessage } from "./4_message.js";
24
24
  export function getChatListItemOrder(lastMessage, pinned) {
@@ -73,7 +73,7 @@ export async function constructChatListItem4(dialog, dialogs, pinnedChats, getEn
73
73
  const userId = "user_id" in dialog.peer ? dialog.peer.user_id : null;
74
74
  const chatId = "chat_id" in dialog.peer ? dialog.peer.chat_id : null;
75
75
  const channelId = "channel_id" in dialog.peer ? dialog.peer.channel_id : null;
76
- const chat__ = chatId != null ? dialogs.chats.find((v) => v instanceof types.Chat && v.id == chatId) : channelId != null ? dialogs.chats.find((v) => v instanceof types.Channel && v.id == channelId) : userId != null ? dialogs.users.find((v) => v instanceof types.User && v.id == userId) : unreachable();
76
+ const chat__ = chatId != null ? dialogs.chats.find((v) => is("chat", v) && v.id == chatId) : channelId != null ? dialogs.chats.find((v) => is("channel", v) && v.id == channelId) : userId != null ? dialogs.users.find((v) => is("user", v) && v.id == userId) : unreachable();
77
77
  if (!chat__) {
78
78
  unreachable();
79
79
  }
@@ -17,7 +17,7 @@
17
17
  * You should have received a copy of the GNU Lesser General Public License
18
18
  * along with this program. If not, see <https://www.gnu.org/licenses/>.
19
19
  */
20
- import { types } from "../2_tl.js";
20
+ import { Api } from "../2_tl.js";
21
21
  import { InlineQueryResult } from "./4_inline_query_result.js";
22
22
  /** An answer to an inline query. */
23
23
  export interface InlineQueryAnswer {
@@ -28,5 +28,5 @@ export interface InlineQueryAnswer {
28
28
  /** A parameter that can be passed to next queries with the same text to yield more results. */
29
29
  nextOffset?: string;
30
30
  }
31
- export declare function constructInlineQueryAnswer(results: types.messages.BotResults): InlineQueryAnswer;
31
+ export declare function constructInlineQueryAnswer(results: Api.messages_BotResults): InlineQueryAnswer;
32
32
  //# sourceMappingURL=5_inline_query_answer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"5_inline_query_answer.d.ts","sourceRoot":"","sources":["../../src/types/5_inline_query_answer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAA8B,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAE3F,oCAAoC;AACpC,MAAM,WAAW,iBAAiB;IAChC,6DAA6D;IAC7D,EAAE,EAAE,MAAM,CAAC;IACX,gCAAgC;IAChC,OAAO,EAAE,iBAAiB,EAAE,CAAC;IAC7B,+FAA+F;IAC/F,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,KAAK,CAAC,QAAQ,CAAC,UAAU,GAAG,iBAAiB,CAMhG"}
1
+ {"version":3,"file":"5_inline_query_answer.d.ts","sourceRoot":"","sources":["../../src/types/5_inline_query_answer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AACjC,OAAO,EAA8B,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAE3F,oCAAoC;AACpC,MAAM,WAAW,iBAAiB;IAChC,6DAA6D;IAC7D,EAAE,EAAE,MAAM,CAAC;IACX,gCAAgC;IAChC,OAAO,EAAE,iBAAiB,EAAE,CAAC;IAC7B,+FAA+F;IAC/F,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,GAAG,CAAC,mBAAmB,GAAG,iBAAiB,CAM9F"}
@@ -17,7 +17,7 @@
17
17
  * You should have received a copy of the GNU Lesser General Public License
18
18
  * along with this program. If not, see <https://www.gnu.org/licenses/>.
19
19
  */
20
- import { types } from "../2_tl.js";
20
+ import { Api } from "../2_tl.js";
21
21
  export declare enum FileType {
22
22
  Thumbnail = 0,
23
23
  ProfilePhoto = 1,
@@ -120,7 +120,7 @@ export interface FileId {
120
120
  export declare function deserializeFileId(fileId: string): FileId;
121
121
  export declare function serializeFileId(fileId: FileId): string;
122
122
  export declare function toUniqueFileId(fileId: FileId): string;
123
- export declare function getPhotoFileId(photo: types.Photo): {
123
+ export declare function getPhotoFileId(photo: Api.photo): {
124
124
  fileId: string;
125
125
  fileUniqueId: string;
126
126
  };
@@ -1 +1 @@
1
- {"version":3,"file":"_file_id.d.ts","sourceRoot":"","sources":["../../src/types/_file_id.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAKH,OAAO,EAAsB,KAAK,EAAE,MAAM,YAAY,CAAC;AAOvD,oBAAY,QAAQ;IAClB,SAAS,IAAA;IACT,YAAY,IAAA;IACZ,KAAK,IAAA;IACL,SAAS,IAAA;IACT,KAAK,IAAA;IACL,QAAQ,IAAA;IACR,SAAS,IAAA;IACT,IAAI,IAAA;IACJ,OAAO,IAAA;IACP,KAAK,IAAA;IACL,SAAS,KAAA;IACT,kBAAkB,KAAA;IAClB,SAAS,KAAA;IACT,SAAS,KAAA;IACT,eAAe,KAAA;IACf,eAAe,KAAA;IACf,UAAU,KAAA;IACV,cAAc,KAAA;IACd,QAAQ,KAAA;IACR,OAAO,KAAA;IACP,UAAU,KAAA;IACV,UAAU,KAAA;IACV,IAAI,KAAA;IACJ,IAAI,KAAA;CACL;AAUD,oBAAY,eAAe;IACzB,MAAM,IAAA;IACN,SAAS,IAAA;IACT,cAAc,IAAA;IACd,YAAY,IAAA;IACZ,mBAAmB,IAAA;IACnB,UAAU,IAAA;IACV,oBAAoB,IAAA;IACpB,kBAAkB,IAAA;IAClB,yBAAyB,IAAA;IACzB,0BAA0B,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../0_deps.js";
21
21
  import { InputError } from "../0_errors.js";
22
22
  import { base64DecodeUrlSafe, base64EncodeUrlSafe, rleDecode, rleEncode } from "../1_utilities.js";
23
- import { TLReader, TLWriter, types } from "../2_tl.js";
23
+ import { is, TLReader, TLWriter } from "../2_tl.js";
24
24
  const NEXT_VERSION = 53;
25
25
  const PERSISTENT_ID_VERSION = 4;
26
26
  const WEB_LOCATION_FLAG = 1 << 24;
@@ -324,14 +324,14 @@ export function toUniqueFileId(fileId) {
324
324
  export function getPhotoFileId(photo) {
325
325
  const sizes = photo.sizes
326
326
  .map((v) => {
327
- if (v instanceof types.PhotoSizeProgressive) {
328
- return new types.PhotoSize({ type: v.type, w: v.w, h: v.h, size: Math.max(...v.sizes) });
327
+ if (is("photoSizeProgressive", v)) {
328
+ return { _: "photoSize", type: v.type, w: v.w, h: v.h, size: Math.max(...v.sizes) };
329
329
  }
330
330
  else {
331
331
  return v;
332
332
  }
333
333
  })
334
- .filter((v) => v instanceof types.PhotoSize)
334
+ .filter((v) => is("photoSize", v))
335
335
  .sort((a, b) => a.size - b.size);
336
336
  const largest = sizes.slice(-1)[0];
337
337
  const { dc_id: dcId, id, access_hash: accessHash, file_reference: fileReference } = photo;
@@ -18,21 +18,21 @@
18
18
  * along with this program. If not, see <https://www.gnu.org/licenses/>.
19
19
  */
20
20
  import { MaybePromise } from "../1_utilities.js";
21
- import { enums, types } from "../2_tl.js";
21
+ import { Api } from "../2_tl.js";
22
22
  import { ID } from "./0_id.js";
23
23
  /** @unlisted */
24
24
  export interface EntityGetter {
25
- (peer: types.PeerUser): MaybePromise<types.User | null>;
26
- (peer: types.PeerChat): MaybePromise<types.Chat | types.ChatForbidden | null>;
27
- (peer: types.PeerChannel): MaybePromise<types.Channel | types.ChannelForbidden | null>;
28
- (peer: types.PeerUser | types.PeerChat | types.PeerChannel): MaybePromise<types.User | types.Chat | types.ChatForbidden | types.Channel | types.ChannelForbidden | null>;
25
+ (peer: Api.peerUser): MaybePromise<Api.user | null>;
26
+ (peer: Api.peerChat): MaybePromise<Api.chat | Api.chatForbidden | null>;
27
+ (peer: Api.peerChannel): MaybePromise<Api.channel | Api.channelForbidden | null>;
28
+ (peer: Api.peerUser | Api.peerChat | Api.peerChannel): MaybePromise<Api.user | Api.chat | Api.chatForbidden | Api.channel | Api.channelForbidden | null>;
29
29
  }
30
30
  /** @unlisted */
31
31
  export interface InputPeerGetter {
32
- (id: ID): Promise<enums.InputPeer>;
32
+ (id: ID): Promise<Api.InputPeer>;
33
33
  }
34
34
  /** @unlisted */
35
35
  export interface UsernameResolver {
36
- (username: string): MaybePromise<types.InputUser>;
36
+ (username: string): MaybePromise<Api.inputUser>;
37
37
  }
38
38
  //# sourceMappingURL=_getters.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"_getters.d.ts","sourceRoot":"","sources":["../../src/types/_getters.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,EAAE,EAAE,MAAM,WAAW,CAAC;AAE/B,gBAAgB;AAChB,MAAM,WAAW,YAAY;IAC3B,CAAC,IAAI,EAAE,KAAK,CAAC,QAAQ,GAAG,YAAY,CAAC,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC;IACxD,CAAC,IAAI,EAAE,KAAK,CAAC,QAAQ,GAAG,YAAY,CAAC,KAAK,CAAC,IAAI,GAAG,KAAK,CAAC,aAAa,GAAG,IAAI,CAAC,CAAC;IAC9E,CAAC,IAAI,EAAE,KAAK,CAAC,WAAW,GAAG,YAAY,CAAC,KAAK,CAAC,OAAO,GAAG,KAAK,CAAC,gBAAgB,GAAG,IAAI,CAAC,CAAC;IACvF,CAAC,IAAI,EAAE,KAAK,CAAC,QAAQ,GAAG,KAAK,CAAC,QAAQ,GAAG,KAAK,CAAC,WAAW,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