@mtkruto/node 0.0.998 → 0.1.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 (237) hide show
  1. package/esm/0_deps.d.ts +1 -1
  2. package/esm/0_deps.js +1 -1
  3. package/esm/3_errors.d.ts +1531 -0
  4. package/esm/3_errors.js +1531 -0
  5. package/esm/3_types.d.ts +39 -3
  6. package/esm/3_types.js +39 -3
  7. package/esm/4_constants.d.ts +1 -1
  8. package/esm/4_constants.js +1 -1
  9. package/esm/4_errors.d.ts +25 -0
  10. package/esm/4_errors.js +64 -0
  11. package/esm/client/2_client_plain.js +1 -1
  12. package/esm/client/3_types.d.ts +1 -5
  13. package/esm/client/4_client.d.ts +20 -3
  14. package/esm/client/4_client.js +61 -62
  15. package/esm/connection/1_connection_web_socket.js +2 -1
  16. package/esm/deps/deno.land/x/{tgcrypto@0.1.3 → tgcrypto@0.2.1}/mod.d.ts +2 -2
  17. package/esm/deps/deno.land/x/{tgcrypto@0.1.3 → tgcrypto@0.2.1}/mod.js +19 -6
  18. package/esm/deps/deno.land/x/tgcrypto@0.2.1/tgcrypto.d.ts +2 -0
  19. package/esm/deps/deno.land/x/tgcrypto@0.2.1/tgcrypto.js +991 -0
  20. package/esm/mod.d.ts +3 -2
  21. package/esm/mod.js +3 -2
  22. package/esm/tl/2_types.d.ts +1 -1
  23. package/esm/tl/2_types.js +1 -2
  24. package/esm/tl/3_functions.d.ts +1 -1
  25. package/esm/tl/3_functions.js +1 -2
  26. package/esm/types/{!0_file_id.js → 0__file_id.js} +0 -1
  27. package/esm/types/0_bot_command.d.ts +4 -0
  28. package/esm/types/0_chat_id.d.ts +4 -0
  29. package/esm/types/0_chat_id.js +1 -0
  30. package/esm/types/0_chat_photo.js +1 -1
  31. package/esm/types/0_input_contact_message_content.d.ts +6 -0
  32. package/esm/types/0_input_contact_message_content.js +1 -0
  33. package/esm/types/0_input_location_message_content.d.ts +8 -0
  34. package/esm/types/0_input_location_message_content.js +1 -0
  35. package/esm/types/0_input_venue_message_content.d.ts +10 -0
  36. package/esm/types/0_input_venue_message_content.js +1 -0
  37. package/esm/types/0_labeled_price.d.ts +4 -0
  38. package/esm/types/0_labeled_price.js +1 -0
  39. package/esm/types/0_parse_mode.d.ts +1 -0
  40. package/esm/types/0_parse_mode.js +1 -0
  41. package/esm/types/0_thumbnail.js +1 -1
  42. package/esm/types/{!0_misc.d.ts → 1__getters.d.ts} +7 -0
  43. package/esm/types/1__getters.js +1 -0
  44. package/esm/types/1_bot_command_scope.d.ts +32 -0
  45. package/esm/types/1_bot_command_scope.js +27 -0
  46. package/esm/types/1_chat.d.ts +1 -1
  47. package/esm/types/1_chat.js +1 -1
  48. package/esm/types/1_inline_query_result_button.d.ts +6 -0
  49. package/esm/types/1_inline_query_result_button.js +1 -0
  50. package/esm/types/1_input_invoice_message_content.d.ts +23 -0
  51. package/esm/types/1_input_invoice_message_content.js +1 -0
  52. package/esm/types/1_input_text_message_content.d.ts +8 -0
  53. package/esm/types/1_input_text_message_content.js +1 -0
  54. package/esm/types/1_photo.js +1 -1
  55. package/esm/types/1_sticker.d.ts +1 -1
  56. package/esm/types/1_sticker.js +1 -1
  57. package/esm/types/1_user.d.ts +1 -1
  58. package/esm/types/1_user.js +1 -1
  59. package/esm/types/2_game.js +1 -1
  60. package/{script/types/1_inline_keyboard_button.d.ts → esm/types/2_inline_keyboard_button.d.ts} +3 -3
  61. package/esm/types/2_inline_query.d.ts +1 -1
  62. package/esm/types/2_input_message_content.d.ts +6 -0
  63. package/esm/types/2_input_message_content.js +1 -0
  64. package/esm/types/{2_inline_keyboard_markup.d.ts → 3_inline_keyboard_markup.d.ts} +3 -2
  65. package/esm/types/{2_inline_keyboard_markup.js → 3_inline_keyboard_markup.js} +1 -1
  66. package/esm/types/3_message.d.ts +13 -13
  67. package/esm/types/3_message.js +13 -13
  68. package/esm/types/4_callback_query.d.ts +1 -1
  69. package/esm/types/4_inline_query_result_article.d.ts +15 -0
  70. package/esm/types/4_inline_query_result_article.js +1 -0
  71. package/esm/types/4_inline_query_result_audio.d.ts +17 -0
  72. package/esm/types/4_inline_query_result_audio.js +1 -0
  73. package/esm/types/4_inline_query_result_cached_audio.d.ts +14 -0
  74. package/esm/types/4_inline_query_result_cached_audio.js +1 -0
  75. package/esm/types/4_inline_query_result_cached_document.d.ts +15 -0
  76. package/esm/types/4_inline_query_result_cached_document.js +1 -0
  77. package/esm/types/4_inline_query_result_cached_gif.d.ts +15 -0
  78. package/esm/types/4_inline_query_result_cached_gif.js +1 -0
  79. package/esm/types/4_inline_query_result_cached_mpeg4_gif.d.ts +15 -0
  80. package/esm/types/4_inline_query_result_cached_mpeg4_gif.js +1 -0
  81. package/esm/types/4_inline_query_result_cached_photo.d.ts +16 -0
  82. package/esm/types/4_inline_query_result_cached_photo.js +1 -0
  83. package/esm/types/4_inline_query_result_cached_sticker.d.ts +9 -0
  84. package/esm/types/4_inline_query_result_cached_sticker.js +1 -0
  85. package/esm/types/4_inline_query_result_cached_video.d.ts +16 -0
  86. package/esm/types/4_inline_query_result_cached_video.js +1 -0
  87. package/esm/types/4_inline_query_result_cached_voice.d.ts +15 -0
  88. package/esm/types/4_inline_query_result_cached_voice.js +1 -0
  89. package/esm/types/4_inline_query_result_contact.d.ts +15 -0
  90. package/esm/types/4_inline_query_result_contact.js +1 -0
  91. package/esm/types/4_inline_query_result_document.d.ts +18 -0
  92. package/esm/types/4_inline_query_result_document.js +1 -0
  93. package/esm/types/4_inline_query_result_game.d.ts +7 -0
  94. package/esm/types/4_inline_query_result_game.js +1 -0
  95. package/esm/types/4_inline_query_result_gif.d.ts +20 -0
  96. package/esm/types/4_inline_query_result_gif.js +1 -0
  97. package/esm/types/4_inline_query_result_location.d.ts +18 -0
  98. package/esm/types/4_inline_query_result_location.js +1 -0
  99. package/esm/types/4_inline_query_result_mpeg4_gif.d.ts +20 -0
  100. package/esm/types/4_inline_query_result_mpeg4_gif.js +1 -0
  101. package/esm/types/4_inline_query_result_photo.d.ts +19 -0
  102. package/esm/types/4_inline_query_result_photo.js +1 -0
  103. package/esm/types/4_inline_query_result_venue.d.ts +19 -0
  104. package/esm/types/4_inline_query_result_venue.js +1 -0
  105. package/esm/types/4_inline_query_result_video.d.ts +21 -0
  106. package/esm/types/4_inline_query_result_video.js +1 -0
  107. package/esm/types/4_inline_query_result_voice.d.ts +16 -0
  108. package/esm/types/4_inline_query_result_voice.js +1 -0
  109. package/esm/types/4_reply_markup.d.ts +7 -0
  110. package/esm/types/4_reply_markup.js +22 -0
  111. package/esm/types/5_inline_query_result.d.ts +29 -0
  112. package/esm/types/5_inline_query_result.js +256 -0
  113. package/esm/utilities/0_crypto.js +6 -4
  114. package/package.json +1 -1
  115. package/script/0_deps.d.ts +1 -1
  116. package/script/0_deps.js +1 -1
  117. package/script/3_errors.d.ts +1531 -0
  118. package/script/3_errors.js +2053 -0
  119. package/script/3_types.d.ts +39 -3
  120. package/script/3_types.js +39 -3
  121. package/script/4_constants.d.ts +1 -1
  122. package/script/4_constants.js +1 -1
  123. package/script/4_errors.d.ts +25 -0
  124. package/script/4_errors.js +88 -0
  125. package/script/client/2_client_plain.js +1 -1
  126. package/script/client/3_types.d.ts +1 -5
  127. package/script/client/4_client.d.ts +20 -3
  128. package/script/client/4_client.js +60 -61
  129. package/script/connection/1_connection_web_socket.js +2 -1
  130. package/script/deps/deno.land/x/{tgcrypto@0.1.3 → tgcrypto@0.2.1}/mod.d.ts +2 -2
  131. package/script/deps/deno.land/x/{tgcrypto@0.1.3 → tgcrypto@0.2.1}/mod.js +19 -6
  132. package/script/deps/deno.land/x/tgcrypto@0.2.1/tgcrypto.d.ts +2 -0
  133. package/script/deps/deno.land/x/tgcrypto@0.2.1/tgcrypto.js +993 -0
  134. package/script/mod.d.ts +3 -2
  135. package/script/mod.js +16 -3
  136. package/script/tl/2_types.d.ts +1 -1
  137. package/script/tl/2_types.js +0 -1
  138. package/script/tl/3_functions.d.ts +1 -1
  139. package/script/tl/3_functions.js +0 -1
  140. package/script/types/{!0_file_id.js → 0__file_id.js} +0 -1
  141. package/script/types/0_bot_command.d.ts +4 -0
  142. package/script/types/0_chat_id.d.ts +4 -0
  143. package/script/types/0_chat_id.js +2 -0
  144. package/script/types/0_chat_photo.js +7 -7
  145. package/script/types/0_input_contact_message_content.d.ts +6 -0
  146. package/script/types/0_input_contact_message_content.js +2 -0
  147. package/script/types/0_input_location_message_content.d.ts +8 -0
  148. package/script/types/0_input_location_message_content.js +2 -0
  149. package/script/types/0_input_venue_message_content.d.ts +10 -0
  150. package/script/types/0_input_venue_message_content.js +2 -0
  151. package/script/types/0_labeled_price.d.ts +4 -0
  152. package/script/types/0_labeled_price.js +2 -0
  153. package/script/types/0_parse_mode.d.ts +1 -0
  154. package/script/types/0_parse_mode.js +2 -0
  155. package/script/types/0_thumbnail.js +5 -5
  156. package/script/types/{!0_misc.d.ts → 1__getters.d.ts} +7 -0
  157. package/script/types/1__getters.js +2 -0
  158. package/script/types/1_bot_command_scope.d.ts +32 -0
  159. package/script/types/1_bot_command_scope.js +31 -0
  160. package/script/types/1_chat.d.ts +1 -1
  161. package/script/types/1_chat.js +1 -1
  162. package/script/types/1_inline_query_result_button.d.ts +6 -0
  163. package/script/types/1_inline_query_result_button.js +2 -0
  164. package/script/types/1_input_invoice_message_content.d.ts +23 -0
  165. package/script/types/1_input_invoice_message_content.js +2 -0
  166. package/script/types/1_input_text_message_content.d.ts +8 -0
  167. package/script/types/1_input_text_message_content.js +2 -0
  168. package/script/types/1_photo.js +5 -5
  169. package/script/types/1_sticker.d.ts +1 -1
  170. package/script/types/1_sticker.js +1 -1
  171. package/script/types/1_user.d.ts +1 -1
  172. package/script/types/1_user.js +1 -1
  173. package/script/types/2_game.js +3 -3
  174. package/{esm/types/1_inline_keyboard_button.d.ts → script/types/2_inline_keyboard_button.d.ts} +3 -3
  175. package/script/types/2_inline_query.d.ts +1 -1
  176. package/script/types/2_input_message_content.d.ts +6 -0
  177. package/script/types/2_input_message_content.js +2 -0
  178. package/script/types/{2_inline_keyboard_markup.d.ts → 3_inline_keyboard_markup.d.ts} +3 -2
  179. package/script/types/{2_inline_keyboard_markup.js → 3_inline_keyboard_markup.js} +3 -3
  180. package/script/types/3_message.d.ts +13 -13
  181. package/script/types/3_message.js +23 -23
  182. package/script/types/4_callback_query.d.ts +1 -1
  183. package/script/types/4_inline_query_result_article.d.ts +15 -0
  184. package/script/types/4_inline_query_result_article.js +2 -0
  185. package/script/types/4_inline_query_result_audio.d.ts +17 -0
  186. package/script/types/4_inline_query_result_audio.js +2 -0
  187. package/script/types/4_inline_query_result_cached_audio.d.ts +14 -0
  188. package/script/types/4_inline_query_result_cached_audio.js +2 -0
  189. package/script/types/4_inline_query_result_cached_document.d.ts +15 -0
  190. package/script/types/4_inline_query_result_cached_document.js +2 -0
  191. package/script/types/4_inline_query_result_cached_gif.d.ts +15 -0
  192. package/script/types/4_inline_query_result_cached_gif.js +2 -0
  193. package/script/types/4_inline_query_result_cached_mpeg4_gif.d.ts +15 -0
  194. package/script/types/4_inline_query_result_cached_mpeg4_gif.js +2 -0
  195. package/script/types/4_inline_query_result_cached_photo.d.ts +16 -0
  196. package/script/types/4_inline_query_result_cached_photo.js +2 -0
  197. package/script/types/4_inline_query_result_cached_sticker.d.ts +9 -0
  198. package/script/types/4_inline_query_result_cached_sticker.js +2 -0
  199. package/script/types/4_inline_query_result_cached_video.d.ts +16 -0
  200. package/script/types/4_inline_query_result_cached_video.js +2 -0
  201. package/script/types/4_inline_query_result_cached_voice.d.ts +15 -0
  202. package/script/types/4_inline_query_result_cached_voice.js +2 -0
  203. package/script/types/4_inline_query_result_contact.d.ts +15 -0
  204. package/script/types/4_inline_query_result_contact.js +2 -0
  205. package/script/types/4_inline_query_result_document.d.ts +18 -0
  206. package/script/types/4_inline_query_result_document.js +2 -0
  207. package/script/types/4_inline_query_result_game.d.ts +7 -0
  208. package/script/types/4_inline_query_result_game.js +2 -0
  209. package/script/types/4_inline_query_result_gif.d.ts +20 -0
  210. package/script/types/4_inline_query_result_gif.js +2 -0
  211. package/script/types/4_inline_query_result_location.d.ts +18 -0
  212. package/script/types/4_inline_query_result_location.js +2 -0
  213. package/script/types/4_inline_query_result_mpeg4_gif.d.ts +20 -0
  214. package/script/types/4_inline_query_result_mpeg4_gif.js +2 -0
  215. package/script/types/4_inline_query_result_photo.d.ts +19 -0
  216. package/script/types/4_inline_query_result_photo.js +2 -0
  217. package/script/types/4_inline_query_result_venue.d.ts +19 -0
  218. package/script/types/4_inline_query_result_venue.js +2 -0
  219. package/script/types/4_inline_query_result_video.d.ts +21 -0
  220. package/script/types/4_inline_query_result_video.js +2 -0
  221. package/script/types/4_inline_query_result_voice.d.ts +16 -0
  222. package/script/types/4_inline_query_result_voice.js +2 -0
  223. package/script/types/4_reply_markup.d.ts +7 -0
  224. package/script/types/4_reply_markup.js +26 -0
  225. package/script/types/5_inline_query_result.d.ts +29 -0
  226. package/script/types/5_inline_query_result.js +260 -0
  227. package/script/utilities/0_crypto.js +6 -4
  228. package/esm/deps/deno.land/x/tgcrypto@0.1.3/tgcrypto.d.ts +0 -2
  229. package/esm/deps/deno.land/x/tgcrypto@0.1.3/tgcrypto.js +0 -1078
  230. package/script/deps/deno.land/x/tgcrypto@0.1.3/tgcrypto.d.ts +0 -2
  231. package/script/deps/deno.land/x/tgcrypto@0.1.3/tgcrypto.js +0 -1080
  232. /package/esm/types/{!0_file_id.d.ts → 0__file_id.d.ts} +0 -0
  233. /package/esm/types/{!0_misc.js → 0_bot_command.js} +0 -0
  234. /package/esm/types/{1_inline_keyboard_button.js → 2_inline_keyboard_button.js} +0 -0
  235. /package/script/types/{!0_file_id.d.ts → 0__file_id.d.ts} +0 -0
  236. /package/script/types/{!0_misc.js → 0_bot_command.js} +0 -0
  237. /package/script/types/{1_inline_keyboard_button.js → 2_inline_keyboard_button.js} +0 -0
