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