@mtkruto/node 0.160.0 → 0.170.0

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 (167) hide show
  1. package/esm/0_deps.d.ts +1 -1
  2. package/esm/0_deps.d.ts.map +1 -1
  3. package/esm/0_deps.js +1 -1
  4. package/esm/2_tl.d.ts +1 -0
  5. package/esm/2_tl.d.ts.map +1 -1
  6. package/esm/2_tl.js +1 -0
  7. package/esm/3_types.d.ts +3 -0
  8. package/esm/3_types.d.ts.map +1 -1
  9. package/esm/3_types.js +3 -0
  10. package/esm/client/0_markdown.d.ts.map +1 -1
  11. package/esm/client/0_params.d.ts +38 -4
  12. package/esm/client/0_params.d.ts.map +1 -1
  13. package/esm/client/0_secret_chat_state.d.ts +86 -0
  14. package/esm/client/0_secret_chat_state.d.ts.map +1 -0
  15. package/esm/client/0_secret_chat_state.js +129 -0
  16. package/esm/client/0_storage_operations.d.ts +1 -0
  17. package/esm/client/0_storage_operations.d.ts.map +1 -1
  18. package/esm/client/0_storage_operations.js +3 -0
  19. package/esm/client/1_client_generic.d.ts +86 -15
  20. package/esm/client/1_client_generic.d.ts.map +1 -1
  21. package/esm/client/2_client_encrypted.js +6 -6
  22. package/esm/client/2_file_manager.d.ts.map +1 -1
  23. package/esm/client/2_file_manager.js +26 -3
  24. package/esm/client/3_account_manager.js +3 -3
  25. package/esm/client/3_filters.d.ts +16 -7
  26. package/esm/client/3_filters.d.ts.map +1 -1
  27. package/esm/client/3_message_manager.d.ts +59 -20
  28. package/esm/client/3_message_manager.d.ts.map +1 -1
  29. package/esm/client/3_message_manager.js +6 -0
  30. package/esm/client/3_secret_chat_manager.d.ts +26 -0
  31. package/esm/client/3_secret_chat_manager.d.ts.map +1 -0
  32. package/esm/client/3_secret_chat_manager.js +770 -0
  33. package/esm/client/4_chat_manager.d.ts +2 -0
  34. package/esm/client/4_chat_manager.d.ts.map +1 -1
  35. package/esm/client/4_chat_manager.js +12 -0
  36. package/esm/client/4_poll_manager.js +2 -2
  37. package/esm/client/6_client.d.ts +87 -16
  38. package/esm/client/6_client.d.ts.map +1 -1
  39. package/esm/client/6_client.js +118 -18
  40. package/esm/client/6_client_dispatcher.d.ts +86 -15
  41. package/esm/client/6_client_dispatcher.d.ts.map +1 -1
  42. package/esm/client/6_client_dispatcher.js +107 -15
  43. package/esm/session/2_session_encrypted.js +5 -5
  44. package/esm/tl/1_secret_chats_api.d.ts +637 -0
  45. package/esm/tl/1_secret_chats_api.d.ts.map +1 -0
  46. package/esm/tl/1_secret_chats_api.js +849 -0
  47. package/esm/tl/1_tl_reader.js +3 -3
  48. package/esm/tl/2_secret_chats.d.ts +33 -0
  49. package/esm/tl/2_secret_chats.d.ts.map +1 -0
  50. package/esm/tl/2_secret_chats.js +53 -0
  51. package/esm/types/0_report_reason.d.ts +10 -0
  52. package/esm/types/0_report_reason.d.ts.map +1 -1
  53. package/esm/types/0_secret_chat.d.ts +66 -0
  54. package/esm/types/0_secret_chat.d.ts.map +1 -0
  55. package/esm/types/0_secret_chat.js +30 -0
  56. package/esm/types/0_secret_message_entity.d.ts +115 -0
  57. package/esm/types/0_secret_message_entity.d.ts.map +1 -0
  58. package/esm/types/0_secret_message_entity.js +174 -0
  59. package/esm/types/1_chat_p.d.ts +3 -3
  60. package/esm/types/1_chat_p.d.ts.map +1 -1
  61. package/esm/types/1_input_poll_media.d.ts +2 -2
  62. package/esm/types/1_sticker.d.ts +2 -1
  63. package/esm/types/1_sticker.d.ts.map +1 -1
  64. package/esm/types/1_sticker.js +23 -1
  65. package/esm/types/1_story_report_result.d.ts +3 -0
  66. package/esm/types/1_story_report_result.d.ts.map +1 -1
  67. package/esm/types/2_inactive_chat.d.ts +1 -1
  68. package/esm/types/2_inactive_chat.d.ts.map +1 -1
  69. package/esm/types/2_message_entity.d.ts +0 -3
  70. package/esm/types/2_message_entity.d.ts.map +1 -1
  71. package/esm/types/2_secret_message.d.ts +184 -0
  72. package/esm/types/2_secret_message.d.ts.map +1 -0
  73. package/esm/types/2_secret_message.js +341 -0
  74. package/esm/types/2_user.d.ts +1 -1
  75. package/esm/types/2_user.d.ts.map +1 -1
  76. package/esm/types/3_input_media.d.ts +2 -2
  77. package/esm/types/4_gift.d.ts +2 -2
  78. package/esm/types/4_gift.d.ts.map +1 -1
  79. package/esm/types/9_message.d.ts +8 -60
  80. package/esm/types/9_message.d.ts.map +1 -1
  81. package/esm/types/9_message.js +1 -0
  82. package/esm/types/B_update.d.ts +32 -41
  83. package/esm/types/B_update.d.ts.map +1 -1
  84. package/package.json +1 -1
  85. package/script/0_deps.d.ts +1 -1
  86. package/script/0_deps.d.ts.map +1 -1
  87. package/script/0_deps.js +2 -1
  88. package/script/2_tl.d.ts +1 -0
  89. package/script/2_tl.d.ts.map +1 -1
  90. package/script/2_tl.js +2 -1
  91. package/script/3_types.d.ts +3 -0
  92. package/script/3_types.d.ts.map +1 -1
  93. package/script/3_types.js +3 -0
  94. package/script/client/0_markdown.d.ts.map +1 -1
  95. package/script/client/0_params.d.ts +38 -4
  96. package/script/client/0_params.d.ts.map +1 -1
  97. package/script/client/0_secret_chat_state.d.ts +86 -0
  98. package/script/client/0_secret_chat_state.d.ts.map +1 -0
  99. package/script/client/0_secret_chat_state.js +133 -0
  100. package/script/client/0_storage_operations.d.ts +1 -0
  101. package/script/client/0_storage_operations.d.ts.map +1 -1
  102. package/script/client/0_storage_operations.js +3 -0
  103. package/script/client/1_client_generic.d.ts +86 -15
  104. package/script/client/1_client_generic.d.ts.map +1 -1
  105. package/script/client/2_client_encrypted.js +6 -6
  106. package/script/client/2_file_manager.d.ts.map +1 -1
  107. package/script/client/2_file_manager.js +25 -2
  108. package/script/client/3_account_manager.js +3 -3
  109. package/script/client/3_filters.d.ts +16 -7
  110. package/script/client/3_filters.d.ts.map +1 -1
  111. package/script/client/3_message_manager.d.ts +59 -20
  112. package/script/client/3_message_manager.d.ts.map +1 -1
  113. package/script/client/3_message_manager.js +6 -0
  114. package/script/client/3_secret_chat_manager.d.ts +26 -0
  115. package/script/client/3_secret_chat_manager.d.ts.map +1 -0
  116. package/script/client/3_secret_chat_manager.js +807 -0
  117. package/script/client/4_chat_manager.d.ts +2 -0
  118. package/script/client/4_chat_manager.d.ts.map +1 -1
  119. package/script/client/4_chat_manager.js +12 -0
  120. package/script/client/4_poll_manager.js +2 -2
  121. package/script/client/6_client.d.ts +87 -16
  122. package/script/client/6_client.d.ts.map +1 -1
  123. package/script/client/6_client.js +118 -18
  124. package/script/client/6_client_dispatcher.d.ts +86 -15
  125. package/script/client/6_client_dispatcher.d.ts.map +1 -1
  126. package/script/client/6_client_dispatcher.js +107 -15
  127. package/script/session/2_session_encrypted.js +5 -5
  128. package/script/tl/1_secret_chats_api.d.ts +637 -0
  129. package/script/tl/1_secret_chats_api.d.ts.map +1 -0
  130. package/script/tl/1_secret_chats_api.js +852 -0
  131. package/script/tl/1_tl_reader.js +3 -3
  132. package/script/tl/2_secret_chats.d.ts +33 -0
  133. package/script/tl/2_secret_chats.d.ts.map +1 -0
  134. package/script/tl/2_secret_chats.js +78 -0
  135. package/script/types/0_report_reason.d.ts +10 -0
  136. package/script/types/0_report_reason.d.ts.map +1 -1
  137. package/script/types/0_secret_chat.d.ts +66 -0
  138. package/script/types/0_secret_chat.d.ts.map +1 -0
  139. package/script/types/0_secret_chat.js +33 -0
  140. package/script/types/0_secret_message_entity.d.ts +115 -0
  141. package/script/types/0_secret_message_entity.d.ts.map +1 -0
  142. package/script/types/0_secret_message_entity.js +179 -0
  143. package/script/types/1_chat_p.d.ts +3 -3
  144. package/script/types/1_chat_p.d.ts.map +1 -1
  145. package/script/types/1_input_poll_media.d.ts +2 -2
  146. package/script/types/1_sticker.d.ts +2 -1
  147. package/script/types/1_sticker.d.ts.map +1 -1
  148. package/script/types/1_sticker.js +23 -0
  149. package/script/types/1_story_report_result.d.ts +3 -0
  150. package/script/types/1_story_report_result.d.ts.map +1 -1
  151. package/script/types/2_inactive_chat.d.ts +1 -1
  152. package/script/types/2_inactive_chat.d.ts.map +1 -1
  153. package/script/types/2_message_entity.d.ts +0 -3
  154. package/script/types/2_message_entity.d.ts.map +1 -1
  155. package/script/types/2_secret_message.d.ts +184 -0
  156. package/script/types/2_secret_message.d.ts.map +1 -0
  157. package/script/types/2_secret_message.js +344 -0
  158. package/script/types/2_user.d.ts +1 -1
  159. package/script/types/2_user.d.ts.map +1 -1
  160. package/script/types/3_input_media.d.ts +2 -2
  161. package/script/types/4_gift.d.ts +2 -2
  162. package/script/types/4_gift.d.ts.map +1 -1
  163. package/script/types/9_message.d.ts +8 -60
  164. package/script/types/9_message.d.ts.map +1 -1
  165. package/script/types/9_message.js +1 -0
  166. package/script/types/B_update.d.ts +32 -41
  167. package/script/types/B_update.d.ts.map +1 -1
