@mtkruto/browser 0.136.0 → 0.138.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (343) hide show
  1. package/esm/0_deps.js +3 -3
  2. package/esm/3_errors.d.ts +2 -2
  3. package/esm/3_errors.d.ts.map +1 -1
  4. package/esm/3_errors.js +2 -2
  5. package/esm/3_types.d.ts +2 -3
  6. package/esm/3_types.d.ts.map +1 -1
  7. package/esm/3_types.js +2 -3
  8. package/esm/client/0_markdown.d.ts.map +1 -1
  9. package/esm/client/0_markdown.js +1 -3
  10. package/esm/client/0_params.d.ts +17 -11
  11. package/esm/client/0_params.d.ts.map +1 -1
  12. package/esm/client/0_storage_operations.js +1 -1
  13. package/esm/client/1_client_generic.d.ts +19 -14
  14. package/esm/client/1_client_generic.d.ts.map +1 -1
  15. package/esm/client/1_client_generic.js +1 -3
  16. package/esm/client/1_client_plain.d.ts +2 -6
  17. package/esm/client/1_client_plain.d.ts.map +1 -1
  18. package/esm/client/1_client_plain.js +1 -3
  19. package/esm/client/2_bot_info_manager.js +1 -1
  20. package/esm/client/2_business_connection_manager.js +1 -1
  21. package/esm/client/2_file_manager.d.ts.map +1 -1
  22. package/esm/client/2_file_manager.js +2 -0
  23. package/esm/client/2_payment_manager.js +1 -1
  24. package/esm/client/2_reaction_manager.js +4 -4
  25. package/esm/client/2_translations_manager.js +2 -2
  26. package/esm/client/2_update_manager.js +2 -2
  27. package/esm/client/3_account_manager.d.ts +2 -1
  28. package/esm/client/3_account_manager.d.ts.map +1 -1
  29. package/esm/client/3_account_manager.js +11 -4
  30. package/esm/client/3_filters.d.ts +94 -18
  31. package/esm/client/3_filters.d.ts.map +1 -1
  32. package/esm/client/3_message_manager.d.ts.map +1 -1
  33. package/esm/client/3_message_manager.js +18 -21
  34. package/esm/client/3_video_chat_manager.js +1 -1
  35. package/esm/client/4_callback_query_manager.js +1 -1
  36. package/esm/client/4_chat_manager.js +3 -3
  37. package/esm/client/4_context.d.ts +155 -463
  38. package/esm/client/4_context.d.ts.map +1 -1
  39. package/esm/client/4_context.js +221 -506
  40. package/esm/client/4_inline_query_manager.js +3 -3
  41. package/esm/client/4_link_preview_manager.js +1 -1
  42. package/esm/client/4_poll_manager.d.ts.map +1 -1
  43. package/esm/client/4_poll_manager.js +4 -2
  44. package/esm/client/4_story_manager.js +4 -4
  45. package/esm/client/6_client.d.ts +20 -21
  46. package/esm/client/6_client.d.ts.map +1 -1
  47. package/esm/client/6_client.js +22 -19
  48. package/esm/client/6_client_dispatcher.d.ts +19 -14
  49. package/esm/client/6_client_dispatcher.d.ts.map +1 -1
  50. package/esm/client/6_client_dispatcher.js +20 -11
  51. package/esm/connection/1_connection_socks5.js +3 -3
  52. package/esm/connection/1_connection_socks5.node.js +3 -3
  53. package/esm/session/1_session.d.ts +2 -6
  54. package/esm/session/1_session.d.ts.map +1 -1
  55. package/esm/storage/2_storage_local_storage.d.ts.map +1 -1
  56. package/esm/storage/2_storage_local_storage.js +10 -6
  57. package/esm/storage/2_storage_memory.d.ts.map +1 -1
  58. package/esm/storage/2_storage_memory.js +9 -5
  59. package/esm/storage/2_storage_session_storage.d.ts.map +1 -1
  60. package/esm/storage/2_storage_session_storage.js +10 -6
  61. package/esm/types/0_bot_token_check_result.d.ts +0 -1
  62. package/esm/types/0_bot_token_check_result.d.ts.map +1 -1
  63. package/esm/types/0_callback_query_question.d.ts +0 -3
  64. package/esm/types/0_callback_query_question.d.ts.map +1 -1
  65. package/esm/types/0_chat_action_type.d.ts +0 -13
  66. package/esm/types/0_chat_action_type.d.ts.map +1 -1
  67. package/esm/types/0_chat_administrator_rights.d.ts +4 -4
  68. package/esm/types/0_chat_administrator_rights.d.ts.map +1 -1
  69. package/esm/types/0_code_check_result.d.ts +0 -3
  70. package/esm/types/0_code_check_result.d.ts.map +1 -1
  71. package/esm/types/0_emoji_status.d.ts +0 -2
  72. package/esm/types/0_emoji_status.d.ts.map +1 -1
  73. package/esm/types/0_gift_component_rarity.d.ts +0 -5
  74. package/esm/types/0_gift_component_rarity.d.ts.map +1 -1
  75. package/esm/types/0_id.d.ts +1 -3
  76. package/esm/types/0_id.d.ts.map +1 -1
  77. package/{script/types/1_inline_query_result_button.d.ts → esm/types/0_inline_query_result_button.d.ts} +3 -4
  78. package/esm/types/0_inline_query_result_button.d.ts.map +1 -0
  79. package/esm/types/0_input_emoji_status.d.ts +0 -2
  80. package/esm/types/0_input_emoji_status.d.ts.map +1 -1
  81. package/esm/types/0_password_check_result.d.ts +0 -2
  82. package/esm/types/0_password_check_result.d.ts.map +1 -1
  83. package/esm/types/0_premium_subscription_duration.d.ts +1 -0
  84. package/esm/types/0_premium_subscription_duration.d.ts.map +1 -1
  85. package/esm/types/0_reaction.d.ts +0 -3
  86. package/esm/types/0_reaction.d.ts.map +1 -1
  87. package/esm/types/0_user_status.d.ts +3 -8
  88. package/esm/types/0_user_status.d.ts.map +1 -1
  89. package/esm/types/0_video_chat.d.ts +0 -3
  90. package/esm/types/0_video_chat.d.ts.map +1 -1
  91. package/esm/types/1_available_reactions.d.ts +0 -3
  92. package/esm/types/1_available_reactions.d.ts.map +1 -1
  93. package/esm/types/1_bot_command_scope.d.ts +1 -8
  94. package/esm/types/1_bot_command_scope.d.ts.map +1 -1
  95. package/esm/types/1_chat_p.d.ts +1 -7
  96. package/esm/types/1_chat_p.d.ts.map +1 -1
  97. package/esm/types/1_inline_keyboard_button.d.ts +25 -42
  98. package/esm/types/1_inline_keyboard_button.d.ts.map +1 -1
  99. package/esm/types/1_inline_keyboard_button.js +57 -64
  100. package/esm/types/1_input_gift.d.ts +0 -3
  101. package/esm/types/1_input_gift.d.ts.map +1 -1
  102. package/esm/types/1_input_story_content.d.ts +2 -2
  103. package/esm/types/1_input_story_content.d.ts.map +1 -1
  104. package/esm/types/1_keyboard_button.d.ts +33 -34
  105. package/esm/types/1_keyboard_button.d.ts.map +1 -1
  106. package/esm/types/1_keyboard_button.js +81 -88
  107. package/esm/types/1_order_info.d.ts +1 -1
  108. package/esm/types/2_chat.d.ts +1 -3
  109. package/esm/types/2_chat.d.ts.map +1 -1
  110. package/esm/types/2_chat_member.d.ts +6 -24
  111. package/esm/types/2_chat_member.d.ts.map +1 -1
  112. package/esm/types/2_message_entity.d.ts +0 -20
  113. package/esm/types/2_message_entity.d.ts.map +1 -1
  114. package/esm/types/{0_mini_app_button_info.js → 2_profile_photo_list.d.ts} +10 -2
  115. package/esm/types/2_profile_photo_list.d.ts.map +1 -0
  116. package/esm/types/{0_keyboard_button_poll_type.d.ts → 2_profile_photo_list.js} +6 -5
  117. package/esm/types/2_reply_markup.d.ts +5 -13
  118. package/esm/types/2_reply_markup.d.ts.map +1 -1
  119. package/esm/types/2_reply_markup.js +13 -17
  120. package/esm/types/2_star_transaction_peer.d.ts +0 -8
  121. package/esm/types/2_star_transaction_peer.d.ts.map +1 -1
  122. package/esm/types/2_story_album_icon.d.ts +0 -2
  123. package/esm/types/2_story_album_icon.d.ts.map +1 -1
  124. package/esm/types/2_story_content.d.ts +3 -4
  125. package/esm/types/2_story_content.d.ts.map +1 -1
  126. package/esm/types/2_story_content.js +3 -3
  127. package/esm/types/2_story_privacy.d.ts +8 -9
  128. package/esm/types/2_story_privacy.d.ts.map +1 -1
  129. package/esm/types/2_story_privacy.js +23 -20
  130. package/esm/types/3_checklist_item.d.ts +2 -8
  131. package/esm/types/3_checklist_item.d.ts.map +1 -1
  132. package/esm/types/3_forward_header.d.ts +0 -5
  133. package/esm/types/3_forward_header.d.ts.map +1 -1
  134. package/esm/types/3_gift_upgraded_component.d.ts +0 -4
  135. package/esm/types/3_gift_upgraded_component.d.ts.map +1 -1
  136. package/esm/types/3_inline_query.d.ts.map +1 -1
  137. package/esm/types/3_inline_query.js +3 -2
  138. package/esm/types/3_input_media.d.ts +10 -20
  139. package/esm/types/3_input_media.d.ts.map +1 -1
  140. package/esm/types/3_invite_link.d.ts +0 -2
  141. package/esm/types/3_invite_link.d.ts.map +1 -1
  142. package/esm/types/3_invite_link.js +3 -4
  143. package/esm/types/4_gift.d.ts +1 -3
  144. package/esm/types/4_gift.d.ts.map +1 -1
  145. package/esm/types/4_reply_to.d.ts +6 -14
  146. package/esm/types/4_reply_to.d.ts.map +1 -1
  147. package/esm/types/5_gift_upgraded_information.d.ts +1 -1
  148. package/esm/types/5_gift_upgraded_information.d.ts.map +1 -1
  149. package/esm/types/5_gift_upgraded_information.js +2 -2
  150. package/esm/types/5_link_preview.d.ts +2 -18
  151. package/esm/types/5_link_preview.d.ts.map +1 -1
  152. package/esm/types/6_message.d.ts +91 -180
  153. package/esm/types/6_message.d.ts.map +1 -1
  154. package/esm/types/6_message.js +105 -121
  155. package/esm/types/6_message_content.d.ts +2 -7
  156. package/esm/types/6_message_content.d.ts.map +1 -1
  157. package/esm/types/7_inline_query_result.d.ts +10 -47
  158. package/esm/types/7_inline_query_result.d.ts.map +1 -1
  159. package/esm/types/7_inline_query_result.js +219 -152
  160. package/esm/types/7_topic.js +3 -3
  161. package/esm/types/8_update.d.ts +59 -106
  162. package/esm/types/8_update.d.ts.map +1 -1
  163. package/esm/utilities/0_int.d.ts +1 -3
  164. package/esm/utilities/0_int.d.ts.map +1 -1
  165. package/esm/utilities/1_logger.js +1 -1
  166. package/package.json +1 -1
  167. package/script/0_deps.js +3 -3
  168. package/script/3_errors.d.ts +2 -2
  169. package/script/3_errors.d.ts.map +1 -1
  170. package/script/3_errors.js +4 -4
  171. package/script/3_types.d.ts +2 -3
  172. package/script/3_types.d.ts.map +1 -1
  173. package/script/3_types.js +2 -3
  174. package/script/client/0_markdown.d.ts.map +1 -1
  175. package/script/client/0_markdown.js +1 -3
  176. package/script/client/0_params.d.ts +17 -11
  177. package/script/client/0_params.d.ts.map +1 -1
  178. package/script/client/0_storage_operations.js +1 -1
  179. package/script/client/1_client_generic.d.ts +19 -14
  180. package/script/client/1_client_generic.d.ts.map +1 -1
  181. package/script/client/1_client_generic.js +1 -3
  182. package/script/client/1_client_plain.d.ts +2 -6
  183. package/script/client/1_client_plain.d.ts.map +1 -1
  184. package/script/client/1_client_plain.js +1 -3
  185. package/script/client/2_bot_info_manager.js +1 -1
  186. package/script/client/2_business_connection_manager.js +1 -1
  187. package/script/client/2_file_manager.d.ts.map +1 -1
  188. package/script/client/2_file_manager.js +2 -0
  189. package/script/client/2_payment_manager.js +1 -1
  190. package/script/client/2_reaction_manager.js +4 -4
  191. package/script/client/2_translations_manager.js +2 -2
  192. package/script/client/2_update_manager.js +2 -2
  193. package/script/client/3_account_manager.d.ts +2 -1
  194. package/script/client/3_account_manager.d.ts.map +1 -1
  195. package/script/client/3_account_manager.js +9 -2
  196. package/script/client/3_filters.d.ts +94 -18
  197. package/script/client/3_filters.d.ts.map +1 -1
  198. package/script/client/3_message_manager.d.ts.map +1 -1
  199. package/script/client/3_message_manager.js +17 -20
  200. package/script/client/3_video_chat_manager.js +1 -1
  201. package/script/client/4_callback_query_manager.js +1 -1
  202. package/script/client/4_chat_manager.js +3 -3
  203. package/script/client/4_context.d.ts +155 -463
  204. package/script/client/4_context.d.ts.map +1 -1
  205. package/script/client/4_context.js +221 -506
  206. package/script/client/4_inline_query_manager.js +3 -3
  207. package/script/client/4_link_preview_manager.js +1 -1
  208. package/script/client/4_poll_manager.d.ts.map +1 -1
  209. package/script/client/4_poll_manager.js +4 -2
  210. package/script/client/4_story_manager.js +4 -4
  211. package/script/client/6_client.d.ts +20 -21
  212. package/script/client/6_client.d.ts.map +1 -1
  213. package/script/client/6_client.js +22 -19
  214. package/script/client/6_client_dispatcher.d.ts +19 -14
  215. package/script/client/6_client_dispatcher.d.ts.map +1 -1
  216. package/script/client/6_client_dispatcher.js +20 -11
  217. package/script/connection/1_connection_socks5.js +3 -3
  218. package/script/connection/1_connection_socks5.node.js +3 -3
  219. package/script/session/1_session.d.ts +2 -6
  220. package/script/session/1_session.d.ts.map +1 -1
  221. package/script/storage/2_storage_local_storage.d.ts.map +1 -1
  222. package/script/storage/2_storage_local_storage.js +10 -6
  223. package/script/storage/2_storage_memory.d.ts.map +1 -1
  224. package/script/storage/2_storage_memory.js +9 -5
  225. package/script/storage/2_storage_session_storage.d.ts.map +1 -1
  226. package/script/storage/2_storage_session_storage.js +10 -6
  227. package/script/types/0_bot_token_check_result.d.ts +0 -1
  228. package/script/types/0_bot_token_check_result.d.ts.map +1 -1
  229. package/script/types/0_callback_query_question.d.ts +0 -3
  230. package/script/types/0_callback_query_question.d.ts.map +1 -1
  231. package/script/types/0_chat_action_type.d.ts +0 -13
  232. package/script/types/0_chat_action_type.d.ts.map +1 -1
  233. package/script/types/0_chat_administrator_rights.d.ts +4 -4
  234. package/script/types/0_chat_administrator_rights.d.ts.map +1 -1
  235. package/script/types/0_code_check_result.d.ts +0 -3
  236. package/script/types/0_code_check_result.d.ts.map +1 -1
  237. package/script/types/0_emoji_status.d.ts +0 -2
  238. package/script/types/0_emoji_status.d.ts.map +1 -1
  239. package/script/types/0_gift_component_rarity.d.ts +0 -5
  240. package/script/types/0_gift_component_rarity.d.ts.map +1 -1
  241. package/script/types/0_id.d.ts +1 -3
  242. package/script/types/0_id.d.ts.map +1 -1
  243. package/{esm/types/1_inline_query_result_button.d.ts → script/types/0_inline_query_result_button.d.ts} +3 -4
  244. package/script/types/0_inline_query_result_button.d.ts.map +1 -0
  245. package/script/types/0_input_emoji_status.d.ts +0 -2
  246. package/script/types/0_input_emoji_status.d.ts.map +1 -1
  247. package/script/types/0_password_check_result.d.ts +0 -2
  248. package/script/types/0_password_check_result.d.ts.map +1 -1
  249. package/script/types/0_premium_subscription_duration.d.ts +1 -0
  250. package/script/types/0_premium_subscription_duration.d.ts.map +1 -1
  251. package/script/types/0_reaction.d.ts +0 -3
  252. package/script/types/0_reaction.d.ts.map +1 -1
  253. package/script/types/0_user_status.d.ts +3 -8
  254. package/script/types/0_user_status.d.ts.map +1 -1
  255. package/script/types/0_video_chat.d.ts +0 -3
  256. package/script/types/0_video_chat.d.ts.map +1 -1
  257. package/script/types/1_available_reactions.d.ts +0 -3
  258. package/script/types/1_available_reactions.d.ts.map +1 -1
  259. package/script/types/1_bot_command_scope.d.ts +1 -8
  260. package/script/types/1_bot_command_scope.d.ts.map +1 -1
  261. package/script/types/1_chat_p.d.ts +1 -7
  262. package/script/types/1_chat_p.d.ts.map +1 -1
  263. package/script/types/1_inline_keyboard_button.d.ts +25 -42
  264. package/script/types/1_inline_keyboard_button.d.ts.map +1 -1
  265. package/script/types/1_inline_keyboard_button.js +57 -64
  266. package/script/types/1_input_gift.d.ts +0 -3
  267. package/script/types/1_input_gift.d.ts.map +1 -1
  268. package/script/types/1_input_story_content.d.ts +2 -2
  269. package/script/types/1_input_story_content.d.ts.map +1 -1
  270. package/script/types/1_keyboard_button.d.ts +33 -34
  271. package/script/types/1_keyboard_button.d.ts.map +1 -1
  272. package/script/types/1_keyboard_button.js +81 -88
  273. package/script/types/1_order_info.d.ts +1 -1
  274. package/script/types/2_chat.d.ts +1 -3
  275. package/script/types/2_chat.d.ts.map +1 -1
  276. package/script/types/2_chat_member.d.ts +6 -24
  277. package/script/types/2_chat_member.d.ts.map +1 -1
  278. package/script/types/2_message_entity.d.ts +0 -20
  279. package/script/types/2_message_entity.d.ts.map +1 -1
  280. package/script/types/{0_keyboard_button_poll_type.d.ts → 2_profile_photo_list.d.ts} +10 -5
  281. package/script/types/2_profile_photo_list.d.ts.map +1 -0
  282. package/script/types/{0_mini_app_button_info.js → 2_profile_photo_list.js} +7 -3
  283. package/script/types/2_reply_markup.d.ts +5 -13
  284. package/script/types/2_reply_markup.d.ts.map +1 -1
  285. package/script/types/2_reply_markup.js +13 -17
  286. package/script/types/2_star_transaction_peer.d.ts +0 -8
  287. package/script/types/2_star_transaction_peer.d.ts.map +1 -1
  288. package/script/types/2_story_album_icon.d.ts +0 -2
  289. package/script/types/2_story_album_icon.d.ts.map +1 -1
  290. package/script/types/2_story_content.d.ts +3 -4
  291. package/script/types/2_story_content.d.ts.map +1 -1
  292. package/script/types/2_story_content.js +3 -3
  293. package/script/types/2_story_privacy.d.ts +8 -9
  294. package/script/types/2_story_privacy.d.ts.map +1 -1
  295. package/script/types/2_story_privacy.js +23 -20
  296. package/script/types/3_checklist_item.d.ts +2 -8
  297. package/script/types/3_checklist_item.d.ts.map +1 -1
  298. package/script/types/3_forward_header.d.ts +0 -5
  299. package/script/types/3_forward_header.d.ts.map +1 -1
  300. package/script/types/3_gift_upgraded_component.d.ts +0 -4
  301. package/script/types/3_gift_upgraded_component.d.ts.map +1 -1
  302. package/script/types/3_inline_query.d.ts.map +1 -1
  303. package/script/types/3_inline_query.js +3 -2
  304. package/script/types/3_input_media.d.ts +10 -20
  305. package/script/types/3_input_media.d.ts.map +1 -1
  306. package/script/types/3_invite_link.d.ts +0 -2
  307. package/script/types/3_invite_link.d.ts.map +1 -1
  308. package/script/types/3_invite_link.js +3 -4
  309. package/script/types/4_gift.d.ts +1 -3
  310. package/script/types/4_gift.d.ts.map +1 -1
  311. package/script/types/4_reply_to.d.ts +6 -14
  312. package/script/types/4_reply_to.d.ts.map +1 -1
  313. package/script/types/5_gift_upgraded_information.d.ts +1 -1
  314. package/script/types/5_gift_upgraded_information.d.ts.map +1 -1
  315. package/script/types/5_gift_upgraded_information.js +2 -2
  316. package/script/types/5_link_preview.d.ts +2 -18
  317. package/script/types/5_link_preview.d.ts.map +1 -1
  318. package/script/types/6_message.d.ts +91 -180
  319. package/script/types/6_message.d.ts.map +1 -1
  320. package/script/types/6_message.js +106 -122
  321. package/script/types/6_message_content.d.ts +2 -7
  322. package/script/types/6_message_content.d.ts.map +1 -1
  323. package/script/types/7_inline_query_result.d.ts +10 -47
  324. package/script/types/7_inline_query_result.d.ts.map +1 -1
  325. package/script/types/7_inline_query_result.js +219 -152
  326. package/script/types/7_topic.js +3 -3
  327. package/script/types/8_update.d.ts +59 -106
  328. package/script/types/8_update.d.ts.map +1 -1
  329. package/script/utilities/0_int.d.ts +1 -3
  330. package/script/utilities/0_int.d.ts.map +1 -1
  331. package/script/utilities/1_logger.js +1 -1
  332. package/esm/types/0_keyboard_button_poll_type.d.ts.map +0 -1
  333. package/esm/types/0_mini_app_button_info.d.ts +0 -26
  334. package/esm/types/0_mini_app_button_info.d.ts.map +0 -1
  335. package/esm/types/1_inline_query_result_button.d.ts.map +0 -1
  336. package/esm/types/1_inline_query_result_button.js +0 -20
  337. package/script/types/0_keyboard_button_poll_type.d.ts.map +0 -1
  338. package/script/types/0_mini_app_button_info.d.ts +0 -26
  339. package/script/types/0_mini_app_button_info.d.ts.map +0 -1
  340. package/script/types/1_inline_query_result_button.d.ts.map +0 -1
  341. package/script/types/1_inline_query_result_button.js +0 -21
  342. /package/esm/types/{0_keyboard_button_poll_type.js → 0_inline_query_result_button.js} +0 -0
  343. /package/script/types/{0_keyboard_button_poll_type.js → 0_inline_query_result_button.js} +0 -0
