@mtkruto/node 0.1.190 → 0.1.200

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 (205) hide show
  1. package/esm/0_errors.d.ts +12 -0
  2. package/esm/0_errors.js +19 -0
  3. package/esm/1_utilities.d.ts +1 -1
  4. package/esm/1_utilities.js +1 -1
  5. package/esm/2_tl.d.ts +6 -6
  6. package/esm/2_tl.js +6 -6
  7. package/esm/3_storage.d.ts +5 -5
  8. package/esm/3_storage.js +5 -5
  9. package/esm/3_types.d.ts +6 -5
  10. package/esm/3_types.js +6 -5
  11. package/esm/4_constants.d.ts +2 -2
  12. package/esm/4_constants.js +2 -2
  13. package/esm/5_client.d.ts +1 -1
  14. package/esm/5_client.js +1 -1
  15. package/esm/client/0_client_abstract.js +3 -2
  16. package/esm/client/0_html.js +4 -3
  17. package/esm/client/0_markdown.js +6 -5
  18. package/esm/client/0_params.d.ts +7 -1
  19. package/esm/client/0_types.d.ts +1 -2
  20. package/esm/client/0_types.js +1 -2
  21. package/esm/client/0_utilities.d.ts +0 -3
  22. package/esm/client/0_utilities.js +2 -21
  23. package/esm/client/1_business_connection_manager.d.ts +11 -0
  24. package/esm/client/1_business_connection_manager.js +47 -0
  25. package/esm/client/1_client_encrypted.js +1 -1
  26. package/esm/client/1_client_plain.js +3 -4
  27. package/esm/client/1_composer.js +3 -2
  28. package/esm/client/1_file_manager.js +4 -4
  29. package/esm/client/1_update_manager.d.ts +8 -1
  30. package/esm/client/1_update_manager.js +88 -8
  31. package/esm/client/2_message_manager.d.ts +7 -6
  32. package/esm/client/2_message_manager.js +89 -74
  33. package/esm/client/3_chat_list_manager.js +3 -2
  34. package/esm/client/3_story_manager.js +2 -1
  35. package/esm/client/4_client.d.ts +422 -421
  36. package/esm/client/4_client.js +578 -520
  37. package/esm/mod.d.ts +1 -0
  38. package/esm/mod.js +1 -0
  39. package/esm/storage/0_storage.d.ts +5 -0
  40. package/esm/storage/0_storage.js +20 -0
  41. package/esm/storage/{1_storage_indexed_db.js → 2_storage_indexed_db.js} +1 -1
  42. package/esm/storage/{1_storage_local_storage.js → 2_storage_local_storage.js} +1 -1
  43. package/{script/storage/1_storage_memory.d.ts → esm/storage/2_storage_memory.d.ts} +1 -4
  44. package/esm/storage/{1_storage_memory.js → 2_storage_memory.js} +8 -28
  45. package/esm/storage/{1_storage_session_storage.js → 2_storage_session_storage.js} +1 -1
  46. package/esm/tl/2_types.d.ts +1071 -183
  47. package/esm/tl/2_types.js +2916 -464
  48. package/esm/tl/3_functions.d.ts +381 -17
  49. package/esm/tl/3_functions.js +1002 -120
  50. package/{script/tl/4_tl_writer.d.ts → esm/tl/5_tl_writer.d.ts} +1 -1
  51. package/{script/tl/4_rpc_result.d.ts → esm/tl/6_rpc_result.d.ts} +1 -1
  52. package/esm/tl/{4_rpc_result.js → 6_rpc_result.js} +1 -1
  53. package/esm/tl/{6_message.d.ts → 7_message.d.ts} +2 -2
  54. package/esm/tl/{6_message.js → 7_message.js} +3 -3
  55. package/esm/tl/{7_message_container.d.ts → 8_message_container.d.ts} +1 -1
  56. package/esm/tl/{7_message_container.js → 8_message_container.js} +3 -3
  57. package/esm/types/0_chat_photo.d.ts +1 -0
  58. package/esm/types/0_chat_photo.js +8 -5
  59. package/esm/types/0_message_entity.d.ts +1 -1
  60. package/esm/types/0_thumbnail.js +1 -1
  61. package/esm/types/1_bot_command_scope.d.ts +1 -1
  62. package/esm/types/1_photo.js +2 -2
  63. package/esm/types/1_story_privacy.d.ts +1 -1
  64. package/esm/types/2_business_connection.d.ts +11 -0
  65. package/esm/types/2_business_connection.js +12 -0
  66. package/esm/types/2_chat_member.d.ts +1 -1
  67. package/esm/types/2_chosen_inline_result.d.ts +1 -1
  68. package/esm/types/2_game.js +1 -1
  69. package/esm/types/2_inline_keyboard_button.d.ts +1 -1
  70. package/esm/types/2_inline_query.d.ts +1 -1
  71. package/esm/types/2_invite_link.d.ts +1 -1
  72. package/esm/types/2_message_reaction_count.d.ts +1 -1
  73. package/esm/types/2_message_reactions.d.ts +1 -1
  74. package/esm/types/2_story_content.js +1 -1
  75. package/{script/types/1_story_interactive_area.d.ts → esm/types/2_story_interactive_area.d.ts} +2 -2
  76. package/esm/types/{1_story_interactive_area.js → 2_story_interactive_area.js} +1 -1
  77. package/esm/types/3_chat_member_updated.d.ts +1 -1
  78. package/esm/types/3_reply_markup.d.ts +1 -1
  79. package/esm/types/3_story.d.ts +2 -2
  80. package/esm/types/3_story.js +1 -1
  81. package/esm/types/4_inline_query_result.d.ts +1 -1
  82. package/esm/types/4_inline_query_result.js +1 -1
  83. package/esm/types/4_message.d.ts +9 -3
  84. package/esm/types/4_message.js +22 -5
  85. package/esm/types/5_callback_query.d.ts +1 -1
  86. package/esm/types/5_callback_query.js +2 -1
  87. package/esm/types/5_chat.d.ts +1 -1
  88. package/esm/types/6_update.d.ts +12 -2
  89. package/esm/types/{0__file_id.js → _file_id.js} +2 -1
  90. package/package.json +1 -1
  91. package/script/0_errors.d.ts +12 -0
  92. package/script/0_errors.js +27 -0
  93. package/script/1_utilities.d.ts +1 -1
  94. package/script/1_utilities.js +1 -1
  95. package/script/2_tl.d.ts +6 -6
  96. package/script/2_tl.js +6 -6
  97. package/script/3_storage.d.ts +5 -5
  98. package/script/3_storage.js +5 -5
  99. package/script/3_types.d.ts +6 -5
  100. package/script/3_types.js +6 -5
  101. package/script/4_constants.d.ts +2 -2
  102. package/script/4_constants.js +2 -2
  103. package/script/5_client.d.ts +1 -1
  104. package/script/5_client.js +1 -1
  105. package/script/client/0_client_abstract.js +3 -2
  106. package/script/client/0_html.js +4 -3
  107. package/script/client/0_markdown.js +6 -5
  108. package/script/client/0_params.d.ts +7 -1
  109. package/script/client/0_types.d.ts +1 -2
  110. package/script/client/0_types.js +0 -4
  111. package/script/client/0_utilities.d.ts +0 -3
  112. package/script/client/0_utilities.js +3 -24
  113. package/script/client/1_business_connection_manager.d.ts +11 -0
  114. package/script/client/1_business_connection_manager.js +51 -0
  115. package/script/client/1_client_encrypted.js +2 -2
  116. package/script/client/1_client_plain.js +3 -4
  117. package/script/client/1_composer.js +3 -2
  118. package/script/client/1_file_manager.js +5 -5
  119. package/script/client/1_update_manager.d.ts +8 -1
  120. package/script/client/1_update_manager.js +88 -8
  121. package/script/client/2_message_manager.d.ts +7 -6
  122. package/script/client/2_message_manager.js +88 -73
  123. package/script/client/3_chat_list_manager.js +3 -2
  124. package/script/client/3_story_manager.js +2 -1
  125. package/script/client/4_client.d.ts +422 -421
  126. package/script/client/4_client.js +578 -520
  127. package/script/mod.d.ts +1 -0
  128. package/script/mod.js +1 -0
  129. package/script/storage/0_storage.d.ts +5 -0
  130. package/script/storage/0_storage.js +20 -0
  131. package/script/storage/{1_storage_indexed_db.js → 2_storage_indexed_db.js} +7 -7
  132. package/script/storage/{1_storage_local_storage.js → 2_storage_local_storage.js} +10 -10
  133. package/{esm/storage/1_storage_memory.d.ts → script/storage/2_storage_memory.d.ts} +1 -4
  134. package/script/storage/{1_storage_memory.js → 2_storage_memory.js} +12 -32
  135. package/script/storage/{1_storage_session_storage.js → 2_storage_session_storage.js} +10 -10
  136. package/script/tl/2_types.d.ts +1071 -183
  137. package/script/tl/2_types.js +3028 -504
  138. package/script/tl/3_functions.d.ts +381 -17
  139. package/script/tl/3_functions.js +1047 -143
  140. package/{esm/tl/4_tl_writer.d.ts → script/tl/5_tl_writer.d.ts} +1 -1
  141. package/{esm/tl/4_rpc_result.d.ts → script/tl/6_rpc_result.d.ts} +1 -1
  142. package/script/tl/{4_rpc_result.js → 6_rpc_result.js} +2 -2
  143. package/script/tl/{6_message.d.ts → 7_message.d.ts} +2 -2
  144. package/script/tl/{6_message.js → 7_message.js} +8 -8
  145. package/script/tl/{7_message_container.d.ts → 8_message_container.d.ts} +1 -1
  146. package/script/tl/{7_message_container.js → 8_message_container.js} +7 -7
  147. package/script/types/0_chat_photo.d.ts +1 -0
  148. package/script/types/0_chat_photo.js +16 -13
  149. package/script/types/0_message_entity.d.ts +1 -1
  150. package/script/types/0_thumbnail.js +6 -6
  151. package/script/types/1_bot_command_scope.d.ts +1 -1
  152. package/script/types/1_photo.js +7 -7
  153. package/script/types/1_story_privacy.d.ts +1 -1
  154. package/script/types/2_business_connection.d.ts +11 -0
  155. package/script/types/2_business_connection.js +16 -0
  156. package/script/types/2_chat_member.d.ts +1 -1
  157. package/script/types/2_chosen_inline_result.d.ts +1 -1
  158. package/script/types/2_game.js +3 -3
  159. package/script/types/2_inline_keyboard_button.d.ts +1 -1
  160. package/script/types/2_inline_query.d.ts +1 -1
  161. package/script/types/2_invite_link.d.ts +1 -1
  162. package/script/types/2_message_reaction_count.d.ts +1 -1
  163. package/script/types/2_message_reactions.d.ts +1 -1
  164. package/script/types/2_story_content.js +4 -4
  165. package/{esm/types/1_story_interactive_area.d.ts → script/types/2_story_interactive_area.d.ts} +2 -2
  166. package/script/types/{1_story_interactive_area.js → 2_story_interactive_area.js} +2 -2
  167. package/script/types/3_chat_member_updated.d.ts +1 -1
  168. package/script/types/3_reply_markup.d.ts +1 -1
  169. package/script/types/3_story.d.ts +2 -2
  170. package/script/types/3_story.js +2 -2
  171. package/script/types/4_inline_query_result.d.ts +1 -1
  172. package/script/types/4_inline_query_result.js +2 -2
  173. package/script/types/4_message.d.ts +9 -3
  174. package/script/types/4_message.js +37 -20
  175. package/script/types/5_callback_query.d.ts +1 -1
  176. package/script/types/5_callback_query.js +2 -1
  177. package/script/types/5_chat.d.ts +1 -1
  178. package/script/types/6_update.d.ts +12 -2
  179. package/script/types/{0__file_id.js → _file_id.js} +2 -1
  180. /package/esm/storage/{0_utilities.d.ts → 1_utilities.d.ts} +0 -0
  181. /package/esm/storage/{0_utilities.js → 1_utilities.js} +0 -0
  182. /package/esm/storage/{1_storage_indexed_db.d.ts → 2_storage_indexed_db.d.ts} +0 -0
  183. /package/esm/storage/{1_storage_local_storage.d.ts → 2_storage_local_storage.d.ts} +0 -0
  184. /package/esm/storage/{1_storage_session_storage.d.ts → 2_storage_session_storage.d.ts} +0 -0
  185. /package/esm/tl/{3_tl_reader.d.ts → 4_tl_reader.d.ts} +0 -0
  186. /package/esm/tl/{3_tl_reader.js → 4_tl_reader.js} +0 -0
  187. /package/esm/tl/{4_tl_writer.js → 5_tl_writer.js} +0 -0
  188. /package/esm/types/{0_venue.d.ts → 1_venue.d.ts} +0 -0
  189. /package/esm/types/{0_venue.js → 1_venue.js} +0 -0
  190. /package/esm/types/{0__file_id.d.ts → _file_id.d.ts} +0 -0
  191. /package/esm/types/{1__getters.d.ts → _getters.d.ts} +0 -0
  192. /package/esm/types/{1__getters.js → _getters.js} +0 -0
  193. /package/script/storage/{0_utilities.d.ts → 1_utilities.d.ts} +0 -0
  194. /package/script/storage/{0_utilities.js → 1_utilities.js} +0 -0
  195. /package/script/storage/{1_storage_indexed_db.d.ts → 2_storage_indexed_db.d.ts} +0 -0
  196. /package/script/storage/{1_storage_local_storage.d.ts → 2_storage_local_storage.d.ts} +0 -0
  197. /package/script/storage/{1_storage_session_storage.d.ts → 2_storage_session_storage.d.ts} +0 -0
  198. /package/script/tl/{3_tl_reader.d.ts → 4_tl_reader.d.ts} +0 -0
  199. /package/script/tl/{3_tl_reader.js → 4_tl_reader.js} +0 -0
  200. /package/script/tl/{4_tl_writer.js → 5_tl_writer.js} +0 -0
  201. /package/script/types/{0_venue.d.ts → 1_venue.d.ts} +0 -0
  202. /package/script/types/{0_venue.js → 1_venue.js} +0 -0
  203. /package/script/types/{0__file_id.d.ts → _file_id.d.ts} +0 -0
  204. /package/script/types/{1__getters.d.ts → _getters.d.ts} +0 -0
  205. /package/script/types/{1__getters.js → _getters.js} +0 -0
