@mtkruto/node 0.1.138 → 0.1.140

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 (287) hide show
  1. package/esm/3_types.d.ts +10 -36
  2. package/esm/3_types.js +10 -36
  3. package/esm/4_constants.d.ts +1 -1
  4. package/esm/4_constants.js +1 -1
  5. package/esm/5_client.d.ts +1 -1
  6. package/esm/5_client.js +1 -1
  7. package/esm/_dnt.polyfills.d.ts +6 -0
  8. package/esm/client/0_filters.d.ts +60 -0
  9. package/esm/client/0_filters.js +27 -0
  10. package/esm/client/0_message.js +2 -2
  11. package/esm/client/{3_params.d.ts → 0_params.d.ts} +30 -33
  12. package/esm/client/0_types.d.ts +39 -0
  13. package/esm/client/0_types.js +2 -0
  14. package/esm/client/0_utilities.d.ts +1 -47
  15. package/esm/client/0_utilities.js +0 -27
  16. package/esm/client/1_composer.d.ts +1 -1
  17. package/esm/client/1_composer.js +1 -1
  18. package/esm/client/1_file_manager.d.ts +10 -0
  19. package/esm/client/1_file_manager.js +241 -0
  20. package/esm/client/1_update_manager.d.ts +18 -0
  21. package/esm/client/1_update_manager.js +553 -0
  22. package/esm/client/2_message_manager.d.ts +40 -0
  23. package/esm/client/2_message_manager.js +621 -0
  24. package/esm/client/3_chat_list_manager.d.ts +21 -0
  25. package/esm/client/3_chat_list_manager.js +353 -0
  26. package/esm/client/3_reaction_manager.d.ts +16 -0
  27. package/esm/client/3_reaction_manager.js +61 -0
  28. package/esm/client/4_client.d.ts +187 -60
  29. package/esm/client/4_client.js +492 -1699
  30. package/esm/connection/1_connection_web_socket.js +6 -6
  31. package/esm/deps/raw.githubusercontent.com/MTKruto/debug/main/deps.d.ts +1 -1
  32. package/esm/deps/raw.githubusercontent.com/MTKruto/debug/main/deps.js +1 -1
  33. package/esm/deps/raw.githubusercontent.com/MTKruto/object-inspect/main/index.d.ts +1 -0
  34. package/esm/deps/raw.githubusercontent.com/MTKruto/object-inspect/main/index.js +524 -0
  35. package/esm/mod.d.ts +1 -0
  36. package/esm/mod.js +1 -0
  37. package/esm/storage/0_storage.d.ts +5 -3
  38. package/esm/storage/0_storage.js +14 -4
  39. package/esm/tl/1_tl_object.d.ts +1 -0
  40. package/esm/tl/1_tl_object.js +24 -0
  41. package/esm/types/0_bot_command.d.ts +1 -0
  42. package/esm/types/0_chat_member_rights.d.ts +37 -0
  43. package/esm/types/0_chat_photo.d.ts +4 -4
  44. package/esm/types/0_file_source.d.ts +5 -0
  45. package/esm/types/0_giveaway_parameters.js +2 -1
  46. package/esm/types/0_id.d.ts +4 -0
  47. package/esm/types/0_message_entity.d.ts +20 -20
  48. package/esm/types/1__getters.d.ts +2 -2
  49. package/esm/types/1_animation.d.ts +1 -1
  50. package/esm/types/1_bot_command_scope.d.ts +5 -4
  51. package/esm/types/1_chat_p.d.ts +5 -6
  52. package/esm/types/1_document.d.ts +1 -0
  53. package/esm/types/1_input_message_content.d.ts +88 -0
  54. package/esm/types/1_photo.d.ts +1 -1
  55. package/esm/types/1_sticker.d.ts +1 -1
  56. package/esm/types/1_user.d.ts +1 -1
  57. package/esm/types/1_video.d.ts +1 -1
  58. package/esm/types/1_video_note.d.ts +1 -1
  59. package/esm/types/2_inline_keyboard_button.d.ts +10 -10
  60. package/esm/types/2_message_reaction_count.d.ts +3 -0
  61. package/esm/types/2_message_reaction_count.js +17 -1
  62. package/esm/types/2_message_reactions.d.ts +15 -0
  63. package/esm/types/2_message_reactions.js +37 -0
  64. package/esm/types/3_reply_markup.d.ts +42 -0
  65. package/esm/types/3_reply_markup.js +117 -0
  66. package/esm/types/4_inline_query_result.d.ts +193 -0
  67. package/esm/types/{5_inline_query_result.js → 4_inline_query_result.js} +2 -2
  68. package/esm/types/4_message.d.ts +36 -39
  69. package/esm/types/4_message.js +7 -24
  70. package/esm/types/5_callback_query.d.ts +2 -1
  71. package/esm/types/5_chat.d.ts +8 -5
  72. package/esm/types/6_update.d.ts +12 -2
  73. package/esm/utilities/0_buffer.js +9 -6
  74. package/esm/utilities/0_object.d.ts +1 -1
  75. package/esm/utilities/0_object.js +1 -6
  76. package/esm/utilities/1_misc.d.ts +2 -0
  77. package/esm/utilities/1_misc.js +6 -0
  78. package/package.json +1 -2
  79. package/script/3_types.d.ts +10 -36
  80. package/script/3_types.js +10 -36
  81. package/script/4_constants.d.ts +1 -1
  82. package/script/4_constants.js +1 -1
  83. package/script/5_client.d.ts +1 -1
  84. package/script/5_client.js +1 -1
  85. package/script/_dnt.polyfills.d.ts +6 -0
  86. package/script/client/0_filters.d.ts +60 -0
  87. package/script/client/0_filters.js +31 -0
  88. package/script/client/0_message.js +1 -1
  89. package/script/client/{3_params.d.ts → 0_params.d.ts} +30 -33
  90. package/script/client/0_types.d.ts +39 -0
  91. package/script/client/0_types.js +6 -0
  92. package/script/client/0_utilities.d.ts +1 -47
  93. package/script/client/0_utilities.js +1 -29
  94. package/script/client/1_composer.d.ts +1 -1
  95. package/script/client/1_composer.js +2 -2
  96. package/script/client/1_file_manager.d.ts +10 -0
  97. package/script/client/1_file_manager.js +245 -0
  98. package/script/client/1_update_manager.d.ts +18 -0
  99. package/script/client/1_update_manager.js +557 -0
  100. package/script/client/2_message_manager.d.ts +40 -0
  101. package/script/client/2_message_manager.js +625 -0
  102. package/script/client/3_chat_list_manager.d.ts +21 -0
  103. package/script/client/3_chat_list_manager.js +357 -0
  104. package/script/client/3_reaction_manager.d.ts +16 -0
  105. package/script/client/3_reaction_manager.js +65 -0
  106. package/script/client/4_client.d.ts +187 -60
  107. package/script/client/4_client.js +491 -1699
  108. package/script/connection/1_connection_web_socket.js +5 -5
  109. package/script/deps/raw.githubusercontent.com/MTKruto/debug/main/deps.d.ts +1 -1
  110. package/script/deps/raw.githubusercontent.com/MTKruto/debug/main/deps.js +2 -2
  111. package/script/deps/raw.githubusercontent.com/MTKruto/object-inspect/main/index.d.ts +1 -0
  112. package/script/deps/raw.githubusercontent.com/MTKruto/object-inspect/main/index.js +550 -0
  113. package/script/mod.d.ts +1 -0
  114. package/script/mod.js +1 -0
  115. package/script/storage/0_storage.d.ts +5 -3
  116. package/script/storage/0_storage.js +14 -4
  117. package/script/tl/1_tl_object.d.ts +1 -0
  118. package/script/tl/1_tl_object.js +24 -0
  119. package/script/types/0_bot_command.d.ts +1 -0
  120. package/script/types/0_chat_member_rights.d.ts +37 -0
  121. package/script/types/0_chat_photo.d.ts +4 -4
  122. package/script/types/0_file_source.d.ts +5 -0
  123. package/script/types/0_giveaway_parameters.js +2 -1
  124. package/script/types/0_id.d.ts +4 -0
  125. package/script/types/0_message_entity.d.ts +20 -20
  126. package/script/types/1__getters.d.ts +2 -2
  127. package/script/types/1_animation.d.ts +1 -1
  128. package/script/types/1_bot_command_scope.d.ts +5 -4
  129. package/script/types/1_chat_p.d.ts +5 -6
  130. package/script/types/1_document.d.ts +1 -0
  131. package/script/types/1_input_message_content.d.ts +88 -0
  132. package/script/types/1_photo.d.ts +1 -1
  133. package/script/types/1_sticker.d.ts +1 -1
  134. package/script/types/1_user.d.ts +1 -1
  135. package/script/types/1_video.d.ts +1 -1
  136. package/script/types/1_video_note.d.ts +1 -1
  137. package/script/types/2_inline_keyboard_button.d.ts +10 -10
  138. package/script/types/2_message_reaction_count.d.ts +3 -0
  139. package/script/types/2_message_reaction_count.js +19 -0
  140. package/script/types/2_message_reactions.d.ts +15 -0
  141. package/script/types/2_message_reactions.js +41 -0
  142. package/script/types/3_reply_markup.d.ts +42 -0
  143. package/script/types/3_reply_markup.js +122 -0
  144. package/script/types/4_inline_query_result.d.ts +193 -0
  145. package/script/types/{5_inline_query_result.js → 4_inline_query_result.js} +3 -3
  146. package/script/types/4_message.d.ts +36 -39
  147. package/script/types/4_message.js +6 -23
  148. package/script/types/5_callback_query.d.ts +2 -1
  149. package/script/types/5_chat.d.ts +8 -5
  150. package/script/types/6_update.d.ts +12 -2
  151. package/script/utilities/0_buffer.js +9 -6
  152. package/script/utilities/0_object.d.ts +1 -1
  153. package/script/utilities/0_object.js +1 -6
  154. package/script/utilities/1_misc.d.ts +2 -0
  155. package/script/utilities/1_misc.js +9 -1
  156. package/esm/types/0_chat_id.d.ts +0 -4
  157. package/esm/types/0_force_reply.d.ts +0 -12
  158. package/esm/types/0_force_reply.js +0 -17
  159. package/esm/types/0_input_contact_message_content.d.ts +0 -11
  160. package/esm/types/0_input_location_message_content.d.ts +0 -15
  161. package/esm/types/0_input_venue_message_content.d.ts +0 -19
  162. package/esm/types/0_reply_keyboard_remove.d.ts +0 -10
  163. package/esm/types/0_reply_keyboard_remove.js +0 -8
  164. package/esm/types/1_input_invoice_message_content.d.ts +0 -23
  165. package/esm/types/1_input_text_message_content.d.ts +0 -8
  166. package/esm/types/1_input_text_message_content.js +0 -1
  167. package/esm/types/2_input_message_content.d.ts +0 -6
  168. package/esm/types/2_input_message_content.js +0 -1
  169. package/esm/types/2_reply_keyboard_markup.d.ts +0 -12
  170. package/esm/types/2_reply_keyboard_markup.js +0 -37
  171. package/esm/types/3_inline_keyboard_markup.d.ts +0 -8
  172. package/esm/types/3_inline_keyboard_markup.js +0 -24
  173. package/esm/types/4_inline_query_result_article.d.ts +0 -15
  174. package/esm/types/4_inline_query_result_article.js +0 -1
  175. package/esm/types/4_inline_query_result_audio.d.ts +0 -17
  176. package/esm/types/4_inline_query_result_audio.js +0 -1
  177. package/esm/types/4_inline_query_result_cached_audio.d.ts +0 -14
  178. package/esm/types/4_inline_query_result_cached_audio.js +0 -1
  179. package/esm/types/4_inline_query_result_cached_document.d.ts +0 -15
  180. package/esm/types/4_inline_query_result_cached_document.js +0 -1
  181. package/esm/types/4_inline_query_result_cached_gif.d.ts +0 -15
  182. package/esm/types/4_inline_query_result_cached_gif.js +0 -1
  183. package/esm/types/4_inline_query_result_cached_mpeg4_gif.d.ts +0 -15
  184. package/esm/types/4_inline_query_result_cached_mpeg4_gif.js +0 -1
  185. package/esm/types/4_inline_query_result_cached_photo.d.ts +0 -16
  186. package/esm/types/4_inline_query_result_cached_photo.js +0 -1
  187. package/esm/types/4_inline_query_result_cached_sticker.d.ts +0 -9
  188. package/esm/types/4_inline_query_result_cached_sticker.js +0 -1
  189. package/esm/types/4_inline_query_result_cached_video.d.ts +0 -16
  190. package/esm/types/4_inline_query_result_cached_video.js +0 -1
  191. package/esm/types/4_inline_query_result_cached_voice.d.ts +0 -15
  192. package/esm/types/4_inline_query_result_cached_voice.js +0 -1
  193. package/esm/types/4_inline_query_result_contact.d.ts +0 -15
  194. package/esm/types/4_inline_query_result_contact.js +0 -1
  195. package/esm/types/4_inline_query_result_document.d.ts +0 -18
  196. package/esm/types/4_inline_query_result_document.js +0 -1
  197. package/esm/types/4_inline_query_result_game.d.ts +0 -7
  198. package/esm/types/4_inline_query_result_game.js +0 -1
  199. package/esm/types/4_inline_query_result_gif.d.ts +0 -20
  200. package/esm/types/4_inline_query_result_gif.js +0 -1
  201. package/esm/types/4_inline_query_result_location.d.ts +0 -18
  202. package/esm/types/4_inline_query_result_location.js +0 -1
  203. package/esm/types/4_inline_query_result_mpeg4_gif.d.ts +0 -20
  204. package/esm/types/4_inline_query_result_mpeg4_gif.js +0 -1
  205. package/esm/types/4_inline_query_result_photo.d.ts +0 -19
  206. package/esm/types/4_inline_query_result_photo.js +0 -1
  207. package/esm/types/4_inline_query_result_venue.d.ts +0 -19
  208. package/esm/types/4_inline_query_result_venue.js +0 -1
  209. package/esm/types/4_inline_query_result_video.d.ts +0 -21
  210. package/esm/types/4_inline_query_result_video.js +0 -1
  211. package/esm/types/4_inline_query_result_voice.d.ts +0 -16
  212. package/esm/types/4_inline_query_result_voice.js +0 -1
  213. package/esm/types/4_reply_markup.d.ts +0 -7
  214. package/esm/types/4_reply_markup.js +0 -22
  215. package/esm/types/5_inline_query_result.d.ts +0 -28
  216. package/script/types/0_chat_id.d.ts +0 -4
  217. package/script/types/0_force_reply.d.ts +0 -12
  218. package/script/types/0_force_reply.js +0 -22
  219. package/script/types/0_input_contact_message_content.d.ts +0 -11
  220. package/script/types/0_input_location_message_content.d.ts +0 -15
  221. package/script/types/0_input_venue_message_content.d.ts +0 -19
  222. package/script/types/0_reply_keyboard_remove.d.ts +0 -10
  223. package/script/types/0_reply_keyboard_remove.js +0 -13
  224. package/script/types/1_input_invoice_message_content.d.ts +0 -23
  225. package/script/types/1_input_text_message_content.d.ts +0 -8
  226. package/script/types/1_input_text_message_content.js +0 -2
  227. package/script/types/2_input_message_content.d.ts +0 -6
  228. package/script/types/2_input_message_content.js +0 -2
  229. package/script/types/2_reply_keyboard_markup.d.ts +0 -12
  230. package/script/types/2_reply_keyboard_markup.js +0 -42
  231. package/script/types/3_inline_keyboard_markup.d.ts +0 -8
  232. package/script/types/3_inline_keyboard_markup.js +0 -29
  233. package/script/types/4_inline_query_result_article.d.ts +0 -15
  234. package/script/types/4_inline_query_result_article.js +0 -2
  235. package/script/types/4_inline_query_result_audio.d.ts +0 -17
  236. package/script/types/4_inline_query_result_audio.js +0 -2
  237. package/script/types/4_inline_query_result_cached_audio.d.ts +0 -14
  238. package/script/types/4_inline_query_result_cached_audio.js +0 -2
  239. package/script/types/4_inline_query_result_cached_document.d.ts +0 -15
  240. package/script/types/4_inline_query_result_cached_document.js +0 -2
  241. package/script/types/4_inline_query_result_cached_gif.d.ts +0 -15
  242. package/script/types/4_inline_query_result_cached_gif.js +0 -2
  243. package/script/types/4_inline_query_result_cached_mpeg4_gif.d.ts +0 -15
  244. package/script/types/4_inline_query_result_cached_mpeg4_gif.js +0 -2
  245. package/script/types/4_inline_query_result_cached_photo.d.ts +0 -16
  246. package/script/types/4_inline_query_result_cached_photo.js +0 -2
  247. package/script/types/4_inline_query_result_cached_sticker.d.ts +0 -9
  248. package/script/types/4_inline_query_result_cached_sticker.js +0 -2
  249. package/script/types/4_inline_query_result_cached_video.d.ts +0 -16
  250. package/script/types/4_inline_query_result_cached_video.js +0 -2
  251. package/script/types/4_inline_query_result_cached_voice.d.ts +0 -15
  252. package/script/types/4_inline_query_result_cached_voice.js +0 -2
  253. package/script/types/4_inline_query_result_contact.d.ts +0 -15
  254. package/script/types/4_inline_query_result_contact.js +0 -2
  255. package/script/types/4_inline_query_result_document.d.ts +0 -18
  256. package/script/types/4_inline_query_result_document.js +0 -2
  257. package/script/types/4_inline_query_result_game.d.ts +0 -7
  258. package/script/types/4_inline_query_result_game.js +0 -2
  259. package/script/types/4_inline_query_result_gif.d.ts +0 -20
  260. package/script/types/4_inline_query_result_gif.js +0 -2
  261. package/script/types/4_inline_query_result_location.d.ts +0 -18
  262. package/script/types/4_inline_query_result_location.js +0 -2
  263. package/script/types/4_inline_query_result_mpeg4_gif.d.ts +0 -20
  264. package/script/types/4_inline_query_result_mpeg4_gif.js +0 -2
  265. package/script/types/4_inline_query_result_photo.d.ts +0 -19
  266. package/script/types/4_inline_query_result_photo.js +0 -2
  267. package/script/types/4_inline_query_result_venue.d.ts +0 -19
  268. package/script/types/4_inline_query_result_venue.js +0 -2
  269. package/script/types/4_inline_query_result_video.d.ts +0 -21
  270. package/script/types/4_inline_query_result_video.js +0 -2
  271. package/script/types/4_inline_query_result_voice.d.ts +0 -16
  272. package/script/types/4_inline_query_result_voice.js +0 -2
  273. package/script/types/4_reply_markup.d.ts +0 -7
  274. package/script/types/4_reply_markup.js +0 -26
  275. package/script/types/5_inline_query_result.d.ts +0 -28
  276. /package/esm/{client/3_params.js → _dnt.polyfills.js} +0 -0
  277. /package/esm/{types/0_chat_id.js → client/0_params.js} +0 -0
  278. /package/esm/types/{0_input_contact_message_content.js → 0_chat_member_rights.js} +0 -0
  279. /package/esm/types/{0_input_location_message_content.js → 0_file_source.js} +0 -0
  280. /package/esm/types/{0_input_venue_message_content.js → 0_id.js} +0 -0
  281. /package/esm/types/{1_input_invoice_message_content.js → 1_input_message_content.js} +0 -0
  282. /package/script/{client/3_params.js → _dnt.polyfills.js} +0 -0
  283. /package/script/{types/0_chat_id.js → client/0_params.js} +0 -0
  284. /package/script/types/{0_input_contact_message_content.js → 0_chat_member_rights.js} +0 -0
  285. /package/script/types/{0_input_location_message_content.js → 0_file_source.js} +0 -0
  286. /package/script/types/{0_input_venue_message_content.js → 0_id.js} +0 -0
  287. /package/script/types/{1_input_invoice_message_content.js → 1_input_message_content.js} +0 -0