@@ -78,13 +78,14 @@ export function constructInlineQueryResult(result) {
78
78
  if (Api.is("botInlineMediaResult", result)) {
79
79
  if (result.photo) {
80
80
  photo = Api.as("photo", result.photo);
81
- ref = { fileId: getPhotoFileId(photo).fileId };
81
+ ref = { type: "fileId", fileId: getPhotoFileId(photo).fileId };
82
82
  const { largest } = photoSizes = getPhotoSizes(photo);
83
83
  attributes = [{ _: "documentAttributeImageSize", w: largest.w, h: largest.h }];
84
84
  }
85
85
  else if (result.document) {
86
86
  const document = Api.as("document", result.document);
87
87
  ref = {
88
+ type: "fileId",
88
89
  fileId: serializeFileId({
89
90
  type: FileType.Document, // Should this be changed? The type is already known.
90
91
  dcId: document.dc_id,
@@ -99,7 +100,7 @@ export function constructInlineQueryResult(result) {
99
100
  }
100
101
  }
101
102
  else if (result.content) {
102
- ref = { url: result.content.url };
103
+ ref = { type: "url", url: result.content.url };
103
104
  attributes = result.content.attributes;
104
105
  }
105
106
  else {
@@ -116,90 +117,182 @@ export function constructInlineQueryResult(result) {
116
117
  switch (type) {
117
118
  case "audio": {
118
119
  const a = attributes?.find((v) => Api.is("documentAttributeAudio", v));
119
- return cleanObject({
120
- id,
121
- type,
122
- title,
123
- ...ref,
124
- messageContent,
125
- replyMarkup,
126
- performer: a?.performer,
127
- audioDuration: a?.duration,
128
- });
120
+ if (ref.type === "fileId") {
121
+ return cleanObject({
122
+ id,
123
+ type: "cachedAudio",
124
+ title,
125
+ fileId: ref.fileId,
126
+ messageContent,
127
+ replyMarkup,
128
+ performer: a?.performer,
129
+ audioDuration: a?.duration,
130
+ });
131
+ }
132
+ else {
133
+ return cleanObject({
134
+ id,
135
+ type,
136
+ title,
137
+ url: ref.url,
138
+ messageContent,
139
+ replyMarkup,
140
+ performer: a?.performer,
141
+ audioDuration: a?.duration,
142
+ });
143
+ }
129
144
  }
130
145
  case "gif":
131
146
  case "mpeg4Gif": {
132
147
  const a = attributes.find((v) => Api.is("documentAttributeVideo", v));
133
- return cleanObject({
134
- id,
135
- type,
136
- title,
137
- ...ref,
138
- messageContent,
139
- replyMarkup,
140
- thumbnailUrl,
141
- width: a?.w,
142
- height: a?.h,
143
- duration: a?.duration,
144
- });
148
+ if (ref.type === "fileId") {
149
+ return cleanObject({
150
+ id,
151
+ type: type === "gif" ? "cachedGif" : "cachedMpeg4Gif",
152
+ title,
153
+ fileId: ref.fileId,
154
+ messageContent,
155
+ replyMarkup,
156
+ thumbnailUrl,
157
+ width: a?.w,
158
+ height: a?.h,
159
+ duration: a?.duration,
160
+ });
161
+ }
162
+ else {
163
+ return cleanObject({
164
+ id,
165
+ type,
166
+ title,
167
+ url: ref.url,
168
+ messageContent,
169
+ replyMarkup,
170
+ thumbnailUrl,
171
+ width: a?.w,
172
+ height: a?.h,
173
+ duration: a?.duration,
174
+ });
175
+ }
145
176
  }
146
177
  case "photo": {
147
178
  const a = attributes.find((v) => Api.is("documentAttributeImageSize", v));
148
- return cleanObject({
149
- id,
150
- type,
151
- title,
152
- description,
153
- ...ref,
154
- messageContent,
155
- replyMarkup,
156
- thumbnailUrl: thumbnailUrl,
157
- thumbnails: photo ? photoSizes?.sizes.slice(0, -1).map((v) => constructThumbnail(v, photo)) : undefined,
158
- width: a?.w,
159
- height: a?.h,
160
- });
179
+ if (ref.type === "fileId") {
180
+ return cleanObject({
181
+ id,
182
+ type: "cachedPhoto",
183
+ title,
184
+ description,
185
+ fileId: ref.fileId,
186
+ messageContent,
187
+ replyMarkup,
188
+ thumbnailUrl: thumbnailUrl,
189
+ thumbnails: photo ? photoSizes?.sizes.slice(0, -1).map((v) => constructThumbnail(v, photo)) : undefined,
190
+ width: a?.w,
191
+ height: a?.h,
192
+ });
193
+ }
194
+ else {
195
+ return cleanObject({
196
+ id,
197
+ type,
198
+ title,
199
+ description,
200
+ url: ref.url,
201
+ messageContent,
202
+ replyMarkup,
203
+ thumbnailUrl: thumbnailUrl,
204
+ thumbnails: photo ? photoSizes?.sizes.slice(0, -1).map((v) => constructThumbnail(v, photo)) : undefined,
205
+ width: a?.w,
206
+ height: a?.h,
207
+ });
208
+ }
161
209
  }
162
210
  case "video": {
163
211
  const a = attributes.find((v) => Api.is("documentAttributeVideo", v));
164
- return cleanObject({
165
- id,
166
- type,
167
- title,
168
- description,
169
- ...ref,
170
- messageContent,
171
- replyMarkup,
172
- mimeType: "content" in result && result.content ? result.content.mime_type : "video/mp4",
173
- thumbnailUrl: thumbnailUrl,
174
- width: a?.w,
175
- height: a?.h,
176
- videoDuration: a?.duration,
177
- });
212
+ if (ref.type === "fileId") {
213
+ return cleanObject({
214
+ id,
215
+ type: "cachedVideo",
216
+ title,
217
+ description,
218
+ fileId: ref.fileId,
219
+ messageContent,
220
+ replyMarkup,
221
+ mimeType: "content" in result && result.content ? result.content.mime_type : "video/mp4",
222
+ thumbnailUrl: thumbnailUrl,
223
+ width: a?.w,
224
+ height: a?.h,
225
+ videoDuration: a?.duration,
226
+ });
227
+ }
228
+ else {
229
+ return cleanObject({
230
+ id,
231
+ type: "video",
232
+ title,
233
+ description,
234
+ url: ref.url,
235
+ messageContent,
236
+ replyMarkup,
237
+ mimeType: "content" in result && result.content ? result.content.mime_type : "video/mp4",
238
+ thumbnailUrl: thumbnailUrl,
239
+ width: a?.w,
240
+ height: a?.h,
241
+ videoDuration: a?.duration,
242
+ });
243
+ }
178
244
  }
179
245
  case "voice": {
180
246
  const a = attributes.find((v) => Api.is("documentAttributeAudio", v));
181
- return cleanObject({
182
- id,
183
- type,
184
- title,
185
- ...ref,
186
- messageContent,
187
- replyMarkup,
188
- thumbnailUrl,
189
- voiceDuration: a?.duration,
190
- });
247
+ if (ref.type === "fileId") {
248
+ return cleanObject({
249
+ id,
250
+ type: "cachedVoice",
251
+ title,
252
+ fileId: ref.fileId,
253
+ messageContent,
254
+ replyMarkup,
255
+ thumbnailUrl,
256
+ voiceDuration: a?.duration,
257
+ });
258
+ }
259
+ else {
260
+ return cleanObject({
261
+ id,
262
+ type: "voice",
263
+ title,
264
+ url: ref.url,
265
+ messageContent,
266
+ replyMarkup,
267
+ thumbnailUrl,
268
+ voiceDuration: a?.duration,
269
+ });
270
+ }
191
271
  }
192
272
  case "document":
193
273
  case "file": // Does it really return this?
194
- return cleanObject({
195
- type: "document",
196
- id,
197
- title: result.title ?? "",
198
- ...ref,
199
- messageContent,
200
- replyMarkup,
201
- thumbnailUrl,
202
- });
274
+ if (ref.type === "fileId") {
275
+ return cleanObject({
276
+ type: "cachedDocument",
277
+ id,
278
+ title: result.title ?? "",
279
+ fileId: ref.fileId,
280
+ messageContent,
281
+ replyMarkup,
282
+ thumbnailUrl,
283
+ });
284
+ }
285
+ else {
286
+ return cleanObject({
287
+ type: "document",
288
+ id,
289
+ title: result.title ?? "",
290
+ url: ref.url,
291
+ messageContent,
292
+ replyMarkup,
293
+ thumbnailUrl,
294
+ });
295
+ }
203
296
  }
204
297
  }
205
298
  unreachable();
@@ -211,103 +304,77 @@ export async function inlineQueryResultToTlObject(result_, parseText, usernameRe
211
304
  let fileId_ = null;
212
305
  switch (result_.type) {
213
306
  case "audio":
214
- if ("url" in result_) {
215
- document = {
216
- _: "inputWebDocument",
217
- url: result_.url,
218
- size: 0,
219
- mime_type: "audio/mpeg",
220
- attributes: [
221
- { _: "documentAttributeAudio", duration: result_.audioDuration ?? 0, title: result_.title, performer: result_.performer },
222
- ],
223
- };
224
- }
225
- else {
226
- fileId_ = result_.fileId;
227
- }
307
+ document = {
308
+ _: "inputWebDocument",
309
+ url: result_.url,
310
+ size: 0,
311
+ mime_type: "audio/mpeg",
312
+ attributes: [
313
+ { _: "documentAttributeAudio", duration: result_.audioDuration ?? 0, title: result_.title, performer: result_.performer },
314
+ ],
315
+ };
228
316
  break;
229
317
  case "video":
230
- if ("url" in result_) {
231
- document = {
232
- _: "inputWebDocument",
233
- url: result_.url,
234
- size: 0,
235
- mime_type: result_.mimeType ?? "video/mp4",
236
- attributes: [
237
- { _: "documentAttributeVideo", duration: result_.videoDuration ?? 0, h: result_.height ?? 0, w: result_.width ?? 0 },
238
- ],
239
- };
240
- }
241
- else {
242
- fileId_ = result_.fileId;
243
- }
318
+ document = {
319
+ _: "inputWebDocument",
320
+ url: result_.url,
321
+ size: 0,
322
+ mime_type: result_.mimeType ?? "video/mp4",
323
+ attributes: [
324
+ { _: "documentAttributeVideo", duration: result_.videoDuration ?? 0, h: result_.height ?? 0, w: result_.width ?? 0 },
325
+ ],
326
+ };
244
327
  break;
245
328
  case "document":
246
- if ("url" in result_) {
247
- document = { _: "inputWebDocument", url: result_.url, mime_type: "application/octet-stream", attributes: [], size: 0 };
248
- }
249
- else {
250
- fileId_ = result_.fileId;
251
- }
329
+ document = { _: "inputWebDocument", url: result_.url, mime_type: "application/octet-stream", attributes: [], size: 0 };
252
330
  break;
253
331
  case "gif":
254
- if ("url" in result_) {
255
- document = {
256
- _: "inputWebDocument",
257
- url: result_.url,
258
- size: 0,
259
- mime_type: "image/gif",
260
- attributes: [
261
- { _: "documentAttributeVideo", duration: result_.duration ?? 0, w: result_.width ?? 0, h: result_.height ?? 0 },
262
- ],
263
- };
264
- }
265
- else {
266
- fileId_ = result_.fileId;
267
- }
332
+ document = {
333
+ _: "inputWebDocument",
334
+ url: result_.url,
335
+ size: 0,
336
+ mime_type: "image/gif",
337
+ attributes: [
338
+ { _: "documentAttributeVideo", duration: result_.duration ?? 0, w: result_.width ?? 0, h: result_.height ?? 0 },
339
+ ],
340
+ };
268
341
  break;
269
342
  case "mpeg4Gif":
270
- if ("url" in result_) {
271
- document = {
272
- _: "inputWebDocument",
273
- url: result_.url,
274
- size: 0,
275
- mime_type: "video/mp4",
276
- attributes: [
277
- { _: "documentAttributeVideo", nosound: true, duration: result_.duration ?? 0, w: result_.width ?? 0, h: result_.height ?? 0, supports_streaming: true },
278
- ],
279
- };
280
- }
281
- else {
282
- fileId_ = result_.fileId;
283
- }
343
+ document = {
344
+ _: "inputWebDocument",
345
+ url: result_.url,
346
+ size: 0,
347
+ mime_type: "video/mp4",
348
+ attributes: [
349
+ { _: "documentAttributeVideo", nosound: true, duration: result_.duration ?? 0, w: result_.width ?? 0, h: result_.height ?? 0, supports_streaming: true },
350
+ ],
351
+ };
284
352
  break;
285
353
  case "photo":
286
- if ("url" in result_) {
287
- document = { _: "inputWebDocument", url: result_.url, size: 0, mime_type: "image/jpeg", attributes: [{ _: "documentAttributeImageSize", w: result_.width ?? 0, h: result_.height ?? 0 }] };
288
- }
289
- else {
290
- fileId_ = result_.fileId;
291
- }
354
+ document = { _: "inputWebDocument", url: result_.url, size: 0, mime_type: "image/jpeg", attributes: [{ _: "documentAttributeImageSize", w: result_.width ?? 0, h: result_.height ?? 0 }] };
292
355
  break;
293
356
  case "sticker":
294
357
  fileId_ = result_.fileId;
295
358
  break;
296
359
  case "voice":
297
- if ("url" in result_) {
298
- document = {
299
- _: "inputWebDocument",
300
- url: result_.url,
301
- size: 0,
302
- mime_type: "audio/mpeg",
303
- attributes: [
304
- { _: "documentAttributeAudio", duration: result_.voiceDuration ?? 0, voice: true },
305
- ],
306
- };
307
- }
308
- else {
309
- fileId_ = result_.fileId;
310
- }
360
+ document = {
361
+ _: "inputWebDocument",
362
+ url: result_.url,
363
+ size: 0,
364
+ mime_type: "audio/mpeg",
365
+ attributes: [
366
+ { _: "documentAttributeAudio", duration: result_.voiceDuration ?? 0, voice: true },
367
+ ],
368
+ };
369
+ break;
370
+ case "cachedAudio":
371
+ case "cachedDocument":
372
+ case "cachedGif":
373
+ case "cachedMpeg4Gif":
374
+ case "cachedPhoto":
375
+ case "cachedVideo":
376
+ case "cachedVoice":
377
+ fileId_ = result_.fileId;
311
378
  break;
312
379
  }
313
380
  const replyMarkup = "replyMarkup" in result_ && result_.replyMarkup ? await replyMarkupToTlObject(result_.replyMarkup, usernameResolver) : undefined;
@@ -42,10 +42,10 @@ export function constructTopic(message) {
42
42
  const isHidden = false;
43
43
  let name = forumTopicCreated.forumTopicCreated.name;
44
44
  const color = forumTopicCreated.forumTopicCreated.color;
45
- let customEmoijId = forumTopicCreated.forumTopicCreated.customEmojiId;
45
+ let customEmojiId = forumTopicCreated.forumTopicCreated.customEmojiId;
46
46
  if (forumTopicEdited) {
47
47
  name = forumTopicEdited.forumTopicEdited.name;
48
- customEmoijId = forumTopicEdited.forumTopicEdited.customEmojiId;
48
+ customEmojiId = forumTopicEdited.forumTopicEdited.customEmojiId;
49
49
  }
50
50
  return cleanObject({
51
51
  id,
@@ -56,6 +56,6 @@ export function constructTopic(message) {
56
56
  isHidden,
57
57
  name,
58
58
  color,
59
- customEmoijId,
59
+ customEmojiId,
60
60
  });
61
61
  }