@mtkruto/node 0.1.200 → 0.1.300

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 (231) hide show
  1. package/esm/0_deps.d.ts +1 -1
  2. package/esm/0_deps.js +2 -1
  3. package/esm/1_utilities.d.ts +1 -1
  4. package/esm/1_utilities.js +1 -1
  5. package/esm/4_errors.js +3 -3
  6. package/esm/client/0_markdown.js +5 -5
  7. package/esm/client/0_utilities.d.ts +6 -0
  8. package/esm/client/0_utilities.js +35 -4
  9. package/esm/client/1_account_manager.js +4 -4
  10. package/esm/client/1_client_encrypted.js +4 -4
  11. package/esm/client/1_client_plain.js +3 -3
  12. package/esm/client/1_file_manager.js +6 -5
  13. package/esm/client/1_reaction_manager.js +2 -2
  14. package/esm/client/1_update_manager.js +9 -8
  15. package/esm/client/2_message_manager.js +47 -24
  16. package/esm/client/3_callback_query_manager.js +2 -0
  17. package/esm/client/3_chat_list_manager.js +13 -12
  18. package/esm/client/3_inline_query_manager.js +4 -2
  19. package/esm/client/3_story_manager.js +7 -5
  20. package/esm/client/4_client.d.ts +5 -8
  21. package/esm/client/4_client.js +19 -27
  22. package/esm/connection/1_connection_web_socket.js +3 -2
  23. package/{script/deps/deno.land/x/tgcrypto@0.3.3 → esm/deps/deno.land/x/tgcrypto@0.4.0}/mod.d.ts +0 -1
  24. package/esm/deps/deno.land/x/{tgcrypto@0.3.3 → tgcrypto@0.4.0}/mod.js +0 -11
  25. package/esm/deps/deno.land/x/tgcrypto@0.4.0/tgcrypto.js +308 -0
  26. package/esm/mod.d.ts +1 -1
  27. package/esm/mod.js +1 -1
  28. package/esm/storage/0_storage.js +6 -5
  29. package/esm/storage/1_utilities.d.ts +0 -1
  30. package/esm/storage/1_utilities.js +2 -3
  31. package/esm/storage/2_storage_local_storage.js +1 -4
  32. package/esm/storage/2_storage_session_storage.js +1 -4
  33. package/esm/tl/3_utilities.js +5 -4
  34. package/esm/transport/2_transport_provider.js +4 -4
  35. package/esm/types/0_message_entity.js +3 -3
  36. package/esm/types/0_message_search_filter.js +2 -2
  37. package/esm/types/0_reaction.js +2 -2
  38. package/esm/types/1_bot_command_scope.js +3 -3
  39. package/esm/types/1_chat_p.js +3 -2
  40. package/esm/types/1_keyboard_button.js +3 -3
  41. package/esm/types/1_message_reaction.js +2 -2
  42. package/esm/types/1_story_privacy.js +3 -3
  43. package/esm/types/2_chat_member.js +6 -5
  44. package/esm/types/2_chosen_inline_result.js +3 -2
  45. package/esm/types/2_inactive_chat.js +3 -2
  46. package/esm/types/2_inline_keyboard_button.js +3 -3
  47. package/esm/types/2_inline_query.js +3 -3
  48. package/esm/types/2_invite_link.js +3 -2
  49. package/esm/types/2_story_content.js +5 -5
  50. package/esm/types/2_story_interactive_area.js +5 -5
  51. package/esm/types/3_chat_member_updated.js +4 -3
  52. package/esm/types/3_reply_markup.js +4 -3
  53. package/esm/types/3_story.js +3 -2
  54. package/esm/types/4_inline_query_result.js +5 -5
  55. package/esm/types/4_message.js +17 -16
  56. package/esm/types/5_callback_query.js +4 -3
  57. package/esm/types/5_chat.js +8 -7
  58. package/esm/types/_file_id.js +9 -8
  59. package/esm/utilities/0_bigint.d.ts +1 -0
  60. package/esm/utilities/0_bigint.js +25 -0
  61. package/esm/utilities/0_logger.d.ts +8 -0
  62. package/esm/utilities/0_logger.js +9 -5
  63. package/esm/utilities/1_math.d.ts +1 -0
  64. package/esm/utilities/1_math.js +51 -0
  65. package/esm/utilities/1_misc.js +2 -2
  66. package/package.json +1 -1
  67. package/script/0_deps.d.ts +1 -1
  68. package/script/0_deps.js +3 -3
  69. package/script/1_utilities.d.ts +1 -1
  70. package/script/1_utilities.js +1 -1
  71. package/script/4_errors.js +3 -3
  72. package/script/client/0_markdown.js +5 -5
  73. package/script/client/0_utilities.d.ts +6 -0
  74. package/script/client/0_utilities.js +41 -4
  75. package/script/client/1_account_manager.js +4 -4
  76. package/script/client/1_client_encrypted.js +2 -2
  77. package/script/client/1_client_plain.js +2 -2
  78. package/script/client/1_file_manager.js +5 -4
  79. package/script/client/1_reaction_manager.js +2 -2
  80. package/script/client/1_update_manager.js +8 -7
  81. package/script/client/2_message_manager.js +51 -28
  82. package/script/client/3_callback_query_manager.js +2 -0
  83. package/script/client/3_chat_list_manager.js +12 -11
  84. package/script/client/3_inline_query_manager.js +4 -2
  85. package/script/client/3_story_manager.js +4 -2
  86. package/script/client/4_client.d.ts +5 -8
  87. package/script/client/4_client.js +18 -26
  88. package/script/connection/1_connection_web_socket.js +2 -1
  89. package/{esm/deps/deno.land/x/tgcrypto@0.3.3 → script/deps/deno.land/x/tgcrypto@0.4.0}/mod.d.ts +0 -1
  90. package/script/deps/deno.land/x/{tgcrypto@0.3.3 → tgcrypto@0.4.0}/mod.js +1 -13
  91. package/script/deps/deno.land/x/tgcrypto@0.4.0/tgcrypto.js +310 -0
  92. package/script/mod.d.ts +1 -1
  93. package/script/mod.js +2 -1
  94. package/script/storage/0_storage.js +5 -4
  95. package/script/storage/1_utilities.d.ts +0 -1
  96. package/script/storage/1_utilities.js +3 -4
  97. package/script/storage/2_storage_local_storage.js +0 -3
  98. package/script/storage/2_storage_session_storage.js +0 -3
  99. package/script/tl/3_utilities.js +4 -3
  100. package/script/transport/2_transport_provider.js +4 -4
  101. package/script/types/0_message_entity.js +3 -3
  102. package/script/types/0_message_search_filter.js +2 -2
  103. package/script/types/0_reaction.js +2 -2
  104. package/script/types/1_bot_command_scope.js +3 -3
  105. package/script/types/1_chat_p.js +2 -1
  106. package/script/types/1_keyboard_button.js +3 -3
  107. package/script/types/1_message_reaction.js +2 -2
  108. package/script/types/1_story_privacy.js +3 -3
  109. package/script/types/2_chat_member.js +5 -4
  110. package/script/types/2_chosen_inline_result.js +2 -1
  111. package/script/types/2_inactive_chat.js +2 -1
  112. package/script/types/2_inline_keyboard_button.js +3 -3
  113. package/script/types/2_inline_query.js +3 -3
  114. package/script/types/2_invite_link.js +2 -1
  115. package/script/types/2_story_content.js +5 -5
  116. package/script/types/2_story_interactive_area.js +5 -5
  117. package/script/types/3_chat_member_updated.js +3 -2
  118. package/script/types/3_reply_markup.js +3 -2
  119. package/script/types/3_story.js +2 -1
  120. package/script/types/4_inline_query_result.js +5 -5
  121. package/script/types/4_message.js +16 -15
  122. package/script/types/5_callback_query.js +3 -2
  123. package/script/types/5_chat.js +7 -6
  124. package/script/types/_file_id.js +8 -7
  125. package/script/utilities/0_bigint.d.ts +1 -0
  126. package/script/utilities/0_bigint.js +27 -1
  127. package/script/utilities/0_logger.d.ts +8 -0
  128. package/script/utilities/0_logger.js +11 -6
  129. package/script/utilities/1_math.d.ts +1 -0
  130. package/script/utilities/1_math.js +55 -0
  131. package/script/utilities/1_misc.js +2 -2
  132. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/DomHandler.d.ts +0 -83
  133. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/DomHandler.js +0 -203
  134. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/DomSerializer.d.ts +0 -50
  135. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/DomSerializer.js +0 -274
  136. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/ElementType.d.ts +0 -47
  137. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/ElementType.js +0 -51
  138. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/FeedHandler.d.ts +0 -66
  139. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/FeedHandler.js +0 -191
  140. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/Node.d.ts +0 -168
  141. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/Node.js +0 -385
  142. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/Parser.d.ts +0 -159
  143. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/Parser.js +0 -431
  144. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/Tokenizer.d.ts +0 -181
  145. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/Tokenizer.js +0 -1046
  146. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/mod.d.ts +0 -42
  147. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/mod.js +0 -52
  148. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/decode.d.ts +0 -11
  149. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/decode.js +0 -122
  150. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/decode_codepoint.d.ts +0 -1
  151. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/decode_codepoint.js +0 -24
  152. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/encode.d.ts +0 -46
  153. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/encode.js +0 -121
  154. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/decode.d.ts +0 -31
  155. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/decode.js +0 -30
  156. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/entities.d.ts +0 -2128
  157. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/entities.js +0 -2127
  158. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/legacy.d.ts +0 -109
  159. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/legacy.js +0 -108
  160. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/xml.d.ts +0 -8
  161. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/xml.js +0 -1
  162. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/mod.d.ts +0 -90
  163. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/mod.js +0 -95
  164. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/helpers.d.ts +0 -50
  165. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/helpers.js +0 -128
  166. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/legacy.d.ts +0 -46
  167. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/legacy.js +0 -110
  168. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/manipulation.d.ts +0 -42
  169. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/manipulation.js +0 -120
  170. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/mod.d.ts +0 -6
  171. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/mod.js +0 -6
  172. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/querying.d.ts +0 -54
  173. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/querying.js +0 -110
  174. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/stringify.d.ts +0 -40
  175. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/stringify.js +0 -75
  176. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/traversal.d.ts +0 -58
  177. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/traversal.js +0 -101
  178. package/esm/deps/deno.land/x/tgcrypto@0.3.3/tgcrypto.js +0 -324
  179. package/esm/utilities/0_control.d.ts +0 -1
  180. package/esm/utilities/0_control.js +0 -3
  181. package/script/deps/deno.land/x/html_parser@v0.1.3/src/DomHandler.d.ts +0 -83
  182. package/script/deps/deno.land/x/html_parser@v0.1.3/src/DomHandler.js +0 -207
  183. package/script/deps/deno.land/x/html_parser@v0.1.3/src/DomSerializer.d.ts +0 -50
  184. package/script/deps/deno.land/x/html_parser@v0.1.3/src/DomSerializer.js +0 -301
  185. package/script/deps/deno.land/x/html_parser@v0.1.3/src/ElementType.d.ts +0 -47
  186. package/script/deps/deno.land/x/html_parser@v0.1.3/src/ElementType.js +0 -55
  187. package/script/deps/deno.land/x/html_parser@v0.1.3/src/FeedHandler.d.ts +0 -66
  188. package/script/deps/deno.land/x/html_parser@v0.1.3/src/FeedHandler.js +0 -222
  189. package/script/deps/deno.land/x/html_parser@v0.1.3/src/Node.d.ts +0 -168
  190. package/script/deps/deno.land/x/html_parser@v0.1.3/src/Node.js +0 -404
  191. package/script/deps/deno.land/x/html_parser@v0.1.3/src/Parser.d.ts +0 -159
  192. package/script/deps/deno.land/x/html_parser@v0.1.3/src/Parser.js +0 -438
  193. package/script/deps/deno.land/x/html_parser@v0.1.3/src/Tokenizer.d.ts +0 -181
  194. package/script/deps/deno.land/x/html_parser@v0.1.3/src/Tokenizer.js +0 -1052
  195. package/script/deps/deno.land/x/html_parser@v0.1.3/src/mod.d.ts +0 -42
  196. package/script/deps/deno.land/x/html_parser@v0.1.3/src/mod.js +0 -88
  197. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/decode.d.ts +0 -11
  198. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/decode.js +0 -128
  199. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/decode_codepoint.d.ts +0 -1
  200. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/decode_codepoint.js +0 -30
  201. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/encode.d.ts +0 -46
  202. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/encode.js +0 -129
  203. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/decode.d.ts +0 -31
  204. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/decode.js +0 -32
  205. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/entities.d.ts +0 -2128
  206. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/entities.js +0 -2129
  207. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/legacy.d.ts +0 -109
  208. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/legacy.js +0 -110
  209. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/xml.d.ts +0 -8
  210. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/xml.js +0 -3
  211. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/mod.d.ts +0 -90
  212. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/mod.js +0 -114
  213. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/helpers.d.ts +0 -50
  214. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/helpers.js +0 -134
  215. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/legacy.d.ts +0 -46
  216. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/legacy.js +0 -118
  217. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/manipulation.d.ts +0 -42
  218. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/manipulation.js +0 -129
  219. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/mod.d.ts +0 -6
  220. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/mod.js +0 -22
  221. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/querying.d.ts +0 -54
  222. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/querying.js +0 -119
  223. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/stringify.d.ts +0 -40
  224. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/stringify.js +0 -86
  225. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/traversal.d.ts +0 -58
  226. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/traversal.js +0 -112
  227. package/script/deps/deno.land/x/tgcrypto@0.3.3/tgcrypto.js +0 -326
  228. package/script/utilities/0_control.d.ts +0 -1
  229. package/script/utilities/0_control.js +0 -7
  230. /package/esm/deps/deno.land/x/{tgcrypto@0.3.3 → tgcrypto@0.4.0}/tgcrypto.d.ts +0 -0
  231. /package/script/deps/deno.land/x/{tgcrypto@0.3.3 → tgcrypto@0.4.0}/tgcrypto.d.ts +0 -0