@@ -10,9 +10,10 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
10
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
11
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
12
12
  };
13
- var _Client_instances, _Client_client, _Client_guaranteeUpdateDelivery, _Client_updateManager, _Client_networkStatisticsManager, _Client_botInfoManager, _Client_fileManager, _Client_reactionManager, _Client_messageManager, _Client_storyManager, _Client_callbackQueryManager, _Client_inlineQueryManager, _Client_chatListManager, _Client_accountManager, _Client_parseMode, _Client_publicKeys, _Client_ignoreOutgoing, _Client_storeMessages, _Client_Lauthorize, _Client_LpingLoop, _Client_LhandleMigrationError, _Client_L$initConncetion, _Client_namespaceProxies, _Client_getApiId, _Client_constructContext, _Client_propagateConnectionState, _Client_lastPropagatedConnectionState, _Client_stateChangeHandler, _Client_storageInited, _Client_initStorage, _Client_connectionInited, _Client_lastPropagatedAuthorizationState, _Client_propagateAuthorizationState, _Client_getSelfId, _Client_pingLoopStarted, _Client_pingLoopAbortController, _Client_pingInterval, _Client_lastUpdates, _Client_startPingLoop, _Client_pingLoop, _Client_invoke, _Client_handleInvokeError, _Client_getUserAccessHash, _Client_getChannelAccessHash, _Client_getInputPeerInner, _Client_handleCtxUpdate, _Client_queueHandleCtxUpdate, _Client_handleUpdate, _Client_lastGetMe, _Client_getMe;
13
+ var _Client_instances, _Client_client, _Client_guaranteeUpdateDelivery, _Client_updateManager, _Client_networkStatisticsManager, _Client_botInfoManager, _Client_fileManager, _Client_reactionManager, _Client_businessConnectionManager, _Client_messageManager, _Client_storyManager, _Client_callbackQueryManager, _Client_inlineQueryManager, _Client_chatListManager, _Client_accountManager, _Client_parseMode, _Client_publicKeys, _Client_ignoreOutgoing, _Client_storeMessages, _Client_Lauthorize, _Client_LpingLoop, _Client_LhandleMigrationError, _Client_L$initConncetion, _Client_namespaceProxies, _Client_getApiId, _Client_constructContext, _Client_propagateConnectionState, _Client_lastPropagatedConnectionState, _Client_stateChangeHandler, _Client_storageInited, _Client_initStorage, _Client_connectionInited, _Client_lastPropagatedAuthorizationState, _Client_propagateAuthorizationState, _Client_getSelfId, _Client_pingLoopStarted, _Client_pingLoopAbortController, _Client_pingInterval, _Client_lastUpdates, _Client_startPingLoop, _Client_pingLoop, _Client_invoke, _Client_handleInvokeError, _Client_getUserAccessHash, _Client_getChannelAccessHash, _Client_getInputPeerInner, _Client_handleCtxUpdate, _Client_queueHandleCtxUpdate, _Client_handleUpdate, _Client_lastGetMe, _Client_getMe;
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.Client = exports.handleMigrationError = exports.restartAuth = exports.Composer = void 0;
16
+ const _0_errors_js_1 = require("../0_errors.js");
16
17
  const _1_utilities_js_1 = require("../1_utilities.js");
17
18
  const _2_tl_js_1 = require("../2_tl.js");
18
19
  const _3_storage_js_1 = require("../3_storage.js");
@@ -23,6 +24,7 @@ const _0_password_js_1 = require("./0_password.js");
23
24
  const _0_utilities_js_1 = require("./0_utilities.js");
24
25
  const _1_account_manager_js_1 = require("./1_account_manager.js");
25
26
  const _1_bot_info_manager_js_1 = require("./1_bot_info_manager.js");
27
+ const _1_business_connection_manager_js_1 = require("./1_business_connection_manager.js");
26
28
  const _1_client_encrypted_js_1 = require("./1_client_encrypted.js");
27
29
  const _1_client_plain_js_1 = require("./1_client_plain.js");
28
30
  const _1_composer_js_1 = require("./1_composer.js");
