@mtkruto/node 0.1.191 → 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 (173) hide show
  1. package/esm/1_utilities.d.ts +1 -1
  2. package/esm/1_utilities.js +1 -1
  3. package/esm/2_tl.d.ts +6 -6
  4. package/esm/2_tl.js +6 -6
  5. package/esm/3_storage.d.ts +5 -5
  6. package/esm/3_storage.js +5 -5
  7. package/esm/3_types.d.ts +6 -5
  8. package/esm/3_types.js +6 -5
  9. package/esm/4_constants.d.ts +2 -2
  10. package/esm/4_constants.js +2 -2
  11. package/esm/5_client.d.ts +1 -1
  12. package/esm/5_client.js +1 -1
  13. package/esm/client/0_params.d.ts +7 -1
  14. package/esm/client/0_types.d.ts +1 -0
  15. package/esm/client/0_utilities.d.ts +0 -3
  16. package/esm/client/0_utilities.js +0 -20
  17. package/esm/client/1_business_connection_manager.d.ts +11 -0
  18. package/esm/client/1_business_connection_manager.js +47 -0
  19. package/esm/client/1_update_manager.d.ts +8 -1
  20. package/esm/client/1_update_manager.js +88 -8
  21. package/esm/client/2_message_manager.d.ts +7 -6
  22. package/esm/client/2_message_manager.js +48 -31
  23. package/esm/client/4_client.d.ts +421 -420
  24. package/esm/client/4_client.js +565 -516
  25. package/esm/storage/0_storage.d.ts +5 -0
  26. package/esm/storage/0_storage.js +20 -0
  27. package/esm/storage/{1_storage_indexed_db.js → 2_storage_indexed_db.js} +1 -1
  28. package/esm/storage/{1_storage_local_storage.js → 2_storage_local_storage.js} +1 -1
  29. package/{script/storage/1_storage_memory.d.ts → esm/storage/2_storage_memory.d.ts} +1 -4
  30. package/esm/storage/{1_storage_memory.js → 2_storage_memory.js} +8 -28
  31. package/esm/storage/{1_storage_session_storage.js → 2_storage_session_storage.js} +1 -1
  32. package/esm/tl/2_types.d.ts +1071 -183
  33. package/esm/tl/2_types.js +2916 -464
  34. package/esm/tl/3_functions.d.ts +381 -17
  35. package/esm/tl/3_functions.js +1002 -120
  36. package/{script/tl/4_tl_writer.d.ts → esm/tl/5_tl_writer.d.ts} +1 -1
  37. package/{script/tl/4_rpc_result.d.ts → esm/tl/6_rpc_result.d.ts} +1 -1
  38. package/esm/tl/{4_rpc_result.js → 6_rpc_result.js} +1 -1
  39. package/esm/tl/{6_message.d.ts → 7_message.d.ts} +2 -2
  40. package/esm/tl/{6_message.js → 7_message.js} +3 -3
  41. package/esm/tl/{7_message_container.d.ts → 8_message_container.d.ts} +1 -1
  42. package/esm/tl/{7_message_container.js → 8_message_container.js} +3 -3
  43. package/esm/types/0_chat_photo.js +1 -1
  44. package/esm/types/0_message_entity.d.ts +1 -1
  45. package/esm/types/0_thumbnail.js +1 -1
  46. package/esm/types/1_bot_command_scope.d.ts +1 -1
  47. package/esm/types/1_photo.js +2 -2
  48. package/esm/types/1_story_privacy.d.ts +1 -1
  49. package/esm/types/2_business_connection.d.ts +11 -0
  50. package/esm/types/2_business_connection.js +12 -0
  51. package/esm/types/2_chat_member.d.ts +1 -1
  52. package/esm/types/2_chosen_inline_result.d.ts +1 -1
  53. package/esm/types/2_game.js +1 -1
  54. package/esm/types/2_inline_keyboard_button.d.ts +1 -1
  55. package/esm/types/2_inline_query.d.ts +1 -1
  56. package/esm/types/2_invite_link.d.ts +1 -1
  57. package/esm/types/2_message_reaction_count.d.ts +1 -1
  58. package/esm/types/2_message_reactions.d.ts +1 -1
  59. package/esm/types/2_story_content.js +1 -1
  60. package/{script/types/1_story_interactive_area.d.ts → esm/types/2_story_interactive_area.d.ts} +2 -2
  61. package/esm/types/{1_story_interactive_area.js → 2_story_interactive_area.js} +1 -1
  62. package/esm/types/3_chat_member_updated.d.ts +1 -1
  63. package/esm/types/3_reply_markup.d.ts +1 -1
  64. package/esm/types/3_story.d.ts +2 -2
  65. package/esm/types/3_story.js +1 -1
  66. package/esm/types/4_inline_query_result.d.ts +1 -1
  67. package/esm/types/4_inline_query_result.js +1 -1
  68. package/esm/types/4_message.d.ts +9 -3
  69. package/esm/types/4_message.js +22 -5
  70. package/esm/types/5_callback_query.d.ts +1 -1
  71. package/esm/types/5_chat.d.ts +1 -1
  72. package/esm/types/6_update.d.ts +12 -2
  73. package/package.json +1 -1
  74. package/script/1_utilities.d.ts +1 -1
  75. package/script/1_utilities.js +1 -1
  76. package/script/2_tl.d.ts +6 -6
  77. package/script/2_tl.js +6 -6
  78. package/script/3_storage.d.ts +5 -5
  79. package/script/3_storage.js +5 -5
  80. package/script/3_types.d.ts +6 -5
  81. package/script/3_types.js +6 -5
  82. package/script/4_constants.d.ts +2 -2
  83. package/script/4_constants.js +2 -2
  84. package/script/5_client.d.ts +1 -1
  85. package/script/5_client.js +1 -1
  86. package/script/client/0_params.d.ts +7 -1
  87. package/script/client/0_types.d.ts +1 -0
  88. package/script/client/0_utilities.d.ts +0 -3
  89. package/script/client/0_utilities.js +1 -23
  90. package/script/client/1_business_connection_manager.d.ts +11 -0
  91. package/script/client/1_business_connection_manager.js +51 -0
  92. package/script/client/1_update_manager.d.ts +8 -1
  93. package/script/client/1_update_manager.js +88 -8
  94. package/script/client/2_message_manager.d.ts +7 -6
  95. package/script/client/2_message_manager.js +47 -30
  96. package/script/client/4_client.d.ts +421 -420
  97. package/script/client/4_client.js +565 -516
  98. package/script/storage/0_storage.d.ts +5 -0
  99. package/script/storage/0_storage.js +20 -0
  100. package/script/storage/{1_storage_indexed_db.js → 2_storage_indexed_db.js} +7 -7
  101. package/script/storage/{1_storage_local_storage.js → 2_storage_local_storage.js} +10 -10
  102. package/{esm/storage/1_storage_memory.d.ts → script/storage/2_storage_memory.d.ts} +1 -4
  103. package/script/storage/{1_storage_memory.js → 2_storage_memory.js} +12 -32
  104. package/script/storage/{1_storage_session_storage.js → 2_storage_session_storage.js} +10 -10
  105. package/script/tl/2_types.d.ts +1071 -183
  106. package/script/tl/2_types.js +3028 -504
  107. package/script/tl/3_functions.d.ts +381 -17
  108. package/script/tl/3_functions.js +1047 -143
  109. package/{esm/tl/4_tl_writer.d.ts → script/tl/5_tl_writer.d.ts} +1 -1
  110. package/{esm/tl/4_rpc_result.d.ts → script/tl/6_rpc_result.d.ts} +1 -1
  111. package/script/tl/{4_rpc_result.js → 6_rpc_result.js} +2 -2
  112. package/script/tl/{6_message.d.ts → 7_message.d.ts} +2 -2
  113. package/script/tl/{6_message.js → 7_message.js} +8 -8
  114. package/script/tl/{7_message_container.d.ts → 8_message_container.d.ts} +1 -1
  115. package/script/tl/{7_message_container.js → 8_message_container.js} +7 -7
  116. package/script/types/0_chat_photo.js +9 -9
  117. package/script/types/0_message_entity.d.ts +1 -1
  118. package/script/types/0_thumbnail.js +6 -6
  119. package/script/types/1_bot_command_scope.d.ts +1 -1
  120. package/script/types/1_photo.js +7 -7
  121. package/script/types/1_story_privacy.d.ts +1 -1
  122. package/script/types/2_business_connection.d.ts +11 -0
  123. package/script/types/2_business_connection.js +16 -0
  124. package/script/types/2_chat_member.d.ts +1 -1
  125. package/script/types/2_chosen_inline_result.d.ts +1 -1
  126. package/script/types/2_game.js +3 -3
  127. package/script/types/2_inline_keyboard_button.d.ts +1 -1
  128. package/script/types/2_inline_query.d.ts +1 -1
  129. package/script/types/2_invite_link.d.ts +1 -1
  130. package/script/types/2_message_reaction_count.d.ts +1 -1
  131. package/script/types/2_message_reactions.d.ts +1 -1
  132. package/script/types/2_story_content.js +4 -4
  133. package/{esm/types/1_story_interactive_area.d.ts → script/types/2_story_interactive_area.d.ts} +2 -2
  134. package/script/types/{1_story_interactive_area.js → 2_story_interactive_area.js} +2 -2
  135. package/script/types/3_chat_member_updated.d.ts +1 -1
  136. package/script/types/3_reply_markup.d.ts +1 -1
  137. package/script/types/3_story.d.ts +2 -2
  138. package/script/types/3_story.js +2 -2
  139. package/script/types/4_inline_query_result.d.ts +1 -1
  140. package/script/types/4_inline_query_result.js +2 -2
  141. package/script/types/4_message.d.ts +9 -3
  142. package/script/types/4_message.js +37 -20
  143. package/script/types/5_callback_query.d.ts +1 -1
  144. package/script/types/5_chat.d.ts +1 -1
  145. package/script/types/6_update.d.ts +12 -2
  146. /package/esm/storage/{0_utilities.d.ts → 1_utilities.d.ts} +0 -0
  147. /package/esm/storage/{0_utilities.js → 1_utilities.js} +0 -0
  148. /package/esm/storage/{1_storage_indexed_db.d.ts → 2_storage_indexed_db.d.ts} +0 -0
  149. /package/esm/storage/{1_storage_local_storage.d.ts → 2_storage_local_storage.d.ts} +0 -0
  150. /package/esm/storage/{1_storage_session_storage.d.ts → 2_storage_session_storage.d.ts} +0 -0
  151. /package/esm/tl/{3_tl_reader.d.ts → 4_tl_reader.d.ts} +0 -0
  152. /package/esm/tl/{3_tl_reader.js → 4_tl_reader.js} +0 -0
  153. /package/esm/tl/{4_tl_writer.js → 5_tl_writer.js} +0 -0
  154. /package/esm/types/{0_venue.d.ts → 1_venue.d.ts} +0 -0
  155. /package/esm/types/{0_venue.js → 1_venue.js} +0 -0
  156. /package/esm/types/{0__file_id.d.ts → _file_id.d.ts} +0 -0
  157. /package/esm/types/{0__file_id.js → _file_id.js} +0 -0
  158. /package/esm/types/{1__getters.d.ts → _getters.d.ts} +0 -0
  159. /package/esm/types/{1__getters.js → _getters.js} +0 -0
  160. /package/script/storage/{0_utilities.d.ts → 1_utilities.d.ts} +0 -0
  161. /package/script/storage/{0_utilities.js → 1_utilities.js} +0 -0
  162. /package/script/storage/{1_storage_indexed_db.d.ts → 2_storage_indexed_db.d.ts} +0 -0
  163. /package/script/storage/{1_storage_local_storage.d.ts → 2_storage_local_storage.d.ts} +0 -0
  164. /package/script/storage/{1_storage_session_storage.d.ts → 2_storage_session_storage.d.ts} +0 -0
  165. /package/script/tl/{3_tl_reader.d.ts → 4_tl_reader.d.ts} +0 -0
  166. /package/script/tl/{3_tl_reader.js → 4_tl_reader.js} +0 -0
  167. /package/script/tl/{4_tl_writer.js → 5_tl_writer.js} +0 -0
  168. /package/script/types/{0_venue.d.ts → 1_venue.d.ts} +0 -0
  169. /package/script/types/{0_venue.js → 1_venue.js} +0 -0
  170. /package/script/types/{0__file_id.d.ts → _file_id.d.ts} +0 -0
  171. /package/script/types/{0__file_id.js → _file_id.js} +0 -0
  172. /package/script/types/{1__getters.d.ts → _getters.d.ts} +0 -0
  173. /package/script/types/{1__getters.js → _getters.js} +0 -0