@@ -10,15 +10,17 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
10
10
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
11
11
  };
12
12
  var _MessageManager_instances, _MessageManager_c, _MessageManager_LresolveFileId, _MessageManager_updatesToMessages, _MessageManager_constructReplyMarkup, _MessageManager_resolveSendAs, _MessageManager_constructReplyTo, _MessageManager_sendDocumentInner, _MessageManager_sendMedia, _MessageManager_sendReaction, _MessageManager_toggleJoinRequests;
13
- import { contentType } from "../0_deps.js";
13
+ import { contentType, unreachable } from "../0_deps.js";
14
14
  import { InputError } from "../0_errors.js";
15
- import { getLogger, getRandomId, toUnixTimestamp, UNREACHABLE } from "../1_utilities.js";
15
+ import { getLogger, getRandomId, toUnixTimestamp } from "../1_utilities.js";
16
16
  import { as, functions, getChannelChatId, peerToChatId, types } from "../2_tl.js";
17
17
  import { constructChatMemberUpdated, constructInviteLink, deserializeFileId } from "../3_types.js";
18
18
  import { assertMessageType, chatMemberRightsToTlObject, constructChatMember, constructMessage as constructMessage_, deserializeInlineMessageId, FileType, messageEntityToTlObject, reactionEqual, reactionToTlObject, replyMarkupToTlObject } from "../3_types.js";
