@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
@@ -9,7 +9,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
9
9
  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");
10
10
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
11
11
  };
12
- 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;
12
+ 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;
13
13
  import { AccessError, InputError } from "../0_errors.js";
14
14
  import { cleanObject, drop, getLogger, getRandomId, mustPrompt, mustPromptOneOf, UNREACHABLE, ZERO_CHANNEL_ID } from "../1_utilities.js";
15
15
  import { as, chatIdToPeerId, functions, getChatIdPeerType, name, peerToChatId, types } from "../2_tl.js";
@@ -21,6 +21,7 @@ import { checkPassword } from "./0_password.js";
21
21
  import { getUsername, resolve } from "./0_utilities.js";
22
22
  import { AccountManager } from "./1_account_manager.js";
23
23
  import { BotInfoManager } from "./1_bot_info_manager.js";
24
+ import { BusinessConnectionManager } from "./1_business_connection_manager.js";
24
25
  import { ClientEncrypted } from "./1_client_encrypted.js";
25
26
  import { ClientPlain } from "./1_client_plain.js";
26
27
  import { Composer as Composer_ } from "./1_composer.js";
@@ -77,6 +78,7 @@ export class Client extends Composer {
77
78
  _Client_botInfoManager.set(this, void 0);
78
79
  _Client_fileManager.set(this, void 0);
79
80
  _Client_reactionManager.set(this, void 0);
81
+ _Client_businessConnectionManager.set(this, void 0);
80
82
  _Client_messageManager.set(this, void 0);
81
83
  _Client_storyManager.set(this, void 0);
82
84
  _Client_callbackQueryManager.set(this, void 0);
@@ -200,7 +202,7 @@ export class Client extends Composer {
200
202
  const reactions = "messageInteractions" in update ? update.messageInteractions : undefined;
201
203
  const mustGetMsg = () => {
202
204
  if (msg !== undefined) {
203
- return { chatId: msg.chat.id, messageId: msg.id, senderId: (msg.from ?? msg.senderChat)?.id };
205
+ return { chatId: msg.chat.id, messageId: msg.id, businessConnectionId: msg.businessConnectionId, senderId: (msg.from ?? msg.senderChat)?.id };
204
206
  }
205
207
  else if (reactions !== undefined) {
206
208
  return { chatId: reactions.chatId, messageId: reactions.messageId };
@@ -259,74 +261,74 @@ export class Client extends Composer {
259
261
  return () => update;
260
262
  },
261
263
  reply: (text, params) => {
262
- const { chatId, messageId } = mustGetMsg();
264
+ const { chatId, messageId, businessConnectionId } = mustGetMsg();
263
265
  const replyToMessageId = getReplyToMessageId(params?.quote, chatId, messageId);
264
- return this.sendMessage(chatId, text, { ...params, replyToMessageId });
266
+ return this.sendMessage(chatId, text, { ...params, replyToMessageId, businessConnectionId });
265
267
  },
266
268
  replyPoll: (question, options, params) => {
267
- const { chatId, messageId } = mustGetMsg();
269
+ const { chatId, messageId, businessConnectionId } = mustGetMsg();
268
270
  const replyToMessageId = getReplyToMessageId(params?.quote, chatId, messageId);
269
- return this.sendPoll(chatId, question, options, { ...params, replyToMessageId });
271
+ return this.sendPoll(chatId, question, options, { ...params, replyToMessageId, businessConnectionId });
270
272
  },
271
273
  replyPhoto: (photo, params) => {
272
- const { chatId, messageId } = mustGetMsg();
274
+ const { chatId, messageId, businessConnectionId } = mustGetMsg();
273
275
  const replyToMessageId = getReplyToMessageId(params?.quote, chatId, messageId);
274
- return this.sendPhoto(chatId, photo, { ...params, replyToMessageId });
276
+ return this.sendPhoto(chatId, photo, { ...params, replyToMessageId, businessConnectionId });
275
277
  },
276
278
  replyDocument: (document, params) => {
277
- const { chatId, messageId } = mustGetMsg();
279
+ const { chatId, messageId, businessConnectionId } = mustGetMsg();
278
280
  const replyToMessageId = getReplyToMessageId(params?.quote, chatId, messageId);
279
- return this.sendDocument(chatId, document, { ...params, replyToMessageId });
281
+ return this.sendDocument(chatId, document, { ...params, replyToMessageId, businessConnectionId });
280
282
  },
281
283
  replySticker: (sticker, params) => {
282
- const { chatId, messageId } = mustGetMsg();
284
+ const { chatId, messageId, businessConnectionId } = mustGetMsg();
283
285
  const replyToMessageId = getReplyToMessageId(params?.quote, chatId, messageId);
284
- return this.sendSticker(chatId, sticker, { ...params, replyToMessageId });
286
+ return this.sendSticker(chatId, sticker, { ...params, replyToMessageId, businessConnectionId });
285
287
  },
286
288
  replyContact: (firstName, number, params) => {
287
- const { chatId, messageId } = mustGetMsg();
289
+ const { chatId, messageId, businessConnectionId } = mustGetMsg();
288
290
  const replyToMessageId = getReplyToMessageId(params?.quote, chatId, messageId);
289
- return this.sendContact(chatId, firstName, number, { ...params, replyToMessageId });
291
+ return this.sendContact(chatId, firstName, number, { ...params, replyToMessageId, businessConnectionId });
290
292
  },
291
293
  replyLocation: (latitude, longitude, params) => {
292
- const { chatId, messageId } = mustGetMsg();
294
+ const { chatId, messageId, businessConnectionId } = mustGetMsg();
293
295
  const replyToMessageId = getReplyToMessageId(params?.quote, chatId, messageId);
294
- return this.sendLocation(chatId, latitude, longitude, { ...params, replyToMessageId });
296
+ return this.sendLocation(chatId, latitude, longitude, { ...params, replyToMessageId, businessConnectionId });
295
297
  },
296
298
  replyDice: (params) => {
297
- const { chatId, messageId } = mustGetMsg();
299
+ const { chatId, messageId, businessConnectionId } = mustGetMsg();
298
300
  const replyToMessageId = getReplyToMessageId(params?.quote, chatId, messageId);
299
- return this.sendDice(chatId, { ...params, replyToMessageId });
301
+ return this.sendDice(chatId, { ...params, replyToMessageId, businessConnectionId });
300
302
  },
301
303
  replyVenue: (latitude, longitude, title, address, params) => {
302
- const { chatId, messageId } = mustGetMsg();
304
+ const { chatId, messageId, businessConnectionId } = mustGetMsg();
303
305
  const replyToMessageId = getReplyToMessageId(params?.quote, chatId, messageId);
304
- return this.sendVenue(chatId, latitude, longitude, title, address, { ...params, replyToMessageId });
306
+ return this.sendVenue(chatId, latitude, longitude, title, address, { ...params, replyToMessageId, businessConnectionId });
305
307
  },
306
308
  replyVideo: (video, params) => {
307
- const { chatId, messageId } = mustGetMsg();
309
+ const { chatId, messageId, businessConnectionId } = mustGetMsg();
308
310
  const replyToMessageId = getReplyToMessageId(params?.quote, chatId, messageId);
309
- return this.sendVideo(chatId, video, { ...params, replyToMessageId });
311
+ return this.sendVideo(chatId, video, { ...params, replyToMessageId, businessConnectionId });
310
312
  },
311
313
  replyAnimation: (document, params) => {
312
- const { chatId, messageId } = mustGetMsg();
314
+ const { chatId, messageId, businessConnectionId } = mustGetMsg();
313
315
  const replyToMessageId = getReplyToMessageId(params?.quote, chatId, messageId);
314
- return this.sendAnimation(chatId, document, { ...params, replyToMessageId });
316
+ return this.sendAnimation(chatId, document, { ...params, replyToMessageId, businessConnectionId });
315
317
  },
316
318
  replyVoice: (document, params) => {
317
- const { chatId, messageId } = mustGetMsg();
319
+ const { chatId, messageId, businessConnectionId } = mustGetMsg();
318
320
  const replyToMessageId = getReplyToMessageId(params?.quote, chatId, messageId);
319
- return this.sendVoice(chatId, document, { ...params, replyToMessageId });
321
+ return this.sendVoice(chatId, document, { ...params, replyToMessageId, businessConnectionId });
320
322
  },
321
323
  replyAudio: (document, params) => {
322
- const { chatId, messageId } = mustGetMsg();
324
+ const { chatId, messageId, businessConnectionId } = mustGetMsg();
323
325
  const replyToMessageId = getReplyToMessageId(params?.quote, chatId, messageId);
324
- return this.sendAudio(chatId, document, { ...params, replyToMessageId });
326
+ return this.sendAudio(chatId, document, { ...params, replyToMessageId, businessConnectionId });
325
327
  },
326
328
  replyVideoNote: (videoNote, params) => {
327
- const { chatId, messageId } = mustGetMsg();
329
+ const { chatId, messageId, businessConnectionId } = mustGetMsg();
328
330
  const replyToMessageId = getReplyToMessageId(params?.quote, chatId, messageId);
329
- return this.sendVideoNote(chatId, videoNote, { ...params, replyToMessageId });
331
+ return this.sendVideoNote(chatId, videoNote, { ...params, replyToMessageId, businessConnectionId });
330
332
  },
331
333
  delete: () => {
332
334
  const { chatId, messageId } = mustGetMsg();
@@ -531,6 +533,13 @@ export class Client extends Composer {
531
533
  const { chatId } = mustGetMsg();
532
534
  return this.deleteChatStickerSet(chatId);
533
535
  },
536
+ getBusinessConnection: () => {
537
+ const { businessConnectionId } = mustGetMsg();
538
+ if (!businessConnectionId) {
539
+ UNREACHABLE();
540
+ }
541
+ return this.getBusinessConnection(businessConnectionId);
542
+ },
534
543
  };
535
544
  return cleanObject(context);
536
545
  });
@@ -636,6 +645,14 @@ export class Client extends Composer {
636
645
  const c = {
637
646
  id,
638
647
  api: this.api,
648
+ invoke: async (function_, businessConnectionId) => {
649
+ if (businessConnectionId) {
650
+ return await this.api.invokeWithBusinessConnection({ connection_id: businessConnectionId, query: function_ });
651
+ }
652
+ else {
653
+ return await this.invoke(function_);
654
+ }
655
+ },
639
656
  storage: this.storage,
640
657
  messageStorage: this.messageStorage,
641
658
  guaranteeUpdateDelivery: __classPrivateFieldGet(this, _Client_guaranteeUpdateDelivery, "f"),
@@ -700,6 +717,7 @@ export class Client extends Composer {
700
717
  __classPrivateFieldSet(this, _Client_botInfoManager, new BotInfoManager(c), "f");
701
718
  __classPrivateFieldSet(this, _Client_fileManager, new FileManager(c), "f");
702
719
  __classPrivateFieldSet(this, _Client_reactionManager, new ReactionManager(c), "f");
720
+ __classPrivateFieldSet(this, _Client_businessConnectionManager, new BusinessConnectionManager(c), "f");
703
721
  __classPrivateFieldSet(this, _Client_messageManager, new MessageManager({ ...c, fileManager: __classPrivateFieldGet(this, _Client_fileManager, "f") }), "f");
704
722
  __classPrivateFieldSet(this, _Client_callbackQueryManager, new CallbackQueryManager({ ...c, messageManager: __classPrivateFieldGet(this, _Client_messageManager, "f") }), "f");
705
723
  __classPrivateFieldSet(this, _Client_storyManager, new StoryManager({ ...c, fileManager: __classPrivateFieldGet(this, _Client_fileManager, "f"), messageManager: __classPrivateFieldGet(this, _Client_messageManager, "f") }), "f");
@@ -814,7 +832,7 @@ export class Client extends Composer {
814
832
  }
815
833
  await this.connect();
816
834
  }
817
- 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() {
835
+ 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() {
818
836
  const apiId = this.apiId || await this.storage.getApiId();
819
837
  if (!apiId) {
820
838
  throw new Error("apiId not set");
@@ -1249,6 +1267,77 @@ export class Client extends Composer {
1249
1267
  }
1250
1268
  return await this.messageStorage.getEntity(id);
1251
1269
  }
1270
+ //
1271
+ // ========================= ACCOUNT ========================= //
1272
+ //
1273
+ /**
1274
+ * Get information on the currently authorized user.
1275
+ *
1276
+ * @method ac
1277
+ */
1278
+ async getMe() {
1279
+ let user_ = await this[getEntity](new types.PeerUser({ user_id: BigInt(await __classPrivateFieldGet(this, _Client_instances, "m", _Client_getSelfId).call(this)) }));
1280
+ if (user_ == null) {
1281
+ const users = await this.api.users.getUsers({ id: [new types.InputUserSelf()] });
1282
+ user_ = users[0][as](types.User);
1283
+ await this.messageStorage.setEntity(user_);
1284
+ }
1285
+ const user = constructUser(user_);
1286
+ __classPrivateFieldSet(this, _Client_lastGetMe, user, "f");
1287
+ return user;
1288
+ }
1289
+ /**
1290
+ * Show a username in the current account, a bot account, a supergroup, or a channel's profile. User-only.
1291
+ *
1292
+ * @method ac
1293
+ * @param id `"me"`, a bot ID, a supergroup ID, or a channel ID.
1294
+ * @param username The username to show.
1295
+ */
1296
+ async showUsername(id, username) {
1297
+ await __classPrivateFieldGet(this, _Client_accountManager, "f").showUsername(id, username);
1298
+ }
1299
+ /**
1300
+ * Hide a username from the current account, a bot account, a supergroup, or a channel's profile. User-only.
1301
+ *
1302
+ * @method ac
1303
+ * @param id `"me"`, a bot ID, a supergroup ID, or a channel ID.
1304
+ * @param username The username to hide.
1305
+ */
1306
+ async hideUsername(id, username) {
1307
+ await __classPrivateFieldGet(this, _Client_accountManager, "f").hideUsername(id, username);
1308
+ }
1309
+ /**
1310
+ * Reorder the usernames of the current account, a bot account, a supergroup, or a channel's profile. User-only.
1311
+ *
1312
+ * @method ac
1313
+ * @param id `"me"`, a bot ID, a supergroup ID, or a channel ID.
1314
+ * @param order The new order to use.
1315
+ * @returns Whether the order was changed.
1316
+ */
1317
+ async reorderUsernames(id, order) {
1318
+ return await __classPrivateFieldGet(this, _Client_accountManager, "f").reorderUsernames(id, order);
1319
+ }
1320
+ /**
1321
+ * Hide all usernames from the a supergroup or a channel's profile. User-only.
1322
+ *
1323
+ * @method ac
1324
+ * @param id A supergroup ID or a channel ID.
1325
+ */
1326
+ async hideUsernames(id) {
1327
+ return await __classPrivateFieldGet(this, _Client_accountManager, "f").hideUsernames(id);
1328
+ }
1329
+ /**
1330
+ * Get a business connection. Bot-only.
1331
+ *
1332
+ * @method ac
1333
+ * @param id The identifier of the business connection.
1334
+ */
1335
+ async getBusinessConnection(id) {
1336
+ return await __classPrivateFieldGet(this, _Client_businessConnectionManager, "f").getBusinessConnection(id);
1337
+ }
1338
+ //
1339
+ // ========================= MESSAGES ========================= //
1340
+ //
1252
1341
  /**
1253
1342
  * Send a text message.
1254
1343
  *
@@ -1260,6 +1349,154 @@ export class Client extends Composer {
1260
1349
  async sendMessage(chatId, text, params) {
1261
1350
  return await __classPrivateFieldGet(this, _Client_messageManager, "f").sendMessage(chatId, text, params);
1262
1351
  }
1352
+ /**
1353
+ * Send a photo.
1354
+ *
1355
+ * @method ms
1356
+ * @param chatId The chat to send the photo to.
1357
+ * @param photo The photo to send.
1358
+ * @returns The sent photo.
1359
+ */
1360
+ async sendPhoto(chatId, photo, params) {
1361
+ return await __classPrivateFieldGet(this, _Client_messageManager, "f").sendPhoto(chatId, photo, params);
1362
+ }
1363
+ /**
1364
+ * Send a document.
1365
+ *
1366
+ * @method ms
1367
+ * @param chatId The chat to send the document to.
1368
+ * @param document The document to send.
1369
+ * @returns The sent document.
1370
+ */
1371
+ async sendDocument(chatId, document, params) {
1372
+ return await __classPrivateFieldGet(this, _Client_messageManager, "f").sendDocument(chatId, document, params);
1373
+ }
1374
+ /**
1375
+ * Send a sticker.
1376
+ *
1377
+ * @method ms
1378
+ * @param chatId The chat to send the sticker to.
1379
+ * @param document The sticker to send.
1380
+ * @returns The sent sticker.
1381
+ */
1382
+ async sendSticker(chatId, sticker, params) {
1383
+ return await __classPrivateFieldGet(this, _Client_messageManager, "f").sendSticker(chatId, sticker, params);
1384
+ }
1385
+ /**
1386
+ * Send a video.
1387
+ *
1388
+ * @method ms
1389
+ * @param chatId The chat to send the video to.
1390
+ * @param video The video to send.
1391
+ * @returns The sent video.
1392
+ */
1393
+ async sendVideo(chatId, video, params) {
1394
+ return await __classPrivateFieldGet(this, _Client_messageManager, "f").sendVideo(chatId, video, params);
1395
+ }
1396
+ /**
1397
+ * Send an animation.
1398
+ *
1399
+ * @method ms
1400
+ * @param chatId The chat to send the animation to.
1401
+ * @param animation The animation to send.
1402
+ * @returns The sent animation.
1403
+ */
1404
+ async sendAnimation(chatId, animation, params) {
1405
+ return await __classPrivateFieldGet(this, _Client_messageManager, "f").sendAnimation(chatId, animation, params);
1406
+ }
1407
+ /**
1408
+ * Send a voice message.
1409
+ *
1410
+ * @method ms
1411
+ * @param chatId The chat to send the voice message to.
1412
+ * @param voice The voice to send.
1413
+ * @returns The sent voice message.
1414
+ */
1415
+ async sendVoice(chatId, voice, params) {
1416
+ return await __classPrivateFieldGet(this, _Client_messageManager, "f").sendVoice(chatId, voice, params);
1417
+ }
1418
+ /**
1419
+ * Send an audio file.
1420
+ *
1421
+ * @method ms
1422
+ * @param chatId The chat to send the audio file to.
1423
+ * @param audio The audio to send.
1424
+ * @returns The sent audio filr.
1425
+ */
1426
+ async sendAudio(chatId, audio, params) {
1427
+ return await __classPrivateFieldGet(this, _Client_messageManager, "f").sendAudio(chatId, audio, params);
1428
+ }
1429
+ /**
1430
+ * Send a video note.
1431
+ *
1432
+ * @method ms
1433
+ * @param chatId The chat to send the video note to.
1434
+ * @param videoNote The video note to send.
1435
+ * @returns The sent video note.
1436
+ */
1437
+ async sendVideoNote(chatId, videoNote, params) {
1438
+ return await __classPrivateFieldGet(this, _Client_messageManager, "f").sendVideoNote(chatId, videoNote, params);
1439
+ }
1440
+ /**
1441
+ * Send a location.
1442
+ *
1443
+ * @method ms
1444
+ * @param chatId The chat to send the location to.
1445
+ * @param latitude The location's latitude.
1446
+ * @param longitude The location's longitude.
1447
+ * @returns The sent location.
1448
+ */
1449
+ async sendLocation(chatId, latitude, longitude, params) {
1450
+ return await __classPrivateFieldGet(this, _Client_messageManager, "f").sendLocation(chatId, latitude, longitude, params);
1451
+ }
1452
+ /**
1453
+ * Send a contact.
1454
+ *
1455
+ * @method ms
1456
+ * @param chatId The chat to send the contact to.
1457
+ * @param firstName The contact's first name.
1458
+ * @param number The contact's phone number.
1459
+ * @returns The sent contact.
1460
+ */
1461
+ async sendContact(chatId, firstName, number, params) {
1462
+ return await __classPrivateFieldGet(this, _Client_messageManager, "f").sendContact(chatId, firstName, number, params);
1463
+ }
1464
+ /**
1465
+ * Send a dice.
1466
+ *
1467
+ * @method ms
1468
+ * @param chatId The chat to send the dice to.
1469
+ * @returns The sent dice.
1470
+ */
1471
+ async sendDice(chatId, params) {
1472
+ return await __classPrivateFieldGet(this, _Client_messageManager, "f").sendDice(chatId, params);
1473
+ }
1474
+ /**
1475
+ * Send a venue.
1476
+ *
1477
+ * @method ms
1478
+ * @param chatId The chat to send the venue to.
1479
+ * @param latitude The latitude of the venue.
1480
+ * @param longitude The longitude of the venue.
1481
+ * @param title The title of the venue.
1482
+ * @param address The written address of the venue.
1483
+ * @returns The sent venue.
1484
+ */
1485
+ async sendVenue(chatId, latitude, longitude, title, address, params) {
1486
+ return await __classPrivateFieldGet(this, _Client_messageManager, "f").sendVenue(chatId, latitude, longitude, title, address, params);
1487
+ }
1488
+ /**
1489
+ * Send a poll.
1490
+ *
1491
+ * @method ms
1492
+ * @param chatId The chat to send the poll to.
1493
+ * @param question The poll's question.
1494
+ * @param options The poll's options.
1495
+ * @returns The sent poll.
1496
+ */
1497
+ async sendPoll(chatId, question, options, params) {
1498
+ return await __classPrivateFieldGet(this, _Client_messageManager, "f").sendPoll(chatId, question, options, params);
1499
+ }
1263
1500
  /**
1264
1501
  * Edit a message's text.
1265
1502
  *
@@ -1356,82 +1593,87 @@ export class Client extends Composer {
1356
1593
  return await __classPrivateFieldGet(this, _Client_messageManager, "f").getMessage(chatId, messageId);
1357
1594
  }
1358
1595
  /**
1359
- * Download a file.
1596
+ * Delete multiple messages.
1360
1597
  *
1361
- * @method fs
1362
- * @param fileId The identifier of the file to download.
1363
- * @example ```ts
1364
- * for await (const chunk of client.download(fileId, { chunkSize: 256 * 1024 })) {
1365
- * await outFile.write(chunk);
1366
- * }
1367
- * ```
1368
- * @returns A generator yielding the contents of the file.
1598
+ * @method ms
1599
+ * @param chatId The identifier of the chat that contains the messages.
1600
+ * @param messageIds The identifiers of the messages to delete.
1369
1601
  */
1370
- async *download(fileId, params) {
1371
- for await (const chunk of __classPrivateFieldGet(this, _Client_fileManager, "f").download(fileId, params)) {
1372
- yield chunk;
1373
- }
1602
+ async deleteMessages(chatId, messageIds, params) {
1603
+ await __classPrivateFieldGet(this, _Client_messageManager, "f").deleteMessages(chatId, messageIds, params);
1374
1604
  }
1375
1605
  /**
1376
- * Forward multiple messages.
1606
+ * Delete a single message.
1377
1607
  *
1378
1608
  * @method ms
1379
- * @param from The identifier of the chat to forward the messages from.
1380
- * @param to The identifier of the chat to forward the messages to.
1381
- * @param messageIds The identifiers of the messages to forward.
1382
- * @returns The forwarded messages.
1609
+ * @param chatId The identifier of the chat that contains the message.
1610
+ * @param messageId The identifier of the message to delete.
1383
1611
  */
1384
- async forwardMessages(from, to, messageIds, params) {
1385
- return await __classPrivateFieldGet(this, _Client_messageManager, "f").forwardMessages(from, to, messageIds, params);
1612
+ async deleteMessage(chatId, messageId, params) {
1613
+ await __classPrivateFieldGet(this, _Client_messageManager, "f").deleteMessages(chatId, [messageId], params);
1386
1614
  }
1387
1615
  /**
1388
- * Forward a single message.
1616
+ * Delete all messages sent by a specific member of a chat. User-only.
1389
1617
  *
1390
1618
  * @method ms
1391
- * @param from The identifier of the chat to forward the message from.
1392
- * @param to The identifier of the chat to forward the message to.
1393
- * @param messageId The identifier of the message to forward.
1394
- * @returns The forwarded message.
1619
+ * @param chatId The identifier of the chat. Must be a supergroup.
1620
+ * @param memberId The identifier of the member.
1395
1621
  */
1396
- async forwardMessage(from, to, messageId, params) {
1397
- return await this.forwardMessages(from, to, [messageId], params).then((v) => v[0]);
1622
+ async deleteChatMemberMessages(chatId, memberId) {
1623
+ await __classPrivateFieldGet(this, _Client_messageManager, "f").deleteChatMemberMessages(chatId, memberId);
1398
1624
  }
1399
1625
  /**
1400
- * Get information on the currently authorized user.
1626
+ * Pin a message in a chat.
1401
1627
  *
1402
- * @method ac
1628
+ * @method ms
1629
+ * @param chatId The identifier of the chat that contains the message.
1630
+ * @param messageId The message's identifier.
1403
1631
  */
1404
- async getMe() {
1405
- let user_ = await this[getEntity](new types.PeerUser({ user_id: BigInt(await __classPrivateFieldGet(this, _Client_instances, "m", _Client_getSelfId).call(this)) }));
1406
- if (user_ == null) {
1407
- const users = await this.api.users.getUsers({ id: [new types.InputUserSelf()] });
1408
- user_ = users[0][as](types.User);
1409
- await this.messageStorage.setEntity(user_);
1410
- }
1411
- const user = constructUser(user_);
1412
- __classPrivateFieldSet(this, _Client_lastGetMe, user, "f");
1413
- return user;
1632
+ async pinMessage(chatId, messageId, params) {
1633
+ await __classPrivateFieldGet(this, _Client_messageManager, "f").pinMessage(chatId, messageId, params);
1414
1634
  }
1415
1635
  /**
1416
- * Answer a callback query. Bot-only.
1636
+ * Unpin a pinned message.
1417
1637
  *
1418
- * @method cq
1419
- * @param id ID of the callback query to answer.
1638
+ * @method ms
1639
+ * @param chatId The identifier of the chat that contains the message.
1640
+ * @param messageId The message's identifier.
1420
1641
  */
1421
- async answerCallbackQuery(id, params) {
1422
- await __classPrivateFieldGet(this, _Client_callbackQueryManager, "f").answerCallbackQuery(id, params);
1642
+ async unpinMessage(chatId, messageId) {
1643
+ await __classPrivateFieldGet(this, _Client_messageManager, "f").unpinMessage(chatId, messageId);
1423
1644
  }
1424
1645
  /**
1425
- * Send a poll.
1646
+ * Unpin all pinned messages.
1426
1647
  *
1427
1648
  * @method ms
1428
- * @param chatId The chat to send the poll to.
1429
- * @param question The poll's question.
1430
- * @param options The poll's options.
1431
- * @returns The sent poll.
1649
+ * @param chatId The identifier of the chat.
1432
1650
  */
1433
- async sendPoll(chatId, question, options, params) {
1434
- return await __classPrivateFieldGet(this, _Client_messageManager, "f").sendPoll(chatId, question, options, params);
1651
+ async unpinMessages(chatId) {
1652
+ await __classPrivateFieldGet(this, _Client_messageManager, "f").unpinMessages(chatId);
1653
+ }
1654
+ /**
1655
+ * Forward multiple messages.
1656
+ *
1657
+ * @method ms
1658
+ * @param from The identifier of the chat to forward the messages from.
1659
+ * @param to The identifier of the chat to forward the messages to.
1660
+ * @param messageIds The identifiers of the messages to forward.
1661
+ * @returns The forwarded messages.
1662
+ */
1663
+ async forwardMessages(from, to, messageIds, params) {
1664
+ return await __classPrivateFieldGet(this, _Client_messageManager, "f").forwardMessages(from, to, messageIds, params);
1665
+ }
1666
+ /**
1667
+ * Forward a single message.
1668
+ *
1669
+ * @method ms
1670
+ * @param from The identifier of the chat to forward the message from.
1671
+ * @param to The identifier of the chat to forward the message to.
1672
+ * @param messageId The identifier of the message to forward.
1673
+ * @returns The forwarded message.
1674
+ */
1675
+ async forwardMessage(from, to, messageId, params) {
1676
+ return await this.forwardMessages(from, to, [messageId], params).then((v) => v[0]);
1435
1677
  }
1436
1678
  /**
1437
1679
  * Stop a poll.
@@ -1456,446 +1698,393 @@ export class Client extends Composer {
1456
1698
  await __classPrivateFieldGet(this, _Client_messageManager, "f").sendChatAction(chatId, action, params);
1457
1699
  }
1458
1700
  /**
1459
- * Upload a file.
1460
- *
1461
- * @method fs
1462
- * @param contents The contents of the file.
1463
- * @returns The uploaded file.
1464
- */
1465
- // deno-lint-ignore no-explicit-any
1466
- async upload(contents, params) {
1467
- return await __classPrivateFieldGet(this, _Client_fileManager, "f").upload(contents, params);
1468
- }
1469
- /**
1470
- * Set the bot's commands in the given scope and/or language. Bot-only.
1471
- *
1472
- * @method bs
1473
- * @param commands The commands to set.
1474
- */
1475
- async setMyCommands(commands, params) {
1476
- await __classPrivateFieldGet(this, _Client_botInfoManager, "f").setMyCommands(commands, params);
1477
- }
1478
- /**
1479
- * Get the bot's commands in the given scope and/or language. Bot-only.
1480
- *
1481
- * @method bs
1482
- * @returns The current bot's commands in the specified language.
1483
- */
1484
- async getMyCommands(params) {
1485
- return await __classPrivateFieldGet(this, _Client_botInfoManager, "f").getMyCommands(params);
1486
- }
1487
- /**
1488
- * Answer an inline query. Bot-only.
1489
- *
1490
- * @method iq
1491
- * @param id The ID of the inline query to answer.
1492
- * @param results The results to answer with.
1493
- */
1494
- async answerInlineQuery(id, results, params) {
1495
- await __classPrivateFieldGet(this, _Client_inlineQueryManager, "f").answerInlineQuery(id, results, params);
1496
- }
1497
- /**
1498
- * Set the bot's description in the given language. Bot-only.
1499
- *
1500
- * @method bs
1501
- */
1502
- async setMyDescription(params) {
1503
- await __classPrivateFieldGet(this, _Client_botInfoManager, "f").setMyDescription(params);
1504
- }
1505
- /**
1506
- * Set the bot's name in the given language. Bot-only.
1507
- *
1508
- * @method bs
1509
- */
1510
- async setMyName(params) {
1511
- await __classPrivateFieldGet(this, _Client_botInfoManager, "f").setMyName(params);
1512
- }
1513
- /**
1514
- * Set the bot's short description in the given language. Bot-only.
1701
+ * Search the messages of a chat. User-only.
1515
1702
  *
1516
- * @method bs
1703
+ * @method ms
1704
+ * @param chatId The identifier of the chat to search the messages in.
1705
+ * @param query The message search query.
1517
1706
  */
1518
- async setMyShortDescription(params) {
1519
- await __classPrivateFieldGet(this, _Client_botInfoManager, "f").setMyShortDescription(params);
1707
+ async searchMessages(chatId, query, params) {
1708
+ return await __classPrivateFieldGet(this, _Client_messageManager, "f").searchMessages(chatId, query, params);
1520
1709
  }
1710
+ //
1711
+ // ========================= FILES ========================= //
1712
+ //
1521
1713
  /**
1522
- * Get the bot's description in the given language. Bot-only.
1714
+ * Download a file.
1523
1715
  *
1524
- * @method bs
1525
- * @returns The current bot's description in the specified language.
1716
+ * @method fs
1717
+ * @param fileId The identifier of the file to download.
1718
+ * @example ```ts
1719
+ * for await (const chunk of client.download(fileId, { chunkSize: 256 * 1024 })) {
1720
+ * await outFile.write(chunk);
1721
+ * }
1722
+ * ```
1723
+ * @returns A generator yielding the contents of the file.
1526
1724
  */
1527
- async getMyDescription(params) {
1528
- return await __classPrivateFieldGet(this, _Client_botInfoManager, "f").getMyDescription(params);
1725
+ async *download(fileId, params) {
1726
+ for await (const chunk of __classPrivateFieldGet(this, _Client_fileManager, "f").download(fileId, params)) {
1727
+ yield chunk;
1728
+ }
1529
1729
  }
1530
1730
  /**
1531
- * Get the bot's name in the given language. Bot-only.
1731
+ * Get custom emoji documents for download.
1532
1732
  *
1533
- * @method bs
1534
- * @returns The current bot's name in the specified language.
1733
+ * @method fs
1734
+ * @param id Identifier of one or more of custom emojis.
1735
+ * @returns The custom emoji documents.
1535
1736
  */
1536
- async getMyName(params) {
1537
- return await __classPrivateFieldGet(this, _Client_botInfoManager, "f").getMyName(params);
1737
+ async getCustomEmojiStickers(id) {
1738
+ return await __classPrivateFieldGet(this, _Client_fileManager, "f").getCustomEmojiStickers(id);
1538
1739
  }
1740
+ //
1741
+ // ========================= CHATS ========================= //
1742
+ //
1539
1743
  /**
1540
- * Get the bot's short description in the given language. Bot-only.
1744
+ * Get chats from a chat list. User-only.
1541
1745
  *
1542
- * @method bs
1543
- * @returns The current bot's short description in the specified language.
1746
+ * @method ch
1544
1747
  */
1545
- async getMyShortDescription(params) {
1546
- return await __classPrivateFieldGet(this, _Client_botInfoManager, "f").getMyShortDescription(params);
1748
+ async getChats(params) {
1749
+ return await __classPrivateFieldGet(this, _Client_chatListManager, "f").getChats(params?.from, params?.after, params?.limit);
1547
1750
  }
1548
1751
  /**
1549
- * Delete multiple messages.
1752
+ * Get a chat.
1550
1753
  *
1551
- * @method ms
1552
- * @param chatId The identifier of the chat that contains the messages.
1553
- * @param messageIds The identifiers of the messages to delete.
1754
+ * @method ch
1554
1755
  */
1555
- async deleteMessages(chatId, messageIds, params) {
1556
- await __classPrivateFieldGet(this, _Client_messageManager, "f").deleteMessages(chatId, messageIds, params);
1756
+ async getChat(chatId) {
1757
+ return await __classPrivateFieldGet(this, _Client_chatListManager, "f").getChat(chatId);
1557
1758
  }
1558
1759
  /**
1559
- * Delete a single message.
1760
+ * Get chat history. User-only.
1560
1761
  *
1561
- * @method ms
1562
- * @param chatId The identifier of the chat that contains the message.
1563
- * @param messageId The identifier of the message to delete.
1762
+ * @method ch
1763
+ * @param chatId The identifier of the chat to get its history.
1564
1764
  */
1565
- async deleteMessage(chatId, messageId, params) {
1566
- await __classPrivateFieldGet(this, _Client_messageManager, "f").deleteMessages(chatId, [messageId], params);
1765
+ async getHistory(chatId, params) {
1766
+ return await __classPrivateFieldGet(this, _Client_messageManager, "f").getHistory(chatId, params);
1567
1767
  }
1568
1768
  /**
1569
- * Send a photo.
1769
+ * Set a chat's available reactions. User-only.
1570
1770
  *
1571
- * @method ms
1572
- * @param chatId The chat to send the photo to.
1573
- * @param photo The photo to send.
1574
- * @returns The sent photo.
1771
+ * @method ch
1772
+ * @param chatId The identifier of the chat.
1773
+ * @param availableReactions The new available reactions.
1575
1774
  */
1576
- async sendPhoto(chatId, photo, params) {
1577
- return await __classPrivateFieldGet(this, _Client_messageManager, "f").sendPhoto(chatId, photo, params);
1775
+ async setAvailableReactions(chatId, availableReactions) {
1776
+ await __classPrivateFieldGet(this, _Client_messageManager, "f").setAvailableReactions(chatId, availableReactions);
1578
1777
  }
1579
1778
  /**
1580
- * Send a document.
1779
+ * Set a chat's photo.
1581
1780
  *
1582
- * @method ms
1583
- * @param chatId The chat to send the document to.
1584
- * @param document The document to send.
1585
- * @returns The sent document.
1781
+ * @method ch
1782
+ * @param chatId The identifier of the chat.
1783
+ * @param photo A photo to set as the chat's photo.
1586
1784
  */
1587
- async sendDocument(chatId, document, params) {
1588
- return await __classPrivateFieldGet(this, _Client_messageManager, "f").sendDocument(chatId, document, params);
1785
+ async setChatPhoto(chatId, photo, params) {
1786
+ await __classPrivateFieldGet(this, _Client_messageManager, "f").setChatPhoto(chatId, photo, params);
1589
1787
  }
1590
1788
  /**
1591
- * Send a sticker.
1789
+ * Delete a chat's photo.
1592
1790
  *
1593
- * @method ms
1594
- * @param chatId The chat to send the sticker to.
1595
- * @param document The sticker to send.
1596
- * @returns The sent sticker.
1791
+ * @method ch
1792
+ * @param chatId The identifier of the chat.
1597
1793
  */
1598
- async sendSticker(chatId, sticker, params) {
1599
- return await __classPrivateFieldGet(this, _Client_messageManager, "f").sendSticker(chatId, sticker, params);
1794
+ async deleteChatPhoto(chatId) {
1795
+ await __classPrivateFieldGet(this, _Client_messageManager, "f").deleteChatPhoto(chatId);
1600
1796
  }
1601
1797
  /**
1602
- * Send a video.
1798
+ * Ban a member from a chat.
1603
1799
  *
1604
- * @method ms
1605
- * @param chatId The chat to send the video to.
1606
- * @param video The video to send.
1607
- * @returns The sent video.
1800
+ * @method ch
1801
+ * @param chatId The identifier of the chat.
1802
+ * @param memberId The identifier of the member.
1608
1803
  */
1609
- async sendVideo(chatId, video, params) {
1610
- return await __classPrivateFieldGet(this, _Client_messageManager, "f").sendVideo(chatId, video, params);
1804
+ async banChatMember(chatId, memberId, params) {
1805
+ await __classPrivateFieldGet(this, _Client_messageManager, "f").banChatMember(chatId, memberId, params);
1611
1806
  }
1612
1807
  /**
1613
- * Send an animation.
1808
+ * Unban a member from a chat.
1614
1809
  *
1615
- * @method ms
1616
- * @param chatId The chat to send the animation to.
1617
- * @param animation The animation to send.
1618
- * @returns The sent animation.
1810
+ * @method ch
1811
+ * @param chatId The identifier of the chat. Must be a supergroup.
1812
+ * @param memberId The identifier of the member.
1619
1813
  */
1620
- async sendAnimation(chatId, animation, params) {
1621
- return await __classPrivateFieldGet(this, _Client_messageManager, "f").sendAnimation(chatId, animation, params);
1814
+ async unbanChatMember(chatId, memberId) {
1815
+ await __classPrivateFieldGet(this, _Client_messageManager, "f").unbanChatMember(chatId, memberId);
1622
1816
  }
1623
1817
  /**
1624
- * Send a voice message.
1818
+ * Kick a member from a chat. Same as a banChatMember call followed by unbanChatMember.
1625
1819
  *
1626
- * @method ms
1627
- * @param chatId The chat to send the voice message to.
1628
- * @param voice The voice to send.
1629
- * @returns The sent voice message.
1820
+ * @method ch
1821
+ * @param chatId The identifier of the chat. Must be a supergroup.
1822
+ * @param memberId The identifier of the member.
1630
1823
  */
1631
- async sendVoice(chatId, voice, params) {
1632
- return await __classPrivateFieldGet(this, _Client_messageManager, "f").sendVoice(chatId, voice, params);
1824
+ async kickChatMember(chatId, memberId) {
1825
+ await __classPrivateFieldGet(this, _Client_messageManager, "f").banChatMember(chatId, memberId);
1826
+ await __classPrivateFieldGet(this, _Client_messageManager, "f").unbanChatMember(chatId, memberId);
1633
1827
  }
1634
1828
  /**
1635
- * Send an audio file.
1829
+ * Set the rights of a chat member.
1636
1830
  *
1637
- * @method ms
1638
- * @param chatId The chat to send the audio file to.
1639
- * @param audio The audio to send.
1640
- * @returns The sent audio filr.
1831
+ * @method ch
1832
+ * @param chatId The identifier of the chat. Must be a supergroup.
1833
+ * @param memberId The identifier of a member.
1641
1834
  */
1642
- async sendAudio(chatId, audio, params) {
1643
- return await __classPrivateFieldGet(this, _Client_messageManager, "f").sendAudio(chatId, audio, params);
1835
+ async setChatMemberRights(chatId, memberId, params) {
1836
+ await __classPrivateFieldGet(this, _Client_messageManager, "f").setChatMemberRights(chatId, memberId, params);
1644
1837
  }
1645
1838
  /**
1646
- * Send a video note.
1839
+ * Get the administrators of a chat.
1647
1840
  *
1648
- * @method ms
1649
- * @param chatId The chat to send the video note to.
1650
- * @param videoNote The video note to send.
1651
- * @returns The sent video note.
1841
+ * @method ch
1842
+ * @param chatId The identifier of the chat.
1843
+ * @returns The chat's administrators.
1652
1844
  */
1653
- async sendVideoNote(chatId, videoNote, params) {
1654
- return await __classPrivateFieldGet(this, _Client_messageManager, "f").sendVideoNote(chatId, videoNote, params);
1845
+ async getChatAdministrators(chatId) {
1846
+ return await __classPrivateFieldGet(this, _Client_messageManager, "f").getChatAdministrators(chatId);
1655
1847
  }
1656
1848
  /**
1657
- * Send a location.
1849
+ * Enable join requests in a chat. User-only.
1658
1850
  *
1659
- * @method ms
1660
- * @param chatId The chat to send the location to.
1661
- * @param latitude The location's latitude.
1662
- * @param longitude The location's longitude.
1663
- * @returns The sent location.
1851
+ * @method ch
1852
+ * @param chatId The identifier of the chat. Must be a channel or a supergroup.
1664
1853
  */
1665
- async sendLocation(chatId, latitude, longitude, params) {
1666
- return await __classPrivateFieldGet(this, _Client_messageManager, "f").sendLocation(chatId, latitude, longitude, params);
1854
+ async enableJoinRequests(chatId) {
1855
+ await __classPrivateFieldGet(this, _Client_messageManager, "f").enableJoinRequests(chatId);
1667
1856
  }
1668
1857
  /**
1669
- * Send a contact.
1858
+ * Disable join requests in a chat. User-only.
1670
1859
  *
1671
- * @method ms
1672
- * @param chatId The chat to send the contact to.
1673
- * @param firstName The contact's first name.
1674
- * @param number The contact's phone number.
1675
- * @returns The sent contact.
1860
+ * @method ch
1861
+ * @param chatId The identifier of the chat. Must be a channel or a supergroup.
1676
1862
  */
1677
- async sendContact(chatId, firstName, number, params) {
1678
- return await __classPrivateFieldGet(this, _Client_messageManager, "f").sendContact(chatId, firstName, number, params);
1863
+ async disableJoinRequests(chatId) {
1864
+ await __classPrivateFieldGet(this, _Client_messageManager, "f").disableJoinRequests(chatId);
1679
1865
  }
1680
1866
  /**
1681
- * Send a dice.
1867
+ * Get inactive chats. User-only.
1682
1868
  *
1683
- * @method ms
1684
- * @param chatId The chat to send the dice to.
1685
- * @returns The sent dice.
1869
+ * @method ch
1870
+ * @retuns A list of inactive chats the current user is member of.
1686
1871
  */
1687
- async sendDice(chatId, params) {
1688
- return await __classPrivateFieldGet(this, _Client_messageManager, "f").sendDice(chatId, params);
1872
+ async getInactiveChats() {
1873
+ return await __classPrivateFieldGet(this, _Client_accountManager, "f").getInactiveChats();
1689
1874
  }
1690
1875
  /**
1691
- * Send a venue.
1876
+ * Get the invite links created for a chat. User-only.
1692
1877
  *
1693
- * @method ms
1694
- * @param chatId The chat to send the venue to.
1695
- * @param latitude The latitude of the venue.
1696
- * @param longitude The longitude of the venue.
1697
- * @param title The title of the venue.
1698
- * @param address The written address of the venue.
1699
- * @returns The sent venue.
1878
+ * @method ch
1879
+ * @param chatId The identifier of the chat.
1880
+ * @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.
1700
1881
  */
1701
- async sendVenue(chatId, latitude, longitude, title, address, params) {
1702
- return await __classPrivateFieldGet(this, _Client_messageManager, "f").sendVenue(chatId, latitude, longitude, title, address, params);
1882
+ async getCreatedInviteLinks(chatId, params) {
1883
+ return await __classPrivateFieldGet(this, _Client_messageManager, "f").getCreatedInviteLinks(chatId, params);
1703
1884
  }
1704
1885
  /**
1705
- * Get network statistics. This might not always be available.
1886
+ * Join a chat. User-only.
1706
1887
  *
1707
- * @method mc
1888
+ * @method ch
1889
+ * @param chatId The identifier of the chat to join.
1708
1890
  */
1709
- async getNetworkStatistics() {
1710
- return await __classPrivateFieldGet(this, _Client_networkStatisticsManager, "f").getNetworkStatistics();
1891
+ async joinChat(chatId) {
1892
+ await __classPrivateFieldGet(this, _Client_messageManager, "f").joinChat(chatId);
1711
1893
  }
1712
1894
  /**
1713
- * Get chats from a chat list. User-only.
1895
+ * Leave a chat.
1714
1896
  *
1715
1897
  * @method ch
1898
+ * @param chatId The identifier of the chat to leave.
1716
1899
  */
1717
- async getChats(params) {
1718
- return await __classPrivateFieldGet(this, _Client_chatListManager, "f").getChats(params?.from, params?.after, params?.limit);
1900
+ async leaveChat(chatId) {
1901
+ await __classPrivateFieldGet(this, _Client_messageManager, "f").leaveChat(chatId);
1719
1902
  }
1720
1903
  /**
1721
- * Get a chat.
1904
+ * Get information on a user's chat membership.
1722
1905
  *
1723
1906
  * @method ch
1907
+ * @param chatId The identifier of a chat that includes the user.
1908
+ * @param userId The identifier of the user.
1724
1909
  */
1725
- async getChat(chatId) {
1726
- return await __classPrivateFieldGet(this, _Client_chatListManager, "f").getChat(chatId);
1910
+ async getChatMember(chatId, userId) {
1911
+ return await __classPrivateFieldGet(this, _Client_messageManager, "f").getChatMember(chatId, userId);
1727
1912
  }
1728
1913
  /**
1729
- * Get chat history. User-only.
1914
+ * Set a chat's sticker set.
1730
1915
  *
1731
1916
  * @method ch
1732
- * @param chatId The identifier of the chat to get its history.
1917
+ * @param chatId The identifier of the chat. Must be a supergroup.
1918
+ * @param setName The name of the set.
1733
1919
  */
1734
- async getHistory(chatId, params) {
1735
- return await __classPrivateFieldGet(this, _Client_messageManager, "f").getHistory(chatId, params);
1920
+ async setChatStickerSet(chatId, setName) {
1921
+ await __classPrivateFieldGet(this, _Client_messageManager, "f").setChatStickerSet(chatId, setName);
1736
1922
  }
1737
1923
  /**
1738
- * Get custom emoji documents for download.
1924
+ * Delete a chat's sticker set.
1739
1925
  *
1740
- * @method fs
1741
- * @param id Identifier of one or more of custom emojis.
1742
- * @returns The custom emoji documents.
1926
+ * @method ch
1927
+ * @param chatId The identifier of the chat. Must be a supergroup.
1743
1928
  */
1744
- async getCustomEmojiStickers(id) {
1745
- return await __classPrivateFieldGet(this, _Client_fileManager, "f").getCustomEmojiStickers(id);
1929
+ async deleteChatStickerSet(chatId) {
1930
+ await __classPrivateFieldGet(this, _Client_messageManager, "f").deleteChatStickerSet(chatId);
1746
1931
  }
1747
1932
  /**
1748
- * Set a chat's available reactions. User-only.
1933
+ * Set the number of boosts required to circument a chat's default restrictions. User-only.
1749
1934
  *
1750
1935
  * @method ch
1751
1936
  * @param chatId The identifier of the chat.
1752
- * @param availableReactions The new available reactions.
1937
+ * @param boosts The number of boosts required to circumvent its restrictions.
1753
1938
  */
1754
- async setAvailableReactions(chatId, availableReactions) {
1755
- await __classPrivateFieldGet(this, _Client_messageManager, "f").setAvailableReactions(chatId, availableReactions);
1939
+ async setBoostsRequiredToCircumventRestrictions(chatId, boosts) {
1940
+ await __classPrivateFieldGet(this, _Client_messageManager, "f").setBoostsRequiredToCircumventRestrictions(chatId, boosts);
1756
1941
  }
1757
1942
  /**
1758
- * Change reactions made to a message.
1943
+ * Create an invite link.
1759
1944
  *
1760
- * @method re
1761
- * @param chatId The identifier of the chat which the message belongs to.
1762
- * @param messageId The identifier of the message to add the reaction to.
1763
- * @param reactions The new reactions.
1945
+ * @method ch
1946
+ * @param chatId The identifier of the chat to create the invite link for.
1947
+ * @returns The newly created invite link.
1764
1948
  */
1765
- async setReactions(chatId, messageId, reactions, params) {
1766
- await __classPrivateFieldGet(this, _Client_messageManager, "f").setReactions(chatId, messageId, reactions, params);
1949
+ async createInviteLink(chatId, params) {
1950
+ return await __classPrivateFieldGet(this, _Client_messageManager, "f").createInviteLink(chatId, params);
1767
1951
  }
1952
+ //
1953
+ // ========================= CALLBACK QUERIES ========================= //
1954
+ //
1768
1955
  /**
1769
- * Make a reaction to a message.
1956
+ * Answer a callback query. Bot-only.
1770
1957
  *
1771
- * @method re
1772
- * @param chatId The identifier of the chat which the message belongs to.
1773
- * @param messageId The identifier of the message to add the reaction to.
1774
- * @param reaction The reaction to add.
1958
+ * @method cq
1959
+ * @param id ID of the callback query to answer.
1775
1960
  */
1776
- async addReaction(chatId, messageId, reaction, params) {
1777
- await __classPrivateFieldGet(this, _Client_messageManager, "f").addReaction(chatId, messageId, reaction, params);
1961
+ async answerCallbackQuery(id, params) {
1962
+ await __classPrivateFieldGet(this, _Client_callbackQueryManager, "f").answerCallbackQuery(id, params);
1778
1963
  }
1964
+ //
1965
+ // ========================= INLINE QUERIES ========================= //
1966
+ //
1779
1967
  /**
1780
- * Undo a reaction made to a message.
1968
+ * Answer an inline query. Bot-only.
1781
1969
  *
1782
- * @method re
1783
- * @param chatId The identifier of the chat which the message belongs to.
1784
- * @param messageId The identifier of the message which the reaction was made to.
1785
- * @param reaction The reaction to remove.
1970
+ * @method iq
1971
+ * @param id The ID of the inline query to answer.
1972
+ * @param results The results to answer with.
1786
1973
  */
1787
- async removeReaction(chatId, messageId, reaction) {
1788
- await __classPrivateFieldGet(this, _Client_messageManager, "f").removeReaction(chatId, messageId, reaction);
1974
+ async answerInlineQuery(id, results, params) {
1975
+ await __classPrivateFieldGet(this, _Client_inlineQueryManager, "f").answerInlineQuery(id, results, params);
1789
1976
  }
1977
+ //
1978
+ // ========================= BOTS ========================= //
1979
+ //
1790
1980
  /**
1791
- * Set a chat's photo.
1981
+ * Set the bot's description in the given language. Bot-only.
1792
1982
  *
1793
- * @method ch
1794
- * @param chatId The identifier of the chat.
1795
- * @param photo A photo to set as the chat's photo.
1983
+ * @method bs
1796
1984
  */
1797
- async setChatPhoto(chatId, photo, params) {
1798
- await __classPrivateFieldGet(this, _Client_messageManager, "f").setChatPhoto(chatId, photo, params);
1985
+ async setMyDescription(params) {
1986
+ await __classPrivateFieldGet(this, _Client_botInfoManager, "f").setMyDescription(params);
1799
1987
  }
1800
1988
  /**
1801
- * Delete a chat's photo.
1989
+ * Set the bot's name in the given language. Bot-only.
1802
1990
  *
1803
- * @method ch
1804
- * @param chatId The identifier of the chat.
1991
+ * @method bs
1805
1992
  */
1806
- async deleteChatPhoto(chatId) {
1807
- await __classPrivateFieldGet(this, _Client_messageManager, "f").deleteChatPhoto(chatId);
1993
+ async setMyName(params) {
1994
+ await __classPrivateFieldGet(this, _Client_botInfoManager, "f").setMyName(params);
1808
1995
  }
1809
1996
  /**
1810
- * Delete all messages sent by a specific member of a chat. User-only.
1997
+ * Set the bot's short description in the given language. Bot-only.
1811
1998
  *
1812
- * @method ms
1813
- * @param chatId The identifier of the chat. Must be a supergroup.
1814
- * @param memberId The identifier of the member.
1999
+ * @method bs
1815
2000
  */
1816
- async deleteChatMemberMessages(chatId, memberId) {
1817
- await __classPrivateFieldGet(this, _Client_messageManager, "f").deleteChatMemberMessages(chatId, memberId);
2001
+ async setMyShortDescription(params) {
2002
+ await __classPrivateFieldGet(this, _Client_botInfoManager, "f").setMyShortDescription(params);
1818
2003
  }
1819
2004
  /**
1820
- * Pin a message in a chat.
2005
+ * Get the bot's description in the given language. Bot-only.
1821
2006
  *
1822
- * @method ms
1823
- * @param chatId The identifier of the chat that contains the message.
1824
- * @param messageId The message's identifier.
2007
+ * @method bs
2008
+ * @returns The current bot's description in the specified language.
1825
2009
  */
1826
- async pinMessage(chatId, messageId, params) {
1827
- await __classPrivateFieldGet(this, _Client_messageManager, "f").pinMessage(chatId, messageId, params);
2010
+ async getMyDescription(params) {
2011
+ return await __classPrivateFieldGet(this, _Client_botInfoManager, "f").getMyDescription(params);
1828
2012
  }
1829
2013
  /**
1830
- * Unpin a pinned message.
2014
+ * Get the bot's name in the given language. Bot-only.
1831
2015
  *
1832
- * @method ms
1833
- * @param chatId The identifier of the chat that contains the message.
1834
- * @param messageId The message's identifier.
2016
+ * @method bs
2017
+ * @returns The current bot's name in the specified language.
1835
2018
  */
1836
- async unpinMessage(chatId, messageId) {
1837
- await __classPrivateFieldGet(this, _Client_messageManager, "f").unpinMessage(chatId, messageId);
2019
+ async getMyName(params) {
2020
+ return await __classPrivateFieldGet(this, _Client_botInfoManager, "f").getMyName(params);
1838
2021
  }
1839
2022
  /**
1840
- * Unpin all pinned messages.
2023
+ * Get the bot's short description in the given language. Bot-only.
1841
2024
  *
1842
- * @method ms
1843
- * @param chatId The identifier of the chat.
2025
+ * @method bs
2026
+ * @returns The current bot's short description in the specified language.
1844
2027
  */
1845
- async unpinMessages(chatId) {
1846
- await __classPrivateFieldGet(this, _Client_messageManager, "f").unpinMessages(chatId);
2028
+ async getMyShortDescription(params) {
2029
+ return await __classPrivateFieldGet(this, _Client_botInfoManager, "f").getMyShortDescription(params);
1847
2030
  }
1848
2031
  /**
1849
- * Ban a member from a chat.
2032
+ * Set the bot's commands in the given scope and/or language. Bot-only.
1850
2033
  *
1851
- * @method ch
1852
- * @param chatId The identifier of the chat.
1853
- * @param memberId The identifier of the member.
2034
+ * @method bs
2035
+ * @param commands The commands to set.
1854
2036
  */
1855
- async banChatMember(chatId, memberId, params) {
1856
- await __classPrivateFieldGet(this, _Client_messageManager, "f").banChatMember(chatId, memberId, params);
2037
+ async setMyCommands(commands, params) {
2038
+ await __classPrivateFieldGet(this, _Client_botInfoManager, "f").setMyCommands(commands, params);
1857
2039
  }
1858
2040
  /**
1859
- * Unban a member from a chat.
2041
+ * Get the bot's commands in the given scope and/or language. Bot-only.
1860
2042
  *
1861
- * @method ch
1862
- * @param chatId The identifier of the chat. Must be a supergroup.
1863
- * @param memberId The identifier of the member.
2043
+ * @method bs
2044
+ * @returns The current bot's commands in the specified language.
1864
2045
  */
1865
- async unbanChatMember(chatId, memberId) {
1866
- await __classPrivateFieldGet(this, _Client_messageManager, "f").unbanChatMember(chatId, memberId);
2046
+ async getMyCommands(params) {
2047
+ return await __classPrivateFieldGet(this, _Client_botInfoManager, "f").getMyCommands(params);
1867
2048
  }
2049
+ //
2050
+ // ========================= REACTIONS ========================= //
2051
+ //
1868
2052
  /**
1869
- * Kick a member from a chat. Same as a banChatMember call followed by unbanChatMember.
2053
+ * Change reactions made to a message.
1870
2054
  *
1871
- * @method ch
1872
- * @param chatId The identifier of the chat. Must be a supergroup.
1873
- * @param memberId The identifier of the member.
2055
+ * @method re
2056
+ * @param chatId The identifier of the chat which the message belongs to.
2057
+ * @param messageId The identifier of the message to add the reaction to.
2058
+ * @param reactions The new reactions.
1874
2059
  */
1875
- async kickChatMember(chatId, memberId) {
1876
- await __classPrivateFieldGet(this, _Client_messageManager, "f").banChatMember(chatId, memberId);
1877
- await __classPrivateFieldGet(this, _Client_messageManager, "f").unbanChatMember(chatId, memberId);
2060
+ async setReactions(chatId, messageId, reactions, params) {
2061
+ await __classPrivateFieldGet(this, _Client_messageManager, "f").setReactions(chatId, messageId, reactions, params);
1878
2062
  }
1879
2063
  /**
1880
- * Set the rights of a chat member.
2064
+ * Make a reaction to a message.
1881
2065
  *
1882
- * @method ch
1883
- * @param chatId The identifier of the chat. Must be a supergroup.
1884
- * @param memberId The identifier of a member.
2066
+ * @method re
2067
+ * @param chatId The identifier of the chat which the message belongs to.
2068
+ * @param messageId The identifier of the message to add the reaction to.
2069
+ * @param reaction The reaction to add.
1885
2070
  */
1886
- async setChatMemberRights(chatId, memberId, params) {
1887
- await __classPrivateFieldGet(this, _Client_messageManager, "f").setChatMemberRights(chatId, memberId, params);
2071
+ async addReaction(chatId, messageId, reaction, params) {
2072
+ await __classPrivateFieldGet(this, _Client_messageManager, "f").addReaction(chatId, messageId, reaction, params);
1888
2073
  }
1889
2074
  /**
1890
- * Get the administrators of a chat.
2075
+ * Undo a reaction made to a message.
1891
2076
  *
1892
- * @method ch
1893
- * @param chatId The identifier of the chat.
1894
- * @returns The chat's administrators.
2077
+ * @method re
2078
+ * @param chatId The identifier of the chat which the message belongs to.
2079
+ * @param messageId The identifier of the message which the reaction was made to.
2080
+ * @param reaction The reaction to remove.
1895
2081
  */
1896
- async getChatAdministrators(chatId) {
1897
- return await __classPrivateFieldGet(this, _Client_messageManager, "f").getChatAdministrators(chatId);
2082
+ async removeReaction(chatId, messageId, reaction) {
2083
+ await __classPrivateFieldGet(this, _Client_messageManager, "f").removeReaction(chatId, messageId, reaction);
1898
2084
  }
2085
+ //
2086
+ // ========================= STORIES ========================= //
2087
+ //
1899
2088
  /**
1900
2089
  * Create a story. User-only.
1901
2090
  *
@@ -1990,130 +2179,16 @@ export class Client extends Composer {
1990
2179
  async removeStoryFromHighlights(chatId, storyId) {
1991
2180
  await __classPrivateFieldGet(this, _Client_storyManager, "f").removeStoryFromHighlights(chatId, storyId);
1992
2181
  }
2182
+ //
2183
+ // ========================= MISC ========================= //
2184
+ //
1993
2185
  /**
1994
- * Enable join requests in a chat. User-only.
1995
- *
1996
- * @method ch
1997
- * @param chatId The identifier of the chat. Must be a channel or a supergroup.
1998
- */
1999
- async enableJoinRequests(chatId) {
2000
- await __classPrivateFieldGet(this, _Client_messageManager, "f").enableJoinRequests(chatId);
2001
- }
2002
- /**
2003
- * Disable join requests in a chat. User-only.
2004
- *
2005
- * @method ch
2006
- * @param chatId The identifier of the chat. Must be a channel or a supergroup.
2007
- */
2008
- async disableJoinRequests(chatId) {
2009
- await __classPrivateFieldGet(this, _Client_messageManager, "f").disableJoinRequests(chatId);
2010
- }
2011
- /**
2012
- * Show a username in the current account, a bot account, sa upergroup, or a channel's profile. User-only.
2013
- *
2014
- * @method ac
2015
- * @param id `"me"`, a bot ID, a supergroup ID, or a channel ID.
2016
- * @param username The username to show.
2017
- */
2018
- async showUsername(id, username) {
2019
- await __classPrivateFieldGet(this, _Client_accountManager, "f").showUsername(id, username);
2020
- }
2021
- /**
2022
- * Hide a username from the current account, a bot account, a supergroup, or a channel's profile. User-only.
2023
- *
2024
- * @method ac
2025
- * @param id `"me"`, a bot ID, a supergroup ID, or a channel ID.
2026
- * @param username The username to hide.
2027
- */
2028
- async hideUsername(id, username) {
2029
- await __classPrivateFieldGet(this, _Client_accountManager, "f").hideUsername(id, username);
2030
- }
2031
- /**
2032
- * Reorder the usernames of the current account, a bot account, a supergroup, or a channel's profile. User-only.
2033
- *
2034
- * @method ac
2035
- * @param id `"me"`, a bot ID, a supergroup ID, or a channel ID.
2036
- * @param order The new order to use.
2037
- * @returns Whether the order was changed.
2038
- */
2039
- async reorderUsernames(id, order) {
2040
- return await __classPrivateFieldGet(this, _Client_accountManager, "f").reorderUsernames(id, order);
2041
- }
2042
- /**
2043
- * Hide all usernames from the a supergroup or a channel's profile. User-only.
2044
- *
2045
- * @method ac
2046
- * @param id A supergroup ID or a channel ID.
2047
- */
2048
- async hideUsernames(id) {
2049
- return await __classPrivateFieldGet(this, _Client_accountManager, "f").hideUsernames(id);
2050
- }
2051
- /**
2052
- * Get inactive chats. User-only.
2053
- *
2054
- * @method ch
2055
- * @retuns A list of inactive chats the current user is member of.
2056
- */
2057
- async getInactiveChats() {
2058
- return await __classPrivateFieldGet(this, _Client_accountManager, "f").getInactiveChats();
2059
- }
2060
- /**
2061
- * Search the messages of a chat. User-only.
2062
- *
2063
- * @method ms
2064
- * @param chatId The identifier of the chat to search the messages in.
2065
- * @param query The message search query.
2066
- */
2067
- async searchMessages(chatId, query, params) {
2068
- return await __classPrivateFieldGet(this, _Client_messageManager, "f").searchMessages(chatId, query, params);
2069
- }
2070
- /**
2071
- * Set the number of boosts required to circument a chat's default restrictions. User-only.
2072
- *
2073
- * @method ch
2074
- * @param chatId The identifier of the chat.
2075
- * @param boosts The number of boosts required to circumvent its restrictions.
2076
- */
2077
- async setBoostsRequiredToCircumventRestrictions(chatId, boosts) {
2078
- await __classPrivateFieldGet(this, _Client_messageManager, "f").setBoostsRequiredToCircumventRestrictions(chatId, boosts);
2079
- }
2080
- /**
2081
- * Create an invite link.
2082
- *
2083
- * @method ch
2084
- * @param chatId The identifier of the chat to create the invite link for.
2085
- * @returns The newly created invite link.
2086
- */
2087
- async createInviteLink(chatId, params) {
2088
- return await __classPrivateFieldGet(this, _Client_messageManager, "f").createInviteLink(chatId, params);
2089
- }
2090
- /**
2091
- * Get the invite links created for a chat. User-only.
2092
- *
2093
- * @method ch
2094
- * @param chatId The identifier of the chat.
2095
- * @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.
2096
- */
2097
- async getCreatedInviteLinks(chatId, params) {
2098
- return await __classPrivateFieldGet(this, _Client_messageManager, "f").getCreatedInviteLinks(chatId, params);
2099
- }
2100
- /**
2101
- * Join a chat. User-only.
2102
- *
2103
- * @method ch
2104
- * @param chatId The identifier of the chat to join.
2105
- */
2106
- async joinChat(chatId) {
2107
- await __classPrivateFieldGet(this, _Client_messageManager, "f").joinChat(chatId);
2108
- }
2109
- /**
2110
- * Leave a chat.
2186
+ * Get network statistics. This might not always be available.
2111
2187
  *
2112
- * @method ch
2113
- * @param chatId The identifier of the chat to leave.
2188
+ * @method mc
2114
2189
  */
2115
- async leaveChat(chatId) {
2116
- await __classPrivateFieldGet(this, _Client_messageManager, "f").leaveChat(chatId);
2190
+ async getNetworkStatistics() {
2191
+ return await __classPrivateFieldGet(this, _Client_networkStatisticsManager, "f").getNetworkStatistics();
2117
2192
  }
2118
2193
  /**
2119
2194
  * Block a user. User-only.
@@ -2133,35 +2208,6 @@ export class Client extends Composer {
2133
2208
  async unblockUser(userId) {
2134
2209
  await __classPrivateFieldGet(this, _Client_messageManager, "f").unblockUser(userId);
2135
2210
  }
2136
- /**
2137
- * Get information on a user's chat membership.
2138
- *
2139
- * @method ch
2140
- * @param chatId The identifier of a chat that includes the user.
2141
- * @param userId The identifier of the user.
2142
- */
2143
- async getChatMember(chatId, userId) {
2144
- return await __classPrivateFieldGet(this, _Client_messageManager, "f").getChatMember(chatId, userId);
2145
- }
2146
- /**
2147
- * Set a chat's sticker set.
2148
- *
2149
- * @method ch
2150
- * @param chatId The identifier of the chat. Must be a supergroup.
2151
- * @param setName The name of the set.
2152
- */
2153
- async setChatStickerSet(chatId, setName) {
2154
- await __classPrivateFieldGet(this, _Client_messageManager, "f").setChatStickerSet(chatId, setName);
2155
- }
2156
- /**
2157
- * Delete a chat's sticker set.
2158
- *
2159
- * @method ch
2160
- * @param chatId The identifier of the chat. Must be a supergroup.
2161
- */
2162
- async deleteChatStickerSet(chatId) {
2163
- await __classPrivateFieldGet(this, _Client_messageManager, "f").deleteChatStickerSet(chatId);
2164
- }
2165
2211
  }
2166
2212
  _Client_handleCtxUpdate = async function _Client_handleCtxUpdate(update) {
2167
2213
  await this.middleware()(await __classPrivateFieldGet(this, _Client_constructContext, "f").call(this, update), resolve);
@@ -2221,6 +2267,9 @@ _Client_handleCtxUpdate = async function _Client_handleCtxUpdate(update) {
2221
2267
  promises.push(__classPrivateFieldGet(this, _Client_instances, "m", _Client_handleCtxUpdate).call(this, upd));
2222
2268
  }
2223
2269
  }
2270
+ if (BusinessConnectionManager.canHandleUpdate(update)) {
2271
+ promises.push(__classPrivateFieldGet(this, _Client_instances, "m", _Client_handleCtxUpdate).call(this, await __classPrivateFieldGet(this, _Client_businessConnectionManager, "f").handleUpdate(update)));
2272
+ }
2224
2273
  return () => Promise.all(promises);
2225
2274
  }, _Client_getMe = async function _Client_getMe() {
2226
2275
  if (__classPrivateFieldGet(this, _Client_lastGetMe, "f") != null) {