@@ -10,7 +10,7 @@ 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
16
  const _0_errors_js_1 = require("../0_errors.js");
@@ -24,6 +24,7 @@ const _0_password_js_1 = require("./0_password.js");
24
24
  const _0_utilities_js_1 = require("./0_utilities.js");
25
25
  const _1_account_manager_js_1 = require("./1_account_manager.js");
26
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");
27
28
  const _1_client_encrypted_js_1 = require("./1_client_encrypted.js");
28
29
  const _1_client_plain_js_1 = require("./1_client_plain.js");
29
30
  const _1_composer_js_1 = require("./1_composer.js");
@@ -81,6 +82,7 @@ class Client extends Composer {
81
82
  _Client_botInfoManager.set(this, void 0);
82
83
  _Client_fileManager.set(this, void 0);
83
84
  _Client_reactionManager.set(this, void 0);
85
+ _Client_businessConnectionManager.set(this, void 0);
84
86
  _Client_messageManager.set(this, void 0);
85
87
  _Client_storyManager.set(this, void 0);
86
88
  _Client_callbackQueryManager.set(this, void 0);
@@ -204,7 +206,7 @@ class Client extends Composer {
204
206
  const reactions = "messageInteractions" in update ? update.messageInteractions : undefined;
205
207
  const mustGetMsg = () => {
206
208
  if (msg !== undefined) {
207
- 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 };
208
210
  }
209
211
  else if (reactions !== undefined) {
210
212
  return { chatId: reactions.chatId, messageId: reactions.messageId };
@@ -263,74 +265,74 @@ class Client extends Composer {
263
265
  return () => update;
264
266
  },
265
267
  reply: (text, params) => {
266
- const { chatId, messageId } = mustGetMsg();
268
+ const { chatId, messageId, businessConnectionId } = mustGetMsg();
267
269
  const replyToMessageId = getReplyToMessageId(params?.quote, chatId, messageId);
268
- return this.sendMessage(chatId, text, { ...params, replyToMessageId });
270
+ return this.sendMessage(chatId, text, { ...params, replyToMessageId, businessConnectionId });
269
271
  },
270
272
  replyPoll: (question, options, params) => {
271
- const { chatId, messageId } = mustGetMsg();
273
+ const { chatId, messageId, businessConnectionId } = mustGetMsg();
272
274
  const replyToMessageId = getReplyToMessageId(params?.quote, chatId, messageId);
273
- return this.sendPoll(chatId, question, options, { ...params, replyToMessageId });
275
+ return this.sendPoll(chatId, question, options, { ...params, replyToMessageId, businessConnectionId });
274
276
  },
275
277
  replyPhoto: (photo, params) => {
276
- const { chatId, messageId } = mustGetMsg();
278
+ const { chatId, messageId, businessConnectionId } = mustGetMsg();
277
279
  const replyToMessageId = getReplyToMessageId(params?.quote, chatId, messageId);
278
- return this.sendPhoto(chatId, photo, { ...params, replyToMessageId });
280
+ return this.sendPhoto(chatId, photo, { ...params, replyToMessageId, businessConnectionId });
279
281
  },
280
282
  replyDocument: (document, params) => {
281
- const { chatId, messageId } = mustGetMsg();
283
+ const { chatId, messageId, businessConnectionId } = mustGetMsg();
282
284
  const replyToMessageId = getReplyToMessageId(params?.quote, chatId, messageId);
283
- return this.sendDocument(chatId, document, { ...params, replyToMessageId });
285
+ return this.sendDocument(chatId, document, { ...params, replyToMessageId, businessConnectionId });
284
286
  },
285
287
  replySticker: (sticker, params) => {
286
- const { chatId, messageId } = mustGetMsg();
288
+ const { chatId, messageId, businessConnectionId } = mustGetMsg();
287
289
  const replyToMessageId = getReplyToMessageId(params?.quote, chatId, messageId);
288
- return this.sendSticker(chatId, sticker, { ...params, replyToMessageId });
290
+ return this.sendSticker(chatId, sticker, { ...params, replyToMessageId, businessConnectionId });
289
291
  },
290
292
  replyContact: (firstName, number, params) => {
291
- const { chatId, messageId } = mustGetMsg();
293
+ const { chatId, messageId, businessConnectionId } = mustGetMsg();
292
294
  const replyToMessageId = getReplyToMessageId(params?.quote, chatId, messageId);
293
- return this.sendContact(chatId, firstName, number, { ...params, replyToMessageId });
295
+ return this.sendContact(chatId, firstName, number, { ...params, replyToMessageId, businessConnectionId });
294
296
  },
295
297
  replyLocation: (latitude, longitude, params) => {
296
- const { chatId, messageId } = mustGetMsg();
298
+ const { chatId, messageId, businessConnectionId } = mustGetMsg();
297
299
  const replyToMessageId = getReplyToMessageId(params?.quote, chatId, messageId);
298
- return this.sendLocation(chatId, latitude, longitude, { ...params, replyToMessageId });
300
+ return this.sendLocation(chatId, latitude, longitude, { ...params, replyToMessageId, businessConnectionId });
299
301
  },
300
302
  replyDice: (params) => {
301
- const { chatId, messageId } = mustGetMsg();
303
+ const { chatId, messageId, businessConnectionId } = mustGetMsg();
302
304
  const replyToMessageId = getReplyToMessageId(params?.quote, chatId, messageId);
303
- return this.sendDice(chatId, { ...params, replyToMessageId });
305
+ return this.sendDice(chatId, { ...params, replyToMessageId, businessConnectionId });
304
306
  },
305
307
  replyVenue: (latitude, longitude, title, address, params) => {
306
- const { chatId, messageId } = mustGetMsg();
308
+ const { chatId, messageId, businessConnectionId } = mustGetMsg();
307
309
  const replyToMessageId = getReplyToMessageId(params?.quote, chatId, messageId);
308
- return this.sendVenue(chatId, latitude, longitude, title, address, { ...params, replyToMessageId });
310
+ return this.sendVenue(chatId, latitude, longitude, title, address, { ...params, replyToMessageId, businessConnectionId });
309
311
  },
310
312
  replyVideo: (video, params) => {
311
- const { chatId, messageId } = mustGetMsg();
313
+ const { chatId, messageId, businessConnectionId } = mustGetMsg();
312
314
  const replyToMessageId = getReplyToMessageId(params?.quote, chatId, messageId);
313
- return this.sendVideo(chatId, video, { ...params, replyToMessageId });
315
+ return this.sendVideo(chatId, video, { ...params, replyToMessageId, businessConnectionId });
314
316
  },
315
317
  replyAnimation: (document, params) => {
316
- const { chatId, messageId } = mustGetMsg();
318
+ const { chatId, messageId, businessConnectionId } = mustGetMsg();
317
319
  const replyToMessageId = getReplyToMessageId(params?.quote, chatId, messageId);
318
- return this.sendAnimation(chatId, document, { ...params, replyToMessageId });
320
+ return this.sendAnimation(chatId, document, { ...params, replyToMessageId, businessConnectionId });
319
321
  },
320
322
  replyVoice: (document, params) => {
321
- const { chatId, messageId } = mustGetMsg();
323
+ const { chatId, messageId, businessConnectionId } = mustGetMsg();
322
324
  const replyToMessageId = getReplyToMessageId(params?.quote, chatId, messageId);
323
- return this.sendVoice(chatId, document, { ...params, replyToMessageId });
325
+ return this.sendVoice(chatId, document, { ...params, replyToMessageId, businessConnectionId });
324
326
  },
325
327
  replyAudio: (document, params) => {
326
- const { chatId, messageId } = mustGetMsg();
328
+ const { chatId, messageId, businessConnectionId } = mustGetMsg();
327
329
  const replyToMessageId = getReplyToMessageId(params?.quote, chatId, messageId);
328
- return this.sendAudio(chatId, document, { ...params, replyToMessageId });
330
+ return this.sendAudio(chatId, document, { ...params, replyToMessageId, businessConnectionId });
329
331
  },
330
332
  replyVideoNote: (videoNote, params) => {
331
- const { chatId, messageId } = mustGetMsg();
333
+ const { chatId, messageId, businessConnectionId } = mustGetMsg();
332
334
  const replyToMessageId = getReplyToMessageId(params?.quote, chatId, messageId);
333
- return this.sendVideoNote(chatId, videoNote, { ...params, replyToMessageId });
335
+ return this.sendVideoNote(chatId, videoNote, { ...params, replyToMessageId, businessConnectionId });
334
336
  },
335
337
  delete: () => {
336
338
  const { chatId, messageId } = mustGetMsg();
@@ -535,6 +537,13 @@ class Client extends Composer {
535
537
  const { chatId } = mustGetMsg();
536
538
  return this.deleteChatStickerSet(chatId);
537
539
  },
540
+ getBusinessConnection: () => {
541
+ const { businessConnectionId } = mustGetMsg();
542
+ if (!businessConnectionId) {
543
+ (0, _1_utilities_js_1.UNREACHABLE)();
544
+ }
545
+ return this.getBusinessConnection(businessConnectionId);
546
+ },
538
547
  };
539
548
  return (0, _1_utilities_js_1.cleanObject)(context);
540
549
  });
@@ -640,6 +649,14 @@ class Client extends Composer {
640
649
  const c = {
641
650
  id,
642
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
+ },
643
660
  storage: this.storage,
644
661
  messageStorage: this.messageStorage,
645
662
  guaranteeUpdateDelivery: __classPrivateFieldGet(this, _Client_guaranteeUpdateDelivery, "f"),
@@ -704,6 +721,7 @@ class Client extends Composer {
704
721
  __classPrivateFieldSet(this, _Client_botInfoManager, new _1_bot_info_manager_js_1.BotInfoManager(c), "f");
705
722
  __classPrivateFieldSet(this, _Client_fileManager, new _1_file_manager_js_1.FileManager(c), "f");
706
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");
707
725
  __classPrivateFieldSet(this, _Client_messageManager, new _2_message_manager_js_1.MessageManager({ ...c, fileManager: __classPrivateFieldGet(this, _Client_fileManager, "f") }), "f");
708
726
  __classPrivateFieldSet(this, _Client_callbackQueryManager, new _3_callback_query_manager_js_1.CallbackQueryManager({ ...c, messageManager: __classPrivateFieldGet(this, _Client_messageManager, "f") }), "f");
709
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");
@@ -818,7 +836,7 @@ class Client extends Composer {
818
836
  }
819
837
  await this.connect();
820
838
  }
821
- 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() {
822
840
  const apiId = this.apiId || await this.storage.getApiId();
823
841
  if (!apiId) {
824
842
  throw new Error("apiId not set");
@@ -1253,6 +1271,77 @@ class Client extends Composer {
1253
1271
  }
1254
1272
  return await this.messageStorage.getEntity(id);
1255
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
+ //
1256
1345
  /**
1257
1346
  * Send a text message.
1258
1347
  *
@@ -1264,6 +1353,154 @@ class Client extends Composer {
1264
1353
  async sendMessage(chatId, text, params) {
1265
1354
  return await __classPrivateFieldGet(this, _Client_messageManager, "f").sendMessage(chatId, text, params);
1266
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
+ }
1267
1504
  /**
1268
1505
  * Edit a message's text.
1269
1506
  *
@@ -1360,82 +1597,87 @@ class Client extends Composer {
1360
1597
  return await __classPrivateFieldGet(this, _Client_messageManager, "f").getMessage(chatId, messageId);
1361
1598
  }
1362
1599
  /**
1363
- * Download a file.
1600
+ * Delete multiple messages.
1364
1601
  *
1365
- * @method fs
1366
- * @param fileId The identifier of the file to download.
1367
- * @example ```ts
1368
- * for await (const chunk of client.download(fileId, { chunkSize: 256 * 1024 })) {
1369
- * await outFile.write(chunk);
1370
- * }
1371
- * ```
1372
- * @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.
1373
1605
  */
1374
- async *download(fileId, params) {
1375
- for await (const chunk of __classPrivateFieldGet(this, _Client_fileManager, "f").download(fileId, params)) {
1376
- yield chunk;
1377
- }
1606
+ async deleteMessages(chatId, messageIds, params) {
1607
+ await __classPrivateFieldGet(this, _Client_messageManager, "f").deleteMessages(chatId, messageIds, params);
1378
1608
  }
1379
1609
  /**
1380
- * Forward multiple messages.
1610
+ * Delete a single message.
1381
1611
  *
1382
1612
  * @method ms
1383
- * @param from The identifier of the chat to forward the messages from.
1384
- * @param to The identifier of the chat to forward the messages to.
1385
- * @param messageIds The identifiers of the messages to forward.
1386
- * @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.
1387
1615
  */
1388
- async forwardMessages(from, to, messageIds, params) {
1389
- 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);
1390
1618
  }
1391
1619
  /**
1392
- * Forward a single message.
1620
+ * Delete all messages sent by a specific member of a chat. User-only.
1393
1621
  *
1394
1622
  * @method ms
1395
- * @param from The identifier of the chat to forward the message from.
1396
- * @param to The identifier of the chat to forward the message to.
1397
- * @param messageId The identifier of the message to forward.
1398
- * @returns The forwarded message.
1623
+ * @param chatId The identifier of the chat. Must be a supergroup.
1624
+ * @param memberId The identifier of the member.
1399
1625
  */
1400
- async forwardMessage(from, to, messageId, params) {
1401
- 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);
1402
1628
  }
1403
1629
  /**
1404
- * Get information on the currently authorized user.
1630
+ * Pin a message in a chat.
1405
1631
  *
1406
- * @method ac
1632
+ * @method ms
1633
+ * @param chatId The identifier of the chat that contains the message.
1634
+ * @param messageId The message's identifier.
1407
1635
  */
1408
- async getMe() {
1409
- 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)) }));
1410
- if (user_ == null) {
1411
- const users = await this.api.users.getUsers({ id: [new _2_tl_js_1.types.InputUserSelf()] });
1412
- user_ = users[0][_2_tl_js_1.as](_2_tl_js_1.types.User);
1413
- await this.messageStorage.setEntity(user_);
1414
- }
1415
- const user = (0, _3_types_js_1.constructUser)(user_);
1416
- __classPrivateFieldSet(this, _Client_lastGetMe, user, "f");
1417
- return user;
1636
+ async pinMessage(chatId, messageId, params) {
1637
+ await __classPrivateFieldGet(this, _Client_messageManager, "f").pinMessage(chatId, messageId, params);
1418
1638
  }