19
19
  import { messageSearchFilterToTlObject } from "../types/0_message_search_filter.js";
20
20
  import { parseHtml } from "./0_html.js";
21
21
  import { parseMarkdown } from "./0_markdown.js";
22
+ import { checkMessageId } from "./0_utilities.js";
23
+ import { checkArray } from "./0_utilities.js";
22
24
  import { getFileContents, isHttpUrl } from "./0_utilities.js";
23
25
  const FALLBACK_MIME_TYPE = "application/octet-stream";
24
26
  const STICKER_MIME_TYPES = ["image/webp", "video/webm", "application/x-tgsticker"];
@@ -41,6 +43,7 @@ export class MessageManager {
41
43
  __classPrivateFieldSet(this, _MessageManager_LresolveFileId, L.branch("resolveFileId"), "f");
42
44
  }
43
45
  async getMessages(chatId, messageIds) {
46
+ checkArray(messageIds, checkMessageId);
44
47
  const peer = await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId);
45
48
  let messages_ = new Array();
46
49
  const chatId_ = peerToChatId(peer);
@@ -111,7 +114,7 @@ export class MessageManager {
111
114
  break;
112
115
  }
113
116
  default:
114
- UNREACHABLE();
117
+ unreachable();
115
118
  }
116
119
  text = text.trimEnd();
117
120
  for (const entity of entities) {
@@ -119,6 +122,9 @@ export class MessageManager {
119
122
  --entity.length;
120
123
  }
121
124
  }
125
+ if (!text.length) {
126
+ throw new InputError("Text must not be empty.");
127
+ }
122
128
  return [text, entities];
123
129
  }