@@ -1,34 +1,5 @@
1
1
  import { MaybePromise } from "../1_utilities.js";
2
- import { BotCommandScope, Chat, ChatID, ForceReply, InlineKeyboardMarkup, InlineQueryResultButton, Message, MessageEntity, ReplyKeyboardMarkup, ReplyKeyboardRemove, ReplyQuote } from "../3_types.js";
3
- import { ParseMode } from "../3_types.js";
4
- import { FileSource } from "./0_utilities.js";
5
- import { ClientPlainParams } from "./2_client_plain.js";
6
- export interface ClientParams extends ClientPlainParams {
7
- /** A parse mode to use when the `parseMode` parameter is not specified when sending or editing messages. Defauls to `ParseMode.None`. */
8
- parseMode?: ParseMode;
9
- /** The app_version parameter to be passed to initConnection when calling `authorize`. It is recommended that this parameter is changed if users are authorized. Defaults to "MTKruto" followed by this version of MTKruto. */
10
- appVersion?: string;
11
- /** The device_version parameter to be passed to initConnection when calling `authorize`. The default varies by the current runtime. */
12
- deviceModel?: string;
13
- /** The lang_code parameter to be passed to initConnection when calling `authorize`. Defaults to the runtime's language or `"en"`. */
14
- langCode?: string;
15
- /** The lang_pack parameter to be passed to initConnection when calling `authorize`. Defaults to an empty string. */
16
- langPack?: string;
17
- /** The system_lang_cde parameter to be passed to initConnection when calling `authorize`. Defaults to the runtime's language or `"en"`. */
18
- systemLangCode?: string;
19
- /** The system_version parameter to be passed to initConnection when calling `authorize`. The default varies by the current runtime. */
20
- systemVersion?: string;
21
- /** Whether to automatically call `start` with no parameters in the first `invoke` call. Defaults to `true`. */
22
- autoStart?: boolean;
23
- /** Whether to use default handlers. Defaults to `true`. */
24
- defaultHandlers?: boolean;
25
- /** Whether to ignore outgoing messages. Defaults to `true` for bots, and `false` for users. */
26
- ignoreOutgoing?: boolean;
27
- /** Default command prefixes. Defaults to `"/"` for bots and `"\"` for users. This option must be set separately for nested composers. */
28
- prefixes?: string | string[];
29
- /** Whether to guarantee that order-sensitive updates are delivered at least once before delivering next ones. Useful mainly for clients providing a user interface à la Telegram Desktop. Defaults to `false`. */
30
- guaranteeUpdateDelivery?: boolean;
31
- }
2
+ import { BotCommandScope, Chat, ChatMemberRights, FileSource, ID, InlineQueryResultButton, Message, MessageEntity, ParseMode, ReplyMarkup, ReplyQuote } from "../3_types.js";
32
3
  export interface AnswerCallbackQueryParams {
33
4
  /** A text to be shown to the user. */
34
5
  text?: string;
@@ -56,9 +27,9 @@ export interface _SendCommon {
56
27
  /** The identifier of a thread to send the message to. */
57
28
  messageThreadId?: number;
58
29
  /** The identifier of the chat to send the message on behalf of. User-only. */
59
- sendAs?: ChatID;
30
+ sendAs?: ID;
60
31
  /** The reply markup of the message. Bot-only. */
61
- replyMarkup?: InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply;
32
+ replyMarkup?: ReplyMarkup;
62
33
  }
63
34
  export interface SendMessageParams extends _SendCommon {
64
35
  /** The parse mode to use. If not provided, the default parse mode will be used. */
@@ -76,7 +47,11 @@ export interface EditMessageParams {
76
47
  /** Whether to disable web page previews in the message that is to be edited. */
77
48
  disableWebPagePreview?: boolean;
78
49
  /** The reply markup of the message. Bot-only. */
79
- replyMarkup?: InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply;
50
+ replyMarkup?: ReplyMarkup;
51
+ }
52
+ export interface EditMessageReplyMarkupParams {
53
+ /** The reply markup of the message. Bot-only. */
54
+ replyMarkup?: ReplyMarkup;
80
55
  }
81
56
  export interface ForwardMessagesParams extends Omit<_SendCommon, "replyToMessageId" | "replyMarkup"> {
82
57
  /** Whether to not include the original sender of the message that is going to be forwarded. */
@@ -109,6 +84,8 @@ export interface SendPollParams extends _SendCommon {
109
84
  export interface DownloadParams {
110
85
  /** Size of each download chunk in bytes. */
111
86
  chunkSize?: number;
87
+ /** Download offset in bytes. */
88
+ offset?: number;
112
89
  }
113
90
  export interface _UploadCommon {
114
91
  /** The file name to assign if applicable. */
@@ -168,6 +145,8 @@ export interface _SpoilCommon {
168
145
  }
169
146
  export interface SendPhotoParams extends _CaptionCommon, _SpoilCommon, _UploadCommon, _SendCommon {
170
147
  }
148
+ export interface SetChatPhotoParams extends _UploadCommon {
149
+ }
171
150
  export interface _ThumbnailCommon {
172
151
  /** A thumbnail to assign. Cannot be a URL. */
173
152
  thumbnail?: FileSource;
@@ -263,3 +242,21 @@ export interface GetChatsParams {
263
242
  /** The maximum number of results to return. Must be in the range of 1-100. Defaults to 100. */
264
243
  limit?: number;
265
244
  }
245
+ export interface PinMessageParams {
246
+ /** Whether to pin the message for both sides. For private chats only. */
247
+ bothSides?: boolean;
248
+ /** Whether to silently pin the message. */
249
+ disableNotification?: boolean;
250
+ }
251
+ export interface BanChatMemberParams {
252
+ /** A point of time in the future to automatically withdraw the ban. */
253
+ untilDate?: Date;
254
+ /** Whether to delete all of the user's messages. */
255
+ deleteMessages?: boolean;
256
+ }
257
+ export interface SetChatMemberRightsParams {
258
+ /** The member's new rights. All fields default to `true` if the chat's default member rights allow. This means that this method is the same as unbanChatMember if this parameter is not provided or all of its fields are `true`. */
259
+ rights?: ChatMemberRights;
260
+ /** A point of time in the future to automatically withdraw the restrictions. */
261
+ untilDate?: Date;
262
+ }
@@ -0,0 +1,39 @@
1
+ import { functions, types } from "../2_tl.js";
2
+ import { Storage } from "../3_storage.js";
3
+ import { ConnectionState, EntityGetter, ID, ParseMode, Update } from "../3_types.js";
4
+ type Functions = typeof functions;
5
+ type Keys = keyof Functions;
6
+ type AnyFunc = (...args: any) => any;
7
+ type Promisify<T extends AnyFunc> = (...args: Parameters<T>) => Promise<ReturnType<T>>;
8
+ export type Api = {
9
+ [K in Keys]: Functions[K] extends {
10
+ __F: AnyFunc;
11
+ } ? Promisify<Functions[K]["__F"]> : {
12
+ [K_ in keyof Functions[K]]: Functions[K][K_] extends {
13
+ __F: AnyFunc;
14
+ } ? Promisify<Functions[K][K_]["__F"]> : Functions[K][K_];
15
+ };
16
+ };
17
+ interface ApiFactory {
18
+ (dcId?: number): {
19
+ api: Api;
20
+ connect: () => Promise<void>;
21
+ disconnect: () => Promise<void>;
22
+ };
23
+ }
24
+ export interface C {
25
+ api: Api;
26
+ storage: Storage;
27
+ guaranteeUpdateDelivery: boolean;
28
+ setConnectionState: (connectionState: ConnectionState) => void;
29
+ resetConnectionState: () => void;
30
+ getSelfId: () => Promise<number>;
31
+ getInputPeer: (id: ID) => Promise<types.InputPeerChat | types.InputPeerUser | types.InputPeerChannel>;
32
+ getEntity: EntityGetter;
33
+ handleUpdate: (update: Update) => void;
34
+ parseMode: ParseMode;
35
+ apiFactory: ApiFactory;
36
+ }
37
+ export declare class ConnectionError extends Error {
38
+ }
39
+ export {};
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ConnectionError = void 0;
4
+ class ConnectionError extends Error {
5
+ }
6
+ exports.ConnectionError = ConnectionError;
@@ -1,55 +1,9 @@
1
1
  import { enums, types } from "../2_tl.js";
2
- import { ChatP, MessageTypes, UpdateMap, User } from "../3_types.js";
2
+ import { FileSource } from "../3_types.js";
3
3
  export declare const resolve: () => Promise<void>;
4
- export type With<T, K extends keyof T> = T & Required<Pick<T, K>>;
5
4
  export declare function isPtsUpdate(v: enums.Update): v is types.UpdateNewMessage | types.UpdateDeleteMessages | types.UpdateReadHistoryInbox | types.UpdateReadHistoryOutbox | types.UpdatePinnedChannelMessages | types.UpdatePinnedMessages | types.UpdateFolderPeers | types.UpdateChannelWebPage | types.UpdateEditMessage | types.UpdateReadMessagesContents | types.UpdateWebPage;
6
5
  export declare function isChannelPtsUpdate(v: enums.Update | enums.Updates): v is types.UpdateNewChannelMessage | types.UpdateEditChannelMessage | types.UpdateDeleteChannelMessages | types.UpdateChannelTooLong;
7
- /**
8
- * Source to a file. Can be a file ID, a file path, URL, or a `Uint8Array`, unless otherwise noted.
9
- */
10
- export type FileSource = string | URL | Uint8Array;
11
6
  export declare function getFileContents(source: FileSource, fileName?: string): Promise<readonly [Uint8Array, string]>;
12
7
  export declare function isHttpUrl(string: string): boolean;
13
8
  export declare function getUsername(string: string): string;
14
9
  export declare function getChatListId(chatList: string): 0 | 1;
15
- type AnyLevel1 = keyof UpdateMap;
16
- type GetLevel1Type<L1 extends AnyLevel1> = UpdateMap[L1];
17
- type GetAnyLevel2<L1 extends AnyLevel1> = L1 extends "message" | "editedMessage" ? keyof MessageTypes : never;
18
- type AnyLevel2<L1 extends AnyLevel1 = AnyLevel1> = L1 extends unknown ? `${L1 extends "message" | "editedMessage" ? L1 | "" : L1}:${GetAnyLevel2<L1>}` : never;
19
- type GetLevel2Type<L1 extends string, L2 extends string> = L2 extends keyof MessageTypes ? L1 extends "" ? {
20
- [P in "message" | "editedMessage"]?: MessageTypes[L2];
21
- } : L1 extends "message" | "editedMessage" ? {
22
- [P in L1]: MessageTypes[L2];
23
- } : never : never;
24
- type AnyLevelX = AnyLevel1 | AnyLevel2;
25
- type FilterCore<Q extends AnyLevelX = AnyLevelX> = Q extends AnyLevel1 ? GetLevel1Type<Q> : Q extends `${infer L1}:${infer L2}` ? GetLevel2Type<L1, L2> : 1;
26
- type Chat<T> = "msg" extends keyof T ? T & {
27
- chat: ChatP;
28
- } : T;
29
- type Msg<T> = "message" extends keyof T ? T & {
30
- msg: NonNullable<T["message"]>;
31
- } : "editedMessage" extends keyof T ? T & {
32
- msg: NonNullable<T["editedMessage"]>;
33
- } : "callbackQuery" extends keyof T ? "message" extends keyof T["callbackQuery"] ? T & {
34
- msg: T["callbackQuery"]["message"];
35
- } : T : T;
36
- type From<T> = "callbackQuery" extends keyof T ? T & {
37
- from: User;
38
- } : "inlineQuery" extends keyof T ? T & {
39
- from: User;
40
- } : "message" extends keyof T ? T & {
41
- from?: User;
42
- } : "editedMessage" extends keyof T ? T & {
43
- from?: User;
44
- } : T;
45
- type SenderChat<T> = "message" extends keyof T ? T & {
46
- senderChat?: ChatP;
47
- } : "editedMessage" extends keyof T ? T & {
48
- senderChat?: ChatP;
49
- } : T;
50
- type Shortcuts<T> = SenderChat<From<Chat<Msg<T>>>>;
51
- type Filter<Q extends AnyLevelX> = Shortcuts<FilterCore<Q>>;
52
- export type FilterQuery = AnyLevelX;
53
- export type WithFilter<T, Q extends FilterQuery> = T & Filter<Q>;
54
- export declare function match<Q extends FilterQuery, T extends object>(filter: Q, value: T): boolean;
55
- export {};
@@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
23
23
  return result;
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.match = exports.getChatListId = exports.getUsername = exports.isHttpUrl = exports.getFileContents = exports.isChannelPtsUpdate = exports.isPtsUpdate = exports.resolve = void 0;
26
+ exports.getChatListId = exports.getUsername = exports.isHttpUrl = exports.getFileContents = exports.isChannelPtsUpdate = exports.isPtsUpdate = exports.resolve = void 0;
27
27
  const dntShim = __importStar(require("../_dnt.shims.js"));
28
28
  const _0_deps_js_1 = require("../0_deps.js");
29
29
  const _1_utilities_js_1 = require("../1_utilities.js");
@@ -178,31 +178,3 @@ function getChatListId(chatList) {
178
178
  }
179
179
  }
180
180
  exports.getChatListId = getChatListId;
181
- function match(filter, value) {
182
- let [type, ...other] = filter.split(":");
183
- if (type != "" && !(type in value)) {
184
- return false;
185
- }
186
- if (type == "") {
187
- if (other.length != 1) {
188
- return false;
189
- }
190
- if ("message" in value) {
191
- type = "message";
192
- }
193
- else if ("editedMessage" in value) {
194
- type = "editedMessage";
195
- }
196
- else {
197
- return false;
198
- }
199
- }
200
- const field = other[0];
201
- if (field) {
202
- if (!(field in value[type])) {
203
- return false;
204
- }
205
- }
206
- return true;
207
- }
208
- exports.match = match;
@@ -1,5 +1,5 @@
1
1
  import { Update, UpdateIntersection, User } from "../3_types.js";
2
- import { FilterQuery, WithFilter } from "./0_utilities.js";
2
+ import { FilterQuery, WithFilter } from "./0_filters.js";
3
3
  type MaybePromise<T> = T | Promise<T>;
4
4
  export type NextFunction = () => Promise<void>;
5
5
  export type MiddlewareFn<C> = (ctx: C, next: NextFunction) => MaybePromise<unknown>;
@@ -13,7 +13,7 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (
13
13
  var _Composer_handle, _Composer_prefixes;
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.Composer = exports.skip = exports.concat = exports.flatten = void 0;
16
- const _0_utilities_js_1 = require("./0_utilities.js");
16
+ const _0_filters_js_1 = require("./0_filters.js");
17
17
  function flatten(mw) {
18
18
  return typeof mw === "function" ? mw : (ctx, next) => mw.middleware()(ctx, next);
19
19
  }
@@ -76,7 +76,7 @@ class Composer {
76
76
  }
77
77
  on(filter, ...middleawre) {
78
78
  return this.filter((ctx) => {
79
- return (0, _0_utilities_js_1.match)(filter, ctx);
79
+ return (0, _0_filters_js_1.match)(filter, ctx);
80
80
  }, ...middleawre);
81
81
  }
82
82
  command(commands, ...middleawre) {
@@ -0,0 +1,10 @@
1
+ import { Document } from "../3_types.js";
2
+ import { DownloadParams, UploadParams } from "./0_params.js";
3
+ import { C } from "./0_types.js";
4
+ export declare class FileManager {
5
+ #private;
6
+ constructor(c: C);
7
+ upload(contents: Uint8Array, params?: UploadParams): Promise<import("../tl/2_types.js").InputFile_ | import("../tl/2_types.js").InputFileBig_>;
8
+ download(fileId: string, params?: DownloadParams): AsyncGenerator<Uint8Array, void, unknown>;
9
+ getCustomEmojiDocuments(id: string | string[]): Promise<Document[]>;
10
+ }
@@ -0,0 +1,245 @@
1
+ "use strict";
2
+ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
3
+ if (kind === "m") throw new TypeError("Private method is not writable");
4
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
5
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
6
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
7
+ };
8
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
9
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
10
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
11
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
12
+ };
13
+ var _FileManager_instances, _FileManager_c, _FileManager_downloadInner;
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.FileManager = void 0;
16
+ const _0_deps_js_1 = require("../0_deps.js");
17
+ const _1_utilities_js_1 = require("../1_utilities.js");
18
+ const _2_tl_js_1 = require("../2_tl.js");
19
+ const _3_types_js_1 = require("../3_types.js");
20
+ const _4_errors_js_1 = require("../4_errors.js");
21
+ const _0_types_js_1 = require("./0_types.js");
22
+ const d = (0, _0_deps_js_1.debug)("FileManager");
23
+ class FileManager {
24
+ constructor(c) {
25
+ _FileManager_instances.add(this);
26
+ _FileManager_c.set(this, void 0);
27
+ __classPrivateFieldSet(this, _FileManager_c, c, "f");
28
+ }
29
+ async upload(contents, params) {
30
+ const isBig = contents.length > 1048576; // 10 MB
31
+ const chunkSize = params?.chunkSize ?? 512 * 1024;
32
+ if ((0, _1_utilities_js_1.mod)(chunkSize, 1024) != 0) {
33
+ throw new Error("chunkSize must be divisible by 1024");
34
+ }
35
+ const signal = params?.signal;
36
+ d("uploading " + (isBig ? "big " : "") + "file of size " + contents.length + " with chunk size of " + chunkSize);
37
+ const fileId = (0, _1_utilities_js_1.getRandomId)();
38
+ const name = params?.fileName ?? fileId.toString();
39
+ const { api, disconnect, connect } = __classPrivateFieldGet(this, _FileManager_c, "f").apiFactory();
40
+ signal?.addEventListener("abort", () => (0, _1_utilities_js_1.drop)(disconnect()));
41
+ await connect();
42
+ let part = 0;
43
+ const partCount = Math.ceil(contents.length / chunkSize);
44
+ try {
45
+ main: for (; part < partCount; part++) {
46
+ chunk: while (true) {
47
+ try {
48
+ const start = part * chunkSize;
49
+ const end = start + chunkSize;
50
+ const bytes = contents.slice(start, end);
51
+ if (bytes.length == 0) {
52
+ continue main;
53
+ }
54
+ if (isBig) {
55
+ await api.upload.saveBigFilePart({ file_id: fileId, file_part: part, bytes, file_total_parts: partCount });
56
+ }
57
+ else {
58
+ await api.upload.saveFilePart({ file_id: fileId, bytes, file_part: part });
59
+ }
60
+ d((part + 1) + " out of " + partCount + " chunks have been uploaded so far");
61
+ break chunk;
62
+ }
63
+ catch (err) {
64
+ if (signal?.aborted) {
65
+ break main;
66
+ }
67
+ if (err instanceof _4_errors_js_1.FloodWait) {
68
+ d("got a flood wait of " + err.seconds + " seconds");
69
+ await new Promise((r) => setTimeout(r, err.seconds * 1000));
70
+ }
71
+ else if (err instanceof _0_types_js_1.ConnectionError) {
72
+ while (true) {
73
+ try {
74
+ await new Promise((r) => setTimeout(r, 3000));
75
+ await connect();
76
+ }
77
+ catch {
78
+ if (signal?.aborted) {
79
+ break main;
80
+ }
81
+ }
82
+ }
83
+ }
84
+ else {
85
+ throw err;
86
+ }
87
+ }
88
+ }
89
+ }
90
+ }
91
+ finally {
92
+ (0, _1_utilities_js_1.drop)(disconnect());
93
+ }
94
+ d("uploaded all " + partCount + " chunk(s)");
95
+ if (isBig) {
96
+ return new _2_tl_js_1.types.InputFileBig({ id: fileId, parts: contents.length / chunkSize, name });
97
+ }
98
+ else {
99
+ return new _2_tl_js_1.types.InputFile({ id: fileId, name, parts: part, md5_checksum: "" });
100
+ }
101
+ }
102
+ async *download(fileId, params) {
103
+ const fileId_ = _3_types_js_1.FileID.decode(fileId);
104
+ switch (fileId_.fileType) {
105
+ case _3_types_js_1.FileType.ChatPhoto: {
106
+ const big = fileId_.params.thumbnailSource == _3_types_js_1.ThumbnailSource.ChatPhotoBig;
107
+ const peer = await __classPrivateFieldGet(this, _FileManager_c, "f").getInputPeer(fileId_.params.chatId);
108
+ const location = new _2_tl_js_1.types.InputPeerPhotoFileLocation({ big: big ? true : undefined, peer, photo_id: fileId_.params.mediaId });
109
+ for await (const chunk of __classPrivateFieldGet(this, _FileManager_instances, "m", _FileManager_downloadInner).call(this, location, fileId_.dcId, params)) {
110
+ yield chunk;
111
+ }
112
+ break;
113
+ }
114
+ case _3_types_js_1.FileType.Photo: {
115
+ if (fileId_.params.mediaId == undefined || fileId_.params.accessHash == undefined || fileId_.params.fileReference == undefined || fileId_.params.thumbnailSize == undefined) {
116
+ (0, _1_utilities_js_1.UNREACHABLE)();
117
+ }
118
+ const location = new _2_tl_js_1.types.InputPhotoFileLocation({
119
+ id: fileId_.params.mediaId,
120
+ access_hash: fileId_.params.accessHash,
121
+ file_reference: fileId_.params.fileReference,
122
+ thumb_size: fileId_.params.thumbnailSize,
123
+ });
124
+ for await (const chunk of __classPrivateFieldGet(this, _FileManager_instances, "m", _FileManager_downloadInner).call(this, location, fileId_.dcId, params)) {
125
+ yield chunk;
126
+ }
127
+ break;
128
+ }
129
+ case _3_types_js_1.FileType.Document:
130
+ case _3_types_js_1.FileType.Sticker:
131
+ case _3_types_js_1.FileType.VideoNote:
132
+ case _3_types_js_1.FileType.Video:
133
+ case _3_types_js_1.FileType.Audio:
134
+ case _3_types_js_1.FileType.Voice:
135
+ case _3_types_js_1.FileType.Animation: {
136
+ if (fileId_.params.mediaId == undefined || fileId_.params.accessHash == undefined || fileId_.params.fileReference == undefined || fileId_.params.thumbnailSize == undefined) {
137
+ (0, _1_utilities_js_1.UNREACHABLE)();
138
+ }
139
+ const location = new _2_tl_js_1.types.InputDocumentFileLocation({
140
+ id: fileId_.params.mediaId,
141
+ access_hash: fileId_.params.accessHash,
142
+ file_reference: fileId_.params.fileReference,
143
+ thumb_size: fileId_.params.thumbnailSize,
144
+ });
145
+ for await (const chunk of __classPrivateFieldGet(this, _FileManager_instances, "m", _FileManager_downloadInner).call(this, location, fileId_.dcId, params)) {
146
+ yield chunk;
147
+ }
148
+ break;
149
+ }
150
+ default:
151
+ (0, _1_utilities_js_1.UNREACHABLE)();
152
+ }
153
+ }
154
+ async getCustomEmojiDocuments(id) {
155
+ id = Array.isArray(id) ? id : [id];
156
+ if (!id.length) {
157
+ throw new Error("No custom emoji ID provided");
158
+ }
159
+ const documents = new Array();
160
+ let shouldFetch = false;
161
+ for (const [i, id_] of id.entries()) {
162
+ const maybeDocument = await __classPrivateFieldGet(this, _FileManager_c, "f").storage.getCustomEmojiDocument(BigInt(id_));
163
+ if (maybeDocument != null && Date.now() - maybeDocument[1].getTime() <= 30 * 60 * 1000) {
164
+ const document_ = maybeDocument[0];
165
+ const fileUniqueId = new _3_types_js_1.FileUniqueID(_3_types_js_1.FileUniqueType.Document, { mediaId: document_.id }).encode();
166
+ const fileId = new _3_types_js_1.FileID(null, null, _3_types_js_1.FileType.Document, document_.dc_id, {
167
+ mediaId: document_.id,
168
+ accessHash: document_.access_hash,
169
+ fileReference: document_.file_reference,
170
+ }).encode();
171
+ const document = (0, _3_types_js_1.constructDocument)(document_, new _2_tl_js_1.types.DocumentAttributeFilename({ file_name: `${id[i] ?? "customEmoji"}.${(0, _0_deps_js_1.extension)(document_.mime_type)}` }), fileId, fileUniqueId);
172
+ documents.push(document);
173
+ }
174
+ else {
175
+ shouldFetch = true;
176
+ break;
177
+ }
178
+ }
179
+ if (!shouldFetch) {
180
+ return documents;
181
+ }
182
+ const documents_ = await __classPrivateFieldGet(this, _FileManager_c, "f").api.messages.getCustomEmojiDocuments({ document_id: id.map(BigInt) }).then((v) => v.map((v) => v[_2_tl_js_1.as](_2_tl_js_1.types.Document)));
183
+ for (const [i, document_] of documents_.entries()) {
184
+ const fileUniqueId = new _3_types_js_1.FileUniqueID(_3_types_js_1.FileUniqueType.Document, { mediaId: document_.id }).encode();
185
+ const fileId = new _3_types_js_1.FileID(null, null, _3_types_js_1.FileType.Document, document_.dc_id, {
186
+ mediaId: document_.id,
187
+ accessHash: document_.access_hash,
188
+ fileReference: document_.file_reference,
189
+ }).encode();
190
+ const document = (0, _3_types_js_1.constructDocument)(document_, new _2_tl_js_1.types.DocumentAttributeFilename({ file_name: `${id[i] ?? "customEmoji"}.${(0, _0_deps_js_1.extension)(document_.mime_type)}` }), fileId, fileUniqueId);
191
+ documents.push(document);
192
+ }
193
+ return documents;
194
+ }
195
+ }
196
+ exports.FileManager = FileManager;
197
+ _FileManager_c = new WeakMap(), _FileManager_instances = new WeakSet(), _FileManager_downloadInner = async function* _FileManager_downloadInner(location, dcId, params) {
198
+ const id = "id" in location ? location.id : "photo_id" in location ? location.photo_id : null;
199
+ if (id != null) {
200
+ const file = await __classPrivateFieldGet(this, _FileManager_c, "f").storage.getFile(id);
201
+ const partOffset = file == null ? 0 : params?.offset ? Math.ceil(10 / file[1]) - 1 : 0;
202
+ if (file != null && file[0] > 0) {
203
+ for await (const part of __classPrivateFieldGet(this, _FileManager_c, "f").storage.iterFileParts(id, file[0], partOffset)) {
204
+ yield part;
205
+ }
206
+ return;
207
+ }
208
+ }
209
+ const chunkSize = params?.chunkSize ?? 1024 * 1024;
210
+ if ((0, _1_utilities_js_1.mod)(chunkSize, 1024) != 0) {
211
+ throw new Error("chunkSize must be divisible by 1024");
212
+ }
213
+ const { api, connect, disconnect } = __classPrivateFieldGet(this, _FileManager_c, "f").apiFactory(dcId);
214
+ await connect();
215
+ const limit = chunkSize;
216
+ let offset = params?.offset ? BigInt(params.offset) : 0n;
217
+ let part = 0;
218
+ try {
219
+ while (true) {
220
+ const file = await api.upload.getFile({ location, offset, limit });
221
+ if (file instanceof _2_tl_js_1.types.upload.File) {
222
+ yield file.bytes;
223
+ if (id != null) {
224
+ await __classPrivateFieldGet(this, _FileManager_c, "f").storage.saveFilePart(id, part, file.bytes);
225
+ }
226
+ ++part;
227
+ if (file.bytes.length < limit) {
228
+ if (id != null) {
229
+ await __classPrivateFieldGet(this, _FileManager_c, "f").storage.setFilePartCount(id, part + 1, chunkSize);
230
+ }
231
+ break;
232
+ }
233
+ else {
234
+ offset += BigInt(file.bytes.length);
235
+ }
236
+ }
237
+ else {
238
+ (0, _1_utilities_js_1.UNREACHABLE)();
239
+ }
240
+ }
241
+ }
242
+ finally {
243
+ (0, _1_utilities_js_1.drop)(disconnect());
244
+ }
245
+ };
@@ -0,0 +1,18 @@
1
+ import { Queue } from "../1_utilities.js";
2
+ import { enums, ReadObject, TLObject } from "../2_tl.js";
3
+ import { C } from "./0_types.js";
4
+ type UpdateHandler = (update: enums.Update) => Promise<(() => Promise<unknown>)>;
5
+ export declare class UpdateManager {
6
+ #private;
7
+ static readonly MAIN_BOX_ID = 0n;
8
+ constructor(c: C);
9
+ fetchState(source: string): Promise<void>;
10
+ processChats(chats: enums.Chat[]): Promise<void>;
11
+ processResult(result: ReadObject): Promise<void>;
12
+ processUsers(users: enums.User[]): Promise<void>;
13
+ getHandleUpdateQueue(boxId: bigint): Queue;
14
+ processUpdates(updates: enums.Update | enums.Updates, checkGap: boolean, call?: TLObject | null, callback?: () => void): void;
15
+ recoverUpdateGap(source: string): Promise<void>;
16
+ setUpdateHandler(handler: UpdateHandler): void;
17
+ }
18
+ export {};