1419
1639
  /**
1420
- * Answer a callback query. Bot-only.
1640
+ * Unpin a pinned message.
1421
1641
  *
1422
- * @method cq
1423
- * @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.
1424
1645
  */
1425
- async answerCallbackQuery(id, params) {
1426
- await __classPrivateFieldGet(this, _Client_callbackQueryManager, "f").answerCallbackQuery(id, params);
1646
+ async unpinMessage(chatId, messageId) {
1647
+ await __classPrivateFieldGet(this, _Client_messageManager, "f").unpinMessage(chatId, messageId);
1427
1648
  }
1428
1649
  /**
1429
- * Send a poll.
1650
+ * Unpin all pinned messages.
1430
1651
  *
1431
1652
  * @method ms
1432
- * @param chatId The chat to send the poll to.
1433
- * @param question The poll's question.
1434
- * @param options The poll's options.
1435
- * @returns The sent poll.
1653
+ * @param chatId The identifier of the chat.
1436
1654
  */
1437
- async sendPoll(chatId, question, options, params) {
1438
- 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]);
1439
1681
  }
1440
1682
  /**
1441
1683
  * Stop a poll.
@@ -1460,446 +1702,393 @@ class Client extends Composer {
1460
1702
  await __classPrivateFieldGet(this, _Client_messageManager, "f").sendChatAction(chatId, action, params);
1461
1703
  }
1462
1704
  /**
1463
- * Upload a file.
1464
- *
1465
- * @method fs
1466
- * @param contents The contents of the file.
1467
- * @returns The uploaded file.
1468
- */
1469
- // deno-lint-ignore no-explicit-any
1470
- async upload(contents, params) {
1471
- return await __classPrivateFieldGet(this, _Client_fileManager, "f").upload(contents, params);
1472
- }
1473
- /**
1474
- * Set the bot's commands in the given scope and/or language. Bot-only.
1475
- *
1476
- * @method bs
1477
- * @param commands The commands to set.
1478
- */
1479
- async setMyCommands(commands, params) {
1480
- await __classPrivateFieldGet(this, _Client_botInfoManager, "f").setMyCommands(commands, params);
1481
- }
1482
- /**
1483
- * Get the bot's commands in the given scope and/or language. Bot-only.
1484
- *
1485
- * @method bs
1486
- * @returns The current bot's commands in the specified language.
1487
- */
1488
- async getMyCommands(params) {
1489
- return await __classPrivateFieldGet(this, _Client_botInfoManager, "f").getMyCommands(params);
1490
- }
1491
- /**
1492
- * Answer an inline query. Bot-only.
1493
- *
1494
- * @method iq
1495
- * @param id The ID of the inline query to answer.
1496
- * @param results The results to answer with.
1497
- */
1498
- async answerInlineQuery(id, results, params) {
1499
- await __classPrivateFieldGet(this, _Client_inlineQueryManager, "f").answerInlineQuery(id, results, params);
1500
- }
1501
- /**
1502
- * Set the bot's description in the given language. Bot-only.
1503
- *
1504
- * @method bs
1505
- */
1506
- async setMyDescription(params) {
1507
- await __classPrivateFieldGet(this, _Client_botInfoManager, "f").setMyDescription(params);
1508
- }
1509
- /**
1510
- * Set the bot's name in the given language. Bot-only.
1511
- *
1512
- * @method bs
1513
- */
1514
- async setMyName(params) {
1515
- await __classPrivateFieldGet(this, _Client_botInfoManager, "f").setMyName(params);
1516
- }
1517
- /**
1518
- * Set the bot's short description in the given language. Bot-only.
1705
+ * Search the messages of a chat. User-only.
1519
1706
  *
1520
- * @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.
1521
1710
  */