@@ -1,16 +1,24 @@
1
- export * from "./types/!0_file_id.js";
2
1
  export * from "./types/0_audio.js";
2
+ export * from "./types/0_bot_command.js";
3
3
  export * from "./types/0_chat_action.js";
4
4
  export * from "./types/0_chat_administrator_rights.js";
5
+ export * from "./types/0_chat_id.js";
5
6
  export * from "./types/0_chat_photo.js";
7
+ export * from "./types/0_color.js";
6
8
  export * from "./types/0_contact.js";
7
9
  export * from "./types/0_dice.js";
10
+ export * from "./types/0__file_id.js";
8
11
  export * from "./types/0_force_reply.js";
12
+ export * from "./types/0_input_contact_message_content.js";
13
+ export * from "./types/0_input_location_message_content.js";
14
+ export * from "./types/0_input_venue_message_content.js";
9
15
  export * from "./types/0_keyboard_button_poll_type.js";
16
+ export * from "./types/0_labeled_price.js";
10
17
  export * from "./types/0_location.js";
11
18
  export * from "./types/0_login_url.js";
12
19
  export * from "./types/0_mask_position.js";
13
20
  export * from "./types/0_message_entity.js";
21
+ export * from "./types/0_parse_mode.js";
14
22
  export * from "./types/0_poll_option.js";