@@ -80,6 +82,7 @@ class Client extends Composer {
80
82
  _Client_botInfoManager.set(this, void 0);
81
83
  _Client_fileManager.set(this, void 0);
82
84
  _Client_reactionManager.set(this, void 0);
85
+ _Client_businessConnectionManager.set(this, void 0);
83
86
  _Client_messageManager.set(this, void 0);
84
87
  _Client_storyManager.set(this, void 0);
85
88
  _Client_callbackQueryManager.set(this, void 0);
@@ -203,7 +206,7 @@ class Client extends Composer {
203
206
  const reactions = "messageInteractions" in update ? update.messageInteractions : undefined;
204
207
  const mustGetMsg = () => {
205
208
  if (msg !== undefined) {
206
- return { chatId: msg.chat.id, messageId: msg.id, senderId: (msg.from ?? msg.senderChat)?.id };
209
+ return { chatId: msg.chat.id, messageId: msg.id, businessConnectionId: msg.businessConnectionId, senderId: (msg.from ?? msg.senderChat)?.id };
207
210
  }
208
211
  else if (reactions !== undefined) {
209
212
  return { chatId: reactions.chatId, messageId: reactions.messageId };
@@ -262,74 +265,74 @@ class Client extends Composer {
262
265
  return () => update;
263
266
  },
264
267
  reply: (text, params) => {
265
- const { chatId, messageId } = mustGetMsg();
268
+ const { chatId, messageId, businessConnectionId } = mustGetMsg();
266
269
  const replyToMessageId = getReplyToMessageId(params?.quote, chatId, messageId);
267
- return this.sendMessage(chatId, text, { ...params, replyToMessageId });
270
+ return this.sendMessage(chatId, text, { ...params, replyToMessageId, businessConnectionId });
268
271
  },
269
272
  replyPoll: (question, options, params) => {
270
- const { chatId, messageId } = mustGetMsg();
273
+ const { chatId, messageId, businessConnectionId } = mustGetMsg();
271
274
  const replyToMessageId = getReplyToMessageId(params?.quote, chatId, messageId);
272
- return this.sendPoll(chatId, question, options, { ...params, replyToMessageId });
275
+ return this.sendPoll(chatId, question, options, { ...params, replyToMessageId, businessConnectionId });
273
276
  },
274
277
  replyPhoto: (photo, params) => {
275
- const { chatId, messageId } = mustGetMsg();
278
+ const { chatId, messageId, businessConnectionId } = mustGetMsg();
276
279
  const replyToMessageId = getReplyToMessageId(params?.quote, chatId, messageId);
277
- return this.sendPhoto(chatId, photo, { ...params, replyToMessageId });
280
+ return this.sendPhoto(chatId, photo, { ...params, replyToMessageId, businessConnectionId });
278
281
  },
279
282
  replyDocument: (document, params) => {
280
- const { chatId, messageId } = mustGetMsg();
283
+ const { chatId, messageId, businessConnectionId } = mustGetMsg();
281
284
  const replyToMessageId = getReplyToMessageId(params?.quote, chatId, messageId);
282
- return this.sendDocument(chatId, document, { ...params, replyToMessageId });
285
+ return this.sendDocument(chatId, document, { ...params, replyToMessageId, businessConnectionId });
283
286
  },
284
287
  replySticker: (sticker, params) => {
285
- const { chatId, messageId } = mustGetMsg();
288
+ const { chatId, messageId, businessConnectionId } = mustGetMsg();
286
289
  const replyToMessageId = getReplyToMessageId(params?.quote, chatId, messageId);
287
- return this.sendSticker(chatId, sticker, { ...params, replyToMessageId });
290
+ return this.sendSticker(chatId, sticker, { ...params, replyToMessageId, businessConnectionId });
288
291
  },
289
292
  replyContact: (firstName, number, params) => {
290
- const { chatId, messageId } = mustGetMsg();
293
+ const { chatId, messageId, businessConnectionId } = mustGetMsg();
291
294
  const replyToMessageId = getReplyToMessageId(params?.quote, chatId, messageId);
292
- return this.sendContact(chatId, firstName, number, { ...params, replyToMessageId });
295
+ return this.sendContact(chatId, firstName, number, { ...params, replyToMessageId, businessConnectionId });
293
296
  },
294
297
  replyLocation: (latitude, longitude, params) => {
295
- const { chatId, messageId } = mustGetMsg();
298
+ const { chatId, messageId, businessConnectionId } = mustGetMsg();
296
299
  const replyToMessageId = getReplyToMessageId(params?.quote, chatId, messageId);
297
- return this.sendLocation(chatId, latitude, longitude, { ...params, replyToMessageId });
300
+ return this.sendLocation(chatId, latitude, longitude, { ...params, replyToMessageId, businessConnectionId });
298
301
  },
299
302
  replyDice: (params) => {
300
- const { chatId, messageId } = mustGetMsg();
303
+ const { chatId, messageId, businessConnectionId } = mustGetMsg();
301
304
  const replyToMessageId = getReplyToMessageId(params?.quote, chatId, messageId);
302
- return this.sendDice(chatId, { ...params, replyToMessageId });
305
+ return this.sendDice(chatId, { ...params, replyToMessageId, businessConnectionId });
303
306
  },
304
307
  replyVenue: (latitude, longitude, title, address, params) => {
305
- const { chatId, messageId } = mustGetMsg();
308
+ const { chatId, messageId, businessConnectionId } = mustGetMsg();
306
309
  const replyToMessageId = getReplyToMessageId(params?.quote, chatId, messageId);
307
- return this.sendVenue(chatId, latitude, longitude, title, address, { ...params, replyToMessageId });
310
+ return this.sendVenue(chatId, latitude, longitude, title, address, { ...params, replyToMessageId, businessConnectionId });
308
311
  },
309
312
  replyVideo: (video, params) => {
310
- const { chatId, messageId } = mustGetMsg();
313
+ const { chatId, messageId, businessConnectionId } = mustGetMsg();
311
314
  const replyToMessageId = getReplyToMessageId(params?.quote, chatId, messageId);
312
- return this.sendVideo(chatId, video, { ...params, replyToMessageId });
315
+ return this.sendVideo(chatId, video, { ...params, replyToMessageId, businessConnectionId });
313
316
  },
314
317
  replyAnimation: (document, params) => {
315
- const { chatId, messageId } = mustGetMsg();
318
+ const { chatId, messageId, businessConnectionId } = mustGetMsg();
316
319
  const replyToMessageId = getReplyToMessageId(params?.quote, chatId, messageId);
317
- return this.sendAnimation(chatId, document, { ...params, replyToMessageId });
320
+ return this.sendAnimation(chatId, document, { ...params, replyToMessageId, businessConnectionId });
318
321
  },
319
322
  replyVoice: (document, params) => {
320
- const { chatId, messageId } = mustGetMsg();
323
+ const { chatId, messageId, businessConnectionId } = mustGetMsg();
321
324
  const replyToMessageId = getReplyToMessageId(params?.quote, chatId, messageId);
322
- return this.sendVoice(chatId, document, { ...params, replyToMessageId });
325
+ return this.sendVoice(chatId, document, { ...params, replyToMessageId, businessConnectionId });
323
326
  },
324
327
  replyAudio: (document, params) => {
325
- const { chatId, messageId } = mustGetMsg();
328
+ const { chatId, messageId, businessConnectionId } = mustGetMsg();
326
329
  const replyToMessageId = getReplyToMessageId(params?.quote, chatId, messageId);
327
- return this.sendAudio(chatId, document, { ...params, replyToMessageId });
330
+ return this.sendAudio(chatId, document, { ...params, replyToMessageId, businessConnectionId });
328
331
  },
329
332
  replyVideoNote: (videoNote, params) => {
330
- const { chatId, messageId } = mustGetMsg();
333
+ const { chatId, messageId, businessConnectionId } = mustGetMsg();
331
334
  const replyToMessageId = getReplyToMessageId(params?.quote, chatId, messageId);
332
- return this.sendVideoNote(chatId, videoNote, { ...params, replyToMessageId });
335
+ return this.sendVideoNote(chatId, videoNote, { ...params, replyToMessageId, businessConnectionId });
333
336
  },
334
337
  delete: () => {
335
338
  const { chatId, messageId } = mustGetMsg();
@@ -534,6 +537,13 @@ class Client extends Composer {
534
537
  const { chatId } = mustGetMsg();
535
538
  return this.deleteChatStickerSet(chatId);
536
539
  },
540
+ getBusinessConnection: () => {
541
+ const { businessConnectionId } = mustGetMsg();
542
+ if (!businessConnectionId) {
543
+ (0, _1_utilities_js_1.UNREACHABLE)();
544
+ }
545
+ return this.getBusinessConnection(businessConnectionId);
546
+ },
537
547
  };
538
548
  return (0, _1_utilities_js_1.cleanObject)(context);
539
549
  });
@@ -639,6 +649,14 @@ class Client extends Composer {
639
649
  const c = {
640
650
  id,
641
651
  api: this.api,
652
+ invoke: async (function_, businessConnectionId) => {
653
+ if (businessConnectionId) {
654
+ return await this.api.invokeWithBusinessConnection({ connection_id: businessConnectionId, query: function_ });
655
+ }
656
+ else {
657
+ return await this.invoke(function_);
658
+ }
659
+ },
642
660
  storage: this.storage,
643
661
  messageStorage: this.messageStorage,
644
662
  guaranteeUpdateDelivery: __classPrivateFieldGet(this, _Client_guaranteeUpdateDelivery, "f"),
@@ -668,6 +686,7 @@ class Client extends Composer {
668
686
  try {
669
687
  const exportedAuth = await this.api.auth.exportAuthorization({ dc_id: dcId });
670
688
  await client.authorize(exportedAuth);
689
+ // throw 1;
671
690
  return true;
672
691
  }
673
692
  catch (err) {
@@ -702,6 +721,7 @@ class Client extends Composer {
702
721
  __classPrivateFieldSet(this, _Client_botInfoManager, new _1_bot_info_manager_js_1.BotInfoManager(c), "f");
703
722
  __classPrivateFieldSet(this, _Client_fileManager, new _1_file_manager_js_1.FileManager(c), "f");
704
723
  __classPrivateFieldSet(this, _Client_reactionManager, new _1_reaction_manager_js_1.ReactionManager(c), "f");
724
+ __classPrivateFieldSet(this, _Client_businessConnectionManager, new _1_business_connection_manager_js_1.BusinessConnectionManager(c), "f");
705
725
  __classPrivateFieldSet(this, _Client_messageManager, new _2_message_manager_js_1.MessageManager({ ...c, fileManager: __classPrivateFieldGet(this, _Client_fileManager, "f") }), "f");
706
726
  __classPrivateFieldSet(this, _Client_callbackQueryManager, new _3_callback_query_manager_js_1.CallbackQueryManager({ ...c, messageManager: __classPrivateFieldGet(this, _Client_messageManager, "f") }), "f");
707
727
  __classPrivateFieldSet(this, _Client_storyManager, new _3_story_manager_js_1.StoryManager({ ...c, fileManager: __classPrivateFieldGet(this, _Client_fileManager, "f"), messageManager: __classPrivateFieldGet(this, _Client_messageManager, "f") }), "f");
@@ -810,9 +830,13 @@ class Client extends Composer {
810
830
  await Promise.all([this.storage.setAuthKey(__classPrivateFieldGet(this, _Client_client, "f").authKey), this.storage.setDc(__classPrivateFieldGet(this, _Client_client, "f").dc), this.storage.setServerSalt(__classPrivateFieldGet(this, _Client_client, "f").serverSalt)]);
811
831
  }
812
832
  async reconnect(dc) {
813
- await __classPrivateFieldGet(this, _Client_client, "f").reconnect(dc);
833
+ await this.disconnect();
834
+ if (dc) {
835
+ await this.setDc(dc);
836
+ }
837
+ await this.connect();
814
838
  }
815
- async [(_Client_client = new WeakMap(), _Client_guaranteeUpdateDelivery = new WeakMap(), _Client_updateManager = new WeakMap(), _Client_networkStatisticsManager = new WeakMap(), _Client_botInfoManager = new WeakMap(), _Client_fileManager = new WeakMap(), _Client_reactionManager = new WeakMap(), _Client_messageManager = new WeakMap(), _Client_storyManager = new WeakMap(), _Client_callbackQueryManager = new WeakMap(), _Client_inlineQueryManager = new WeakMap(), _Client_chatListManager = new WeakMap(), _Client_accountManager = new WeakMap(), _Client_parseMode = new WeakMap(), _Client_publicKeys = new WeakMap(), _Client_ignoreOutgoing = new WeakMap(), _Client_storeMessages = new WeakMap(), _Client_Lauthorize = new WeakMap(), _Client_LpingLoop = new WeakMap(), _Client_LhandleMigrationError = new WeakMap(), _Client_L$initConncetion = new WeakMap(), _Client_namespaceProxies = new WeakMap(), _Client_constructContext = new WeakMap(), _Client_lastPropagatedConnectionState = new WeakMap(), _Client_stateChangeHandler = new WeakMap(), _Client_storageInited = new WeakMap(), _Client_connectionInited = new WeakMap(), _Client_lastPropagatedAuthorizationState = new WeakMap(), _Client_pingLoopStarted = new WeakMap(), _Client_pingLoopAbortController = new WeakMap(), _Client_pingInterval = new WeakMap(), _Client_lastUpdates = new WeakMap(), _Client_handleInvokeError = new WeakMap(), _Client_lastGetMe = new WeakMap(), _Client_instances = new WeakSet(), _Client_getApiId = async function _Client_getApiId() {
839
+ async [(_Client_client = new WeakMap(), _Client_guaranteeUpdateDelivery = new WeakMap(), _Client_updateManager = new WeakMap(), _Client_networkStatisticsManager = new WeakMap(), _Client_botInfoManager = new WeakMap(), _Client_fileManager = new WeakMap(), _Client_reactionManager = new WeakMap(), _Client_businessConnectionManager = new WeakMap(), _Client_messageManager = new WeakMap(), _Client_storyManager = new WeakMap(), _Client_callbackQueryManager = new WeakMap(), _Client_inlineQueryManager = new WeakMap(), _Client_chatListManager = new WeakMap(), _Client_accountManager = new WeakMap(), _Client_parseMode = new WeakMap(), _Client_publicKeys = new WeakMap(), _Client_ignoreOutgoing = new WeakMap(), _Client_storeMessages = new WeakMap(), _Client_Lauthorize = new WeakMap(), _Client_LpingLoop = new WeakMap(), _Client_LhandleMigrationError = new WeakMap(), _Client_L$initConncetion = new WeakMap(), _Client_namespaceProxies = new WeakMap(), _Client_constructContext = new WeakMap(), _Client_lastPropagatedConnectionState = new WeakMap(), _Client_stateChangeHandler = new WeakMap(), _Client_storageInited = new WeakMap(), _Client_connectionInited = new WeakMap(), _Client_lastPropagatedAuthorizationState = new WeakMap(), _Client_pingLoopStarted = new WeakMap(), _Client_pingLoopAbortController = new WeakMap(), _Client_pingInterval = new WeakMap(), _Client_lastUpdates = new WeakMap(), _Client_handleInvokeError = new WeakMap(), _Client_lastGetMe = new WeakMap(), _Client_instances = new WeakSet(), _Client_getApiId = async function _Client_getApiId() {
816
840
  const apiId = this.apiId || await this.storage.getApiId();
817
841
  if (!apiId) {
818
842
  throw new Error("apiId not set");
@@ -1054,6 +1078,9 @@ class Client extends Composer {
1054
1078
  inputPeer.access_hash = await __classPrivateFieldGet(this, _Client_instances, "m", _Client_getUserAccessHash).call(this, inputPeer.user_id);
1055
1079
  }
1056
1080
  }
1081
+ else {
1082
+ throw new _0_errors_js_1.AccessError(`Cannot access the chat ${id} because there is no access hash for it.`);
1083
+ }
1057
1084
  return inputPeer;
1058
1085
  }
1059
1086
  /**
@@ -1064,7 +1091,7 @@ class Client extends Composer {
1064
1091
  async getInputChannel(id) {
1065
1092
  const inputPeer = await this.getInputPeer(id);
1066
1093
  if (!(inputPeer instanceof _2_tl_js_1.types.InputPeerChannel)) {
1067
- (0, _1_utilities_js_1.UNREACHABLE)();
1094
+ throw new TypeError(`The chat ${id} is not a channel neither a supergroup.`);
1068
1095
  }
1069
1096
  return new _2_tl_js_1.types.InputChannel(inputPeer);
1070
1097
  }
@@ -1076,7 +1103,7 @@ class Client extends Composer {
1076
1103
  async getInputUser(id) {
1077
1104
  const inputPeer = await this.getInputPeer(id);
1078
1105
  if (!(inputPeer instanceof _2_tl_js_1.types.InputPeerUser)) {
1079
- (0, _1_utilities_js_1.UNREACHABLE)();
1106
+ throw new TypeError(`The chat ${id} is not a private chat.`);
1080
1107
  }
1081
1108
  return new _2_tl_js_1.types.InputUser(inputPeer);
1082
1109
  }
@@ -1231,7 +1258,7 @@ class Client extends Composer {
1231
1258
  return new _2_tl_js_1.types.InputPeerChannel({ channel_id: (0, _2_tl_js_1.chatIdToPeerId)(id), access_hash: accessHash ?? 0n });
1232
1259
  }
1233
1260
  else {
1234
- throw new Error("ID format unknown or not implemented");
1261
+ throw new _0_errors_js_1.InputError("The ID is of an format unknown.");
1235
1262
  }
1236
1263
  }, getEntity)](peer) {
1237
1264
  const id = (0, _2_tl_js_1.peerToChatId)(peer);
@@ -1244,6 +1271,77 @@ class Client extends Composer {
1244
1271
  }
1245
1272
  return await this.messageStorage.getEntity(id);
1246
1273
  }
1274
+ //
1275
+ // ========================= ACCOUNT ========================= //
1276
+ //
1277
+ /**
1278
+ * Get information on the currently authorized user.
1279
+ *
1280
+ * @method ac
1281
+ */
1282
+ async getMe() {
1283
+ let user_ = await this[getEntity](new _2_tl_js_1.types.PeerUser({ user_id: BigInt(await __classPrivateFieldGet(this, _Client_instances, "m", _Client_getSelfId).call(this)) }));
1284
+ if (user_ == null) {
1285
+ const users = await this.api.users.getUsers({ id: [new _2_tl_js_1.types.InputUserSelf()] });
1286
+ user_ = users[0][_2_tl_js_1.as](_2_tl_js_1.types.User);
1287
+ await this.messageStorage.setEntity(user_);
1288
+ }
1289
+ const user = (0, _3_types_js_1.constructUser)(user_);
1290
+ __classPrivateFieldSet(this, _Client_lastGetMe, user, "f");
1291
+ return user;
1292
+ }
1293
+ /**
1294
+ * Show a username in the current account, a bot account, a supergroup, or a channel's profile. User-only.
1295
+ *
1296
+ * @method ac
1297
+ * @param id `"me"`, a bot ID, a supergroup ID, or a channel ID.
1298
+ * @param username The username to show.
1299
+ */
1300
+ async showUsername(id, username) {
1301
+ await __classPrivateFieldGet(this, _Client_accountManager, "f").showUsername(id, username);
1302
+ }
1303
+ /**
1304
+ * Hide a username from the current account, a bot account, a supergroup, or a channel's profile. User-only.
1305
+ *
1306
+ * @method ac
1307
+ * @param id `"me"`, a bot ID, a supergroup ID, or a channel ID.
1308
+ * @param username The username to hide.
1309
+ */
1310
+ async hideUsername(id, username) {
1311
+ await __classPrivateFieldGet(this, _Client_accountManager, "f").hideUsername(id, username);
1312
+ }
1313
+ /**
1314
+ * Reorder the usernames of the current account, a bot account, a supergroup, or a channel's profile. User-only.
1315
+ *
1316
+ * @method ac
1317
+ * @param id `"me"`, a bot ID, a supergroup ID, or a channel ID.
1318
+ * @param order The new order to use.
1319
+ * @returns Whether the order was changed.
1320
+ */
1321
+ async reorderUsernames(id, order) {
1322
+ return await __classPrivateFieldGet(this, _Client_accountManager, "f").reorderUsernames(id, order);
1323
+ }
1324
+ /**
1325
+ * Hide all usernames from the a supergroup or a channel's profile. User-only.
1326
+ *
1327
+ * @method ac
1328
+ * @param id A supergroup ID or a channel ID.
1329
+ */
1330
+ async hideUsernames(id) {
1331
+ return await __classPrivateFieldGet(this, _Client_accountManager, "f").hideUsernames(id);
1332
+ }
1333
+ /**
1334
+ * Get a business connection. Bot-only.
1335
+ *
1336
+ * @method ac
1337
+ * @param id The identifier of the business connection.
1338
+ */
1339
+ async getBusinessConnection(id) {
1340
+ return await __classPrivateFieldGet(this, _Client_businessConnectionManager, "f").getBusinessConnection(id);
1341
+ }
1342
+ //
1343
+ // ========================= MESSAGES ========================= //
1344
+ //
1247
1345
  /**
1248
1346
  * Send a text message.
1249
1347
  *
@@ -1255,6 +1353,154 @@ class Client extends Composer {
1255
1353
  async sendMessage(chatId, text, params) {
1256
1354
  return await __classPrivateFieldGet(this, _Client_messageManager, "f").sendMessage(chatId, text, params);
1257
1355
  }
1356
+ /**
1357
+ * Send a photo.
1358
+ *
1359
+ * @method ms
1360
+ * @param chatId The chat to send the photo to.
1361
+ * @param photo The photo to send.
1362
+ * @returns The sent photo.
1363
+ */
1364
+ async sendPhoto(chatId, photo, params) {
1365
+ return await __classPrivateFieldGet(this, _Client_messageManager, "f").sendPhoto(chatId, photo, params);
1366
+ }
1367
+ /**
1368
+ * Send a document.
1369
+ *
1370
+ * @method ms
1371
+ * @param chatId The chat to send the document to.
1372
+ * @param document The document to send.
1373
+ * @returns The sent document.
1374
+ */
1375
+ async sendDocument(chatId, document, params) {
1376
+ return await __classPrivateFieldGet(this, _Client_messageManager, "f").sendDocument(chatId, document, params);
1377
+ }
1378
+ /**
1379
+ * Send a sticker.
1380
+ *
1381
+ * @method ms
1382
+ * @param chatId The chat to send the sticker to.
1383
+ * @param document The sticker to send.
1384
+ * @returns The sent sticker.
1385
+ */
1386
+ async sendSticker(chatId, sticker, params) {
1387
+ return await __classPrivateFieldGet(this, _Client_messageManager, "f").sendSticker(chatId, sticker, params);
1388
+ }
1389
+ /**
1390
+ * Send a video.
1391
+ *
1392
+ * @method ms
1393
+ * @param chatId The chat to send the video to.
1394
+ * @param video The video to send.
1395
+ * @returns The sent video.
1396
+ */
1397
+ async sendVideo(chatId, video, params) {
1398
+ return await __classPrivateFieldGet(this, _Client_messageManager, "f").sendVideo(chatId, video, params);
1399
+ }
1400
+ /**
1401
+ * Send an animation.
1402
+ *
1403
+ * @method ms
1404
+ * @param chatId The chat to send the animation to.
1405
+ * @param animation The animation to send.
1406
+ * @returns The sent animation.
1407
+ */
1408
+ async sendAnimation(chatId, animation, params) {
1409
+ return await __classPrivateFieldGet(this, _Client_messageManager, "f").sendAnimation(chatId, animation, params);
1410
+ }
1411
+ /**
1412
+ * Send a voice message.
1413
+ *
1414
+ * @method ms
1415
+ * @param chatId The chat to send the voice message to.
1416
+ * @param voice The voice to send.
1417
+ * @returns The sent voice message.
1418
+ */
1419
+ async sendVoice(chatId, voice, params) {
1420
+ return await __classPrivateFieldGet(this, _Client_messageManager, "f").sendVoice(chatId, voice, params);
1421
+ }
1422
+ /**
1423
+ * Send an audio file.
1424
+ *
1425
+ * @method ms
1426
+ * @param chatId The chat to send the audio file to.
1427
+ * @param audio The audio to send.
1428
+ * @returns The sent audio filr.
1429
+ */
1430
+ async sendAudio(chatId, audio, params) {
1431
+ return await __classPrivateFieldGet(this, _Client_messageManager, "f").sendAudio(chatId, audio, params);
1432
+ }
1433
+ /**
1434
+ * Send a video note.
1435
+ *
1436
+ * @method ms
1437
+ * @param chatId The chat to send the video note to.
1438
+ * @param videoNote The video note to send.
1439
+ * @returns The sent video note.
1440
+ */
1441
+ async sendVideoNote(chatId, videoNote, params) {
1442
+ return await __classPrivateFieldGet(this, _Client_messageManager, "f").sendVideoNote(chatId, videoNote, params);
1443
+ }
1444
+ /**
1445
+ * Send a location.
1446
+ *
1447
+ * @method ms
1448
+ * @param chatId The chat to send the location to.
1449
+ * @param latitude The location's latitude.
1450
+ * @param longitude The location's longitude.
1451
+ * @returns The sent location.
1452
+ */
1453
+ async sendLocation(chatId, latitude, longitude, params) {
1454
+ return await __classPrivateFieldGet(this, _Client_messageManager, "f").sendLocation(chatId, latitude, longitude, params);
1455
+ }
1456
+ /**
1457
+ * Send a contact.
1458
+ *
1459
+ * @method ms
1460
+ * @param chatId The chat to send the contact to.
1461
+ * @param firstName The contact's first name.
1462
+ * @param number The contact's phone number.
1463
+ * @returns The sent contact.
1464
+ */
1465
+ async sendContact(chatId, firstName, number, params) {
1466
+ return await __classPrivateFieldGet(this, _Client_messageManager, "f").sendContact(chatId, firstName, number, params);
1467
+ }
1468
+ /**
1469
+ * Send a dice.
1470
+ *
1471
+ * @method ms
1472
+ * @param chatId The chat to send the dice to.
1473
+ * @returns The sent dice.
1474
+ */
1475
+ async sendDice(chatId, params) {
1476
+ return await __classPrivateFieldGet(this, _Client_messageManager, "f").sendDice(chatId, params);
1477
+ }
1478
+ /**
1479
+ * Send a venue.
1480
+ *
1481
+ * @method ms
1482
+ * @param chatId The chat to send the venue to.
1483
+ * @param latitude The latitude of the venue.
1484
+ * @param longitude The longitude of the venue.
1485
+ * @param title The title of the venue.
1486
+ * @param address The written address of the venue.
1487
+ * @returns The sent venue.
1488
+ */
1489
+ async sendVenue(chatId, latitude, longitude, title, address, params) {
1490
+ return await __classPrivateFieldGet(this, _Client_messageManager, "f").sendVenue(chatId, latitude, longitude, title, address, params);
1491
+ }
1492
+ /**
1493
+ * Send a poll.
1494
+ *
1495
+ * @method ms
1496
+ * @param chatId The chat to send the poll to.
1497
+ * @param question The poll's question.
1498
+ * @param options The poll's options.
1499
+ * @returns The sent poll.
1500
+ */
1501
+ async sendPoll(chatId, question, options, params) {
1502
+ return await __classPrivateFieldGet(this, _Client_messageManager, "f").sendPoll(chatId, question, options, params);
1503
+ }
1258
1504
  /**
1259
1505
  * Edit a message's text.
1260
1506
  *
@@ -1351,82 +1597,87 @@ class Client extends Composer {
1351
1597
  return await __classPrivateFieldGet(this, _Client_messageManager, "f").getMessage(chatId, messageId);
1352
1598
  }
1353
1599
  /**
1354
- * Download a file.
1600
+ * Delete multiple messages.
1355
1601
  *
1356
- * @method fs
1357
- * @param fileId The identifier of the file to download.
1358
- * @example ```ts
1359
- * for await (const chunk of client.download(fileId, { chunkSize: 256 * 1024 })) {
1360
- * await outFile.write(chunk);
1361
- * }
1362
- * ```
1363
- * @returns A generator yielding the contents of the file.
1602
+ * @method ms
1603
+ * @param chatId The identifier of the chat that contains the messages.
1604
+ * @param messageIds The identifiers of the messages to delete.
1364
1605
  */
1365
- async *download(fileId, params) {
1366
- for await (const chunk of __classPrivateFieldGet(this, _Client_fileManager, "f").download(fileId, params)) {
1367
- yield chunk;
1368
- }
1606
+ async deleteMessages(chatId, messageIds, params) {
1607
+ await __classPrivateFieldGet(this, _Client_messageManager, "f").deleteMessages(chatId, messageIds, params);
1369
1608
  }
1370
1609
  /**
1371
- * Forward multiple messages.
1610
+ * Delete a single message.
1372
1611
  *
1373
1612
  * @method ms
1374
- * @param from The identifier of the chat to forward the messages from.
1375
- * @param to The identifier of the chat to forward the messages to.
1376
- * @param messageIds The identifiers of the messages to forward.
1377
- * @returns The forwarded messages.
1613
+ * @param chatId The identifier of the chat that contains the message.
1614
+ * @param messageId The identifier of the message to delete.
1378
1615
  */
1379
- async forwardMessages(from, to, messageIds, params) {
1380
- return await __classPrivateFieldGet(this, _Client_messageManager, "f").forwardMessages(from, to, messageIds, params);
1616
+ async deleteMessage(chatId, messageId, params) {
1617
+ await __classPrivateFieldGet(this, _Client_messageManager, "f").deleteMessages(chatId, [messageId], params);
1381
1618
  }
1382
1619
  /**
1383
- * Forward a single message.
1620
+ * Delete all messages sent by a specific member of a chat. User-only.
1384
1621
  *
1385
1622
  * @method ms
1386
- * @param from The identifier of the chat to forward the message from.
1387
- * @param to The identifier of the chat to forward the message to.
1388
- * @param messageId The identifier of the message to forward.
1389
- * @returns The forwarded message.
1623
+ * @param chatId The identifier of the chat. Must be a supergroup.
1624
+ * @param memberId The identifier of the member.
1390
1625
  */
1391
- async forwardMessage(from, to, messageId, params) {
1392
- return await this.forwardMessages(from, to, [messageId], params).then((v) => v[0]);
1626
+ async deleteChatMemberMessages(chatId, memberId) {
1627
+ await __classPrivateFieldGet(this, _Client_messageManager, "f").deleteChatMemberMessages(chatId, memberId);
1393
1628
  }
1394
1629
  /**
1395
- * Get information on the currently authorized user.
1630
+ * Pin a message in a chat.
1396
1631
  *
1397
- * @method ac
1632
+ * @method ms
1633
+ * @param chatId The identifier of the chat that contains the message.
1634
+ * @param messageId The message's identifier.
1398
1635
  */
1399
- async getMe() {
1400
- let user_ = await this[getEntity](new _2_tl_js_1.types.PeerUser({ user_id: BigInt(await __classPrivateFieldGet(this, _Client_instances, "m", _Client_getSelfId).call(this)) }));
1401
- if (user_ == null) {
1402
- const users = await this.api.users.getUsers({ id: [new _2_tl_js_1.types.InputUserSelf()] });
1403
- user_ = users[0][_2_tl_js_1.as](_2_tl_js_1.types.User);
1404
- await this.messageStorage.setEntity(user_);
1405
- }
1406
- const user = (0, _3_types_js_1.constructUser)(user_);
1407
- __classPrivateFieldSet(this, _Client_lastGetMe, user, "f");
1408
- return user;
1636
+ async pinMessage(chatId, messageId, params) {
1637
+ await __classPrivateFieldGet(this, _Client_messageManager, "f").pinMessage(chatId, messageId, params);
1409
1638
  }
1410
1639
  /**
1411
- * Answer a callback query. Bot-only.
1640
+ * Unpin a pinned message.
1412
1641
  *
1413
- * @method cq
1414
- * @param id ID of the callback query to answer.
1642
+ * @method ms
1643
+ * @param chatId The identifier of the chat that contains the message.
1644
+ * @param messageId The message's identifier.
1415
1645
  */
1416
- async answerCallbackQuery(id, params) {
1417
- await __classPrivateFieldGet(this, _Client_callbackQueryManager, "f").answerCallbackQuery(id, params);
1646
+ async unpinMessage(chatId, messageId) {
1647
+ await __classPrivateFieldGet(this, _Client_messageManager, "f").unpinMessage(chatId, messageId);
1418
1648
  }
1419
1649
  /**
1420
- * Send a poll.
1650
+ * Unpin all pinned messages.
1421
1651
  *
1422
1652
  * @method ms
1423
- * @param chatId The chat to send the poll to.
1424
- * @param question The poll's question.
1425
- * @param options The poll's options.
1426
- * @returns The sent poll.
1653
+ * @param chatId The identifier of the chat.
1427
1654
  */
1428
- async sendPoll(chatId, question, options, params) {
1429
- return await __classPrivateFieldGet(this, _Client_messageManager, "f").sendPoll(chatId, question, options, params);
1655
+ async unpinMessages(chatId) {
1656
+ await __classPrivateFieldGet(this, _Client_messageManager, "f").unpinMessages(chatId);
1657
+ }
1658
+ /**
1659
+ * Forward multiple messages.
1660
+ *
1661
+ * @method ms
1662
+ * @param from The identifier of the chat to forward the messages from.
1663
+ * @param to The identifier of the chat to forward the messages to.
1664
+ * @param messageIds The identifiers of the messages to forward.
1665
+ * @returns The forwarded messages.
1666
+ */
1667
+ async forwardMessages(from, to, messageIds, params) {
1668
+ return await __classPrivateFieldGet(this, _Client_messageManager, "f").forwardMessages(from, to, messageIds, params);
1669
+ }
1670
+ /**
1671
+ * Forward a single message.
1672
+ *
1673
+ * @method ms
1674
+ * @param from The identifier of the chat to forward the message from.
1675
+ * @param to The identifier of the chat to forward the message to.
1676
+ * @param messageId The identifier of the message to forward.
1677
+ * @returns The forwarded message.
1678
+ */
1679
+ async forwardMessage(from, to, messageId, params) {
1680
+ return await this.forwardMessages(from, to, [messageId], params).then((v) => v[0]);
1430
1681
  }
1431
1682
  /**
1432
1683
  * Stop a poll.
@@ -1451,446 +1702,393 @@ class Client extends Composer {
1451
1702
  await __classPrivateFieldGet(this, _Client_messageManager, "f").sendChatAction(chatId, action, params);
1452
1703
  }
1453
1704
  /**
1454
- * Upload a file.
1455
- *
1456
- * @method fs
1457
- * @param contents The contents of the file.
1458
- * @returns The uploaded file.
1459
- */
1460
- // deno-lint-ignore no-explicit-any
1461
- async upload(contents, params) {
1462
- return await __classPrivateFieldGet(this, _Client_fileManager, "f").upload(contents, params);
1463
- }
1464
- /**
1465
- * Set the bot's commands in the given scope and/or language. Bot-only.
1466
- *
1467
- * @method bs
1468
- * @param commands The commands to set.
1469
- */
1470
- async setMyCommands(commands, params) {
1471
- await __classPrivateFieldGet(this, _Client_botInfoManager, "f").setMyCommands(commands, params);
1472
- }
1473
- /**
1474
- * Get the bot's commands in the given scope and/or language. Bot-only.
1475
- *
1476
- * @method bs
1477
- * @returns The current bot's commands in the specified language.
1478
- */
1479
- async getMyCommands(params) {
1480
- return await __classPrivateFieldGet(this, _Client_botInfoManager, "f").getMyCommands(params);
1481
- }
1482
- /**
1483
- * Answer an inline query. Bot-only.
1484
- *
1485
- * @method iq
1486
- * @param id The ID of the inline query to answer.
1487
- * @param results The results to answer with.
1488
- */
1489
- async answerInlineQuery(id, results, params) {
1490
- await __classPrivateFieldGet(this, _Client_inlineQueryManager, "f").answerInlineQuery(id, results, params);
1491
- }
1492
- /**
1493
- * Set the bot's description in the given language. Bot-only.
1494
- *
1495
- * @method bs
1496
- */
1497
- async setMyDescription(params) {
1498
- await __classPrivateFieldGet(this, _Client_botInfoManager, "f").setMyDescription(params);
1499
- }
1500
- /**
1501
- * Set the bot's name in the given language. Bot-only.
1502
- *
1503
- * @method bs
1504
- */
1505
- async setMyName(params) {
1506
- await __classPrivateFieldGet(this, _Client_botInfoManager, "f").setMyName(params);
1507
- }
1508
- /**
1509
- * Set the bot's short description in the given language. Bot-only.
1705
+ * Search the messages of a chat. User-only.
1510
1706
  *
1511
- * @method bs
1707
+ * @method ms
1708
+ * @param chatId The identifier of the chat to search the messages in.
1709
+ * @param query The message search query.
1512
1710
  */
1513
- async setMyShortDescription(params) {
1514
- await __classPrivateFieldGet(this, _Client_botInfoManager, "f").setMyShortDescription(params);
1711
+ async searchMessages(chatId, query, params) {
1712
+ return await __classPrivateFieldGet(this, _Client_messageManager, "f").searchMessages(chatId, query, params);
1515
1713
  }
1714
+ //
1715
+ // ========================= FILES ========================= //
1716
+ //
1516
1717
  /**
1517
- * Get the bot's description in the given language. Bot-only.
1718
+ * Download a file.
1518
1719
  *
1519
- * @method bs
1520
- * @returns The current bot's description in the specified language.
1720
+ * @method fs
1721
+ * @param fileId The identifier of the file to download.
1722
+ * @example ```ts
1723
+ * for await (const chunk of client.download(fileId, { chunkSize: 256 * 1024 })) {
1724
+ * await outFile.write(chunk);
1725
+ * }
1726
+ * ```
1727
+ * @returns A generator yielding the contents of the file.
1521
1728
  */
1522
- async getMyDescription(params) {
1523
- return await __classPrivateFieldGet(this, _Client_botInfoManager, "f").getMyDescription(params);
1729
+ async *download(fileId, params) {
1730
+ for await (const chunk of __classPrivateFieldGet(this, _Client_fileManager, "f").download(fileId, params)) {
1731
+ yield chunk;
1732
+ }
1524
1733
  }
1525
1734
  /**
1526
- * Get the bot's name in the given language. Bot-only.
1735
+ * Get custom emoji documents for download.
1527
1736
  *
1528
- * @method bs
1529
- * @returns The current bot's name in the specified language.
1737
+ * @method fs
1738
+ * @param id Identifier of one or more of custom emojis.
1739
+ * @returns The custom emoji documents.
1530
1740
  */
1531
- async getMyName(params) {
1532
- return await __classPrivateFieldGet(this, _Client_botInfoManager, "f").getMyName(params);
1741
+ async getCustomEmojiStickers(id) {
1742
+ return await __classPrivateFieldGet(this, _Client_fileManager, "f").getCustomEmojiStickers(id);
1533
1743
  }
1744
+ //
1745
+ // ========================= CHATS ========================= //
1746
+ //
1534
1747
  /**
1535
- * Get the bot's short description in the given language. Bot-only.
1748
+ * Get chats from a chat list. User-only.
1536
1749
  *
1537
- * @method bs
1538
- * @returns The current bot's short description in the specified language.
1750
+ * @method ch
1539
1751
  */
1540
- async getMyShortDescription(params) {
1541
- return await __classPrivateFieldGet(this, _Client_botInfoManager, "f").getMyShortDescription(params);
1752
+ async getChats(params) {
1753
+ return await __classPrivateFieldGet(this, _Client_chatListManager, "f").getChats(params?.from, params?.after, params?.limit);
1542
1754
  }
1543
1755
  /**
1544
- * Delete multiple messages.
1756
+ * Get a chat.
1545
1757
  *
1546
- * @method ms
1547
- * @param chatId The identifier of the chat that contains the messages.
1548
- * @param messageIds The identifiers of the messages to delete.
1758
+ * @method ch
1549
1759
  */
1550
- async deleteMessages(chatId, messageIds, params) {
1551
- await __classPrivateFieldGet(this, _Client_messageManager, "f").deleteMessages(chatId, messageIds, params);
1760
+ async getChat(chatId) {
1761
+ return await __classPrivateFieldGet(this, _Client_chatListManager, "f").getChat(chatId);
1552
1762
  }
1553
1763
  /**
1554
- * Delete a single message.
1764
+ * Get chat history. User-only.
1555
1765
  *
1556
- * @method ms
1557
- * @param chatId The identifier of the chat that contains the message.
1558
- * @param messageId The identifier of the message to delete.
1766
+ * @method ch
1767
+ * @param chatId The identifier of the chat to get its history.
1559
1768
  */
1560
- async deleteMessage(chatId, messageId, params) {
1561
- await __classPrivateFieldGet(this, _Client_messageManager, "f").deleteMessages(chatId, [messageId], params);
1769
+ async getHistory(chatId, params) {
1770
+ return await __classPrivateFieldGet(this, _Client_messageManager, "f").getHistory(chatId, params);
1562
1771
  }
1563
1772
  /**
1564
- * Send a photo.
1773
+ * Set a chat's available reactions. User-only.
1565
1774
  *
1566
- * @method ms
1567
- * @param chatId The chat to send the photo to.
1568
- * @param photo The photo to send.
1569
- * @returns The sent photo.
1775
+ * @method ch
1776
+ * @param chatId The identifier of the chat.
1777
+ * @param availableReactions The new available reactions.
1570
1778
  */
1571
- async sendPhoto(chatId, photo, params) {
1572
- return await __classPrivateFieldGet(this, _Client_messageManager, "f").sendPhoto(chatId, photo, params);
1779
+ async setAvailableReactions(chatId, availableReactions) {
1780
+ await __classPrivateFieldGet(this, _Client_messageManager, "f").setAvailableReactions(chatId, availableReactions);
1573
1781
  }
1574
1782
  /**
1575
- * Send a document.
1783
+ * Set a chat's photo.
1576
1784
  *
1577
- * @method ms
1578
- * @param chatId The chat to send the document to.
1579
- * @param document The document to send.
1580
- * @returns The sent document.
1785
+ * @method ch
1786
+ * @param chatId The identifier of the chat.
1787
+ * @param photo A photo to set as the chat's photo.
1581
1788
  */
1582
- async sendDocument(chatId, document, params) {
1583
- return await __classPrivateFieldGet(this, _Client_messageManager, "f").sendDocument(chatId, document, params);
1789
+ async setChatPhoto(chatId, photo, params) {
1790
+ await __classPrivateFieldGet(this, _Client_messageManager, "f").setChatPhoto(chatId, photo, params);
1584
1791
  }
1585
1792
  /**
1586
- * Send a sticker.
1793
+ * Delete a chat's photo.
1587
1794
  *
1588
- * @method ms
1589
- * @param chatId The chat to send the sticker to.
1590
- * @param document The sticker to send.
1591
- * @returns The sent sticker.
1795
+ * @method ch
1796
+ * @param chatId The identifier of the chat.
1592
1797
  */
1593
- async sendSticker(chatId, sticker, params) {
1594
- return await __classPrivateFieldGet(this, _Client_messageManager, "f").sendSticker(chatId, sticker, params);
1798
+ async deleteChatPhoto(chatId) {
1799
+ await __classPrivateFieldGet(this, _Client_messageManager, "f").deleteChatPhoto(chatId);
1595
1800
  }
1596
1801
  /**
1597
- * Send a video.
1802
+ * Ban a member from a chat.
1598
1803
  *
1599
- * @method ms
1600
- * @param chatId The chat to send the video to.
1601
- * @param video The video to send.
1602
- * @returns The sent video.
1804
+ * @method ch
1805
+ * @param chatId The identifier of the chat.
1806
+ * @param memberId The identifier of the member.
1603
1807
  */
1604
- async sendVideo(chatId, video, params) {
1605
- return await __classPrivateFieldGet(this, _Client_messageManager, "f").sendVideo(chatId, video, params);
1808
+ async banChatMember(chatId, memberId, params) {
1809
+ await __classPrivateFieldGet(this, _Client_messageManager, "f").banChatMember(chatId, memberId, params);
1606
1810
  }
1607
1811
  /**
1608
- * Send an animation.
1812
+ * Unban a member from a chat.
1609
1813
  *
1610
- * @method ms
1611
- * @param chatId The chat to send the animation to.
1612
- * @param animation The animation to send.
1613
- * @returns The sent animation.
1814
+ * @method ch
1815
+ * @param chatId The identifier of the chat. Must be a supergroup.
1816
+ * @param memberId The identifier of the member.
1614
1817
  */
1615
- async sendAnimation(chatId, animation, params) {
1616
- return await __classPrivateFieldGet(this, _Client_messageManager, "f").sendAnimation(chatId, animation, params);
1818
+ async unbanChatMember(chatId, memberId) {
1819
+ await __classPrivateFieldGet(this, _Client_messageManager, "f").unbanChatMember(chatId, memberId);
1617
1820
  }
1618
1821
  /**
1619
- * Send a voice message.
1822
+ * Kick a member from a chat. Same as a banChatMember call followed by unbanChatMember.
1620
1823
  *
1621
- * @method ms
1622
- * @param chatId The chat to send the voice message to.
1623
- * @param voice The voice to send.
1624
- * @returns The sent voice message.
1824
+ * @method ch
1825
+ * @param chatId The identifier of the chat. Must be a supergroup.
1826
+ * @param memberId The identifier of the member.
1625
1827
  */
1626
- async sendVoice(chatId, voice, params) {
1627
- return await __classPrivateFieldGet(this, _Client_messageManager, "f").sendVoice(chatId, voice, params);
1828
+ async kickChatMember(chatId, memberId) {
1829
+ await __classPrivateFieldGet(this, _Client_messageManager, "f").banChatMember(chatId, memberId);
1830
+ await __classPrivateFieldGet(this, _Client_messageManager, "f").unbanChatMember(chatId, memberId);
1628
1831
  }
1629
1832
  /**
1630
- * Send an audio file.
1833
+ * Set the rights of a chat member.
1631
1834
  *
1632
- * @method ms
1633
- * @param chatId The chat to send the audio file to.
1634
- * @param audio The audio to send.
1635
- * @returns The sent audio filr.
1835
+ * @method ch
1836
+ * @param chatId The identifier of the chat. Must be a supergroup.
1837
+ * @param memberId The identifier of a member.
1636
1838
  */
1637
- async sendAudio(chatId, audio, params) {
1638
- return await __classPrivateFieldGet(this, _Client_messageManager, "f").sendAudio(chatId, audio, params);
1839
+ async setChatMemberRights(chatId, memberId, params) {
1840
+ await __classPrivateFieldGet(this, _Client_messageManager, "f").setChatMemberRights(chatId, memberId, params);
1639
1841
  }
1640
1842
  /**
1641
- * Send a video note.
1843
+ * Get the administrators of a chat.
1642
1844
  *
1643
- * @method ms
1644
- * @param chatId The chat to send the video note to.
1645
- * @param videoNote The video note to send.
1646
- * @returns The sent video note.
1845
+ * @method ch
1846
+ * @param chatId The identifier of the chat.
1847
+ * @returns The chat's administrators.
1647
1848
  */
1648
- async sendVideoNote(chatId, videoNote, params) {
1649
- return await __classPrivateFieldGet(this, _Client_messageManager, "f").sendVideoNote(chatId, videoNote, params);
1849
+ async getChatAdministrators(chatId) {
1850
+ return await __classPrivateFieldGet(this, _Client_messageManager, "f").getChatAdministrators(chatId);
1650
1851
  }
1651
1852
  /**
1652
- * Send a location.
1853
+ * Enable join requests in a chat. User-only.
1653
1854
  *
1654
- * @method ms
1655
- * @param chatId The chat to send the location to.
1656
- * @param latitude The location's latitude.
1657
- * @param longitude The location's longitude.
1658
- * @returns The sent location.
1855
+ * @method ch
1856
+ * @param chatId The identifier of the chat. Must be a channel or a supergroup.
1659
1857
  */
1660
- async sendLocation(chatId, latitude, longitude, params) {
1661
- return await __classPrivateFieldGet(this, _Client_messageManager, "f").sendLocation(chatId, latitude, longitude, params);
1858
+ async enableJoinRequests(chatId) {
1859
+ await __classPrivateFieldGet(this, _Client_messageManager, "f").enableJoinRequests(chatId);
1662
1860
  }
1663
1861
  /**
1664
- * Send a contact.
1862
+ * Disable join requests in a chat. User-only.
1665
1863
  *
1666
- * @method ms
1667
- * @param chatId The chat to send the contact to.
1668
- * @param firstName The contact's first name.
1669
- * @param number The contact's phone number.
1670
- * @returns The sent contact.
1864
+ * @method ch
1865
+ * @param chatId The identifier of the chat. Must be a channel or a supergroup.
1671
1866
  */
1672
- async sendContact(chatId, firstName, number, params) {
1673
- return await __classPrivateFieldGet(this, _Client_messageManager, "f").sendContact(chatId, firstName, number, params);
1867
+ async disableJoinRequests(chatId) {
1868
+ await __classPrivateFieldGet(this, _Client_messageManager, "f").disableJoinRequests(chatId);
1674
1869
  }
1675
1870
  /**
1676
- * Send a dice.
1871
+ * Get inactive chats. User-only.
1677
1872
  *
1678
- * @method ms
1679
- * @param chatId The chat to send the dice to.
1680
- * @returns The sent dice.
1873
+ * @method ch
1874
+ * @retuns A list of inactive chats the current user is member of.
1681
1875
  */
1682
- async sendDice(chatId, params) {
1683
- return await __classPrivateFieldGet(this, _Client_messageManager, "f").sendDice(chatId, params);
1876
+ async getInactiveChats() {
1877
+ return await __classPrivateFieldGet(this, _Client_accountManager, "f").getInactiveChats();
1684
1878
  }
1685
1879
  /**
1686
- * Send a venue.
1880
+ * Get the invite links created for a chat. User-only.
1687
1881
  *
1688
- * @method ms
1689
- * @param chatId The chat to send the venue to.
1690
- * @param latitude The latitude of the venue.
1691
- * @param longitude The longitude of the venue.
1692
- * @param title The title of the venue.
1693
- * @param address The written address of the venue.
1694
- * @returns The sent venue.
1882
+ * @method ch
1883
+ * @param chatId The identifier of the chat.
1884
+ * @returns The invite links created for the chat. This might be a subset of the results if they were less than `limit`. The parameters `afterDate` and `afterInviteLink` can be used for pagination.
1695
1885
  */
1696
- async sendVenue(chatId, latitude, longitude, title, address, params) {
1697
- return await __classPrivateFieldGet(this, _Client_messageManager, "f").sendVenue(chatId, latitude, longitude, title, address, params);
1886
+ async getCreatedInviteLinks(chatId, params) {
1887
+ return await __classPrivateFieldGet(this, _Client_messageManager, "f").getCreatedInviteLinks(chatId, params);
1698
1888
  }
1699
1889
  /**
1700
- * Get network statistics. This might not always be available.
1890
+ * Join a chat. User-only.
1701
1891
  *
1702
- * @method mc
1892
+ * @method ch
1893
+ * @param chatId The identifier of the chat to join.
1703
1894
  */
1704
- async getNetworkStatistics() {
1705
- return await __classPrivateFieldGet(this, _Client_networkStatisticsManager, "f").getNetworkStatistics();
1895
+ async joinChat(chatId) {
1896
+ await __classPrivateFieldGet(this, _Client_messageManager, "f").joinChat(chatId);
1706
1897
  }
1707
1898
  /**
1708
- * Get chats from a chat list. User-only.
1899
+ * Leave a chat.
1709
1900
  *
1710
1901
  * @method ch
1902
+ * @param chatId The identifier of the chat to leave.
1711
1903
  */
1712
- async getChats(params) {
1713
- return await __classPrivateFieldGet(this, _Client_chatListManager, "f").getChats(params?.from, params?.after, params?.limit);
1904
+ async leaveChat(chatId) {
1905
+ await __classPrivateFieldGet(this, _Client_messageManager, "f").leaveChat(chatId);
1714
1906
  }
1715
1907
  /**
1716
- * Get a chat.
1908
+ * Get information on a user's chat membership.
1717
1909
  *
1718
1910
  * @method ch
1911
+ * @param chatId The identifier of a chat that includes the user.
1912
+ * @param userId The identifier of the user.
1719
1913
  */
1720
- async getChat(chatId) {
1721
- return await __classPrivateFieldGet(this, _Client_chatListManager, "f").getChat(chatId);
1914
+ async getChatMember(chatId, userId) {
1915
+ return await __classPrivateFieldGet(this, _Client_messageManager, "f").getChatMember(chatId, userId);
1722
1916
  }
1723
1917
  /**
1724
- * Get chat history. User-only.
1918
+ * Set a chat's sticker set.
1725
1919
  *
1726
1920
  * @method ch
1727
- * @param chatId The identifier of the chat to get its history.
1921
+ * @param chatId The identifier of the chat. Must be a supergroup.
1922
+ * @param setName The name of the set.
1728
1923
  */
1729
- async getHistory(chatId, params) {
1730
- return await __classPrivateFieldGet(this, _Client_messageManager, "f").getHistory(chatId, params);
1924
+ async setChatStickerSet(chatId, setName) {
1925
+ await __classPrivateFieldGet(this, _Client_messageManager, "f").setChatStickerSet(chatId, setName);
1731
1926
  }
1732
1927
  /**
1733
- * Get custom emoji documents for download.
1928
+ * Delete a chat's sticker set.
1734
1929
  *
1735
- * @method fs
1736
- * @param id Identifier of one or more of custom emojis.
1737
- * @returns The custom emoji documents.
1930
+ * @method ch
1931
+ * @param chatId The identifier of the chat. Must be a supergroup.
1738
1932
  */
1739
- async getCustomEmojiStickers(id) {
1740
- return await __classPrivateFieldGet(this, _Client_fileManager, "f").getCustomEmojiStickers(id);
1933
+ async deleteChatStickerSet(chatId) {
1934
+ await __classPrivateFieldGet(this, _Client_messageManager, "f").deleteChatStickerSet(chatId);
1741
1935
  }
1742
1936
  /**
1743
- * Set a chat's available reactions. User-only.
1937
+ * Set the number of boosts required to circument a chat's default restrictions. User-only.
1744
1938
  *
1745
1939
  * @method ch
1746
1940
  * @param chatId The identifier of the chat.
1747
- * @param availableReactions The new available reactions.
1941
+ * @param boosts The number of boosts required to circumvent its restrictions.
1748
1942
  */
1749
- async setAvailableReactions(chatId, availableReactions) {
1750
- await __classPrivateFieldGet(this, _Client_messageManager, "f").setAvailableReactions(chatId, availableReactions);
1943
+ async setBoostsRequiredToCircumventRestrictions(chatId, boosts) {
1944
+ await __classPrivateFieldGet(this, _Client_messageManager, "f").setBoostsRequiredToCircumventRestrictions(chatId, boosts);
1751
1945
  }
1752
1946
  /**
1753
- * Change reactions made to a message.
1947
+ * Create an invite link.
1754
1948
  *
1755
- * @method re
1756
- * @param chatId The identifier of the chat which the message belongs to.
1757
- * @param messageId The identifier of the message to add the reaction to.
1758
- * @param reactions The new reactions.
1949
+ * @method ch
1950
+ * @param chatId The identifier of the chat to create the invite link for.
1951
+ * @returns The newly created invite link.
1759
1952
  */
1760
- async setReactions(chatId, messageId, reactions, params) {
1761
- await __classPrivateFieldGet(this, _Client_messageManager, "f").setReactions(chatId, messageId, reactions, params);
1953
+ async createInviteLink(chatId, params) {
1954
+ return await __classPrivateFieldGet(this, _Client_messageManager, "f").createInviteLink(chatId, params);
1762
1955
  }
1956
+ //
1957
+ // ========================= CALLBACK QUERIES ========================= //
1958
+ //
1763
1959
  /**
1764
- * Make a reaction to a message.
1960
+ * Answer a callback query. Bot-only.
1765
1961
  *
1766
- * @method re
1767
- * @param chatId The identifier of the chat which the message belongs to.
1768
- * @param messageId The identifier of the message to add the reaction to.
1769
- * @param reaction The reaction to add.
1962
+ * @method cq
1963
+ * @param id ID of the callback query to answer.
1770
1964
  */
1771
- async addReaction(chatId, messageId, reaction, params) {
1772
- await __classPrivateFieldGet(this, _Client_messageManager, "f").addReaction(chatId, messageId, reaction, params);
1965
+ async answerCallbackQuery(id, params) {
1966
+ await __classPrivateFieldGet(this, _Client_callbackQueryManager, "f").answerCallbackQuery(id, params);
1773
1967
  }
1968
+ //
1969
+ // ========================= INLINE QUERIES ========================= //
1970
+ //
1774
1971
  /**
1775
- * Undo a reaction made to a message.
1972
+ * Answer an inline query. Bot-only.
1776
1973
  *
1777
- * @method re
1778
- * @param chatId The identifier of the chat which the message belongs to.
1779
- * @param messageId The identifier of the message which the reaction was made to.
1780
- * @param reaction The reaction to remove.
1974
+ * @method iq
1975
+ * @param id The ID of the inline query to answer.
1976
+ * @param results The results to answer with.
1781
1977
  */
1782
- async removeReaction(chatId, messageId, reaction) {
1783
- await __classPrivateFieldGet(this, _Client_messageManager, "f").removeReaction(chatId, messageId, reaction);
1978
+ async answerInlineQuery(id, results, params) {
1979
+ await __classPrivateFieldGet(this, _Client_inlineQueryManager, "f").answerInlineQuery(id, results, params);
1784
1980
  }
1981
+ //
1982
+ // ========================= BOTS ========================= //
1983
+ //
1785
1984
  /**
1786
- * Set a chat's photo.
1985
+ * Set the bot's description in the given language. Bot-only.
1787
1986
  *
1788
- * @method ch
1789
- * @param chatId The identifier of the chat.
1790
- * @param photo A photo to set as the chat's photo.
1987
+ * @method bs
1791
1988
  */
1792
- async setChatPhoto(chatId, photo, params) {
1793
- await __classPrivateFieldGet(this, _Client_messageManager, "f").setChatPhoto(chatId, photo, params);
1989
+ async setMyDescription(params) {
1990
+ await __classPrivateFieldGet(this, _Client_botInfoManager, "f").setMyDescription(params);
1794
1991
  }
1795
1992
  /**
1796
- * Delete a chat's photo.
1993
+ * Set the bot's name in the given language. Bot-only.
1797
1994
  *
1798
- * @method ch
1799
- * @param chatId The identifier of the chat.
1995
+ * @method bs
1800
1996
  */
1801
- async deleteChatPhoto(chatId) {
1802
- await __classPrivateFieldGet(this, _Client_messageManager, "f").deleteChatPhoto(chatId);
1997
+ async setMyName(params) {
1998
+ await __classPrivateFieldGet(this, _Client_botInfoManager, "f").setMyName(params);
1803
1999
  }
1804
2000
  /**
1805
- * Delete all messages sent by a specific member of a chat. User-only.
2001
+ * Set the bot's short description in the given language. Bot-only.
1806
2002
  *
1807
- * @method ms
1808
- * @param chatId The identifier of the chat. Must be a supergroup.
1809
- * @param memberId The identifier of the member.
2003
+ * @method bs
1810
2004
  */
1811
- async deleteChatMemberMessages(chatId, memberId) {
1812
- await __classPrivateFieldGet(this, _Client_messageManager, "f").deleteChatMemberMessages(chatId, memberId);
2005
+ async setMyShortDescription(params) {
2006
+ await __classPrivateFieldGet(this, _Client_botInfoManager, "f").setMyShortDescription(params);
1813
2007
  }
1814
2008
  /**
1815
- * Pin a message in a chat.
2009
+ * Get the bot's description in the given language. Bot-only.
1816
2010
  *
1817
- * @method ms
1818
- * @param chatId The identifier of the chat that contains the message.
1819
- * @param messageId The message's identifier.
2011
+ * @method bs
2012
+ * @returns The current bot's description in the specified language.
1820
2013
  */
1821
- async pinMessage(chatId, messageId, params) {
1822
- await __classPrivateFieldGet(this, _Client_messageManager, "f").pinMessage(chatId, messageId, params);
2014
+ async getMyDescription(params) {
2015
+ return await __classPrivateFieldGet(this, _Client_botInfoManager, "f").getMyDescription(params);
1823
2016
  }
1824
2017
  /**
1825
- * Unpin a pinned message.
2018
+ * Get the bot's name in the given language. Bot-only.
1826
2019
  *
1827
- * @method ms
1828
- * @param chatId The identifier of the chat that contains the message.
1829
- * @param messageId The message's identifier.
2020
+ * @method bs
2021
+ * @returns The current bot's name in the specified language.
1830
2022
  */
1831
- async unpinMessage(chatId, messageId) {
1832
- await __classPrivateFieldGet(this, _Client_messageManager, "f").unpinMessage(chatId, messageId);
2023
+ async getMyName(params) {
2024
+ return await __classPrivateFieldGet(this, _Client_botInfoManager, "f").getMyName(params);
1833
2025
  }
1834
2026
  /**
1835
- * Unpin all pinned messages.
2027
+ * Get the bot's short description in the given language. Bot-only.
1836
2028
  *
1837
- * @method ms
1838
- * @param chatId The identifier of the chat.
2029
+ * @method bs
2030
+ * @returns The current bot's short description in the specified language.
1839
2031
  */
1840
- async unpinMessages(chatId) {
1841
- await __classPrivateFieldGet(this, _Client_messageManager, "f").unpinMessages(chatId);
2032
+ async getMyShortDescription(params) {
2033
+ return await __classPrivateFieldGet(this, _Client_botInfoManager, "f").getMyShortDescription(params);
1842
2034
  }
1843
2035
  /**
1844
- * Ban a member from a chat.
2036
+ * Set the bot's commands in the given scope and/or language. Bot-only.
1845
2037
  *
1846
- * @method ch
1847
- * @param chatId The identifier of the chat.
1848
- * @param memberId The identifier of the member.
2038
+ * @method bs
2039
+ * @param commands The commands to set.
1849
2040
  */
1850
- async banChatMember(chatId, memberId, params) {
1851
- await __classPrivateFieldGet(this, _Client_messageManager, "f").banChatMember(chatId, memberId, params);
2041
+ async setMyCommands(commands, params) {
2042
+ await __classPrivateFieldGet(this, _Client_botInfoManager, "f").setMyCommands(commands, params);
1852
2043
  }
1853
2044
  /**
1854
- * Unban a member from a chat.
2045
+ * Get the bot's commands in the given scope and/or language. Bot-only.
1855
2046
  *
1856
- * @method ch
1857
- * @param chatId The identifier of the chat. Must be a supergroup.
1858
- * @param memberId The identifier of the member.
2047
+ * @method bs
2048
+ * @returns The current bot's commands in the specified language.
1859
2049
  */
1860
- async unbanChatMember(chatId, memberId) {
1861
- await __classPrivateFieldGet(this, _Client_messageManager, "f").unbanChatMember(chatId, memberId);
2050
+ async getMyCommands(params) {
2051
+ return await __classPrivateFieldGet(this, _Client_botInfoManager, "f").getMyCommands(params);
1862
2052
  }
2053
+ //
2054
+ // ========================= REACTIONS ========================= //
2055
+ //
1863
2056
  /**
1864
- * Kick a member from a chat. Same as a banChatMember call followed by unbanChatMember.
2057
+ * Change reactions made to a message.
1865
2058
  *
1866
- * @method ch
1867
- * @param chatId The identifier of the chat. Must be a supergroup.
1868
- * @param memberId The identifier of the member.
2059
+ * @method re
2060
+ * @param chatId The identifier of the chat which the message belongs to.
2061
+ * @param messageId The identifier of the message to add the reaction to.
2062
+ * @param reactions The new reactions.
1869
2063
  */
1870
- async kickChatMember(chatId, memberId) {
1871
- await __classPrivateFieldGet(this, _Client_messageManager, "f").banChatMember(chatId, memberId);
1872
- await __classPrivateFieldGet(this, _Client_messageManager, "f").unbanChatMember(chatId, memberId);
2064
+ async setReactions(chatId, messageId, reactions, params) {
2065
+ await __classPrivateFieldGet(this, _Client_messageManager, "f").setReactions(chatId, messageId, reactions, params);
1873
2066
  }
1874
2067
  /**
1875
- * Set the rights of a chat member.
2068
+ * Make a reaction to a message.
1876
2069
  *
1877
- * @method ch
1878
- * @param chatId The identifier of the chat. Must be a supergroup.
1879
- * @param memberId The identifier of a member.
2070
+ * @method re
2071
+ * @param chatId The identifier of the chat which the message belongs to.
2072
+ * @param messageId The identifier of the message to add the reaction to.
2073
+ * @param reaction The reaction to add.
1880
2074
  */
1881
- async setChatMemberRights(chatId, memberId, params) {
1882
- await __classPrivateFieldGet(this, _Client_messageManager, "f").setChatMemberRights(chatId, memberId, params);
2075
+ async addReaction(chatId, messageId, reaction, params) {
2076
+ await __classPrivateFieldGet(this, _Client_messageManager, "f").addReaction(chatId, messageId, reaction, params);
1883
2077
  }
1884
2078
  /**
1885
- * Get the administrators of a chat.
2079
+ * Undo a reaction made to a message.
1886
2080
  *
1887
- * @method ch
1888
- * @param chatId The identifier of the chat.
1889
- * @returns The chat's administrators.
2081
+ * @method re
2082
+ * @param chatId The identifier of the chat which the message belongs to.
2083
+ * @param messageId The identifier of the message which the reaction was made to.
2084
+ * @param reaction The reaction to remove.
1890
2085
  */
1891
- async getChatAdministrators(chatId) {
1892
- return await __classPrivateFieldGet(this, _Client_messageManager, "f").getChatAdministrators(chatId);
2086
+ async removeReaction(chatId, messageId, reaction) {
2087
+ await __classPrivateFieldGet(this, _Client_messageManager, "f").removeReaction(chatId, messageId, reaction);
1893
2088
  }
2089
+ //
2090
+ // ========================= STORIES ========================= //
2091
+ //
1894
2092
  /**
1895
2093
  * Create a story. User-only.
1896
2094
  *
@@ -1985,130 +2183,16 @@ class Client extends Composer {
1985
2183
  async removeStoryFromHighlights(chatId, storyId) {
1986
2184
  await __classPrivateFieldGet(this, _Client_storyManager, "f").removeStoryFromHighlights(chatId, storyId);
1987
2185
  }
2186
+ //
2187
+ // ========================= MISC ========================= //
2188
+ //
1988
2189
  /**
1989
- * Enable join requests in a chat. User-only.
1990
- *
1991
- * @method ch
1992
- * @param chatId The identifier of the chat. Must be a channel or a supergroup.
1993
- */
1994
- async enableJoinRequests(chatId) {
1995
- await __classPrivateFieldGet(this, _Client_messageManager, "f").enableJoinRequests(chatId);
1996
- }
1997
- /**
1998
- * Disable join requests in a chat. User-only.
1999
- *
2000
- * @method ch
2001
- * @param chatId The identifier of the chat. Must be a channel or a supergroup.
2002
- */
2003
- async disableJoinRequests(chatId) {
2004
- await __classPrivateFieldGet(this, _Client_messageManager, "f").disableJoinRequests(chatId);
2005
- }
2006
- /**
2007
- * Show a username in the current account, a bot account, sa upergroup, or a channel's profile. User-only.
2008
- *
2009
- * @method ac
2010
- * @param id `"me"`, a bot ID, a supergroup ID, or a channel ID.
2011
- * @param username The username to show.
2012
- */
2013
- async showUsername(id, username) {
2014
- await __classPrivateFieldGet(this, _Client_accountManager, "f").showUsername(id, username);
2015
- }
2016
- /**
2017
- * Hide a username from the current account, a bot account, a supergroup, or a channel's profile. User-only.
2018
- *
2019
- * @method ac
2020
- * @param id `"me"`, a bot ID, a supergroup ID, or a channel ID.
2021
- * @param username The username to hide.
2022
- */
2023
- async hideUsername(id, username) {
2024
- await __classPrivateFieldGet(this, _Client_accountManager, "f").hideUsername(id, username);
2025
- }
2026
- /**
2027
- * Reorder the usernames of the current account, a bot account, a supergroup, or a channel's profile. User-only.
2028
- *
2029
- * @method ac
2030
- * @param id `"me"`, a bot ID, a supergroup ID, or a channel ID.
2031
- * @param order The new order to use.
2032
- * @returns Whether the order was changed.
2033
- */
2034
- async reorderUsernames(id, order) {
2035
- return await __classPrivateFieldGet(this, _Client_accountManager, "f").reorderUsernames(id, order);
2036
- }
2037
- /**
2038
- * Hide all usernames from the a supergroup or a channel's profile. User-only.
2039
- *
2040
- * @method ac
2041
- * @param id A supergroup ID or a channel ID.
2042
- */
2043
- async hideUsernames(id) {
2044
- return await __classPrivateFieldGet(this, _Client_accountManager, "f").hideUsernames(id);
2045
- }
2046
- /**
2047
- * Get inactive chats. User-only.
2048
- *
2049
- * @method ch
2050
- * @retuns A list of inactive chats the current user is member of.
2051
- */
2052
- async getInactiveChats() {
2053
- return await __classPrivateFieldGet(this, _Client_accountManager, "f").getInactiveChats();
2054
- }
2055
- /**
2056
- * Search the messages of a chat. User-only.
2057
- *
2058
- * @method ms
2059
- * @param chatId The identifier of the chat to search the messages in.
2060
- * @param query The message search query.
2061
- */
2062
- async searchMessages(chatId, query, params) {
2063
- return await __classPrivateFieldGet(this, _Client_messageManager, "f").searchMessages(chatId, query, params);
2064
- }
2065
- /**
2066
- * Set the number of boosts required to circument a chat's default restrictions. User-only.
2067
- *
2068
- * @method ch
2069
- * @param chatId The identifier of the chat.
2070
- * @param boosts The number of boosts required to circumvent its restrictions.
2071
- */
2072
- async setBoostsRequiredToCircumventRestrictions(chatId, boosts) {
2073
- await __classPrivateFieldGet(this, _Client_messageManager, "f").setBoostsRequiredToCircumventRestrictions(chatId, boosts);
2074
- }
2075
- /**
2076
- * Create an invite link.
2077
- *
2078
- * @method ch
2079
- * @param chatId The identifier of the chat to create the invite link for.
2080
- * @returns The newly created invite link.
2081
- */
2082
- async createInviteLink(chatId, params) {
2083
- return await __classPrivateFieldGet(this, _Client_messageManager, "f").createInviteLink(chatId, params);
2084
- }
2085
- /**
2086
- * Get the invite links created for a chat. User-only.
2087
- *
2088
- * @method ch
2089
- * @param chatId The identifier of the chat.
2090
- * @returns The invite links created for the chat. This might be a subset of the results if they were less than `limit`. The parameters `afterDate` and `afterInviteLink` can be used for pagination.
2091
- */
2092
- async getCreatedInviteLinks(chatId, params) {
2093
- return await __classPrivateFieldGet(this, _Client_messageManager, "f").getCreatedInviteLinks(chatId, params);
2094
- }
2095
- /**
2096
- * Join a chat. User-only.
2097
- *
2098
- * @method ch
2099
- * @param chatId The identifier of the chat to join.
2100
- */
2101
- async joinChat(chatId) {
2102
- await __classPrivateFieldGet(this, _Client_messageManager, "f").joinChat(chatId);
2103
- }
2104
- /**
2105
- * Leave a chat.
2190
+ * Get network statistics. This might not always be available.
2106
2191
  *
2107
- * @method ch
2108
- * @param chatId The identifier of the chat to leave.
2192
+ * @method mc
2109
2193
  */
2110
- async leaveChat(chatId) {
2111
- await __classPrivateFieldGet(this, _Client_messageManager, "f").leaveChat(chatId);
2194
+ async getNetworkStatistics() {
2195
+ return await __classPrivateFieldGet(this, _Client_networkStatisticsManager, "f").getNetworkStatistics();
2112
2196
  }
2113
2197
  /**
2114
2198
  * Block a user. User-only.
@@ -2128,35 +2212,6 @@ class Client extends Composer {
2128
2212
  async unblockUser(userId) {
2129
2213
  await __classPrivateFieldGet(this, _Client_messageManager, "f").unblockUser(userId);
2130
2214
  }
2131
- /**
2132
- * Get information on a user's chat membership.
2133
- *
2134
- * @method ch
2135
- * @param chatId The identifier of a chat that includes the user.
2136
- * @param userId The identifier of the user.
2137
- */
2138
- async getChatMember(chatId, userId) {
2139
- return await __classPrivateFieldGet(this, _Client_messageManager, "f").getChatMember(chatId, userId);
2140
- }
2141
- /**
2142
- * Set a chat's sticker set.
2143
- *
2144
- * @method ch
2145
- * @param chatId The identifier of the chat. Must be a supergroup.
2146
- * @param setName The name of the set.
2147
- */
2148
- async setChatStickerSet(chatId, setName) {
2149
- await __classPrivateFieldGet(this, _Client_messageManager, "f").setChatStickerSet(chatId, setName);
2150
- }
2151
- /**
2152
- * Delete a chat's sticker set.
2153
- *
2154
- * @method ch
2155
- * @param chatId The identifier of the chat. Must be a supergroup.
2156
- */
2157
- async deleteChatStickerSet(chatId) {
2158
- await __classPrivateFieldGet(this, _Client_messageManager, "f").deleteChatStickerSet(chatId);
2159
- }
2160
2215
  }
2161
2216
  exports.Client = Client;
2162
2217
  _Client_handleCtxUpdate = async function _Client_handleCtxUpdate(update) {
@@ -2217,6 +2272,9 @@ _Client_handleCtxUpdate = async function _Client_handleCtxUpdate(update) {
2217
2272
  promises.push(__classPrivateFieldGet(this, _Client_instances, "m", _Client_handleCtxUpdate).call(this, upd));
2218
2273
  }
2219
2274
  }
2275
+ if (_1_business_connection_manager_js_1.BusinessConnectionManager.canHandleUpdate(update)) {
2276
+ promises.push(__classPrivateFieldGet(this, _Client_instances, "m", _Client_handleCtxUpdate).call(this, await __classPrivateFieldGet(this, _Client_businessConnectionManager, "f").handleUpdate(update)));
2277
+ }
2220
2278
  return () => Promise.all(promises);
2221
2279
  }, _Client_getMe = async function _Client_getMe() {
2222
2280
  if (__classPrivateFieldGet(this, _Client_lastGetMe, "f") != null) {