1522
- async setMyShortDescription(params) {
1523
- 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);
1524
1713
  }
1714
+ //
1715
+ // ========================= FILES ========================= //
1716
+ //
1525
1717
  /**
1526
- * Get the bot's description in the given language. Bot-only.
1718
+ * Download a file.
1527
1719
  *
1528
- * @method bs
1529
- * @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.
1530
1728
  */
1531
- async getMyDescription(params) {
1532
- 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
+ }
1533
1733
  }
1534
1734
  /**
1535
- * Get the bot's name in the given language. Bot-only.
1735
+ * Get custom emoji documents for download.
1536
1736
  *
1537
- * @method bs
1538
- * @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.
1539
1740
  */
1540
- async getMyName(params) {
1541
- return await __classPrivateFieldGet(this, _Client_botInfoManager, "f").getMyName(params);
1741
+ async getCustomEmojiStickers(id) {
1742
+ return await __classPrivateFieldGet(this, _Client_fileManager, "f").getCustomEmojiStickers(id);
1542
1743
  }
1744
+ //
1745
+ // ========================= CHATS ========================= //
1746
+ //
1543
1747
  /**
1544
- * Get the bot's short description in the given language. Bot-only.
1748
+ * Get chats from a chat list. User-only.
1545
1749
  *
1546
- * @method bs
1547
- * @returns The current bot's short description in the specified language.
1750
+ * @method ch
1548
1751
  */
1549
- async getMyShortDescription(params) {
1550
- 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);
1551
1754
  }