15
23
  export * from "./types/0_reply_keyboard_remove.js";
16
24
  export * from "./types/0_thumbnail.js";
@@ -18,9 +26,13 @@ export * from "./types/0_venue.js";
18
26
  export * from "./types/0_voice.js";
19
27
  export * from "./types/0_web_app_info.js";
20
28
  export * from "./types/1_animation.js";
29
+ export * from "./types/1_bot_command_scope.js";
21
30
  export * from "./types/1_chat.js";
22
31
  export * from "./types/1_document.js";
23
- export * from "./types/1_inline_keyboard_button.js";
32
+ export * from "./types/1__getters.js";
33
+ export * from "./types/1_inline_query_result_button.js";
34
+ export * from "./types/1_input_invoice_message_content.js";
35
+ export * from "./types/1_input_text_message_content.js";
24
36
  export * from "./types/1_keyboard_button.js";
25
37
  export * from "./types/1_photo.js";
26
38
  export * from "./types/1_poll.js";
@@ -29,8 +41,32 @@ export * from "./types/1_user.js";
29
41
  export * from "./types/1_video_note.js";
30
42
  export * from "./types/1_video.js";
31
43
  export * from "./types/2_game.js";
32
- export * from "./types/2_inline_keyboard_markup.js";
44
+ export * from "./types/2_inline_keyboard_button.js";
33
45
  export * from "./types/2_inline_query.js";