124
130
  async parseText(text_, params) {
@@ -130,6 +136,7 @@ export class MessageManager {
130
136
  return await constructMessage_(message_, __classPrivateFieldGet(this, _MessageManager_c, "f").getEntity, this.getMessage.bind(this), __classPrivateFieldGet(this, _MessageManager_c, "f").fileManager.getStickerSetName.bind(__classPrivateFieldGet(this, _MessageManager_c, "f").fileManager), r, business);
131
137
  }
132
138
  async forwardMessages(from, to, messageIds, params) {
139
+ checkArray(messageIds, checkMessageId);
133
140
  const result = await __classPrivateFieldGet(this, _MessageManager_c, "f").api.messages.forwardMessages({
134
141
  from_peer: await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(from),
135
142
  to_peer: await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(to),
@@ -173,7 +180,7 @@ export class MessageManager {
173
180
  hash: 0n,
174
181
  });
175
182
  if (!("messages" in result)) {
176
- UNREACHABLE();
183
+ unreachable();
177
184
  }
178
185
  for (const message_ of result.messages) {
179
186
  const message = await this.constructMessage(message_, false);
@@ -445,10 +452,10 @@ export class MessageManager {
445
452
  }
446
453
  if (fileId != null) {
447
454
  if (!expectedFileType.includes(fileId.type)) {
448
- UNREACHABLE();
455
+ unreachable();
449
456
  }
450
457
  return {
451
- id: "id" in fileId.location ? fileId.location.id : UNREACHABLE(),
458
+ id: "id" in fileId.location ? fileId.location.id : unreachable(),
452
459
  access_hash: fileId.location.accessHash,
453
460
  file_reference: fileId.fileReference ?? new Uint8Array(),
454
461
  };
@@ -456,6 +463,13 @@ export class MessageManager {
456
463
  return null;
457
464
  }
458
465
  async sendPoll(chatId, question, options, params) {
466
+ question = question?.trim();
467
+ if (!question) {
468
+ throw new Error("Question must not be empty.");
469
+ }
470
+ if (!Array.isArray(options) || options.length < 2) {
471
+ throw new Error("There must be at least two options.");
472
+ }
459
473
  const peer = await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId);
460
474
  const randomId = getRandomId();
461
475
  const silent = params?.disableNotification ? true : undefined;
@@ -500,7 +514,7 @@ export class MessageManager {
500
514
  }
501
515
  async editMessageReplyMarkup(chatId, messageId, params) {
502
516
  const result = await __classPrivateFieldGet(this, _MessageManager_c, "f").api.messages.editMessage({
503
- id: messageId,
517
+ id: checkMessageId(messageId),
504
518
  peer: await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId),
505
519
  reply_markup: await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_constructReplyMarkup).call(this, params),
506
520
  });
@@ -528,7 +542,7 @@ export class MessageManager {
528
542
  });
529
543
  }
530
544
  const result = await __classPrivateFieldGet(this, _MessageManager_c, "f").api.messages.editMessage({
531
- id: messageId,
545
+ id: checkMessageId(messageId),
532
546
  peer: await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId),
533
547
  entities,
534
548
  message,
@@ -565,6 +579,7 @@ export class MessageManager {
565
579
  });
566
580
  }
567
581
  async deleteMessages(chatId, messageIds, params) {
582
+ checkArray(messageIds, checkMessageId);
568
583
  const peer = await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId);
569
584
  if (peer instanceof types.InputPeerChannel) {
570
585
  await __classPrivateFieldGet(this, _MessageManager_c, "f").api.channels.deleteMessages({ channel: new types.InputChannel(peer), id: messageIds });
@@ -581,7 +596,7 @@ export class MessageManager {
581
596
  async pinMessage(chatId, messageId, params) {
582
597
  await __classPrivateFieldGet(this, _MessageManager_c, "f").api.messages.updatePinnedMessage({
583
598
  peer: await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId),
584
- id: messageId,
599
+ id: checkMessageId(messageId),
585
600
  silent: params?.disableNotification ? true : undefined,
586
601
  pm_oneside: params?.bothSides ? undefined : true,
587
602
  });
@@ -589,7 +604,7 @@ export class MessageManager {
589
604
  async unpinMessage(chatId, messageId) {
590
605
  await __classPrivateFieldGet(this, _MessageManager_c, "f").api.messages.updatePinnedMessage({
591
606
  peer: await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId),
592
- id: messageId,
607
+ id: checkMessageId(messageId),
593
608
  unpin: true,
594
609
  });
595
610
  }
@@ -600,14 +615,18 @@ export class MessageManager {
600
615
  // TODO: sync with storage
601
616
  await __classPrivateFieldGet(this, _MessageManager_c, "f").api.messages.setChatAvailableReactions({
602
617
  peer: await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId),
603
- available_reactions: availableReactions == "none" ? new types.ChatReactionsNone() : availableReactions == "all" ? new types.ChatReactionsAll() : Array.isArray(availableReactions) ? new types.ChatReactionsSome({ reactions: availableReactions.map((v) => v.type == "emoji" ? new types.ReactionEmoji({ emoticon: v.emoji }) : new types.ReactionCustomEmoji({ document_id: BigInt(v.id) })) }) : UNREACHABLE(),
618
+ available_reactions: availableReactions == "none" ? new types.ChatReactionsNone() : availableReactions == "all" ? new types.ChatReactionsAll() : Array.isArray(availableReactions) ? new types.ChatReactionsSome({ reactions: availableReactions.map((v) => v.type == "emoji" ? new types.ReactionEmoji({ emoticon: v.emoji }) : new types.ReactionCustomEmoji({ document_id: BigInt(v.id) })) }) : unreachable(),
604
619
  });
605
620
  }
606
621
  async setReactions(chatId, messageId, reactions, params) {
607
622
  await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_sendReaction).call(this, chatId, messageId, reactions, params);
608
623
  }
609
624
  async addReaction(chatId, messageId, reaction, params) {
610
- const chosenReactions = await this.getMessage(chatId, messageId).then((v) => v?.reactions ?? []).then((v) => v.filter((v) => v.chosen));
625
+ const message = await this.getMessage(chatId, messageId);
626
+ if (!message) {
627
+ throw new InputError("Message not found.");
628
+ }
629
+ const chosenReactions = (message.reactions ?? []).filter((v) => v.chosen);
611
630
  for (const r of chosenReactions) {
612
631
  if (reactionEqual(r.reaction, reaction)) {
613
632
  return;
@@ -617,7 +636,11 @@ export class MessageManager {
617
636
  await this.setReactions(chatId, messageId, reactions, params);
618
637
  }
619
638
  async removeReaction(chatId, messageId, reaction) {
620
- const chosenReactions = await this.getMessage(chatId, messageId).then((v) => v?.reactions ?? []).then((v) => v.filter((v) => v.chosen));
639
+ const message = await this.getMessage(chatId, messageId);
640
+ if (!message) {
641
+ throw new InputError("Message not found.");
642
+ }
643
+ const chosenReactions = (message.reactions ?? []).filter((v) => v.chosen);
621
644
  for (const r of chosenReactions) {
622
645
  if (reactionEqual(r.reaction, reaction)) {
623
646
  const reactions = chosenReactions.filter((v) => v != r).map((v) => v.reaction);
@@ -754,7 +777,7 @@ export class MessageManager {
754
777
  async deleteChatPhoto(chatId) {
755
778
  const peer = await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId);
756
779
  if (!(peer instanceof types.InputPeerChannel) && !(peer instanceof types.InputPeerChat)) {
757
- UNREACHABLE();
780
+ unreachable();
758
781
  }
759
782
  if (peer instanceof types.InputPeerChannel) {
760
783
  await __classPrivateFieldGet(this, _MessageManager_c, "f").api.channels.editPhoto({ channel: new types.InputChannel(peer), photo: new types.InputChatPhotoEmpty() });
@@ -766,7 +789,7 @@ export class MessageManager {
766
789
  async setChatPhoto(chatId, photo, params) {
767
790
  const peer = await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId);
768
791
  if (!(peer instanceof types.InputPeerChannel) && !(peer instanceof types.InputPeerChat)) {
769
- UNREACHABLE();
792
+ unreachable();
770
793
  }
771
794
  const [contents, fileName] = await getFileContents(photo);
772
795
  const file = await __classPrivateFieldGet(this, _MessageManager_c, "f").fileManager.upload(contents, { fileName: params?.fileName ?? fileName, chunkSize: params?.chunkSize, signal: params?.signal });
@@ -850,7 +873,7 @@ export class MessageManager {
850
873
  hash: 0n,
851
874
  });
852
875
  if (participants instanceof types.channels.ChannelParticipantsNotModified) {
853
- UNREACHABLE();
876
+ unreachable();
854
877
  }
855
878
  const chatMembers = new Array();
856
879
  for (const p of participants.participants) {
@@ -861,7 +884,7 @@ export class MessageManager {
861
884
  else if (peer instanceof types.InputPeerChat) {
862
885
  const fullChat = await __classPrivateFieldGet(this, _MessageManager_c, "f").api.messages.getFullChat(peer); // TODO: full chat cache
863
886
  if (!(fullChat.full_chat instanceof types.ChatFull) || !(fullChat.full_chat.participants instanceof types.ChatParticipants)) {
864
- UNREACHABLE();
887
+ unreachable();
865
888
  }
866
889
  const chatMembers = new Array();
867
890
  for (const p of fullChat.full_chat.participants.participants) {
@@ -870,7 +893,7 @@ export class MessageManager {
870
893
  return chatMembers;
871
894
  }
872
895
  else {
873
- UNREACHABLE();
896
+ unreachable();
874
897
  }
875
898
  }
876
899
  async enableJoinRequests(chatId) {
@@ -897,7 +920,7 @@ export class MessageManager {
897
920
  from_id: params?.from ? await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(params.from) : undefined,
898
921
  });
899
922
  if (!("messages" in result)) {
900
- UNREACHABLE();
923
+ unreachable();
901
924
  }
902
925
  const messages = new Array();
903
926
  for (const message_ of result.messages) {
@@ -948,7 +971,7 @@ export class MessageManager {
948
971
  await __classPrivateFieldGet(this, _MessageManager_c, "f").api.messages.addChatUser({ chat_id: peer.chat_id, user_id: new types.InputUserSelf(), fwd_limit: 0 }); // TODO: use potential high-level method for adding participants to chats
949
972
  }
950
973
  else {
951
- UNREACHABLE();
974
+ unreachable();
952
975
  }
953
976
  }
954
977
  async leaveChat(chatId) {
@@ -963,7 +986,7 @@ export class MessageManager {
963
986
  await __classPrivateFieldGet(this, _MessageManager_c, "f").api.messages.deleteChatUser({ chat_id: peer.chat_id, user_id: new types.InputUserSelf() }); // TODO: use potential high-level method for adding participants to chats
964
987
  }
965
988
  else {
966
- UNREACHABLE();
989
+ unreachable();
967
990
  }
968
991
  }
969
992
  async blockUser(userId) {
@@ -1056,7 +1079,7 @@ export class MessageManager {
1056
1079
  const message = await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_updatesToMessages).call(this, chatId, result).then((v) => v[0]);
1057
1080
  return assertMessageType(message, "location");
1058
1081
  }
1059
- UNREACHABLE();
1082
+ unreachable();
1060
1083
  }
1061
1084
  async editInlineMessageLiveLocation(inlineMessageId, latitude, longitude, params) {
1062
1085
  await __classPrivateFieldGet(this, _MessageManager_c, "f").storage.assertBot("editInlineMessageLiveLocation");
@@ -1144,7 +1167,7 @@ _MessageManager_c = new WeakMap(), _MessageManager_LresolveFileId = new WeakMap(
1144
1167
  let fileName = params?.fileName ?? fileName_;
1145
1168
  const mimeType = params?.mimeType ?? contentType(fileName.split(".").slice(-1)[0]) ?? FALLBACK_MIME_TYPE;
1146
1169
  if (expectedMimeTypes && !expectedMimeTypes.includes(mimeType)) {
1147
- UNREACHABLE();
1170
+ unreachable();
1148
1171
  }
1149
1172
  if (fileName.endsWith(".tgs") && fileType == FileType.Document) {
1150
1173
  fileName += "-";
@@ -1194,7 +1217,7 @@ _MessageManager_c = new WeakMap(), _MessageManager_LresolveFileId = new WeakMap(
1194
1217
  }, _MessageManager_sendReaction = async function _MessageManager_sendReaction(chatId, messageId, reactions, params) {
1195
1218
  await __classPrivateFieldGet(this, _MessageManager_c, "f").api.messages.sendReaction({
1196
1219
  peer: await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId),
1197
- msg_id: messageId,
1220
+ msg_id: checkMessageId(messageId),
1198
1221
  reaction: reactions.map((v) => reactionToTlObject(v)),
1199
1222
  big: params?.big ? true : undefined,
1200
1223
  add_to_recent: params?.addToRecents ? true : undefined,
@@ -12,6 +12,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
12
12
  var _CallbackQueryManager_c;
13
13
  import { types } from "../2_tl.js";
14
14
  import { constructCallbackQuery } from "../3_types.js";
15
+ import { checkCallbackQueryId } from "./0_utilities.js";
15
16
  export class CallbackQueryManager {
16
17
  constructor(c) {
17
18
  _CallbackQueryManager_c.set(this, void 0);
@@ -19,6 +20,7 @@ export class CallbackQueryManager {
19
20
  }
20
21
  async answerCallbackQuery(id, params) {
21
22
  await __classPrivateFieldGet(this, _CallbackQueryManager_c, "f").storage.assertBot("answerCallbackQuery");
23
+ checkCallbackQueryId(id);
22
24
  await __classPrivateFieldGet(this, _CallbackQueryManager_c, "f").api.messages.setBotCallbackAnswer({
23
25
  query_id: BigInt(id),
24
26
  cache_time: params?.cacheTime ?? 0,
@@ -10,8 +10,9 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
10
10
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
11
11
  };
12
12
  var _ChatListManager_instances, _ChatListManager_c, _ChatListManager_LgetChats, _ChatListManager_sendChatUpdate, _ChatListManager_chats, _ChatListManager_archivedChats, _ChatListManager_chatsLoadedFromStorage, _ChatListManager_tryGetChatId, _ChatListManager_getChatAnywhere, _ChatListManager_getChatList, _ChatListManager_loadChatsFromStorage, _ChatListManager_getLoadedChats, _ChatListManager_pinnedChats, _ChatListManager_pinnedArchiveChats, _ChatListManager_storageHadPinnedChats, _ChatListManager_pinnedChatsLoaded, _ChatListManager_loadPinnedChats, _ChatListManager_fetchPinnedChats, _ChatListManager_getPinnedChats, _ChatListManager_updateOrAddChat, _ChatListManager_removeChat, _ChatListManager_handleUpdateFolderPeers, _ChatListManager_handleUpdatePinnedDialogs, _ChatListManager_handleUpdateChannel, _ChatListManager_handleUpdateChat, _ChatListManager_handleUpdateUser, _ChatListManager_fetchChats;
13
+ import { unreachable } from "../0_deps.js";
13
14
  import { InputError } from "../0_errors.js";
14
- import { getLogger, toUnixTimestamp, UNREACHABLE } from "../1_utilities.js";
15
+ import { getLogger, toUnixTimestamp } from "../1_utilities.js";
15
16
  import { as, peerToChatId, types } from "../2_tl.js";
16
17
  import { constructChat, constructChat2, constructChat3, constructChat4, getChatOrder } from "../3_types.js";
17
18
  import { getChatListId, getUsername } from "./0_utilities.js";
@@ -54,7 +55,7 @@ export class ChatListManager {
54
55
  const pinnedChats = await __classPrivateFieldGet(this, _ChatListManager_instances, "m", _ChatListManager_getPinnedChats).call(this, listId);
55
56
  const chat = await constructChat3(chatId, pinnedChats.indexOf(chatId), message, __classPrivateFieldGet(this, _ChatListManager_c, "f").getEntity);
56
57
  if (chat == null) {
57
- UNREACHABLE();
58
+ unreachable();
58
59
  }
59
60
  __classPrivateFieldGet(this, _ChatListManager_chats, "f").set(chatId, chat);
60
61
  await __classPrivateFieldGet(this, _ChatListManager_c, "f").storage.setChat(listId, chatId, chat.pinned, chat.lastMessage?.id ?? 0, chat.lastMessage?.date ?? new Date(0));
@@ -75,7 +76,7 @@ export class ChatListManager {
75
76
  const pinnedChats = await __classPrivateFieldGet(this, _ChatListManager_instances, "m", _ChatListManager_getPinnedChats).call(this, listId);
76
77
  const chat = await constructChat3(chatId, pinnedChats.indexOf(chatId), message, __classPrivateFieldGet(this, _ChatListManager_c, "f").getEntity);
77
78
  if (chat == null) {
78
- UNREACHABLE();
79
+ unreachable();
79
80
  }
80
81
  __classPrivateFieldGet(this, _ChatListManager_chats, "f").set(chatId, chat);
81
82
  }
@@ -146,7 +147,7 @@ export class ChatListManager {
146
147
  await __classPrivateFieldGet(this, _ChatListManager_instances, "m", _ChatListManager_handleUpdateUser).call(this, update);
147
148
  }
148
149
  else {
149
- UNREACHABLE();
150
+ unreachable();
150
151
  }
151
152
  }
152
153
  async getChat(chatId) {
@@ -159,7 +160,7 @@ export class ChatListManager {
159
160
  maybeChatId = __classPrivateFieldGet(this, _ChatListManager_instances, "m", _ChatListManager_tryGetChatId).call(this, getUsername(chatId));
160
161
  }
161
162
  else {
162
- UNREACHABLE();
163
+ unreachable();
163
164
  }
164
165
  if (maybeChatId != null) {
165
166
  const [chat] = __classPrivateFieldGet(this, _ChatListManager_instances, "m", _ChatListManager_getChatAnywhere).call(this, maybeChatId);
@@ -190,7 +191,7 @@ export class ChatListManager {
190
191
  const chats = await __classPrivateFieldGet(this, _ChatListManager_c, "f").api.messages.getChats({ id: [inputPeer.chat_id] }).then((v) => v[as](types.messages.Chats));
191
192
  const chat = chats.chats[0];
192
193
  if (chat instanceof types.ChatEmpty) {
193
- UNREACHABLE();
194
+ unreachable();
194
195
  }
195
196
  return constructChat2(chat, -1, undefined);
196
197
  }
@@ -198,7 +199,7 @@ export class ChatListManager {
198
199
  const channels = await __classPrivateFieldGet(this, _ChatListManager_c, "f").api.channels.getChannels({ id: [new types.InputChannel(inputPeer)] });
199
200
  const channel = channels.chats[0];
200
201
  if (channel instanceof types.ChatEmpty) {
201
- UNREACHABLE();
202
+ unreachable();
202
203
  }
203
204
  return constructChat2(channel, -1, undefined);
204
205
  }
@@ -206,12 +207,12 @@ export class ChatListManager {
206
207
  const users = await __classPrivateFieldGet(this, _ChatListManager_c, "f").api.users.getUsers({ id: [new types.InputUser(inputPeer)] });
207
208
  const user = users[0];
208
209
  if (user instanceof types.UserEmpty) {
209
- UNREACHABLE();
210
+ unreachable();
210
211
  }
211
212
  return constructChat2(user, -1, undefined);
212
213
  }
213
214
  else {
214
- UNREACHABLE();
215
+ unreachable();
215
216
  }
216
217
  }
217
218
  }
@@ -316,7 +317,7 @@ _ChatListManager_c = new WeakMap(), _ChatListManager_LgetChats = new WeakMap(),
316
317
  await __classPrivateFieldGet(this, _ChatListManager_c, "f").storage.setPinnedChats(1, __classPrivateFieldGet(this, _ChatListManager_pinnedArchiveChats, "f"));
317
318
  }
318
319
  if (listId != null && listId != 0 && listId != 1) {
319
- UNREACHABLE();
320
+ unreachable();
320
321
  }
321
322
  }, _ChatListManager_getPinnedChats = async function _ChatListManager_getPinnedChats(listId) {
322
323
  if (!__classPrivateFieldGet(this, _ChatListManager_pinnedChatsLoaded, "f")) {
@@ -331,7 +332,7 @@ _ChatListManager_c = new WeakMap(), _ChatListManager_LgetChats = new WeakMap(),
331
332
  case 1:
332
333
  return __classPrivateFieldGet(this, _ChatListManager_pinnedArchiveChats, "f");
333
334
  default:
334
- UNREACHABLE();
335
+ unreachable();
335
336
  }
336
337
  }, _ChatListManager_updateOrAddChat = async function _ChatListManager_updateOrAddChat(chatId) {
337
338
  const [chat, listId] = __classPrivateFieldGet(this, _ChatListManager_instances, "m", _ChatListManager_getChatAnywhere).call(this, chatId);
@@ -428,7 +429,7 @@ _ChatListManager_c = new WeakMap(), _ChatListManager_LgetChats = new WeakMap(),
428
429
  });
429
430
  const pinnedChats = await __classPrivateFieldGet(this, _ChatListManager_instances, "m", _ChatListManager_getPinnedChats).call(this, listId);
430
431
  if (!(dialogs instanceof types.messages.Dialogs) && !(dialogs instanceof types.messages.DialogsSlice)) {
431
- UNREACHABLE();
432
+ unreachable();
432
433
  }
433
434
  if (dialogs.dialogs.length < limit) {
434
435
  await __classPrivateFieldGet(this, _ChatListManager_c, "f").storage.setHasAllChats(listId, true);
@@ -10,9 +10,10 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
10
10
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
11
11
  };
12
12
  var _InlineQueryManager_c;
13
- import { UNREACHABLE } from "../1_utilities.js";
13
+ import { unreachable } from "../0_deps.js";
14
14
  import { types } from "../2_tl.js";
15
15
  import { constructChosenInlineResult, constructInlineQuery, inlineQueryResultToTlObject } from "../3_types.js";
16
+ import { checkInlineQueryId } from "./0_utilities.js";
16
17
  export class InlineQueryManager {
17
18
  constructor(c) {
18
19
  _InlineQueryManager_c.set(this, void 0);
@@ -20,6 +21,7 @@ export class InlineQueryManager {
20
21
  }
21
22
  async answerInlineQuery(id, results, params) {
22
23
  await __classPrivateFieldGet(this, _InlineQueryManager_c, "f").storage.assertBot("answerInlineQuery");
24
+ checkInlineQueryId(id);
23
25
  await __classPrivateFieldGet(this, _InlineQueryManager_c, "f").api.messages.setInlineBotResults({
24
26
  query_id: BigInt(id),
25
27
  results: await Promise.all(results.map((v) => inlineQueryResultToTlObject(v, __classPrivateFieldGet(this, _InlineQueryManager_c, "f").messageManager.parseText.bind(__classPrivateFieldGet(this, _InlineQueryManager_c, "f").messageManager), __classPrivateFieldGet(this, _InlineQueryManager_c, "f").messageManager.usernameResolver.bind(__classPrivateFieldGet(this, _InlineQueryManager_c, "f").messageManager)))),
@@ -42,7 +44,7 @@ export class InlineQueryManager {
42
44
  return { chosenInlineResult: await constructChosenInlineResult(update, __classPrivateFieldGet(this, _InlineQueryManager_c, "f").getEntity) };
43
45
  }
44
46
  else {
45
- UNREACHABLE();
47
+ unreachable();
46
48
  }
47
49
  }
48
50
  }
@@ -10,12 +10,12 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
10
10
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
11
11
  };
12
12
  var _StoryManager_instances, _StoryManager_c, _StoryManager_updatesToStory, _StoryManager_togglePinned;
13
- import { contentType } from "../0_deps.js";
13
+ import { contentType, unreachable } from "../0_deps.js";
14
14
  import { InputError } from "../0_errors.js";
15
- import { getRandomId, UNREACHABLE } from "../1_utilities.js";
15
+ import { getRandomId } from "../1_utilities.js";
16
16
  import { as, inputPeerToPeer, peerToChatId, types } from "../2_tl.js";
17
17
  import { constructStory, FileType, storyInteractiveAreaToTlObject, storyPrivacyToTlObject } from "../3_types.js";
18
- import { getFileContents, isHttpUrl } from "./0_utilities.js";
18
+ import { checkArray, checkStoryId, getFileContents, isHttpUrl } from "./0_utilities.js";
19
19
  export class StoryManager {
20
20
  constructor(c) {
21
21
  _StoryManager_instances.add(this);
@@ -25,7 +25,7 @@ export class StoryManager {
25
25
  async createStory(chatId, content, params) {
26
26
  await __classPrivateFieldGet(this, _StoryManager_c, "f").storage.assertUser("createStory");
27
27
  let media = null;
28
- const source = "video" in content ? content.video : "photo" in content ? content.photo : UNREACHABLE();
28
+ const source = "video" in content ? content.video : "photo" in content ? content.photo : unreachable();
29
29
  if (typeof source === "string") {
30
30
  const fileId = __classPrivateFieldGet(this, _StoryManager_c, "f").messageManager.resolveFileId(source, FileType.Photo);
31
31
  if (fileId != null) {
@@ -84,6 +84,7 @@ export class StoryManager {
84
84
  }
85
85
  async getStories(chatId, storyIds) {
86
86
  await __classPrivateFieldGet(this, _StoryManager_c, "f").storage.assertUser("getStories");
87
+ checkArray(storyIds, checkStoryId);
87
88
  const peer = await __classPrivateFieldGet(this, _StoryManager_c, "f").getInputPeer(chatId);
88
89
  const stories_ = await __classPrivateFieldGet(this, _StoryManager_c, "f").api.stories.getStoriesByID({ peer, id: storyIds });
89
90
  const stories = new Array();
@@ -146,8 +147,9 @@ _StoryManager_c = new WeakMap(), _StoryManager_instances = new WeakSet(), _Story
146
147
  return await constructStory(updateStory.story, updateStory.peer, __classPrivateFieldGet(this, _StoryManager_c, "f").getEntity);
147
148
  }
148
149
  }
149
- UNREACHABLE();
150
+ unreachable();
150
151
  }, _StoryManager_togglePinned = async function _StoryManager_togglePinned(chatId, storyIds, pinned) {
152
+ checkArray(storyIds, checkStoryId);
151
153
  const peer = await __classPrivateFieldGet(this, _StoryManager_c, "f").getInputPeer(chatId);
152
154
  await __classPrivateFieldGet(this, _StoryManager_c, "f").api.stories.togglePinned({ peer, id: storyIds, pinned });
153
155
  };
@@ -235,27 +235,24 @@ export declare class Client<C extends Context = Context> extends Composer<C> {
235
235
  [handleMigrationError](err: Migrate): Promise<void>;
236
236
  disconnect(): Promise<void>;
237
237
  /**
238
- * Calls [initConnection](1) and authorizes the client with one of the following:
238
+ * Authorizes the client with one of the following:
239
239
  *
240
240
  * - Bot token (`string`)
241
- * - Exported authorization (`types.AuthExportedAuthorization`)
242
241
  * - User authorization handlers (`AuthorizeUserParams`)
243
242
  *
244
- * if the current auth key doesn't throw AUTH_KEY_UNREGISTERED when calling [updates.getState](2).
243
+ * if the current auth key doesn't throw AUTH_KEY_UNREGISTERED when calling [updates.getState](1).
245
244
  *
246
245
  * Notes:
247
246
  * 1. Requires the `apiId` and `apiHash` paramters to be passed when constructing the client.
248
247
  * 2. Reconnects the client to the appropriate DC in case of MIGRATE_X errors.
249
- * 3. The parameters passed to the [initConnection][1] call can be configured with the last parameter of the constructor.
250
248
  *
251
- * [1]: https://core.telegram.org/method/initConnection
252
- * [2]: https://core.telegram.org/method/updates.getState
249
+ * [1]: https://core.telegram.org/method/updates.getState
253
250
  */
254
- authorize(params?: string | types.auth.ExportedAuthorization | AuthorizeUserParams): Promise<void>;
251
+ authorize(params?: string | AuthorizeUserParams): Promise<void>;
255
252
  /**
256
253
  * Same as calling `.connect()` followed by `.authorize(params)`.
257
254
  */
258
- start(params?: string | types.auth.ExportedAuthorization | AuthorizeUserParams): Promise<void>;
255
+ start(params?: string | AuthorizeUserParams): Promise<void>;
259
256
  /**
260
257
  * Invokes a function waiting and returning its reply if the second parameter is not `true`. Requires the client
261
258
  * to be connected.