1552
1755
  /**
1553
- * Delete multiple messages.
1756
+ * Get a chat.
1554
1757
  *
1555
- * @method ms
1556
- * @param chatId The identifier of the chat that contains the messages.
1557
- * @param messageIds The identifiers of the messages to delete.
1758
+ * @method ch
1558
1759
  */
1559
- async deleteMessages(chatId, messageIds, params) {
1560
- await __classPrivateFieldGet(this, _Client_messageManager, "f").deleteMessages(chatId, messageIds, params);
1760
+ async getChat(chatId) {
1761
+ return await __classPrivateFieldGet(this, _Client_chatListManager, "f").getChat(chatId);
1561
1762
  }
1562
1763
  /**
1563
- * Delete a single message.
1764
+ * Get chat history. User-only.
1564
1765
  *
1565
- * @method ms
1566
- * @param chatId The identifier of the chat that contains the message.
1567
- * @param messageId The identifier of the message to delete.
1766
+ * @method ch
1767
+ * @param chatId The identifier of the chat to get its history.
1568
1768
  */
1569
- async deleteMessage(chatId, messageId, params) {
1570
- 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);
1571
1771
  }
1572
1772
  /**
1573
- * Send a photo.
1773
+ * Set a chat's available reactions. User-only.
1574
1774
  *
1575
- * @method ms
1576
- * @param chatId The chat to send the photo to.
1577
- * @param photo The photo to send.
1578
- * @returns The sent photo.
1775
+ * @method ch
1776
+ * @param chatId The identifier of the chat.
1777
+ * @param availableReactions The new available reactions.
1579
1778
  */
1580
- async sendPhoto(chatId, photo, params) {
1581
- 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);
1582
1781
  }
1583
1782
  /**
1584
- * Send a document.
1783
+ * Set a chat's photo.
1585
1784
  *
1586
- * @method ms
1587
- * @param chatId The chat to send the document to.
1588
- * @param document The document to send.
1589
- * @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.
1590
1788
  */
1591
- async sendDocument(chatId, document, params) {
1592
- 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);
1593
1791
  }
1594
1792
  /**
1595
- * Send a sticker.
1793
+ * Delete a chat's photo.
1596
1794
  *
1597
- * @method ms
1598
- * @param chatId The chat to send the sticker to.
1599
- * @param document The sticker to send.
1600
- * @returns The sent sticker.
1795
+ * @method ch
1796
+ * @param chatId The identifier of the chat.
1601
1797
  */
1602
- async sendSticker(chatId, sticker, params) {
1603
- return await __classPrivateFieldGet(this, _Client_messageManager, "f").sendSticker(chatId, sticker, params);
1798
+ async deleteChatPhoto(chatId) {
1799
+ await __classPrivateFieldGet(this, _Client_messageManager, "f").deleteChatPhoto(chatId);
1604
1800
  }
1605
1801
  /**
1606
- * Send a video.
1802
+ * Ban a member from a chat.
1607
1803
  *
1608
- * @method ms
1609
- * @param chatId The chat to send the video to.
1610
- * @param video The video to send.
1611
- * @returns The sent video.
1804
+ * @method ch
1805
+ * @param chatId The identifier of the chat.
1806
+ * @param memberId The identifier of the member.
1612
1807
  */
1613
- async sendVideo(chatId, video, params) {
1614
- 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);
1615
1810
  }
1616
1811
  /**
1617
- * Send an animation.
1812
+ * Unban a member from a chat.
1618
1813
  *
1619
- * @method ms
1620
- * @param chatId The chat to send the animation to.
1621
- * @param animation The animation to send.
1622
- * @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.
1623
1817
  */
1624
- async sendAnimation(chatId, animation, params) {
1625
- 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);
1626
1820
  }
1627
1821
  /**
1628
- * Send a voice message.
1822
+ * Kick a member from a chat. Same as a banChatMember call followed by unbanChatMember.
1629
1823
  *
1630
- * @method ms
1631
- * @param chatId The chat to send the voice message to.
1632
- * @param voice The voice to send.
1633
- * @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.
1634
1827
  */
1635
- async sendVoice(chatId, voice, params) {
1636
- 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);
1637
1831
  }
1638
1832
  /**
1639
- * Send an audio file.
1833
+ * Set the rights of a chat member.
1640
1834
  *
1641
- * @method ms
1642
- * @param chatId The chat to send the audio file to.
1643
- * @param audio The audio to send.
1644
- * @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.
1645
1838
  */
1646
- async sendAudio(chatId, audio, params) {
1647
- 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);
1648
1841
  }
1649
1842
  /**
1650
- * Send a video note.
1843
+ * Get the administrators of a chat.
1651
1844
  *
1652
- * @method ms
1653
- * @param chatId The chat to send the video note to.
1654
- * @param videoNote The video note to send.
1655
- * @returns The sent video note.
1845
+ * @method ch
1846
+ * @param chatId The identifier of the chat.
1847
+ * @returns The chat's administrators.
1656
1848
  */