46
+ export * from "./types/2_input_message_content.js";
34
47
  export * from "./types/2_reply_keyboard_markup.js";
48
+ export * from "./types/3_inline_keyboard_markup.js";
35
49
  export * from "./types/3_message.js";
36
50
  export * from "./types/4_callback_query.js";
51
+ export * from "./types/4_inline_query_result_article.js";
52
+ export * from "./types/4_inline_query_result_audio.js";
53
+ export * from "./types/4_inline_query_result_cached_audio.js";
54
+ export * from "./types/4_inline_query_result_cached_document.js";
55
+ export * from "./types/4_inline_query_result_cached_gif.js";
56
+ export * from "./types/4_inline_query_result_cached_mpeg4_gif.js";
57
+ export * from "./types/4_inline_query_result_cached_photo.js";
58
+ export * from "./types/4_inline_query_result_cached_sticker.js";
59
+ export * from "./types/4_inline_query_result_cached_video.js";
60
+ export * from "./types/4_inline_query_result_cached_voice.js";
61
+ export * from "./types/4_inline_query_result_contact.js";
62
+ export * from "./types/4_inline_query_result_document.js";
63
+ export * from "./types/4_inline_query_result_game.js";
64
+ export * from "./types/4_inline_query_result_gif.js";
65
+ export * from "./types/4_inline_query_result_location.js";
66
+ export * from "./types/4_inline_query_result_mpeg4_gif.js";
67
+ export * from "./types/4_inline_query_result_photo.js";
68
+ export * from "./types/4_inline_query_result_venue.js";
69
+ export * from "./types/4_inline_query_result_video.js";
70
+ export * from "./types/4_inline_query_result_voice.js";
71
+ export * from "./types/4_reply_markup.js";
72
+ export * from "./types/5_inline_query_result.js";
package/script/3_types.js CHANGED
@@ -14,19 +14,27 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./types/!0_file_id.js"), exports);
18
17
  __exportStar(require("./types/0_audio.js"), exports);
18
+ __exportStar(require("./types/0_bot_command.js"), exports);
19
19
  __exportStar(require("./types/0_chat_action.js"), exports);
20
20
  __exportStar(require("./types/0_chat_administrator_rights.js"), exports);
21
+ __exportStar(require("./types/0_chat_id.js"), exports);
21
22
  __exportStar(require("./types/0_chat_photo.js"), exports);
23
+ __exportStar(require("./types/0_color.js"), exports);
22
24
  __exportStar(require("./types/0_contact.js"), exports);
23
25
  __exportStar(require("./types/0_dice.js"), exports);
26
+ __exportStar(require("./types/0__file_id.js"), exports);
24
27
  __exportStar(require("./types/0_force_reply.js"), exports);
28
+ __exportStar(require("./types/0_input_contact_message_content.js"), exports);
29
+ __exportStar(require("./types/0_input_location_message_content.js"), exports);
30
+ __exportStar(require("./types/0_input_venue_message_content.js"), exports);
25
31
  __exportStar(require("./types/0_keyboard_button_poll_type.js"), exports);
32
+ __exportStar(require("./types/0_labeled_price.js"), exports);
26
33
  __exportStar(require("./types/0_location.js"), exports);
27
34
  __exportStar(require("./types/0_login_url.js"), exports);
28
35
  __exportStar(require("./types/0_mask_position.js"), exports);
29
36
  __exportStar(require("./types/0_message_entity.js"), exports);
37
+ __exportStar(require("./types/0_parse_mode.js"), exports);
30
38
  __exportStar(require("./types/0_poll_option.js"), exports);
31
39
  __exportStar(require("./types/0_reply_keyboard_remove.js"), exports);
32
40
  __exportStar(require("./types/0_thumbnail.js"), exports);
@@ -34,9 +42,13 @@ __exportStar(require("./types/0_venue.js"), exports);
34
42
  __exportStar(require("./types/0_voice.js"), exports);
35
43
  __exportStar(require("./types/0_web_app_info.js"), exports);
36
44
  __exportStar(require("./types/1_animation.js"), exports);
45
+ __exportStar(require("./types/1_bot_command_scope.js"), exports);
37
46
  __exportStar(require("./types/1_chat.js"), exports);
38
47
  __exportStar(require("./types/1_document.js"), exports);
39
- __exportStar(require("./types/1_inline_keyboard_button.js"), exports);
48
+ __exportStar(require("./types/1__getters.js"), exports);
49
+ __exportStar(require("./types/1_inline_query_result_button.js"), exports);
50
+ __exportStar(require("./types/1_input_invoice_message_content.js"), exports);
51
+ __exportStar(require("./types/1_input_text_message_content.js"), exports);
40
52
  __exportStar(require("./types/1_keyboard_button.js"), exports);
41
53
  __exportStar(require("./types/1_photo.js"), exports);
42
54
  __exportStar(require("./types/1_poll.js"), exports);
@@ -45,8 +57,32 @@ __exportStar(require("./types/1_user.js"), exports);
45
57
  __exportStar(require("./types/1_video_note.js"), exports);
46
58
  __exportStar(require("./types/1_video.js"), exports);
47
59
  __exportStar(require("./types/2_game.js"), exports);
48
- __exportStar(require("./types/2_inline_keyboard_markup.js"), exports);
60
+ __exportStar(require("./types/2_inline_keyboard_button.js"), exports);
49
61
  __exportStar(require("./types/2_inline_query.js"), exports);
62
+ __exportStar(require("./types/2_input_message_content.js"), exports);
50
63
  __exportStar(require("./types/2_reply_keyboard_markup.js"), exports);
64
+ __exportStar(require("./types/3_inline_keyboard_markup.js"), exports);
51
65
  __exportStar(require("./types/3_message.js"), exports);
52
66
  __exportStar(require("./types/4_callback_query.js"), exports);