@@ -47,6 +47,7 @@ import { UpdateManager } from "./2_update_manager.js";
47
47
  import { AccountManager } from "./3_account_manager.js";
48
48
  import { ClientEncryptedPool } from "./3_client_encrypted_pool.js";
49
49
  import { MessageManager } from "./3_message_manager.js";
50
+ import { SecretChatManager } from "./3_secret_chat_manager.js";
50
51
  import { StickerSetManager } from "./3_sticker_set_manager.js";
51
52
  import { VideoChatManager } from "./3_video_chat_manager.js";
52
53
  import { CallbackQueryManager } from "./4_callback_query_manager.js";
@@ -89,6 +90,7 @@ export class Client extends Composer {
89
90
  // 3_
90
91
  #accountManager;
91
92
  #messageManager;
93
+ #secretChatManager;
92
94
  #stickerSetManager;
93
95
  #videoChatManager;
94
96
  // 4_
@@ -124,6 +126,7 @@ export class Client extends Composer {
124
126
  // 3_
125
127
  accountManager: this.#accountManager,
126
128
  messageManager: this.#messageManager,
129
+ secretChatManager: this.#secretChatManager,
127
130
  stickerSetManager: this.#stickerSetManager,
128
131
  videoChatManager: this.#videoChatManager,
129
132
  // 4_
@@ -260,6 +263,7 @@ export class Client extends Composer {
260
263
  // 3_
261
264
  this.#accountManager = new AccountManager({ ...c, fileManager });
262
265
  const messageManager = this.#messageManager = new MessageManager({ ...c, fileManager });
266
+ this.#secretChatManager = new SecretChatManager({ ...c, fileManager });
263
267
  this.#stickerSetManager = new StickerSetManager({ ...c, fileManager });
264
268
  this.#videoChatManager = new VideoChatManager({ ...c, fileManager });
265
269
  // 4_
@@ -360,6 +364,7 @@ export class Client extends Composer {
360
364
  await this.storage.deleteUpdates();
361
365
  await this.storage.commit(true);
362
366
  }
367
+ await this.#secretChatManager.loadSecretChats();
363
368
  this.#storageInited = true;
364
369
  }
365
370
  }
@@ -597,7 +602,7 @@ export class Client extends Composer {
597
602
  /**
598
603
  * Check whether a bot token is valid.
599
604
  *
600
- * @param password The password to check
605
+ * @param botToken The bot token to check
601
606
  * @returns The result of the check.
602
607
  * @method ac
603
608
  */
@@ -922,7 +927,7 @@ export class Client extends Composer {
922
927
  async getInputChannel(id) {
923
928
  const inputPeer = await this.getInputPeer(id);
924
929
  if (!canBeInputChannel(inputPeer)) {
925
- throw new TypeError(`The chat ${id} is not a channel neither a supergroup.`);
930
+ throw new TypeError(`The chat ${id} is neither a channel nor a supergroup.`);
926
931
  }
927
932
  return toInputChannel(inputPeer);
928
933
  }
@@ -1011,7 +1016,7 @@ export class Client extends Composer {
1011
1016
  peer = { _: "inputPeerChannel", channel_id: Api.chatIdToPeerId(id), access_hash: accessHash ?? 0n };
1012
1017
  }
1013
1018
  else {
1014
- throw new InputError("The ID is of an format unknown.");
1019
+ throw new InputError("The ID is of an unknown format.");
1015
1020
  }
1016
1021
  if (!Api.is("inputPeerChat", peer) && !peer.access_hash) {
1017
1022
  // TODO
@@ -1151,6 +1156,9 @@ export class Client extends Composer {
1151
1156
  if (this.#accountManager.canHandleUpdate(update)) {
1152
1157
  maybePromises.push(() => this.#accountManager.handleUpdate(update));
1153
1158
  }
1159
+ if (this.#secretChatManager.canHandleUpdate(update)) {
1160
+ maybePromises.push(() => this.#secretChatManager.handleUpdate(update));
1161
+ }
1154
1162
  return () => Promise.resolve().then(async () => {
1155
1163
  const updates = [{ type: "update", update }];
1156
1164
  for (const maybePromise of maybePromises) {
@@ -1509,7 +1517,7 @@ export class Client extends Composer {
1509
1517
  * Resolve a phone number. User-only.
1510
1518
  *
1511
1519
  * @method ac
1512
- * @param username The phone number to resolve.
1520
+ * @param phoneNumber The phone number to resolve.
1513
1521
  */
1514
1522
  async resolvePhoneNumber(phoneNumber) {
1515
1523
  return await this.#accountManager.resolvePhoneNumber(phoneNumber);
@@ -1746,7 +1754,7 @@ export class Client extends Composer {
1746
1754
  *
1747
1755
  * @method ms
1748
1756
  * @param chatId The identifier of a chat to send the sticker to.
1749
- * @param document The sticker to send.
1757
+ * @param sticker The sticker to send.
1750
1758
  * @returns The sent sticker.
1751
1759
  */
1752
1760
  async sendSticker(chatId, sticker, params) {
@@ -1836,11 +1844,11 @@ export class Client extends Composer {
1836
1844
  * @method ms
1837
1845
  * @param chatId The identifier of a chat to send the contact to.
1838
1846
  * @param firstName The contact's first name.
1839
- * @param number The contact's phone number.
1847
+ * @param phoneNumber The contact's phone number.
1840
1848
  * @returns The sent contact.
1841
1849
  */
1842
- async sendContact(chatId, firstName, number, params) {
1843
- return await this.#messageManager.sendContact(chatId, firstName, number, params);
1850
+ async sendContact(chatId, firstName, phoneNumber, params) {
1851
+ return await this.#messageManager.sendContact(chatId, firstName, phoneNumber, params);
1844
1852
  }
1845
1853
  /**
1846
1854
  * Send a dice.
@@ -1935,7 +1943,6 @@ export class Client extends Composer {
1935
1943
  * @method ms
1936
1944
  * @param chatId The identifier of the chat which the message belongs to.
1937
1945
  * @param messageId The identifier of the message.
1938
- * @param text The new caption of the message.
1939
1946
  * @returns The edited message.
1940
1947
  */
1941
1948
  async editMessageCaption(chatId, messageId, params) {
@@ -2220,7 +2227,6 @@ export class Client extends Composer {
2220
2227
  * @method ms
2221
2228
  * @param chatId The identifier of a chat to send the chat action to.
2222
2229
  * @param action The chat action.
2223
- * @param messageThreadId The thread to send the chat action to.
2224
2230
  */
2225
2231
  async sendChatAction(chatId, action, params) {
2226
2232
  await this.#messageManager.sendChatAction(chatId, action, params);
@@ -2534,6 +2540,16 @@ export class Client extends Composer {
2534
2540
  async unsaveAnimation(fileId) {
2535
2541
  return await this.#messageManager.unsaveAnimation(fileId);
2536
2542
  }
2543
+ /**
2544
+ * Get a message's read date. User-only.
2545
+ *
2546
+ * @method ms
2547
+ * @param chatId The identifier of a chat.
2548
+ * @param messageId The identifier of the message.
2549
+ */
2550
+ async getMessageReadDate(chatId, messageId) {
2551
+ return await this.#messageManager.getMessageReadDate(chatId, messageId);
2552
+ }
2537
2553
  //
2538
2554
  // ========================= POLLS ========================= //
2539
2555
  //
@@ -2573,7 +2589,7 @@ export class Client extends Composer {
2573
2589
  *
2574
2590
  * @param chatId The identifier of the chat that includes the poll.
2575
2591
  * @param messageId The identifier of the message that includes the poll.
2576
- * @param option The identifier of the option to remove.
2592
+ * @param optionId The identifier of the option to remove.
2577
2593
  */
2578
2594
  async removePollOption(chatId, messageId, optionId) {
2579
2595
  await this.#pollManager.removePollOption(chatId, messageId, optionId);
@@ -2991,7 +3007,7 @@ export class Client extends Composer {
2991
3007
  *
2992
3008
  * @method ch
2993
3009
  * @param chatId The identifier of the channel or supergroup to add the users to.
2994
- * @param userId The identifiers of the users to add to the channel or supergroup.
3010
+ * @param userIds The identifiers of the users to add to the channel or supergroup.
2995
3011
  * @returns An array of FailedInvitation that has at most a length that is the same as that of the parameter userIds. If empty, it means that all the provided users were added.
2996
3012
  */
2997
3013
  async addChatMembers(chatId, userIds) {
@@ -3473,6 +3489,24 @@ export class Client extends Composer {
3473
3489
  async reportChat(chatId, reason, params) {
3474
3490
  return await this.#chatManager.reportChat(chatId, reason, params);
3475
3491
  }
3492
+ /**
3493
+ * Mark a chat as unread. User-only.
3494
+ *
3495
+ * @method ch
3496
+ * @param chatId The identifier of a chat.
3497
+ */
3498
+ async markChatAsUnread(chatId) {
3499
+ return await this.#chatManager.markChatAsUnread(chatId);
3500
+ }
3501
+ /**
3502
+ * Mark a chat as read. User-only.
3503
+ *
3504
+ * @method ch
3505
+ * @param chatId The identifier of a chat.
3506
+ */
3507
+ async markChatAsRead(chatId) {
3508
+ return await this.#chatManager.markChatAsRead(chatId);
3509
+ }
3476
3510
  //
3477
3511
  // ========================= CALLBACK QUERIES ========================= //
3478
3512
  //
@@ -4125,7 +4159,7 @@ export class Client extends Composer {
4125
4159
  * Craft gifts.
4126
4160
  *
4127
4161
  * @method gf
4128
- * @param gift The gifts to craft.
4162
+ * @param gifts The gifts to craft.
4129
4163
  */
4130
4164
  async craftGifts(gifts) {
4131
4165
  await this.#giftManager.craftGifts(gifts);
@@ -4221,7 +4255,7 @@ export class Client extends Composer {
4221
4255
  * @method gc
4222
4256
  * @param chatId The identifier of the chat that includes the gift collection.
4223
4257
  * @param collectionId The identifier of a gift collection.
4224
- * @param gifts The gifts to remove from the collection.
4258
+ * @param gifts The new order of gifts.
4225
4259
  */
4226
4260
  async reorderGiftsInCollection(chatId, collectionId, gifts) {
4227
4261
  return await this.#giftCollectionManager.reorderGiftsInCollection(chatId, collectionId, gifts);
@@ -4275,8 +4309,8 @@ export class Client extends Composer {
4275
4309
  * @method ss
4276
4310
  * @param slug The slug of the sticker set or its link.
4277
4311
  */
4278
- async getStickerSet(name) {
4279
- return await this.#stickerSetManager.getStickerSet(name);
4312
+ async getStickerSet(slug) {
4313
+ return await this.#stickerSetManager.getStickerSet(slug);
4280
4314
  }
4281
4315
  /**
4282
4316
  * Get a dice sticker set.
@@ -4383,8 +4417,8 @@ export class Client extends Composer {
4383
4417
  * @param fileId The identifier of the sticker.
4384
4418
  * @param position The new position of the sticker.
4385
4419
  */
4386
- async changeStickerPositionInStickerSet(slug, position) {
4387
- return await this.#stickerSetManager.changeStickerPositionInStickerSet(slug, position);
4420
+ async changeStickerPositionInStickerSet(fileId, position) {
4421
+ return await this.#stickerSetManager.changeStickerPositionInStickerSet(fileId, position);
4388
4422
  }
4389
4423
  /**
4390
4424
  * Set a sticker set's thumbnail.
@@ -4461,4 +4495,70 @@ export class Client extends Composer {
4461
4495
  async answerGuestQuery(id, result) {
4462
4496
  return await this.#messageManager.answerGuestQuery(id, result);
4463
4497
  }
4498
+ //
4499
+ // ========================= SECRET CHATS ========================= //
4500
+ //
4501
+ /**
4502
+ * Request a secret chat. User-only.
4503
+ *
4504
+ * @method sc
4505
+ * @param chatId The identifier of a chat.
4506
+ */
4507
+ async requestSecretChat(chatId) {
4508
+ return await this.#secretChatManager.requestSecretChat(chatId);
4509
+ }
4510
+ /**
4511
+ * Accept a secret chat. User-only.
4512
+ *
4513
+ * @method sc
4514
+ * @param id The identifier of the secret chat.
4515
+ */
4516
+ async acceptSecretChat(id) {
4517
+ return await this.#secretChatManager.acceptSecretChat(id);
4518
+ }
4519
+ /**
4520
+ * Send a message to a secret chat. User-only.
4521
+ *
4522
+ * @method sc
4523
+ * @param id The identifier of the secret chat.
4524
+ * @param text The message's text.
4525
+ */
4526
+ async sendSecretMessage(id, text, params) {
4527
+ return await this.#secretChatManager.sendSecretMessage(id, text, params);
4528
+ }
4529
+ /**
4530
+ * Send a location to a secret chat. User-only.
4531
+ *
4532
+ * @method sc
4533
+ * @param id The identifier of the secret chat.
4534
+ * @param latitude The location's latitude.
4535
+ * @param longitude The location's longitude.
4536
+ */
4537
+ async sendSecretLocation(id, latitude, longitude, params) {
4538
+ return await this.#secretChatManager.sendSecretLocation(id, latitude, longitude, params);
4539
+ }
4540
+ /**
4541
+ * Send a venue to a secret chat. User-only.
4542
+ *
4543
+ * @method sc
4544
+ * @param id The identifier of the secret chat.
4545
+ * @param latitude The latitude of the venue.
4546
+ * @param longitude The longitude of the venue.
4547
+ * @param title The title of the venue.
4548
+ * @param address The written address of the venue.
4549
+ */
4550
+ async sendSecretVenue(id, latitude, longitude, title, address, params) {
4551
+ return await this.#secretChatManager.sendSecretVenue(id, latitude, longitude, title, address, params);
4552
+ }
4553
+ /**
4554
+ * Send a contact to a secret chat. User-only.
4555
+ *
4556
+ * @method sc
4557
+ * @param id The identifier of the secret chat.
4558
+ * @param firstName The contact's first name.
4559
+ * @param phoneNumber The contact's phone number.
4560
+ */
4561
+ async sendSecretContact(id, firstName, phoneNumber, params) {
4562
+ return await this.#secretChatManager.sendSecretContact(id, firstName, phoneNumber, params);
4563
+ }
4464
4564
  }
@@ -1,7 +1,7 @@
1
1
  import type { Api, Mtproto } from "../2_tl.js";
2
2
  import type { DC } from "../3_transport.js";
3
- import type { AlbumStoryList, Animation, AppSupport, AuthorizationSession, AvailableReactions, Birthday, BlockedUserList, BotAccessSettings, BotCommand, BotTokenCheckResult, BusinessConnection, CallbackQueryAnswer, CallbackQueryQuestion, Chat, ChatActionType, ChatListItem, ChatMember, ChatP, ChatPChannel, ChatPGroup, ChatPPrivate, ChatPSupergroup, ChatSettings, ClaimedGifts, CodeCheckResult, Country, FailedInvitation, FileSource, Gift, GiftCollection, ID, InactiveChat, InlineQueryAnswer, InlineQueryResult, InputChecklistItem, InputEmojiStatus, InputGift, InputMedia, InputPollOption, InputRichText, InputSticker, InputStoryContent, InviteLink, JoinRequest, LeftChannelList, LinkPreview, LiveStreamChannel, Message, MessageAnimation, MessageAudio, MessageChecklist, MessageContact, MessageCounters, MessageDice, MessageDocument, MessageInvoice, MessageList, MessageLivePhoto, MessageLocation, MessagePhoto, MessagePoll, MessageReactionList, MessageRichText, MessageSticker, MessageText, MessageVenue, MessageVideo, MessageVideoNote, MessageVoice, MiniAppInfo, NetworkStatistics, ParseMode, PasswordCheckResult, Poll, PremiumSubscriptionDuration, PriceTag, ProfilePhotoList, Reaction, ReportReason, RichText, SavedChats, SlowModeDuration, StarAmount, StarTransactionList, Sticker, StickerSet, Story, StoryAlbum, StoryReportResult, SummarizedText, TextToTranslate, Timezone, Topic, TranslatedText, Translation, User, VideoChat, VideoChatActive, VideoChatScheduled, VoiceTranscription } from "../3_types.js";
4
- import type { AddBotToAttachmentsMenuParams, AddChatMemberParams, AddContactParams, AddReactionParams, AddStickerToStickerSetParams, AnswerCallbackQueryParams, AnswerInlineQueryParams, AnswerPreCheckoutQueryParams, ApproveJoinRequestsParams, BanChatMemberParams, CheckUsernameParams, CreateChannelParams, CreateGroupParams, CreateInviteLinkParams, CreateStickerSetParams, CreateStoryParams, CreateSupergroupParams, CreateTopicParams, DeclineJoinRequestsParams, DeleteAccountParams, DeleteMessageParams, DeleteMessagesParams, DownloadLiveStreamSegmentParams, DownloadParams, EditInlineMessageCaptionParams, EditInlineMessageMediaParams, EditInlineMessageRichTextParams, EditInlineMessageTextParams, EditMessageCaptionParams, EditMessageLiveLocationParams, EditMessageMediaParams, EditMessageReplyMarkupParams, EditMessageRichTextParams, EditMessageTextParams, EditTopicParams, EnableSignaturesParams, EndTakeoutSessionParams, ForwardMessagesParams, GetBlockedUsersParams, GetChatMembersParams, GetChatsParams, GetClaimedGiftsParams, GetCommonChatsParams, GetCreatedInviteLinksParams, GetHistoryParams, GetJoinRequestsParams, GetLeftChannelsParams, GetLinkPreviewParams, GetMessageReactionsParams, GetMyCommandsParams, GetProfilePhotosParams, GetSavedChatsParams, GetSavedMessagesParams, GetStarTransactionsParams, GetTranslationsParams, GiftPremiumSubscriptionParams, InvokeParams, JoinVideoChatParams, OpenChatParams, OpenMiniAppParams, PinMessageParams, PromoteChatMemberParams, RemoveProfilePhotoParams, ReplaceStickerInStickerSetParams, ReportChatParams, ReportStoryParams, ResolveUsernameParams, ScheduleVideoChatParams, SearchMessagesParams, SendAnimationParams, SendAudioParams, SendChecklistParams, SendContactParams, SendDiceParams, SendDocumentParams, SendGiftParams, SendInlineQueryParams, SendInvoiceParams, SendLivePhotoParams, SendLocationParams, SendMediaGroupParams, SendMessageDraftParams, SendMessageParams, SendPhotoParams, SendPollParams, SendRichTextDraftParams, SendRichTextParams, SendStickerParams, SendVenueParams, SendVideoNoteParams, SendVideoParams, SendVoiceParams, SetBirthdayParams, SetChatMemberRightsParams, SetChatMemberTagParams, SetChatPhotoParams, SetContactNoteParams, SetEmojiStatusParams, SetLocationParams, SetManagedBotAccessSettingsParams, SetMyCommandsParams, SetNameColorParams, SetPersonalChannelParams, SetProfileColorParams, SetReactionsParams, SetWorkingHoursParams, SignInParams, StartBotParams, StartTakeoutSessionParams, StartVideoChatParams, StopPollParams, SummarizeTextParams, TranslateTextParams, UnpinMessageParams, UnpinMessagesParams, UpdateChecklistParams, UpdateProfileParams, UpdateProfilePhotoParams, UpdateProfileVideoParams } from "./0_params.js";
3
+ import type { AlbumStoryList, Animation, AppSupport, AuthorizationSession, AvailableReactions, Birthday, BlockedUserList, BotAccessSettings, BotCommand, BotTokenCheckResult, BusinessConnection, CallbackQueryAnswer, CallbackQueryQuestion, Chat, ChatActionType, ChatListItem, ChatMember, ChatP, ChatPChannel, ChatPGroup, ChatPPrivate, ChatPSupergroup, ChatSettings, ClaimedGifts, CodeCheckResult, Country, FailedInvitation, FileSource, Gift, GiftCollection, ID, InactiveChat, InlineQueryAnswer, InlineQueryResult, InputChecklistItem, InputEmojiStatus, InputGift, InputMedia, InputPollOption, InputRichText, InputSticker, InputStoryContent, InviteLink, JoinRequest, LeftChannelList, LinkPreview, LiveStreamChannel, Message, MessageAnimation, MessageAudio, MessageChecklist, MessageContact, MessageCounters, MessageDice, MessageDocument, MessageInvoice, MessageList, MessageLivePhoto, MessageLocation, MessagePhoto, MessagePoll, MessageReactionList, MessageRichText, MessageSticker, MessageText, MessageVenue, MessageVideo, MessageVideoNote, MessageVoice, MiniAppInfo, NetworkStatistics, ParseMode, PasswordCheckResult, Poll, PremiumSubscriptionDuration, PriceTag, ProfilePhotoList, Reaction, ReportReason, RichText, SavedChats, SecretChat, SlowModeDuration, StarAmount, StarTransactionList, Sticker, StickerSet, Story, StoryAlbum, StoryReportResult, SummarizedText, TextToTranslate, Timezone, Topic, TranslatedText, Translation, User, VideoChat, VideoChatActive, VideoChatScheduled, VoiceTranscription } from "../3_types.js";
4
+ import type { AddBotToAttachmentsMenuParams, AddChatMemberParams, AddContactParams, AddReactionParams, AddStickerToStickerSetParams, AnswerCallbackQueryParams, AnswerInlineQueryParams, AnswerPreCheckoutQueryParams, ApproveJoinRequestsParams, BanChatMemberParams, CheckUsernameParams, CreateChannelParams, CreateGroupParams, CreateInviteLinkParams, CreateStickerSetParams, CreateStoryParams, CreateSupergroupParams, CreateTopicParams, DeclineJoinRequestsParams, DeleteAccountParams, DeleteMessageParams, DeleteMessagesParams, DownloadLiveStreamSegmentParams, DownloadParams, EditInlineMessageCaptionParams, EditInlineMessageMediaParams, EditInlineMessageRichTextParams, EditInlineMessageTextParams, EditMessageCaptionParams, EditMessageLiveLocationParams, EditMessageMediaParams, EditMessageReplyMarkupParams, EditMessageRichTextParams, EditMessageTextParams, EditTopicParams, EnableSignaturesParams, EndTakeoutSessionParams, ForwardMessagesParams, GetBlockedUsersParams, GetChatMembersParams, GetChatsParams, GetClaimedGiftsParams, GetCommonChatsParams, GetCreatedInviteLinksParams, GetHistoryParams, GetJoinRequestsParams, GetLeftChannelsParams, GetLinkPreviewParams, GetMessageReactionsParams, GetMyCommandsParams, GetProfilePhotosParams, GetSavedChatsParams, GetSavedMessagesParams, GetStarTransactionsParams, GetTranslationsParams, GiftPremiumSubscriptionParams, InvokeParams, JoinVideoChatParams, OpenChatParams, OpenMiniAppParams, PinMessageParams, PromoteChatMemberParams, RemoveProfilePhotoParams, ReplaceStickerInStickerSetParams, ReportChatParams, ReportStoryParams, ResolveUsernameParams, ScheduleVideoChatParams, SearchMessagesParams, SendAnimationParams, SendAudioParams, SendChecklistParams, SendContactParams, SendDiceParams, SendDocumentParams, SendGiftParams, SendInlineQueryParams, SendInvoiceParams, SendLivePhotoParams, SendLocationParams, SendMediaGroupParams, SendMessageDraftParams, SendMessageParams, SendPhotoParams, SendPollParams, SendRichTextDraftParams, SendRichTextParams, SendSecretContactParams, SendSecretLocationParams, SendSecretMessageParams, SendSecretVenueParams, SendStickerParams, SendVenueParams, SendVideoNoteParams, SendVideoParams, SendVoiceParams, SetBirthdayParams, SetChatMemberRightsParams, SetChatMemberTagParams, SetChatPhotoParams, SetContactNoteParams, SetEmojiStatusParams, SetLocationParams, SetManagedBotAccessSettingsParams, SetMyCommandsParams, SetNameColorParams, SetPersonalChannelParams, SetProfileColorParams, SetReactionsParams, SetWorkingHoursParams, SignInParams, StartBotParams, StartTakeoutSessionParams, StartVideoChatParams, StopPollParams, SummarizeTextParams, TranslateTextParams, UnpinMessageParams, UnpinMessagesParams, UpdateChecklistParams, UpdateProfileParams, UpdateProfilePhotoParams, UpdateProfileVideoParams } from "./0_params.js";
5
5
  import type { WorkerRequest } from "./0_worker_request.js";
6
6
  import type { ClientGeneric } from "./1_client_generic.js";
7
7
  import { type InvokeErrorHandler } from "./1_invoke_middleware.js";
@@ -49,7 +49,7 @@ export interface ClientDispatcherParams {
49
49
  * When the provided storage takes advantage of memory, nothing changes, even if set to `true`.
50
50
  */
51
51
  persistCache?: boolean;
52
- /** Whether to disable receiving updates. UpdateConnectionState and UpdatesAuthorizationState will always be received. Defaults to `false`. */
52
+ /** Whether to disable receiving updates. UpdateConnectionState and UpdateAuthorizationState will always be received. Defaults to `false`. */
53
53
  disableUpdates?: boolean;
54
54
  /** An auth string to automatically import. Can be overridden by a later importAuthString call. */
55
55
  authString?: string;
@@ -109,7 +109,7 @@ export declare class ClientDispatcher<C extends Context = Context> extends Compo
109
109
  /**
110
110
  * Check whether a bot token is valid.
111
111
  *
112
- * @param password The password to check
112
+ * @param botToken The bot token to check
113
113
  * @returns The result of the check.
114
114
  * @method ac
115
115
  */
@@ -364,7 +364,7 @@ export declare class ClientDispatcher<C extends Context = Context> extends Compo
364
364
  * Resolve a phone number. User-only.
365
365
  *
366
366
  * @method ac
367
- * @param username The phone number to resolve.
367
+ * @param phoneNumber The phone number to resolve.
368
368
  */
369
369
  resolvePhoneNumber(phoneNumber: string): Promise<User>;
370
370
  /**
@@ -548,7 +548,7 @@ export declare class ClientDispatcher<C extends Context = Context> extends Compo
548
548
  *
549
549
  * @method ms
550
550
  * @param chatId The identifier of a chat to send the sticker to.
551
- * @param document The sticker to send.
551
+ * @param sticker The sticker to send.
552
552
  * @returns The sent sticker.
553
553
  */
554
554
  sendSticker(chatId: ID, sticker: FileSource, params?: SendStickerParams): Promise<MessageSticker>;
@@ -622,10 +622,10 @@ export declare class ClientDispatcher<C extends Context = Context> extends Compo
622
622
  * @method ms
623
623
  * @param chatId The identifier of a chat to send the contact to.
624
624
  * @param firstName The contact's first name.
625
- * @param number The contact's phone number.
625
+ * @param phoneNumber The contact's phone number.
626
626
  * @returns The sent contact.
627
627
  */
628
- sendContact(chatId: ID, firstName: string, number: string, params?: SendContactParams): Promise<MessageContact>;
628
+ sendContact(chatId: ID, firstName: string, phoneNumber: string, params?: SendContactParams): Promise<MessageContact>;
629
629
  /**
630
630
  * Send a dice.
631
631
  *
@@ -705,7 +705,6 @@ export declare class ClientDispatcher<C extends Context = Context> extends Compo
705
705
  * @method ms
706
706
  * @param chatId The identifier of the chat which the message belongs to.
707
707
  * @param messageId The identifier of the message.
708
- * @param text The new caption of the message.
709
708
  * @returns The edited message.
710
709
  */
711
710
  editMessageCaption(chatId: ID, messageId: number, params?: EditMessageCaptionParams): Promise<Message>;
@@ -938,7 +937,6 @@ export declare class ClientDispatcher<C extends Context = Context> extends Compo
938
937
  * @method ms
939
938
  * @param chatId The identifier of a chat to send the chat action to.
940
939
  * @param action The chat action.
941
- * @param messageThreadId The thread to send the chat action to.
942
940
  */
943
941
  sendChatAction(chatId: ID, action: ChatActionType, params?: {
944
942
  messageThreadId?: number;
@@ -1180,6 +1178,14 @@ export declare class ClientDispatcher<C extends Context = Context> extends Compo
1180
1178
  * @param fileId The file identifier of the animation.
1181
1179
  */
1182
1180
  unsaveAnimation(fileId: string): Promise<void>;
1181
+ /**
1182
+ * Get a message's read date. User-only.
1183
+ *
1184
+ * @method ms
1185
+ * @param chatId The identifier of a chat.
1186
+ * @param messageId The identifier of the message.
1187
+ */
1188
+ getMessageReadDate(chatId: ID, messageId: number): Promise<number>;
1183
1189
  /**
1184
1190
  * Cast a vote. User-only.
1185
1191
  *
@@ -1210,7 +1216,7 @@ export declare class ClientDispatcher<C extends Context = Context> extends Compo
1210
1216
  *
1211
1217
  * @param chatId The identifier of the chat that includes the poll.
1212
1218
  * @param messageId The identifier of the message that includes the poll.
1213
- * @param option The identifier of the option to remove.
1219
+ * @param optionId The identifier of the option to remove.
1214
1220
  */
1215
1221
  removePollOption(chatId: ID, messageId: number, optionId: string): Promise<void>;
1216
1222
  /**
@@ -1531,7 +1537,7 @@ export declare class ClientDispatcher<C extends Context = Context> extends Compo
1531
1537
  *
1532
1538
  * @method ch
1533
1539
  * @param chatId The identifier of the channel or supergroup to add the users to.
1534
- * @param userId The identifiers of the users to add to the channel or supergroup.
1540
+ * @param userIds The identifiers of the users to add to the channel or supergroup.
1535
1541
  * @returns An array of FailedInvitation that has at most a length that is the same as that of the parameter userIds. If empty, it means that all the provided users were added.
1536
1542
  */
1537
1543
  addChatMembers(chatId: ID, userIds: ID[]): Promise<FailedInvitation[]>;
@@ -1911,6 +1917,20 @@ export declare class ClientDispatcher<C extends Context = Context> extends Compo
1911
1917
  * @param reason The reason of the report.
1912
1918
  */
1913
1919
  reportChat(chatId: ID, reason: ReportReason, params?: ReportChatParams): Promise<void>;
1920
+ /**
1921
+ * Mark a chat as unread. User-only.
1922
+ *
1923
+ * @method ch
1924
+ * @param chatId The identifier of a chat.
1925
+ */
1926
+ markChatAsUnread(chatId: ID): Promise<void>;
1927
+ /**
1928
+ * Mark a chat as read. User-only.
1929
+ *
1930
+ * @method ch
1931
+ * @param chatId The identifier of a chat.
1932
+ */
1933
+ markChatAsRead(chatId: ID): Promise<void>;
1914
1934
  /**
1915
1935
  * Send a callback query. User-only.
1916
1936
  *
@@ -2490,7 +2510,7 @@ export declare class ClientDispatcher<C extends Context = Context> extends Compo
2490
2510
  * @method gc
2491
2511
  * @param chatId The identifier of the chat that includes the gift collection.
2492
2512
  * @param collectionId The identifier of a gift collection.
2493
- * @param gifts The gifts to remove from the collection.
2513
+ * @param gifts The new order of gifts.
2494
2514
  */
2495
2515
  reorderGiftsInCollection(chatId: ID, collectionId: number, gifts: InputGift[]): Promise<GiftCollection>;
2496
2516
  /**
@@ -2528,7 +2548,7 @@ export declare class ClientDispatcher<C extends Context = Context> extends Compo
2528
2548
  * @method ss
2529
2549
  * @param slug The slug of the sticker set or its link.
2530
2550
  */
2531
- getStickerSet(name: string): Promise<StickerSet>;
2551
+ getStickerSet(slug: string): Promise<StickerSet>;
2532
2552
  /**
2533
2553
  * Get a dice sticker set.
2534
2554
  *
@@ -2614,7 +2634,7 @@ export declare class ClientDispatcher<C extends Context = Context> extends Compo
2614
2634
  * @param fileId The identifier of the sticker.
2615
2635
  * @param position The new position of the sticker.
2616
2636
  */
2617
- changeStickerPositionInStickerSet(slug: string, position: number): Promise<void>;
2637
+ changeStickerPositionInStickerSet(fileId: string, position: number): Promise<void>;
2618
2638
  /**
2619
2639
  * Set a sticker set's thumbnail.
2620
2640
  *
@@ -2670,5 +2690,56 @@ export declare class ClientDispatcher<C extends Context = Context> extends Compo
2670
2690
  * @returns The identifier of the sent message.
2671
2691
  */
2672
2692
  answerGuestQuery(id: string, result: InlineQueryResult): Promise<string>;
2693
+ /**
2694
+ * Request a secret chat. User-only.
2695
+ *
2696
+ * @method sc
2697
+ * @param chatId The identifier of a chat.
2698
+ */
2699
+ requestSecretChat(chatId: ID): Promise<SecretChat>;
2700
+ /**
2701
+ * Accept a secret chat. User-only.
2702
+ *
2703
+ * @method sc
2704
+ * @param id The identifier of the secret chat.
2705
+ */
2706
+ acceptSecretChat(id: number): Promise<SecretChat>;
2707
+ /**
2708
+ * Send a message to a secret chat. User-only.
2709
+ *
2710
+ * @method sc
2711
+ * @param id The identifier of the secret chat.
2712
+ * @param text The message's text.
2713
+ */
2714
+ sendSecretMessage(id: number, text: string, params?: SendSecretMessageParams): Promise<void>;
2715
+ /**
2716
+ * Send a location to a secret chat. User-only.
2717
+ *
2718
+ * @method sc
2719
+ * @param id The identifier of the secret chat.
2720
+ * @param latitude The location's latitude.
2721
+ * @param longitude The location's longitude.
2722
+ */
2723
+ sendSecretLocation(id: number, latitude: number, longitude: number, params?: SendSecretLocationParams): Promise<void>;
2724
+ /**
2725
+ * Send a venue to a secret chat. User-only.
2726
+ *
2727
+ * @method sc
2728
+ * @param id The identifier of the secret chat.
2729
+ * @param latitude The latitude of the venue.
2730
+ * @param longitude The longitude of the venue.
2731
+ * @param title The title of the venue.
2732
+ * @param address The written address of the venue.
2733
+ */
2734
+ sendSecretVenue(id: number, latitude: number, longitude: number, title: string, address: string, params?: SendSecretVenueParams): Promise<void>;
2735
+ /**
2736
+ * Send a contact to a secret chat. User-only.
2737
+ *
2738
+ * @method sc
2739
+ * @param id The identifier of the secret chat.
2740
+ * @param firstName The contact's first name.
2741
+ * @param phoneNumber The contact's phone number.
2742
+ */
2743
+ sendSecretContact(id: number, firstName: string, phoneNumber: string, params?: SendSecretContactParams): Promise<void>;
2673
2744
  }
2674
2745
  //# sourceMappingURL=6_client_dispatcher.d.ts.map