1657
- async sendVideoNote(chatId, videoNote, params) {
1658
- 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);
1659
1851
  }
1660
1852
  /**
1661
- * Send a location.
1853
+ * Enable join requests in a chat. User-only.
1662
1854
  *
1663
- * @method ms
1664
- * @param chatId The chat to send the location to.
1665
- * @param latitude The location's latitude.
1666
- * @param longitude The location's longitude.
1667
- * @returns The sent location.
1855
+ * @method ch
1856
+ * @param chatId The identifier of the chat. Must be a channel or a supergroup.
1668
1857
  */
1669
- async sendLocation(chatId, latitude, longitude, params) {
1670
- 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);
1671
1860
  }
1672
1861
  /**
1673
- * Send a contact.
1862
+ * Disable join requests in a chat. User-only.
1674
1863
  *
1675
- * @method ms
1676
- * @param chatId The chat to send the contact to.
1677
- * @param firstName The contact's first name.
1678
- * @param number The contact's phone number.
1679
- * @returns The sent contact.
1864
+ * @method ch
1865
+ * @param chatId The identifier of the chat. Must be a channel or a supergroup.
1680
1866
  */
1681
- async sendContact(chatId, firstName, number, params) {
1682
- 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);
1683
1869
  }
1684
1870
  /**
1685
- * Send a dice.
1871
+ * Get inactive chats. User-only.
1686
1872
  *
1687
- * @method ms
1688
- * @param chatId The chat to send the dice to.
1689
- * @returns The sent dice.
1873
+ * @method ch
1874
+ * @retuns A list of inactive chats the current user is member of.
1690
1875
  */
1691
- async sendDice(chatId, params) {
1692
- return await __classPrivateFieldGet(this, _Client_messageManager, "f").sendDice(chatId, params);
1876
+ async getInactiveChats() {
1877
+ return await __classPrivateFieldGet(this, _Client_accountManager, "f").getInactiveChats();
1693
1878
  }
1694
1879
  /**
1695
- * Send a venue.
1880
+ * Get the invite links created for a chat. User-only.
1696
1881
  *
1697
- * @method ms
1698
- * @param chatId The chat to send the venue to.
1699
- * @param latitude The latitude of the venue.
1700
- * @param longitude The longitude of the venue.
1701
- * @param title The title of the venue.
1702
- * @param address The written address of the venue.
1703
- * @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.
1704
1885
  */
1705
- async sendVenue(chatId, latitude, longitude, title, address, params) {
1706
- 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);
1707
1888
  }
1708
1889
  /**
1709
- * Get network statistics. This might not always be available.
1890
+ * Join a chat. User-only.
1710
1891
  *
1711
- * @method mc
1892
+ * @method ch
1893
+ * @param chatId The identifier of the chat to join.
1712
1894
  */
1713
- async getNetworkStatistics() {
1714
- return await __classPrivateFieldGet(this, _Client_networkStatisticsManager, "f").getNetworkStatistics();
1895
+ async joinChat(chatId) {
1896
+ await __classPrivateFieldGet(this, _Client_messageManager, "f").joinChat(chatId);
1715
1897
  }
1716
1898
  /**
1717
- * Get chats from a chat list. User-only.
1899
+ * Leave a chat.
1718
1900
  *
1719
1901
  * @method ch
1902
+ * @param chatId The identifier of the chat to leave.
1720
1903
  */
1721
- async getChats(params) {
1722
- 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);
1723
1906
  }
1724
1907
  /**
1725
- * Get a chat.
1908
+ * Get information on a user's chat membership.
1726
1909
  *
1727
1910
  * @method ch
1911
+ * @param chatId The identifier of a chat that includes the user.
1912
+ * @param userId The identifier of the user.
1728
1913
  */
1729
- async getChat(chatId) {
1730
- 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);
1731
1916
  }
1732
1917
  /**
1733
- * Get chat history. User-only.
1918
+ * Set a chat's sticker set.
1734
1919
  *
1735
1920
  * @method ch
1736
- * @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.
1737
1923
  */
1738
- async getHistory(chatId, params) {
1739
- 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);
1740
1926
  }
1741
1927
  /**
1742
- * Get custom emoji documents for download.
1928
+ * Delete a chat's sticker set.
1743
1929
  *
1744
- * @method fs
1745
- * @param id Identifier of one or more of custom emojis.
1746
- * @returns The custom emoji documents.
1930
+ * @method ch
1931
+ * @param chatId The identifier of the chat. Must be a supergroup.
1747
1932
  */
1748
- async getCustomEmojiStickers(id) {
1749
- return await __classPrivateFieldGet(this, _Client_fileManager, "f").getCustomEmojiStickers(id);
1933
+ async deleteChatStickerSet(chatId) {
1934
+ await __classPrivateFieldGet(this, _Client_messageManager, "f").deleteChatStickerSet(chatId);
1750
1935
  }
1751
1936
  /**
1752
- * Set a chat's available reactions. User-only.
1937
+ * Set the number of boosts required to circument a chat's default restrictions. User-only.
1753
1938
  *
1754
1939
  * @method ch
1755
1940
  * @param chatId The identifier of the chat.
1756
- * @param availableReactions The new available reactions.
1941
+ * @param boosts The number of boosts required to circumvent its restrictions.
1757
1942
  */
1758
- async setAvailableReactions(chatId, availableReactions) {
1759
- await __classPrivateFieldGet(this, _Client_messageManager, "f").setAvailableReactions(chatId, availableReactions);
1943
+ async setBoostsRequiredToCircumventRestrictions(chatId, boosts) {
1944
+ await __classPrivateFieldGet(this, _Client_messageManager, "f").setBoostsRequiredToCircumventRestrictions(chatId, boosts);
1760
1945
  }
1761
1946
  /**
1762
- * Change reactions made to a message.
1947
+ * Create an invite link.
1763
1948
  *
1764
- * @method re
1765
- * @param chatId The identifier of the chat which the message belongs to.
1766
- * @param messageId The identifier of the message to add the reaction to.
1767
- * @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.
1768
1952
  */
1769
- async setReactions(chatId, messageId, reactions, params) {
1770
- 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);
1771
1955
  }
1956
+ //
1957
+ // ========================= CALLBACK QUERIES ========================= //
1958
+ //
1772
1959
  /**
1773
- * Make a reaction to a message.
1960
+ * Answer a callback query. Bot-only.
1774
1961
  *
1775
- * @method re
1776
- * @param chatId The identifier of the chat which the message belongs to.
1777
- * @param messageId The identifier of the message to add the reaction to.
1778
- * @param reaction The reaction to add.
1962
+ * @method cq
1963
+ * @param id ID of the callback query to answer.
1779
1964
  */
1780
- async addReaction(chatId, messageId, reaction, params) {
1781
- 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);
1782
1967
  }
1968
+ //
1969
+ // ========================= INLINE QUERIES ========================= //
1970
+ //
1783
1971
  /**
1784
- * Undo a reaction made to a message.
1972
+ * Answer an inline query. Bot-only.
1785
1973
  *
1786
- * @method re
1787
- * @param chatId The identifier of the chat which the message belongs to.
1788
- * @param messageId The identifier of the message which the reaction was made to.
1789
- * @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.
1790
1977
  */
1791
- async removeReaction(chatId, messageId, reaction) {
1792
- 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);
1793
1980
  }