67
+ __exportStar(require("./types/4_inline_query_result_article.js"), exports);
68
+ __exportStar(require("./types/4_inline_query_result_audio.js"), exports);
69
+ __exportStar(require("./types/4_inline_query_result_cached_audio.js"), exports);
70
+ __exportStar(require("./types/4_inline_query_result_cached_document.js"), exports);
71
+ __exportStar(require("./types/4_inline_query_result_cached_gif.js"), exports);
72
+ __exportStar(require("./types/4_inline_query_result_cached_mpeg4_gif.js"), exports);
73
+ __exportStar(require("./types/4_inline_query_result_cached_photo.js"), exports);
74
+ __exportStar(require("./types/4_inline_query_result_cached_sticker.js"), exports);
75
+ __exportStar(require("./types/4_inline_query_result_cached_video.js"), exports);
76
+ __exportStar(require("./types/4_inline_query_result_cached_voice.js"), exports);
77
+ __exportStar(require("./types/4_inline_query_result_contact.js"), exports);
78
+ __exportStar(require("./types/4_inline_query_result_document.js"), exports);
79
+ __exportStar(require("./types/4_inline_query_result_game.js"), exports);
80
+ __exportStar(require("./types/4_inline_query_result_gif.js"), exports);
81
+ __exportStar(require("./types/4_inline_query_result_location.js"), exports);
82
+ __exportStar(require("./types/4_inline_query_result_mpeg4_gif.js"), exports);
83
+ __exportStar(require("./types/4_inline_query_result_photo.js"), exports);
84
+ __exportStar(require("./types/4_inline_query_result_venue.js"), exports);
85
+ __exportStar(require("./types/4_inline_query_result_video.js"), exports);
86
+ __exportStar(require("./types/4_inline_query_result_voice.js"), exports);
87
+ __exportStar(require("./types/4_reply_markup.js"), exports);
88
+ __exportStar(require("./types/5_inline_query_result.js"), exports);
@@ -5,7 +5,7 @@ export declare const PUBLIC_KEYS: PublicKeys;
5
5
  export declare const VECTOR_CONSTRUCTOR = 481674261;
6
6
  export declare const INITIAL_DC: DC;
7
7
  export declare const LAYER = 161;
8
- export declare const APP_VERSION = "MTKruto 0.0.998";
8
+ export declare const APP_VERSION = "MTKruto 0.1.0";
9
9
  export declare const DEVICE_MODEL: string;
10
10
  export declare const LANG_CODE: string;
11
11
  export declare const LANG_PACK = "";