1981
+ //
1982
+ // ========================= BOTS ========================= //
1983
+ //
1794
1984
  /**
1795
- * Set a chat's photo.
1985
+ * Set the bot's description in the given language. Bot-only.
1796
1986
  *
1797
- * @method ch
1798
- * @param chatId The identifier of the chat.
1799
- * @param photo A photo to set as the chat's photo.
1987
+ * @method bs
1800
1988
  */
1801
- async setChatPhoto(chatId, photo, params) {
1802
- await __classPrivateFieldGet(this, _Client_messageManager, "f").setChatPhoto(chatId, photo, params);
1989
+ async setMyDescription(params) {
1990
+ await __classPrivateFieldGet(this, _Client_botInfoManager, "f").setMyDescription(params);
1803
1991
  }
1804
1992
  /**
1805
- * Delete a chat's photo.
1993
+ * Set the bot's name in the given language. Bot-only.
1806
1994
  *
1807
- * @method ch
1808
- * @param chatId The identifier of the chat.
1995
+ * @method bs
1809
1996
  */
1810
- async deleteChatPhoto(chatId) {
1811
- await __classPrivateFieldGet(this, _Client_messageManager, "f").deleteChatPhoto(chatId);
1997
+ async setMyName(params) {
1998
+ await __classPrivateFieldGet(this, _Client_botInfoManager, "f").setMyName(params);
1812
1999
  }
1813
2000
  /**
1814
- * 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.
1815
2002
  *
1816
- * @method ms
1817
- * @param chatId The identifier of the chat. Must be a supergroup.
1818
- * @param memberId The identifier of the member.
2003
+ * @method bs
1819
2004
  */
1820
- async deleteChatMemberMessages(chatId, memberId) {
1821
- await __classPrivateFieldGet(this, _Client_messageManager, "f").deleteChatMemberMessages(chatId, memberId);
2005
+ async setMyShortDescription(params) {
2006
+ await __classPrivateFieldGet(this, _Client_botInfoManager, "f").setMyShortDescription(params);
1822
2007
  }
1823
2008
  /**
1824
- * Pin a message in a chat.
2009
+ * Get the bot's description in the given language. Bot-only.
1825
2010
  *
1826
- * @method ms
1827
- * @param chatId The identifier of the chat that contains the message.
1828
- * @param messageId The message's identifier.
2011
+ * @method bs
2012
+ * @returns The current bot's description in the specified language.
1829
2013
  */
1830
- async pinMessage(chatId, messageId, params) {
1831
- await __classPrivateFieldGet(this, _Client_messageManager, "f").pinMessage(chatId, messageId, params);
2014
+ async getMyDescription(params) {
2015
+ return await __classPrivateFieldGet(this, _Client_botInfoManager, "f").getMyDescription(params);
1832
2016
  }
1833
2017
  /**
1834
- * Unpin a pinned message.
2018
+ * Get the bot's name in the given language. Bot-only.
1835
2019
  *
1836
- * @method ms
1837
- * @param chatId The identifier of the chat that contains the message.
1838
- * @param messageId The message's identifier.
2020
+ * @method bs
2021
+ * @returns The current bot's name in the specified language.
1839
2022
  */
1840
- async unpinMessage(chatId, messageId) {
1841
- await __classPrivateFieldGet(this, _Client_messageManager, "f").unpinMessage(chatId, messageId);
2023
+ async getMyName(params) {
2024
+ return await __classPrivateFieldGet(this, _Client_botInfoManager, "f").getMyName(params);
1842
2025
  }
1843
2026
  /**
1844
- * Unpin all pinned messages.
2027
+ * Get the bot's short description in the given language. Bot-only.
1845
2028
  *
1846
- * @method ms
1847
- * @param chatId The identifier of the chat.
2029
+ * @method bs
2030
+ * @returns The current bot's short description in the specified language.
1848
2031
  */
1849
- async unpinMessages(chatId) {
1850
- await __classPrivateFieldGet(this, _Client_messageManager, "f").unpinMessages(chatId);
2032
+ async getMyShortDescription(params) {
2033
+ return await __classPrivateFieldGet(this, _Client_botInfoManager, "f").getMyShortDescription(params);
1851
2034
  }
1852
2035
  /**
1853
- * Ban a member from a chat.
2036
+ * Set the bot's commands in the given scope and/or language. Bot-only.
1854
2037
  *
1855
- * @method ch
1856
- * @param chatId The identifier of the chat.
1857
- * @param memberId The identifier of the member.
2038
+ * @method bs
2039
+ * @param commands The commands to set.
1858
2040
  */
1859
- async banChatMember(chatId, memberId, params) {
1860
- 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);
1861
2043
  }
1862
2044
  /**
1863
- * Unban a member from a chat.
2045
+ * Get the bot's commands in the given scope and/or language. Bot-only.
1864
2046
  *
1865
- * @method ch
1866
- * @param chatId The identifier of the chat. Must be a supergroup.
1867
- * @param memberId The identifier of the member.
2047
+ * @method bs
2048
+ * @returns The current bot's commands in the specified language.
1868
2049
  */
1869
- async unbanChatMember(chatId, memberId) {
1870
- await __classPrivateFieldGet(this, _Client_messageManager, "f").unbanChatMember(chatId, memberId);
2050
+ async getMyCommands(params) {
2051
+ return await __classPrivateFieldGet(this, _Client_botInfoManager, "f").getMyCommands(params);
1871
2052
  }
2053
+ //
2054
+ // ========================= REACTIONS ========================= //
2055
+ //
1872
2056
  /**
1873
- * Kick a member from a chat. Same as a banChatMember call followed by unbanChatMember.
2057
+ * Change reactions made to a message.
1874
2058
  *
1875
- * @method ch
1876
- * @param chatId The identifier of the chat. Must be a supergroup.
1877
- * @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.
1878
2063
  */
1879
- async kickChatMember(chatId, memberId) {
1880
- await __classPrivateFieldGet(this, _Client_messageManager, "f").banChatMember(chatId, memberId);
1881
- 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);
1882
2066
  }
1883
2067
  /**
1884
- * Set the rights of a chat member.
2068
+ * Make a reaction to a message.
1885
2069
  *
1886
- * @method ch
1887
- * @param chatId The identifier of the chat. Must be a supergroup.
1888
- * @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.
1889
2074
  */
1890
- async setChatMemberRights(chatId, memberId, params) {
1891
- 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);
1892
2077
  }
1893
2078
  /**
1894
- * Get the administrators of a chat.
2079
+ * Undo a reaction made to a message.
1895
2080
  *
1896
- * @method ch
1897
- * @param chatId The identifier of the chat.
1898
- * @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.
1899
2085
  */
1900
- async getChatAdministrators(chatId) {
1901
- 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);
1902
2088
  }
2089
+ //
2090
+ // ========================= STORIES ========================= //
2091
+ //
1903
2092
  /**
1904
2093
  * Create a story. User-only.
1905
2094
  *
@@ -1994,130 +2183,16 @@ class Client extends Composer {
1994
2183
  async removeStoryFromHighlights(chatId, storyId) {
1995
2184
  await __classPrivateFieldGet(this, _Client_storyManager, "f").removeStoryFromHighlights(chatId, storyId);
1996
2185
  }
2186
+ //
2187
+ // ========================= MISC ========================= //
2188
+ //
1997
2189
  /**
1998
- * Enable 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 enableJoinRequests(chatId) {
2004
- await __classPrivateFieldGet(this, _Client_messageManager, "f").enableJoinRequests(chatId);
2005
- }
2006
- /**
2007
- * Disable join requests in a chat. User-only.
2008
- *
2009
- * @method ch
2010
- * @param chatId The identifier of the chat. Must be a channel or a supergroup.
2011
- */
2012
- async disableJoinRequests(chatId) {
2013
- await __classPrivateFieldGet(this, _Client_messageManager, "f").disableJoinRequests(chatId);
2014
- }
2015
- /**
2016
- * Show a username in the current account, a bot account, sa upergroup, or a channel's profile. User-only.
2017
- *
2018
- * @method ac
2019
- * @param id `"me"`, a bot ID, a supergroup ID, or a channel ID.
2020
- * @param username The username to show.
2021
- */
2022
- async showUsername(id, username) {
2023
- await __classPrivateFieldGet(this, _Client_accountManager, "f").showUsername(id, username);
2024
- }
2025
- /**
2026
- * Hide a username from the current account, a bot account, a supergroup, or a channel's profile. User-only.
2027
- *
2028
- * @method ac
2029
- * @param id `"me"`, a bot ID, a supergroup ID, or a channel ID.
2030
- * @param username The username to hide.
2031
- */
2032
- async hideUsername(id, username) {
2033
- await __classPrivateFieldGet(this, _Client_accountManager, "f").hideUsername(id, username);
2034
- }
2035
- /**
2036
- * Reorder the usernames of the current account, a bot account, a supergroup, or a channel's profile. User-only.
2037
- *
2038
- * @method ac
2039
- * @param id `"me"`, a bot ID, a supergroup ID, or a channel ID.
2040
- * @param order The new order to use.
2041
- * @returns Whether the order was changed.
2042
- */
2043
- async reorderUsernames(id, order) {
2044
- return await __classPrivateFieldGet(this, _Client_accountManager, "f").reorderUsernames(id, order);
2045
- }
2046
- /**
2047
- * Hide all usernames from the a supergroup or a channel's profile. User-only.
2048
- *
2049
- * @method ac
2050
- * @param id A supergroup ID or a channel ID.
2051
- */
2052
- async hideUsernames(id) {
2053
- return await __classPrivateFieldGet(this, _Client_accountManager, "f").hideUsernames(id);
2054
- }
2055
- /**
2056
- * Get inactive chats. User-only.
2057
- *
2058
- * @method ch
2059
- * @retuns A list of inactive chats the current user is member of.
2060
- */
2061
- async getInactiveChats() {
2062
- return await __classPrivateFieldGet(this, _Client_accountManager, "f").getInactiveChats();
2063
- }
2064
- /**
2065
- * Search the messages of a chat. User-only.
2066
- *
2067
- * @method ms
2068
- * @param chatId The identifier of the chat to search the messages in.
2069
- * @param query The message search query.
2070
- */
2071
- async searchMessages(chatId, query, params) {
2072
- return await __classPrivateFieldGet(this, _Client_messageManager, "f").searchMessages(chatId, query, params);
2073
- }
2074
- /**
2075
- * Set the number of boosts required to circument a chat's default restrictions. User-only.
2076
- *
2077
- * @method ch
2078
- * @param chatId The identifier of the chat.
2079
- * @param boosts The number of boosts required to circumvent its restrictions.
2080
- */
2081
- async setBoostsRequiredToCircumventRestrictions(chatId, boosts) {
2082
- await __classPrivateFieldGet(this, _Client_messageManager, "f").setBoostsRequiredToCircumventRestrictions(chatId, boosts);
2083
- }
2084
- /**
2085
- * Create an invite link.
2086
- *
2087
- * @method ch
2088
- * @param chatId The identifier of the chat to create the invite link for.
2089
- * @returns The newly created invite link.
2090
- */
2091
- async createInviteLink(chatId, params) {
2092
- return await __classPrivateFieldGet(this, _Client_messageManager, "f").createInviteLink(chatId, params);
2093
- }
2094
- /**
2095
- * Get the invite links created for a chat. User-only.
2096
- *
2097
- * @method ch
2098
- * @param chatId The identifier of the chat.
2099
- * @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.
2100
- */
2101
- async getCreatedInviteLinks(chatId, params) {
2102
- return await __classPrivateFieldGet(this, _Client_messageManager, "f").getCreatedInviteLinks(chatId, params);
2103
- }
2104
- /**
2105
- * Join a chat. User-only.
2106
- *
2107
- * @method ch
2108
- * @param chatId The identifier of the chat to join.
2109
- */
2110
- async joinChat(chatId) {
2111
- await __classPrivateFieldGet(this, _Client_messageManager, "f").joinChat(chatId);
2112
- }
2113
- /**
2114
- * Leave a chat.
2190
+ * Get network statistics. This might not always be available.
2115
2191
  *
2116
- * @method ch
2117
- * @param chatId The identifier of the chat to leave.
2192
+ * @method mc
2118
2193
  */
2119
- async leaveChat(chatId) {
2120
- await __classPrivateFieldGet(this, _Client_messageManager, "f").leaveChat(chatId);
2194
+ async getNetworkStatistics() {
2195
+ return await __classPrivateFieldGet(this, _Client_networkStatisticsManager, "f").getNetworkStatistics();
2121
2196
  }
2122
2197
  /**
2123
2198
  * Block a user. User-only.
@@ -2137,35 +2212,6 @@ class Client extends Composer {
2137
2212
  async unblockUser(userId) {
2138
2213
  await __classPrivateFieldGet(this, _Client_messageManager, "f").unblockUser(userId);
2139
2214
  }
2140
- /**
2141
- * Get information on a user's chat membership.
2142
- *
2143
- * @method ch
2144
- * @param chatId The identifier of a chat that includes the user.
2145
- * @param userId The identifier of the user.
2146
- */
2147
- async getChatMember(chatId, userId) {
2148
- return await __classPrivateFieldGet(this, _Client_messageManager, "f").getChatMember(chatId, userId);
2149
- }
2150
- /**
2151
- * Set a chat's sticker set.
2152
- *
2153
- * @method ch
2154
- * @param chatId The identifier of the chat. Must be a supergroup.
2155
- * @param setName The name of the set.
2156
- */
2157
- async setChatStickerSet(chatId, setName) {
2158
- await __classPrivateFieldGet(this, _Client_messageManager, "f").setChatStickerSet(chatId, setName);
2159
- }
2160
- /**
2161
- * Delete a chat's sticker set.
2162
- *
2163
- * @method ch
2164
- * @param chatId The identifier of the chat. Must be a supergroup.
2165
- */
2166
- async deleteChatStickerSet(chatId) {
2167
- await __classPrivateFieldGet(this, _Client_messageManager, "f").deleteChatStickerSet(chatId);
2168
- }
2169
2215
  }
2170
2216
  exports.Client = Client;
2171
2217
  _Client_handleCtxUpdate = async function _Client_handleCtxUpdate(update) {
@@ -2226,6 +2272,9 @@ _Client_handleCtxUpdate = async function _Client_handleCtxUpdate(update) {
2226
2272
  promises.push(__classPrivateFieldGet(this, _Client_instances, "m", _Client_handleCtxUpdate).call(this, upd));
2227
2273
  }
2228
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
+ }
2229
2278
  return () => Promise.all(promises);
2230
2279
  }, _Client_getMe = async function _Client_getMe() {
2231
2280
  if (__classPrivateFieldGet(this, _Client_lastGetMe, "f") != null) {