@@ -80,7 +80,7 @@ exports.PUBLIC_KEYS = Object.freeze([
80
80
  exports.VECTOR_CONSTRUCTOR = 0x1CB5C415;
81
81
  exports.INITIAL_DC = "2-test";
82
82
  exports.LAYER = 161;
83
- exports.APP_VERSION = "MTKruto 0.0.998";
83
+ exports.APP_VERSION = "MTKruto 0.1.0";
84
84
  // @ts-ignore: lib
85
85
  exports.DEVICE_MODEL = typeof dntShim.Deno === "undefined" ? typeof navigator === "undefined" ? typeof process === "undefined" ? "Unknown" : process.platform + "-" + process.arch : navigator.userAgent.split(" ")[0] : dntShim.Deno.build.os + "-" + dntShim.Deno.build.arch;
86
86
  exports.LANG_CODE = typeof navigator === "undefined" ? "en" : navigator.language.split("-")[0];
@@ -0,0 +1,25 @@
1
+ import { types } from "./2_tl.js";
2
+ export * from "./3_errors.js";
3
+ export declare class FloodWait extends types.RPCError {
4
+ seconds: number;
5
+ constructor(params: {
6
+ errorCode: number;
7
+ errorMessage: string;
8
+ });
9
+ }
10
+ export declare class Migrate extends types.RPCError {
11
+ dc: number;
12
+ constructor(params: {
13
+ errorCode: number;
14
+ errorMessage: string;
15
+ });
16
+ }
17
+ export declare class UserMigrate extends Migrate {
18
+ }
19
+ export declare class PhoneMigrate extends Migrate {
20
+ }
21
+ export declare class FileMigrate extends Migrate {
22
+ }
23
+ export declare class StatsMigrate extends Migrate {
24
+ }
25
+ export declare function upgradeInstance(error: types.RPCError): types.RPCError;
@@ -0,0 +1,88 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.upgradeInstance = exports.StatsMigrate = exports.FileMigrate = exports.PhoneMigrate = exports.UserMigrate = exports.Migrate = exports.FloodWait = void 0;
18
+ const _1_utilities_js_1 = require("./1_utilities.js");
19
+ const _3_errors_js_1 = require("./3_errors.js");
20
+ const _2_tl_js_1 = require("./2_tl.js");
21
+ __exportStar(require("./3_errors.js"), exports);
22
+ class FloodWait extends _2_tl_js_1.types.RPCError {
23
+ constructor(params) {
24
+ super(params);
25
+ Object.defineProperty(this, "seconds", {
26
+ enumerable: true,
27
+ configurable: true,
28
+ writable: true,
29
+ value: void 0
30
+ });
31
+ const p = params.errorMessage.split("_");
32
+ this.seconds = Number(p[p.length - 1]);
33
+ if (isNaN(this.seconds)) {
34
+ (0, _1_utilities_js_1.UNREACHABLE)();
35
+ }
36
+ }
37
+ }
38
+ exports.FloodWait = FloodWait;
39
+ class Migrate extends _2_tl_js_1.types.RPCError {
40
+ constructor(params) {
41
+ super(params);
42
+ Object.defineProperty(this, "dc", {
43
+ enumerable: true,
44
+ configurable: true,
45
+ writable: true,
46
+ value: void 0
47
+ });
48
+ const p = params.errorMessage.split("_");
49
+ this.dc = Number(p[p.length - 1]);
50
+ if (isNaN(this.dc)) {
51
+ (0, _1_utilities_js_1.UNREACHABLE)();
52
+ }
53
+ }
54
+ }
55
+ exports.Migrate = Migrate;
56
+ class UserMigrate extends Migrate {
57
+ }
58
+ exports.UserMigrate = UserMigrate;
59
+ class PhoneMigrate extends Migrate {
60
+ }
61
+ exports.PhoneMigrate = PhoneMigrate;
62
+ class FileMigrate extends Migrate {
63
+ }
64
+ exports.FileMigrate = FileMigrate;
65
+ class StatsMigrate extends Migrate {
66
+ }
67
+ exports.StatsMigrate = StatsMigrate;
68
+ const prefixMap = {
69
+ "FILE_MIGRATE_": FileMigrate,
70
+ "PHONE_MIGRATE_": PhoneMigrate,
71
+ "USER_MIGRATE_": UserMigrate,
72
+ "STATS_MIGRATE_": StatsMigrate,
73
+ "FLOOD_WAIT_": FloodWait,
74
+ };
75
+ function upgradeInstance(error) {
76
+ for (const [k, v] of Object.entries(prefixMap)) {
77
+ if (error.errorMessage.startsWith(k)) {
78
+ return new v(error);
79
+ }
80
+ }
81
+ for (const [k, v] of Object.entries(_3_errors_js_1.map)) {
82
+ if (error.errorMessage == k) {
83
+ return new v(error);
84
+ }
85
+ }
86
+ return error;
87
+ }
88
+ exports.upgradeInstance = upgradeInstance;
@@ -5,8 +5,8 @@ const _0_deps_js_1 = require("../0_deps.js");
5
5
  const _1_utilities_js_1 = require("../1_utilities.js");
6
6
  const _2_tl_js_1 = require("../2_tl.js");
7
7
  const _4_constants_js_1 = require("../4_constants.js");
8
- const _1_client_abstract_js_1 = require("./1_client_abstract.js");
9
8
  const _0_message_js_1 = require("./0_message.js");
9
+ const _1_client_abstract_js_1 = require("./1_client_abstract.js");
10
10
  const d = (0, _0_deps_js_1.debug)("ClientPlain/createAuthKey");
11
11
  class ClientPlain extends _1_client_abstract_js_1.ClientAbstract {
12
12
  constructor(params) {
@@ -1,5 +1,5 @@
1
1
  import { MaybePromise } from "../1_utilities.js";
2
- import { CallbackQuery, ForceReply, InlineKeyboardMarkup, InlineQuery, Message, MessageEntity, ReplyKeyboardMarkup, ReplyKeyboardRemove } from "../3_types.js";
2
+ import { CallbackQuery, ChatID, ForceReply, InlineKeyboardMarkup, InlineQuery, Message, MessageEntity, ReplyKeyboardMarkup, ReplyKeyboardRemove } from "../3_types.js";
3
3
  import { With } from "./0_utilities.js";
4
4
  import { ClientPlainParams } from "./2_client_plain.js";
5
5
  export type ParseMode = "HTML" | null;
@@ -52,10 +52,6 @@ export interface AuthorizeUserParams<S = string> {
52
52
  code: S | (() => MaybePromise<S>);
53
53
  password: S | ((hint: string | null) => MaybePromise<S>);
54
54
  }
55
- /**
56
- * A chat identifier as provided by MTKruto or a string starting with a @ that is followed by a username.
57
- */
58
- export type ChatID = number | string;
59
55
  export interface SendMessagesParams {
60
56
  /**
61
57
  * The parse mode to use. If not provided, the default parse mode will be used.
@@ -2,10 +2,11 @@ import { MaybePromise } from "../1_utilities.js";
2
2
  import { functions, ReadObject, types } from "../2_tl.js";
3
3
  import { Storage } from "../3_storage.js";
4
4
  import { DC } from "../3_transport.js";
5
- import { ChatAction, Message } from "../3_types.js";
5
+ import { BotCommand, BotCommandScope, ChatAction, ChatID, InlineQueryResult, InlineQueryResultButton, Message } from "../3_types.js";
6
+ import { Migrate } from "../4_errors.js";
6
7
  import { With } from "./0_utilities.js";
7
8
  import { ClientAbstract } from "./1_client_abstract.js";
8
- import { AnswerCallbackQueryParams, AuthorizeUserParams, ChatID, ClientParams, EditMessageParams, FilterableUpdates, FilterUpdate, ForwardMessagesParams, Handler, ParseMode, SendMessagesParams, SendPollParams, Update } from "./3_types.js";
9
+ import { AnswerCallbackQueryParams, AuthorizeUserParams, ClientParams, EditMessageParams, FilterableUpdates, FilterUpdate, ForwardMessagesParams, Handler, ParseMode, SendMessagesParams, SendPollParams, Update } from "./3_types.js";
9
10
  export declare const getEntity: unique symbol;
10
11
  export declare const getStickerSetName: unique symbol;
11
12
  export declare const handleMigrationError: unique symbol;
@@ -60,7 +61,7 @@ export declare class Client extends ClientAbstract {
60
61
  private assertUser;
61
62
  private assertBot;
62
63
  private fetchState;
63
- [handleMigrationError](err: types.RPCError): Promise<void>;
64
+ [handleMigrationError](err: Migrate): Promise<void>;
64
65
  private connectionInited;
65
66
  disconnect(): Promise<void>;
66
67
  private initConnection;
@@ -192,6 +193,7 @@ export declare class Client extends ClientAbstract {
192
193
  * @param id ID of the callback query to answer.
193
194
  */
194
195
  answerCallbackQuery(id: string, params?: AnswerCallbackQueryParams): Promise<void>;
196
+ private usernameResolver;
195
197
  private constructReplyMarkup;
196
198
  private static assertMsgHas;
197
199
  /**
@@ -210,6 +212,21 @@ export declare class Client extends ClientAbstract {
210
212
  * @param messageThreadId The thread to send the chat action to.
211
213
  */
212
214
  sendChatAction(chatId: ChatID, action_: ChatAction, messageThreadId?: number): Promise<void>;
215
+ setMyCommands(commands: BotCommand[], params?: {
216
+ languageCode?: string;
217
+ scope?: BotCommandScope;
218
+ }): Promise<void>;
219
+ getMyCommands(params?: {
220
+ languageCode?: string;
221
+ scope?: BotCommandScope;
222
+ }): Promise<BotCommand[]>;
223
+ answerInlineQuery(id: string, results: InlineQueryResult[], params?: {
224
+ cacheTime?: number;
225
+ isPersonal?: boolean;
226
+ nextOffset?: string;
227
+ isGallery?: boolean;
228
+ button: InlineQueryResultButton;
229
+ }): Promise<void>;
213
230
  private handle;
214
231
  use(handler: Handler): void;
215
232
  branch(predicate: (upd: Update) => MaybePromise<boolean>, trueHandler: Handler, falseHandler: Handler): void;
@@ -7,12 +7,13 @@ const _2_tl_js_1 = require("../2_tl.js");
7
7
  const _3_storage_js_1 = require("../3_storage.js");
8
8
  const _3_types_js_1 = require("../3_types.js");
9
9
  const _4_constants_js_1 = require("../4_constants.js");
10
- const _0_utilities_js_1 = require("./0_utilities.js");
10
+ const _4_errors_js_1 = require("../4_errors.js");
11
+ const _0_html_js_1 = require("./0_html.js");
11
12
  const _0_message_js_1 = require("./0_message.js");
12
13
  const _0_password_js_1 = require("./0_password.js");
13
- const _0_html_js_1 = require("./0_html.js");
14
- const _2_client_plain_js_1 = require("./2_client_plain.js");
14
+ const _0_utilities_js_1 = require("./0_utilities.js");
15
15
  const _1_client_abstract_js_1 = require("./1_client_abstract.js");
16
+ const _2_client_plain_js_1 = require("./2_client_plain.js");
16
17
  const _3_types_js_2 = require("./3_types.js");
17
18
  const d = (0, _0_deps_js_1.debug)("Client");
18
19
  const dGap = (0, _0_deps_js_1.debug)("Client/recoverUpdateGap");
@@ -215,6 +216,15 @@ class Client extends _1_client_abstract_js_1.ClientAbstract {
215
216
  writable: true,
216
217
  value: new _1_utilities_js_1.Queue("processUpdates")
217
218
  });
219
+ Object.defineProperty(this, "usernameResolver", {
220
+ enumerable: true,
221
+ configurable: true,
222
+ writable: true,
223
+ value: async (v) => {
224
+ const inputPeer = await this.getInputPeer(v).then((v) => v[_2_tl_js_1.as](_2_tl_js_1.types.InputPeerUser));
225
+ return new _2_tl_js_1.types.InputUser({ userId: inputPeer.userId, accessHash: inputPeer.accessHash });
226
+ }
227
+ });
218
228
  Object.defineProperty(this, "handle", {
219
229
  enumerable: true,
220
230
  configurable: true,
@@ -321,18 +331,12 @@ class Client extends _1_client_abstract_js_1.ClientAbstract {
321
331
  d("state fetched [%s]", source);
322
332
  }
323
333
  async [exports.handleMigrationError](err) {
324
- const match = err.errorMessage.match(/MIGRATE_(\d)$/);
325
- if (match) {
326
- let newDc = match[1];
327
- if (Math.abs(this.dcId) >= 10000) {
328
- newDc += "-test";
329
- }
330
- await this.reconnect(newDc);
331
- d("migrated to DC%s", newDc);
332
- }
333
- else {
334
- (0, _1_utilities_js_1.UNREACHABLE)();
334
+ let newDc = String(err.dc);
335
+ if (Math.abs(this.dcId) >= 10000) {
336
+ newDc += "-test";
335
337
  }
338
+ await this.reconnect(newDc);
339
+ d("migrated to DC%s", newDc);
336
340
  }
337
341
  disconnect() {
338
342
  this.connectionInited = false;
@@ -405,7 +409,7 @@ class Client extends _1_client_abstract_js_1.ClientAbstract {
405
409
  return;
406
410
  }
407
411
  catch (err) {
408
- if (!(err instanceof _2_tl_js_1.types.RPCError) || err.errorMessage != "AUTH_KEY_UNREGISTERED") {
412
+ if (!(err instanceof _4_errors_js_1.AuthKeyUnregistered)) {
409
413
  throw err;
410
414
  }
411
415
  }
@@ -417,16 +421,10 @@ class Client extends _1_client_abstract_js_1.ClientAbstract {
417
421
  break;
418
422
  }
419
423
  catch (err) {
420
- if (err instanceof _2_tl_js_1.types.RPCError) {
421
- const match = err.errorMessage.match(/MIGRATE_(\d)$/);
422
- if (match) {
423
- await this[exports.handleMigrationError](err);
424
- await this.initConnection();
425
- continue;
426
- }
427
- else {
428
- throw err;
429
- }
424
+ if (err instanceof _4_errors_js_1.Migrate) {
425
+ await this[exports.handleMigrationError](err);
426
+ await this.initConnection();
427
+ continue;
430
428
  }
431
429
  else {
432
430
  throw err;
@@ -458,16 +456,10 @@ class Client extends _1_client_abstract_js_1.ClientAbstract {
458
456
  sentCode = await sendCode();
459
457
  }
460
458
  catch (err) {
461
- if (err instanceof _2_tl_js_1.types.RPCError) {
462
- const match = err.errorMessage.match(/MIGRATE_(\d)$/);
463
- if (match) {
464
- await this[exports.handleMigrationError](err);
465
- await this.initConnection();
466
- sentCode = await sendCode();
467
- }
468
- else {
469
- throw err;
470
- }
459
+ if (err instanceof _4_errors_js_1.Migrate) {
460
+ await this[exports.handleMigrationError](err);
461
+ await this.initConnection();
462
+ sentCode = await sendCode();
471
463
  }
472
464
  else {
473
465
  throw err;
@@ -476,7 +468,7 @@ class Client extends _1_client_abstract_js_1.ClientAbstract {
476
468
  break;
477
469
  }
478
470
  catch (err) {
479
- if (err instanceof _2_tl_js_1.types.RPCError && err.errorMessage == "PHONE_NUMBER_INVALID") {
471
+ if (err instanceof _4_errors_js_1.PhoneNumberInvalid) {
480
472
  continue;
481
473
  }
482
474
  else {
@@ -510,7 +502,7 @@ class Client extends _1_client_abstract_js_1.ClientAbstract {
510
502
  }
511
503
  }
512
504
  }
513
- if (!(err instanceof _2_tl_js_1.types.RPCError && err.errorMessage == "SESSION_PASSWORD_NEEDED")) {
505
+ if (!(err instanceof _4_errors_js_1.SessionPasswordNeeded)) {
514
506
  throw err;
515
507
  }
516
508
  while (true) {
@@ -529,7 +521,7 @@ class Client extends _1_client_abstract_js_1.ClientAbstract {
529
521
  break;
530
522
  }
531
523
  catch (err) {
532
- if (err instanceof _2_tl_js_1.types.RPCError && err.errorMessage == "PASSWORD_HASH_INVALID") {
524
+ if (err instanceof _4_errors_js_1.PasswordHashInvalid) {
533
525
  continue;
534
526
  }
535
527
  else {
@@ -551,7 +543,7 @@ class Client extends _1_client_abstract_js_1.ClientAbstract {
551
543
  return;
552
544
  }
553
545
  catch (err) {
554
- if (!(err instanceof _2_tl_js_1.types.RPCError) || err.errorMessage != "AUTH_KEY_UNREGISTERED") {
546
+ if (!(err instanceof _4_errors_js_1.AuthKeyUnregistered)) {
555
547
  throw err;
556
548
  }
557
549
  }
@@ -603,7 +595,7 @@ class Client extends _1_client_abstract_js_1.ClientAbstract {
603
595
  const promise = this.promises.get(messageId);
604
596
  if (promise) {
605
597
  if (result instanceof _2_tl_js_1.types.RPCError) {
606
- promise.reject(result);
598
+ promise.reject((0, _4_errors_js_1.upgradeInstance)(result));
607
599
  }
608
600
  else {
609
601
  promise.resolve(result);
@@ -697,7 +689,7 @@ class Client extends _1_client_abstract_js_1.ClientAbstract {
697
689
  });
698
690
  }
699
691
  catch (err) {
700
- if (err instanceof _2_tl_js_1.types.RPCError && err.errorMessage == "AUTH_KEY_UNREGISTERED") {
692
+ if (err instanceof _4_errors_js_1.AuthKeyUnregistered) {
701
693
  await this.propagateAuthorizationState(false);
702
694
  }
703
695
  throw err;
@@ -1507,29 +1499,10 @@ class Client extends _1_client_abstract_js_1.ClientAbstract {
1507
1499
  }));
1508
1500
  }
1509
1501
  async constructReplyMarkup(params) {
1510
- let replyMarkup = undefined;
1511
1502
  if (params?.replyMarkup) {
1512
1503
  await this.assertBot("replyMarkup");
1513
- if ("inlineKeyboard" in params.replyMarkup) {
1514
- replyMarkup = await (0, _3_types_js_1.inlineKeyboardMarkupToTlObject)(params.replyMarkup, async (v) => {
1515
- const inputPeer = await this.getInputPeer(v).then((v) => v[_2_tl_js_1.as](_2_tl_js_1.types.InputPeerUser));
1516
- return new _2_tl_js_1.types.InputUser({ userId: inputPeer.userId, accessHash: inputPeer.accessHash });
1517
- });
1518
- }
1519
- else if ("keyboard" in params.replyMarkup) {
1520
- replyMarkup = (0, _3_types_js_1.replyKeyboardMarkupToTlObject)(params.replyMarkup);
1521
- }
1522
- else if ("removeKeyboard" in params.replyMarkup) {
1523
- replyMarkup = (0, _3_types_js_1.replyKeyboardRemoveToTlObject)(params.replyMarkup);
1524
- }
1525
- else if ("forceReply" in params.replyMarkup) {
1526
- replyMarkup = (0, _3_types_js_1.forceReplyToTlObject)(params.replyMarkup);
1527
- }
1528
- else {
1529
- throw new Error("The replyMarkup parameter has an unexpected type");
1530
- }
1504
+ return (0, _3_types_js_1.replyMarkupToTlObject)(params.replyMarkup, this.usernameResolver.bind(this));
1531
1505
  }
1532
- return replyMarkup;
1533
1506
  }
1534
1507
  static assertMsgHas(message, key) {
1535
1508
  if (!(key in message) || message[key] === undefined) {
@@ -1637,6 +1610,32 @@ class Client extends _1_client_abstract_js_1.ClientAbstract {
1637
1610
  }
1638
1611
  await this.invoke(new _2_tl_js_1.functions.MessagesSetTyping({ peer: await this.getInputPeer(chatId), action, topMsgId: messageThreadId }));
1639
1612
  }
1613
+ async setMyCommands(commands, params) {
1614
+ await this.invoke(new _2_tl_js_1.functions.BotsSetBotCommands({
1615
+ commands: commands.map((v) => new _2_tl_js_1.types.BotCommand(v)),
1616
+ langCode: params?.languageCode ?? "",
1617
+ scope: await (0, _3_types_js_1.botCommandScopeToTlObject)(params?.scope ?? { type: "default" }, this.getInputPeer.bind(this)), // TODO: use params.scope
1618
+ }));
1619
+ }
1620
+ async getMyCommands(params) {
1621
+ const commands_ = await this.invoke(new _2_tl_js_1.functions.BotsGetBotCommands({
1622
+ langCode: params?.languageCode ?? "",
1623
+ scope: await (0, _3_types_js_1.botCommandScopeToTlObject)(params?.scope ?? { type: "default" }, this.getInputPeer.bind(this)), // TODO: use params.scope
1624
+ }));
1625
+ return commands_.map((v) => ({ command: v.command, description: v.description }));
1626
+ }
1627
+ async answerInlineQuery(id, results, params) {
1628
+ await this.invoke(new _2_tl_js_1.functions.MessagesSetInlineBotResults({
1629
+ queryId: BigInt(id),
1630
+ results: await Promise.all(results.map((v) => (0, _3_types_js_1.inlineQueryResultToTlObject)(v, this.parseText.bind(this), this.usernameResolver.bind(this)))),
1631
+ cacheTime: params?.cacheTime ?? 300,
1632
+ private: params?.isPersonal ? true : undefined,
1633
+ switchWebview: params?.button && params.button.webApp ? new _2_tl_js_1.types.InlineBotWebView({ text: params.button.text, url: params.button.webApp.url }) : undefined,
1634
+ switchPm: params?.button && params.button.startParameter ? new _2_tl_js_1.types.InlineBotSwitchPM({ text: params.button.text, startParam: params.button.startParameter }) : undefined,
1635
+ gallery: params?.isGallery ? true : undefined,
1636
+ nextOffset: params?.nextOffset,
1637
+ }));
1638
+ }
1640
1639
  use(handler) {
1641
1640
  const handle = this.handle;
1642
1641
  this.handle = async (upd, next) => {
@@ -26,6 +26,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.ConnectionWebSocket = void 0;
27
27
  const dntShim = __importStar(require("../_dnt.shims.js"));
28
28
  const _0_deps_js_1 = require("../0_deps.js");
29
+ const _1_utilities_js_1 = require("../1_utilities.js");
29
30
  const _0_connection_js_1 = require("./0_connection.js");
30
31
  const d = (0, _0_deps_js_1.debug)("ConnectionWebSocket");
31
32
  class ConnectionWebSocket extends _0_connection_js_1.ConnectionUnframed {
@@ -101,7 +102,7 @@ class ConnectionWebSocket extends _0_connection_js_1.ConnectionUnframed {
101
102
  return;
102
103
  }
103
104
  const release = await mutex.acquire();
104
- const data = new Uint8Array(await new Blob([e.data].map((v) => v instanceof Blob ? v : v instanceof ArrayBuffer ? v : Array.isArray(v) ? v.map((v) => v.buffer) : v.buffer).flat()).arrayBuffer());
105
+ const data = new Uint8Array(await new Blob([e.data].map((v) => v instanceof Blob || v instanceof Uint8Array ? v : v instanceof ArrayBuffer ? v : (0, _1_utilities_js_1.UNREACHABLE)())).arrayBuffer());
105
106
  for (const byte of data) {
106
107
  this.buffer.push(byte);
107
108
  }
@@ -23,11 +23,11 @@ export declare function ige256Decrypt(data: Uint8Array, key: Uint8Array, iv: Uin
23
23
  * @param iv 16-byte initialization vector
24
24
  * @param state 1-byte state
25
25
  */
26
- export declare function ctr256Encrypt(data: Uint8Array, key: Uint8Array, iv: Uint8Array, state: Uint8Array): [Uint8Array, Uint8Array, Uint8Array];
26
+ export declare function ctr256Encrypt(data: Uint8Array, key: Uint8Array, iv: Uint8Array, state: Uint8Array): [Uint8Array, Uint8Array];
27
27
  /**
28
28
  * Alias of `ctr256Encrypt`
29
29
  */
30
- export declare function ctr256Decrypt(data: Uint8Array, key: Uint8Array, iv: Uint8Array, state: Uint8Array): [Uint8Array, Uint8Array, Uint8Array];
30
+ export declare function ctr256Decrypt(data: Uint8Array, key: Uint8Array, iv: Uint8Array, state: Uint8Array): [Uint8Array, Uint8Array];
31
31
  /**
32
32
  * Performs CBC-256 encryption.
33
33
  *