@mtkruto/node 0.1.155 → 0.1.157

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 (89) hide show
  1. package/esm/4_constants.d.ts +1 -1
  2. package/esm/4_constants.js +1 -1
  3. package/esm/4_errors.d.ts +1 -1
  4. package/esm/client/0_params.d.ts +20 -0
  5. package/esm/client/0_password.d.ts +2 -2
  6. package/esm/client/0_types.d.ts +1 -0
  7. package/esm/client/1_composer.d.ts +3 -3
  8. package/esm/client/2_client_plain.d.ts +1 -4
  9. package/esm/client/2_client_plain.js +1 -4
  10. package/esm/client/2_message_manager.d.ts +9 -36
  11. package/esm/client/2_message_manager.js +73 -1
  12. package/esm/client/4_client.d.ts +90 -15
  13. package/esm/client/4_client.js +123 -12
  14. package/esm/storage/0_storage.d.ts +38 -38
  15. package/esm/storage/0_storage.js +2 -2
  16. package/esm/storage/0_utilities.d.ts +2 -2
  17. package/esm/storage/1_storage_indexed_db.d.ts +1 -1
  18. package/esm/storage/1_storage_local_storage.d.ts +1 -1
  19. package/esm/storage/1_storage_memory.d.ts +3 -3
  20. package/esm/storage/1_storage_session_storage.d.ts +1 -1
  21. package/esm/tl/0_tl_raw_writer.d.ts +9 -9
  22. package/esm/tl/1_tl_object.d.ts +1 -1
  23. package/esm/tl/1_tl_object.js +3 -3
  24. package/esm/tl/2_types.d.ts +4745 -0
  25. package/esm/tl/2_types.js +4745 -0
  26. package/esm/tl/3_functions.d.ts +2041 -28
  27. package/esm/tl/3_functions.js +2599 -586
  28. package/esm/tl/3_utilities.d.ts +3 -3
  29. package/esm/tl/4_tl_writer.d.ts +1 -1
  30. package/esm/types/0_chat_administrator_rights.d.ts +2 -2
  31. package/esm/types/0_chat_member_rights.d.ts +1 -1
  32. package/esm/types/0_message_entity.d.ts +1 -1
  33. package/esm/types/0_message_search_filter.d.ts +2 -1
  34. package/esm/types/1_bot_command_scope.d.ts +2 -1
  35. package/esm/types/1_keyboard_button.d.ts +1 -1
  36. package/esm/types/1_story_interactive_area.d.ts +1 -1
  37. package/esm/types/2_inline_keyboard_button.d.ts +1 -1
  38. package/esm/types/2_invite_link.d.ts +6 -6
  39. package/esm/types/2_invite_link.js +4 -4
  40. package/esm/types/3_reply_markup.d.ts +2 -2
  41. package/esm/types/4_inline_query_result.d.ts +2 -1
  42. package/esm/types/4_message.d.ts +1 -60
  43. package/esm/types/5_callback_query.d.ts +2 -2
  44. package/esm/utilities/0_cache_map.d.ts +1 -1
  45. package/package.json +1 -1
  46. package/script/4_constants.d.ts +1 -1
  47. package/script/4_constants.js +1 -1
  48. package/script/4_errors.d.ts +1 -1
  49. package/script/client/0_params.d.ts +20 -0
  50. package/script/client/0_password.d.ts +2 -2
  51. package/script/client/0_types.d.ts +1 -0
  52. package/script/client/1_composer.d.ts +3 -3
  53. package/script/client/2_client_plain.d.ts +1 -4
  54. package/script/client/2_client_plain.js +1 -4
  55. package/script/client/2_message_manager.d.ts +9 -36
  56. package/script/client/2_message_manager.js +72 -0
  57. package/script/client/4_client.d.ts +90 -15
  58. package/script/client/4_client.js +123 -12
  59. package/script/storage/0_storage.d.ts +38 -38
  60. package/script/storage/0_storage.js +2 -2
  61. package/script/storage/0_utilities.d.ts +2 -2
  62. package/script/storage/1_storage_indexed_db.d.ts +1 -1
  63. package/script/storage/1_storage_local_storage.d.ts +1 -1
  64. package/script/storage/1_storage_memory.d.ts +3 -3
  65. package/script/storage/1_storage_session_storage.d.ts +1 -1
  66. package/script/tl/0_tl_raw_writer.d.ts +9 -9
  67. package/script/tl/1_tl_object.d.ts +1 -1
  68. package/script/tl/1_tl_object.js +3 -3
  69. package/script/tl/2_types.d.ts +4745 -0
  70. package/script/tl/2_types.js +4745 -0
  71. package/script/tl/3_functions.d.ts +2041 -28
  72. package/script/tl/3_functions.js +2599 -586
  73. package/script/tl/3_utilities.d.ts +3 -3
  74. package/script/tl/4_tl_writer.d.ts +1 -1
  75. package/script/types/0_chat_administrator_rights.d.ts +2 -2
  76. package/script/types/0_chat_member_rights.d.ts +1 -1
  77. package/script/types/0_message_entity.d.ts +1 -1
  78. package/script/types/0_message_search_filter.d.ts +2 -1
  79. package/script/types/1_bot_command_scope.d.ts +2 -1
  80. package/script/types/1_keyboard_button.d.ts +1 -1
  81. package/script/types/1_story_interactive_area.d.ts +1 -1
  82. package/script/types/2_inline_keyboard_button.d.ts +1 -1
  83. package/script/types/2_invite_link.d.ts +6 -6
  84. package/script/types/2_invite_link.js +4 -4
  85. package/script/types/3_reply_markup.d.ts +2 -2
  86. package/script/types/4_inline_query_result.d.ts +2 -1
  87. package/script/types/4_message.d.ts +1 -60
  88. package/script/types/5_callback_query.d.ts +2 -2
  89. package/script/utilities/0_cache_map.d.ts +1 -1
@@ -38,12 +38,12 @@ import { InlineQueryManager } from "./3_inline_query_manager.js";
38
38
  import { StoryManager } from "./3_story_manager.js";
39
39
  let id = 0;
40
40
  const getEntity = Symbol();
41
- export const handleMigrationError = Symbol();
41
+ export const handleMigrationError = Symbol("handleMigrationError");
42
42
  const functionNamespaces = Object.entries(functions).filter(([, v]) => !(v instanceof Function)).map(([k]) => k);
43
43
  export function skipInvoke() {
44
44
  return (_ctx, next) => next();
45
45
  }
46
- export const restartAuth = Symbol();
46
+ export const restartAuth = Symbol("restartAuth");
47
47
  export class Client extends ClientAbstract {
48
48
  /**
49
49
  * Constructs the client.
@@ -216,6 +216,20 @@ export class Client extends ClientAbstract {
216
216
  UNREACHABLE();
217
217
  }
218
218
  };
219
+ const mustGetUserId = () => {
220
+ if (msg?.from) {
221
+ return msg.from.id;
222
+ }
223
+ else if ("callbackQuery" in update) {
224
+ return update.callbackQuery.from.id;
225
+ }
226
+ else if ("chosenInlineResult" in update) {
227
+ return update.chosenInlineResult.from.id;
228
+ }
229
+ else {
230
+ UNREACHABLE();
231
+ }
232
+ };
219
233
  const mustGetInlineMsgId = () => {
220
234
  if ("chosenInlineResult" in update) {
221
235
  if (update.chosenInlineResult.inlineMessageId) {
@@ -481,6 +495,24 @@ export class Client extends ClientAbstract {
481
495
  const { chatId } = mustGetMsg();
482
496
  return this.setBoostsRequiredToCircumventRestrictions(chatId, boosts);
483
497
  },
498
+ createInviteLink: (params) => {
499
+ const { chatId } = mustGetMsg();
500
+ return this.createInviteLink(chatId, params);
501
+ },
502
+ getCreatedInviteLinks: (params) => {
503
+ const { chatId } = mustGetMsg();
504
+ return this.getCreatedInviteLinks(chatId, params);
505
+ },
506
+ leave: () => {
507
+ const { chatId } = mustGetMsg();
508
+ return this.leaveChat(chatId);
509
+ },
510
+ block: () => {
511
+ return this.blockUser(mustGetUserId());
512
+ },
513
+ unblock: () => {
514
+ return this.unblockUser(mustGetUserId());
515
+ },
484
516
  };
485
517
  return cleanObject(context);
486
518
  });
@@ -582,6 +614,7 @@ export class Client extends ClientAbstract {
582
614
  getSelfId: __classPrivateFieldGet(this, _Client_instances, "m", _Client_getSelfId).bind(this),
583
615
  getInputPeer: this.getInputPeer.bind(this),
584
616
  getInputChannel: this.getInputChannel.bind(this),
617
+ getInputUser: this.getInputUser.bind(this),
585
618
  getEntity: this[getEntity].bind(this),
586
619
  handleUpdate: __classPrivateFieldGet(this, _Client_instances, "m", _Client_queueHandleCtxUpdate).bind(this),
587
620
  parseMode: __classPrivateFieldGet(this, _Client_parseMode, "f"),
@@ -726,7 +759,7 @@ export class Client extends ClientAbstract {
726
759
  plain.setDc(dc);
727
760
  }
728
761
  await plain.connect();
729
- const { authKey, salt } = await plain.createAuthKey();
762
+ const [authKey, salt] = await plain.createAuthKey();
730
763
  await plain.disconnect();
731
764
  await this.storage.setAuthKey(authKey);
732
765
  await __classPrivateFieldGet(this, _Client_instances, "m", _Client_setAuth).call(this, authKey);
@@ -1458,7 +1491,7 @@ export class Client extends ClientAbstract {
1458
1491
  * @param inlineMessageId The inline message's identifier.
1459
1492
  */
1460
1493
  async editInlineMessageReplyMarkup(inlineMessageId, params) {
1461
- return await __classPrivateFieldGet(this, _Client_messageManager, "f").editInlineMessageReplyMarkup(inlineMessageId, params);
1494
+ await __classPrivateFieldGet(this, _Client_messageManager, "f").editInlineMessageReplyMarkup(inlineMessageId, params);
1462
1495
  }
1463
1496
  /**
1464
1497
  * Retrieve multiple messages.
@@ -1573,14 +1606,16 @@ export class Client extends ClientAbstract {
1573
1606
  * @param messageThreadId The thread to send the chat action to.
1574
1607
  */
1575
1608
  async sendChatAction(chatId, action, params) {
1576
- return await __classPrivateFieldGet(this, _Client_messageManager, "f").sendChatAction(chatId, action, params);
1609
+ await __classPrivateFieldGet(this, _Client_messageManager, "f").sendChatAction(chatId, action, params);
1577
1610
  }
1578
1611
  /**
1579
1612
  * Upload a file.
1580
1613
  *
1581
1614
  * @method fs
1582
1615
  * @param contents The contents of the file.
1616
+ * @returns The uploaded file.
1583
1617
  */
1618
+ // deno-lint-ignore no-explicit-any
1584
1619
  async upload(contents, params) {
1585
1620
  return await __classPrivateFieldGet(this, _Client_fileManager, "f").upload(contents, params);
1586
1621
  }
@@ -1597,6 +1632,7 @@ export class Client extends ClientAbstract {
1597
1632
  * Get the bot's commands in the given scope and/or language. Bot-only.
1598
1633
  *
1599
1634
  * @method bs
1635
+ * @returns The current bot's commands in the specified language.
1600
1636
  */
1601
1637
  async getMyCommands(params) {
1602
1638
  return await __classPrivateFieldGet(this, _Client_botInfoManager, "f").getMyCommands(params);
@@ -1639,14 +1675,16 @@ export class Client extends ClientAbstract {
1639
1675
  * Get the bot's description in the given language. Bot-only.
1640
1676
  *
1641
1677
  * @method bs
1678
+ * @returns The current bot's description in the specified language.
1642
1679
  */
1643
1680
  async getMyDescription(params) {
1644
1681
  return await __classPrivateFieldGet(this, _Client_botInfoManager, "f").getMyDescription(params);
1645
1682
  }
1646
1683
  /**
1647
- * Set the bot's name in the given language. Bot-only.
1684
+ * Get the bot's name in the given language. Bot-only.
1648
1685
  *
1649
1686
  * @method bs
1687
+ * @returns The current bot's name in the specified language.
1650
1688
  */
1651
1689
  async getMyName(params) {
1652
1690
  return await __classPrivateFieldGet(this, _Client_botInfoManager, "f").getMyName(params);
@@ -1655,6 +1693,7 @@ export class Client extends ClientAbstract {
1655
1693
  * Get the bot's short description in the given language. Bot-only.
1656
1694
  *
1657
1695
  * @method bs
1696
+ * @returns The current bot's short description in the specified language.
1658
1697
  */
1659
1698
  async getMyShortDescription(params) {
1660
1699
  return await __classPrivateFieldGet(this, _Client_botInfoManager, "f").getMyShortDescription(params);
@@ -1667,7 +1706,7 @@ export class Client extends ClientAbstract {
1667
1706
  * @param messageIds The identifiers of the messages to delete.
1668
1707
  */
1669
1708
  async deleteMessages(chatId, messageIds, params) {
1670
- return await __classPrivateFieldGet(this, _Client_messageManager, "f").deleteMessages(chatId, messageIds, params);
1709
+ await __classPrivateFieldGet(this, _Client_messageManager, "f").deleteMessages(chatId, messageIds, params);
1671
1710
  }
1672
1711
  /**
1673
1712
  * Delete a single message.
@@ -1677,7 +1716,7 @@ export class Client extends ClientAbstract {
1677
1716
  * @param messageId The identifier of the message to delete.
1678
1717
  */
1679
1718
  async deleteMessage(chatId, messageId, params) {
1680
- return await __classPrivateFieldGet(this, _Client_messageManager, "f").deleteMessages(chatId, [messageId], params);
1719
+ await __classPrivateFieldGet(this, _Client_messageManager, "f").deleteMessages(chatId, [messageId], params);
1681
1720
  }
1682
1721
  /**
1683
1722
  * Send a photo.
@@ -1685,6 +1724,7 @@ export class Client extends ClientAbstract {
1685
1724
  * @method ms
1686
1725
  * @param chatId The chat to send the photo to.
1687
1726
  * @param photo The photo to send.
1727
+ * @returns The sent photo.
1688
1728
  */
1689
1729
  async sendPhoto(chatId, photo, params) {
1690
1730
  return await __classPrivateFieldGet(this, _Client_messageManager, "f").sendPhoto(chatId, photo, params);
@@ -1695,6 +1735,7 @@ export class Client extends ClientAbstract {
1695
1735
  * @method ms
1696
1736
  * @param chatId The chat to send the document to.
1697
1737
  * @param document The document to send.
1738
+ * @returns The sent document.
1698
1739
  */
1699
1740
  async sendDocument(chatId, document, params) {
1700
1741
  return await __classPrivateFieldGet(this, _Client_messageManager, "f").sendDocument(chatId, document, params);
@@ -1705,6 +1746,7 @@ export class Client extends ClientAbstract {
1705
1746
  * @method ms
1706
1747
  * @param chatId The chat to send the video to.
1707
1748
  * @param video The video to send.
1749
+ * @returns The sent video.
1708
1750
  */
1709
1751
  async sendVideo(chatId, video, params) {
1710
1752
  return await __classPrivateFieldGet(this, _Client_messageManager, "f").sendVideo(chatId, video, params);
@@ -1715,6 +1757,7 @@ export class Client extends ClientAbstract {
1715
1757
  * @method ms
1716
1758
  * @param chatId The chat to send the animation to.
1717
1759
  * @param animation The animation to send.
1760
+ * @returns The sent animation.
1718
1761
  */
1719
1762
  async sendAnimation(chatId, animation, params) {
1720
1763
  return await __classPrivateFieldGet(this, _Client_messageManager, "f").sendAnimation(chatId, animation, params);
@@ -1725,6 +1768,7 @@ export class Client extends ClientAbstract {
1725
1768
  * @method ms
1726
1769
  * @param chatId The chat to send the voice message to.
1727
1770
  * @param voice The voice to send.
1771
+ * @returns The sent voice message.
1728
1772
  */
1729
1773
  async sendVoice(chatId, voice, params) {
1730
1774
  return await __classPrivateFieldGet(this, _Client_messageManager, "f").sendVoice(chatId, voice, params);
@@ -1735,6 +1779,7 @@ export class Client extends ClientAbstract {
1735
1779
  * @method ms
1736
1780
  * @param chatId The chat to send the audio file to.
1737
1781
  * @param audio The audio to send.
1782
+ * @returns The sent audio filr.
1738
1783
  */
1739
1784
  async sendAudio(chatId, audio, params) {
1740
1785
  return await __classPrivateFieldGet(this, _Client_messageManager, "f").sendAudio(chatId, audio, params);
@@ -1745,6 +1790,7 @@ export class Client extends ClientAbstract {
1745
1790
  * @method ms
1746
1791
  * @param chatId The chat to send the video note to.
1747
1792
  * @param videoNote The video note to send.
1793
+ * @returns The sent video note.
1748
1794
  */
1749
1795
  async sendVideoNote(chatId, videoNote, params) {
1750
1796
  return await __classPrivateFieldGet(this, _Client_messageManager, "f").sendVideoNote(chatId, videoNote, params);
@@ -1756,6 +1802,7 @@ export class Client extends ClientAbstract {
1756
1802
  * @param chatId The chat to send the location to.
1757
1803
  * @param latitude The location's latitude.
1758
1804
  * @param longitude The location's longitude.
1805
+ * @returns The sent location.
1759
1806
  */
1760
1807
  async sendLocation(chatId, latitude, longitude, params) {
1761
1808
  return await __classPrivateFieldGet(this, _Client_messageManager, "f").sendLocation(chatId, latitude, longitude, params);
@@ -1767,6 +1814,7 @@ export class Client extends ClientAbstract {
1767
1814
  * @param chatId The chat to send the contact to.
1768
1815
  * @param firstName The contact's first name.
1769
1816
  * @param number The contact's phone number.
1817
+ * @returns The sent contact.
1770
1818
  */
1771
1819
  async sendContact(chatId, firstName, number, params) {
1772
1820
  return await __classPrivateFieldGet(this, _Client_messageManager, "f").sendContact(chatId, firstName, number, params);
@@ -1776,6 +1824,7 @@ export class Client extends ClientAbstract {
1776
1824
  *
1777
1825
  * @method ms
1778
1826
  * @param chatId The chat to send the dice to.
1827
+ * @returns The sent dice.
1779
1828
  */
1780
1829
  async sendDice(chatId, params) {
1781
1830
  return await __classPrivateFieldGet(this, _Client_messageManager, "f").sendDice(chatId, params);
@@ -1789,6 +1838,7 @@ export class Client extends ClientAbstract {
1789
1838
  * @param longitude The longitude of the venue.
1790
1839
  * @param title The title of the venue.
1791
1840
  * @param address The written address of the venue.
1841
+ * @returns The sent venue.
1792
1842
  */
1793
1843
  async sendVenue(chatId, latitude, longitude, title, address, params) {
1794
1844
  return await __classPrivateFieldGet(this, _Client_messageManager, "f").sendVenue(chatId, latitude, longitude, title, address, params);
@@ -1831,6 +1881,7 @@ export class Client extends ClientAbstract {
1831
1881
  *
1832
1882
  * @method fs
1833
1883
  * @param id Identifier of one or more of custom emojis.
1884
+ * @returns The custom emoji documents.
1834
1885
  */
1835
1886
  async getCustomEmojiDocuments(id) {
1836
1887
  return await __classPrivateFieldGet(this, _Client_fileManager, "f").getCustomEmojiDocuments(id);
@@ -1905,7 +1956,7 @@ export class Client extends ClientAbstract {
1905
1956
  * @param memberId The identifier of the member.
1906
1957
  */
1907
1958
  async deleteChatMemberMessages(chatId, memberId) {
1908
- return await __classPrivateFieldGet(this, _Client_messageManager, "f").deleteChatMemberMessages(chatId, memberId);
1959
+ await __classPrivateFieldGet(this, _Client_messageManager, "f").deleteChatMemberMessages(chatId, memberId);
1909
1960
  }
1910
1961
  /**
1911
1962
  * Pin a message in a chat.
@@ -1915,7 +1966,7 @@ export class Client extends ClientAbstract {
1915
1966
  * @param messageId The message's identifier.
1916
1967
  */
1917
1968
  async pinMessage(chatId, messageId, params) {
1918
- return await __classPrivateFieldGet(this, _Client_messageManager, "f").pinMessage(chatId, messageId, params);
1969
+ await __classPrivateFieldGet(this, _Client_messageManager, "f").pinMessage(chatId, messageId, params);
1919
1970
  }
1920
1971
  /**
1921
1972
  * Unpin a pinned message.
@@ -1925,7 +1976,7 @@ export class Client extends ClientAbstract {
1925
1976
  * @param messageId The message's identifier.
1926
1977
  */
1927
1978
  async unpinMessage(chatId, messageId) {
1928
- return await __classPrivateFieldGet(this, _Client_messageManager, "f").unpinMessage(chatId, messageId);
1979
+ await __classPrivateFieldGet(this, _Client_messageManager, "f").unpinMessage(chatId, messageId);
1929
1980
  }
1930
1981
  /**
1931
1982
  * Unpin all pinned messages.
@@ -1934,7 +1985,7 @@ export class Client extends ClientAbstract {
1934
1985
  * @param chatId The identifier of the chat.
1935
1986
  */
1936
1987
  async unpinMessages(chatId) {
1937
- return await __classPrivateFieldGet(this, _Client_messageManager, "f").unpinMessages(chatId);
1988
+ await __classPrivateFieldGet(this, _Client_messageManager, "f").unpinMessages(chatId);
1938
1989
  }
1939
1990
  /**
1940
1991
  * Ban a member from a chat.
@@ -1982,6 +2033,7 @@ export class Client extends ClientAbstract {
1982
2033
  *
1983
2034
  * @method ch
1984
2035
  * @param chatId The identifier of the chat.
2036
+ * @returns The chat's administrators.
1985
2037
  */
1986
2038
  async getChatAdministrators(chatId) {
1987
2039
  return await __classPrivateFieldGet(this, _Client_messageManager, "f").getChatAdministrators(chatId);
@@ -2015,6 +2067,7 @@ export class Client extends ClientAbstract {
2015
2067
  * @method st
2016
2068
  * @param chatId The identifier of the chat to retrieve the story from.
2017
2069
  * @param storyId The identifier of the story to retrieve.
2070
+ * @returns The retrieved story.
2018
2071
  */
2019
2072
  async getStory(chatId, storyId) {
2020
2073
  return await __classPrivateFieldGet(this, _Client_storyManager, "f").getStory(chatId, storyId);
@@ -2123,6 +2176,7 @@ export class Client extends ClientAbstract {
2123
2176
  * @method ac
2124
2177
  * @param id `"me"`, a bot ID, a supergroup ID, or a channel ID.
2125
2178
  * @param order The new order to use.
2179
+ * @returns Whether the order was changed.
2126
2180
  */
2127
2181
  async reorderUsernames(id, order) {
2128
2182
  return await __classPrivateFieldGet(this, _Client_accountManager, "f").reorderUsernames(id, order);
@@ -2140,6 +2194,7 @@ export class Client extends ClientAbstract {
2140
2194
  * Get inactive chats. User-only.
2141
2195
  *
2142
2196
  * @method ch
2197
+ * @retuns A list of inactive chats the current user is member of.
2143
2198
  */
2144
2199
  async getInactiveChats() {
2145
2200
  return await __classPrivateFieldGet(this, _Client_accountManager, "f").getInactiveChats();
@@ -2164,6 +2219,62 @@ export class Client extends ClientAbstract {
2164
2219
  async setBoostsRequiredToCircumventRestrictions(chatId, boosts) {
2165
2220
  await __classPrivateFieldGet(this, _Client_messageManager, "f").setBoostsRequiredToCircumventRestrictions(chatId, boosts);
2166
2221
  }
2222
+ /**
2223
+ * Create an invite link.
2224
+ *
2225
+ * @method ch
2226
+ * @param chatId The identifier of the chat to create the invite link for.
2227
+ * @returns The newly created invite link.
2228
+ */
2229
+ async createInviteLink(chatId, params) {
2230
+ return await __classPrivateFieldGet(this, _Client_messageManager, "f").createInviteLink(chatId, params);
2231
+ }
2232
+ /**
2233
+ * Get the invite links created for a chat. User-only.
2234
+ *
2235
+ * @method ch
2236
+ * @param chatId The identifier of the chat.
2237
+ * @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.
2238
+ */
2239
+ async getCreatedInviteLinks(chatId, params) {
2240
+ return await __classPrivateFieldGet(this, _Client_messageManager, "f").getCreatedInviteLinks(chatId, params);
2241
+ }
2242
+ /**
2243
+ * Join a chat. User-only.
2244
+ *
2245
+ * @method ch
2246
+ * @param chatId The identifier of the chat to join.
2247
+ */
2248
+ async joinChat(chatId) {
2249
+ await __classPrivateFieldGet(this, _Client_messageManager, "f").joinChat(chatId);
2250
+ }
2251
+ /**
2252
+ * Leave a chat.
2253
+ *
2254
+ * @method ch
2255
+ * @param chatId The identifier of the chat to leave.
2256
+ */
2257
+ async leaveChat(chatId) {
2258
+ await __classPrivateFieldGet(this, _Client_messageManager, "f").leaveChat(chatId);
2259
+ }
2260
+ /**
2261
+ * Block a user. User-only.
2262
+ *
2263
+ * @method mc
2264
+ * @param userId The identifier of the user to block.
2265
+ */
2266
+ async blockUser(userId) {
2267
+ await __classPrivateFieldGet(this, _Client_messageManager, "f").blockUser(userId);
2268
+ }
2269
+ /**
2270
+ * Unblock a user. User-only.
2271
+ *
2272
+ * @method mc
2273
+ * @param userId The identifier of the user to unblock.
2274
+ */
2275
+ async unblockUser(userId) {
2276
+ await __classPrivateFieldGet(this, _Client_messageManager, "f").unblockUser(userId);
2277
+ }
2167
2278
  }
2168
2279
  _Client_handleCtxUpdate = async function _Client_handleCtxUpdate(update) {
2169
2280
  await __classPrivateFieldGet(this, _Client_handle, "f").call(this, await __classPrivateFieldGet(this, _Client_constructContext, "f").call(this, update), resolve);
@@ -1,53 +1,53 @@
1
1
  import { MaybePromise } from "../1_utilities.js";
2
- import { AnyEntity, enums, TLObject, types } from "../2_tl.js";
2
+ import { AnyEntity, enums, ReadObject, TLObject, types } from "../2_tl.js";
3
3
  import { DC } from "../3_transport.js";
4
4
  export declare const K: {
5
5
  session: {
6
6
  P: (string: string) => string;
7
- serverSalt: () => string[];
7
+ serverSalt: () => StorageKeyPart[];
8
8
  };
9
9
  auth: {
10
10
  P: (string: string) => string;
11
- dc: () => string[];
12
- key: () => string[];
13
- accountType: () => string[];
11
+ dc: () => StorageKeyPart[];
12
+ key: () => StorageKeyPart[];
13
+ accountType: () => StorageKeyPart[];
14
14
  };
15
15
  updates: {
16
16
  P: (string: string) => string;
17
- state: () => string[];
18
- all: () => string[];
19
- updates: (boxId: bigint) => (string | bigint)[];
20
- update: (boxId: bigint, id: bigint) => (string | bigint)[];
21
- channelPts: (channelId: bigint) => (string | bigint)[];
17
+ state: () => StorageKeyPart[];
18
+ all: () => StorageKeyPart[];
19
+ updates: (boxId: bigint) => StorageKeyPart[];
20
+ update: (boxId: bigint, id: bigint) => StorageKeyPart[];
21
+ channelPts: (channelId: bigint) => StorageKeyPart[];
22
22
  };
23
23
  cache: {
24
24
  P: (string: string) => string;
25
- usernames: () => string[];
26
- username: (v: string) => string[];
27
- peers: () => string[];
28
- peer: (id: number) => (string | number)[];
29
- stickerSetNames: () => string[];
30
- stickerSetName: (id: bigint, accessHash: bigint) => (string | bigint)[];
31
- files: () => string[];
32
- file: (fileId: bigint) => (string | bigint)[];
33
- fileParts: () => string[];
34
- filePart: (fileId: bigint, n: number) => (string | number | bigint)[];
35
- customEmojiDocuments: () => string[];
36
- customEmojiDocument: (id: bigint) => (string | bigint)[];
25
+ usernames: () => StorageKeyPart[];
26
+ username: (v: string) => StorageKeyPart[];
27
+ peers: () => StorageKeyPart[];
28
+ peer: (id: number) => StorageKeyPart[];
29
+ stickerSetNames: () => StorageKeyPart[];
30
+ stickerSetName: (id: bigint, accessHash: bigint) => StorageKeyPart[];
31
+ files: () => StorageKeyPart[];
32
+ file: (fileId: bigint) => StorageKeyPart[];
33
+ fileParts: () => StorageKeyPart[];
34
+ filePart: (fileId: bigint, n: number) => StorageKeyPart[];
35
+ customEmojiDocuments: () => StorageKeyPart[];
36
+ customEmojiDocument: (id: bigint) => StorageKeyPart[];
37
37
  };
38
38
  messages: {
39
39
  P: (string: string) => string;
40
- messages: (chatId: number) => (string | number)[];
41
- message: (chatId: number, messageId: number) => (string | number)[];
42
- allMessageRefs: () => string[];
43
- messageRef: (messageId: number) => (string | number)[];
40
+ messages: (chatId: number) => StorageKeyPart[];
41
+ message: (chatId: number, messageId: number) => StorageKeyPart[];
42
+ allMessageRefs: () => StorageKeyPart[];
43
+ messageRef: (messageId: number) => StorageKeyPart[];
44
44
  };
45
45
  chatlists: {
46
46
  P: (string: string) => string;
47
- hasAllChats: (listId: number) => (string | number)[];
48
- chats: (listId: number) => (string | number)[];
49
- chat: (listId: number, chatId: number) => (string | number)[];
50
- pinnedChats: (listId: number) => (string | number)[];
47
+ hasAllChats: (listId: number) => StorageKeyPart[];
48
+ chats: (listId: number) => StorageKeyPart[];
49
+ chat: (listId: number, chatId: number) => StorageKeyPart[];
50
+ pinnedChats: (listId: number) => StorageKeyPart[];
51
51
  };
52
52
  };
53
53
  export type StorageKeyPart = string | number | bigint;
@@ -70,7 +70,7 @@ export declare abstract class Storage {
70
70
  abstract get supportsFiles(): boolean;
71
71
  abstract branch(id: string): Storage;
72
72
  get isMemoryStorage(): boolean;
73
- setDc(dc: DC | null): MaybePromise<void>;
73
+ setDc(dc: DC | null): Promise<void>;
74
74
  getDc(): MaybePromise<DC | null>;
75
75
  getAuthKey(): Promise<Uint8Array | null>;
76
76
  setAuthKey(authKey: Uint8Array | null): Promise<void>;
@@ -82,9 +82,9 @@ export declare abstract class Storage {
82
82
  updateUsernames(id: number, usernames: string[]): Promise<void>;
83
83
  getUsername(username: string): Promise<[number, Date] | null>;
84
84
  setTlObject(key: readonly StorageKeyPart[], value: TLObject | null): Promise<void>;
85
- getTlObject(keyOrBuffer: TLObject | Uint8Array | readonly StorageKeyPart[]): Promise<import("../2_tl.js").ReadObject | null>;
85
+ getTlObject(keyOrBuffer: TLObject | Uint8Array | readonly StorageKeyPart[]): Promise<ReadObject | null>;
86
86
  setState(state: enums.updates.State): Promise<void>;
87
- getState(): Promise<import("../tl/2_types.js").updates_State_ | null>;
87
+ getState(): Promise<enums.updates.State | null>;
88
88
  setMessage(chatId: number, messageId: number, message: enums.Message | null): Promise<void>;
89
89
  deleteMessages(): Promise<void>;
90
90
  getMessageChat(messageId: number): MaybePromise<number | null>;
@@ -93,9 +93,9 @@ export declare abstract class Storage {
93
93
  setChannelPts(channelId: bigint, pts: number): Promise<void>;
94
94
  getChannelPts(channelId: bigint): MaybePromise<number | null>;
95
95
  setEntity(entity: AnyEntity): Promise<void>;
96
- getEntity(key: number): Promise<import("../2_tl.js").ReadObject | null>;
96
+ getEntity(key: number): Promise<ReadObject | null>;
97
97
  setAccountType(type: "user" | "bot"): Promise<void>;
98
- getAccountType(): Promise<"bot" | "user" | null>;
98
+ getAccountType(): Promise<"user" | "bot" | null>;
99
99
  updateStickerSetName(id: bigint, accessHash: bigint, name: string): Promise<void>;
100
100
  getStickerSetName(id: bigint, accessHash: bigint): MaybePromise<[string, Date] | null>;
101
101
  setServerSalt(serverSalt: bigint): Promise<void>;
@@ -114,14 +114,14 @@ export declare abstract class Storage {
114
114
  getPinnedChats(listId: number): Promise<number[] | null>;
115
115
  getHistory(chatId: number, offsetId: number, limit: number): Promise<enums.Message[]>;
116
116
  getFile(id: bigint): Promise<[number, number] | null>;
117
- iterFileParts(id: bigint, partCount: number, offset: number): AsyncGenerator<Uint8Array, void, unknown>;
117
+ iterFileParts(id: bigint, partCount: number, offset: number): AsyncGenerator<Uint8Array>;
118
118
  saveFilePart(id: bigint, index: number, bytes: Uint8Array): Promise<void>;
119
119
  setFilePartCount(id: bigint, partCount: number, chunkSize: number): Promise<void>;
120
120
  setCustomEmojiDocument(id: bigint, document: types.Document): Promise<void>;
121
- getCustomEmojiDocument(id: bigint): Promise<[import("../tl/2_types.js").Document_, Date] | null>;
121
+ getCustomEmojiDocument(id: bigint): Promise<[types.Document, Date] | null>;
122
122
  setUpdate(boxId: bigint, update: enums.Update): Promise<void>;
123
123
  deleteUpdates(): Promise<void>;
124
- getFirstUpdate(boxId: bigint): Promise<readonly [readonly StorageKeyPart[], import("../tl/2_types.js").UpdateNewMessage_ | import("../tl/2_types.js").UpdateMessageID_ | import("../tl/2_types.js").UpdateDeleteMessages_ | import("../tl/2_types.js").UpdateUserTyping_ | import("../tl/2_types.js").UpdateChatUserTyping_ | import("../tl/2_types.js").UpdateChatParticipants_ | import("../tl/2_types.js").UpdateUserStatus_ | import("../tl/2_types.js").UpdateUserName_ | import("../tl/2_types.js").UpdateNewAuthorization_ | import("../tl/2_types.js").UpdateNewEncryptedMessage_ | import("../tl/2_types.js").UpdateEncryptedChatTyping_ | import("../tl/2_types.js").UpdateEncryption_ | import("../tl/2_types.js").UpdateEncryptedMessagesRead_ | import("../tl/2_types.js").UpdateChatParticipantAdd_ | import("../tl/2_types.js").UpdateChatParticipantDelete_ | import("../tl/2_types.js").UpdateDcOptions_ | import("../tl/2_types.js").UpdateNotifySettings_ | import("../tl/2_types.js").UpdateServiceNotification_ | import("../tl/2_types.js").UpdatePrivacy_ | import("../tl/2_types.js").UpdateUserPhone_ | import("../tl/2_types.js").UpdateReadHistoryInbox_ | import("../tl/2_types.js").UpdateReadHistoryOutbox_ | import("../tl/2_types.js").UpdateWebPage_ | import("../tl/2_types.js").UpdateReadMessagesContents_ | import("../tl/2_types.js").UpdateChannelTooLong_ | import("../tl/2_types.js").UpdateChannel_ | import("../tl/2_types.js").UpdateNewChannelMessage_ | import("../tl/2_types.js").UpdateReadChannelInbox_ | import("../tl/2_types.js").UpdateDeleteChannelMessages_ | import("../tl/2_types.js").UpdateChannelMessageViews_ | import("../tl/2_types.js").UpdateChatParticipantAdmin_ | import("../tl/2_types.js").UpdateNewStickerSet_ | import("../tl/2_types.js").UpdateStickerSetsOrder_ | import("../tl/2_types.js").UpdateStickerSets_ | import("../tl/2_types.js").UpdateSavedGifs_ | import("../tl/2_types.js").UpdateBotInlineQuery_ | import("../tl/2_types.js").UpdateBotInlineSend_ | import("../tl/2_types.js").UpdateEditChannelMessage_ | import("../tl/2_types.js").UpdateBotCallbackQuery_ | import("../tl/2_types.js").UpdateEditMessage_ | import("../tl/2_types.js").UpdateInlineBotCallbackQuery_ | import("../tl/2_types.js").UpdateReadChannelOutbox_ | import("../tl/2_types.js").UpdateDraftMessage_ | import("../tl/2_types.js").UpdateReadFeaturedStickers_ | import("../tl/2_types.js").UpdateRecentStickers_ | import("../tl/2_types.js").UpdateConfig_ | import("../tl/2_types.js").UpdatePtsChanged_ | import("../tl/2_types.js").UpdateChannelWebPage_ | import("../tl/2_types.js").UpdateDialogPinned_ | import("../tl/2_types.js").UpdatePinnedDialogs_ | import("../tl/2_types.js").UpdateBotWebhookJSON_ | import("../tl/2_types.js").UpdateBotWebhookJSONQuery_ | import("../tl/2_types.js").UpdateBotShippingQuery_ | import("../tl/2_types.js").UpdateBotPrecheckoutQuery_ | import("../tl/2_types.js").UpdatePhoneCall_ | import("../tl/2_types.js").UpdateLangPackTooLong_ | import("../tl/2_types.js").UpdateLangPack_ | import("../tl/2_types.js").UpdateFavedStickers_ | import("../tl/2_types.js").UpdateChannelReadMessagesContents_ | import("../tl/2_types.js").UpdateContactsReset_ | import("../tl/2_types.js").UpdateChannelAvailableMessages_ | import("../tl/2_types.js").UpdateDialogUnreadMark_ | import("../tl/2_types.js").UpdateMessagePoll_ | import("../tl/2_types.js").UpdateChatDefaultBannedRights_ | import("../tl/2_types.js").UpdateFolderPeers_ | import("../tl/2_types.js").UpdatePeerSettings_ | import("../tl/2_types.js").UpdatePeerLocated_ | import("../tl/2_types.js").UpdateNewScheduledMessage_ | import("../tl/2_types.js").UpdateDeleteScheduledMessages_ | import("../tl/2_types.js").UpdateTheme_ | import("../tl/2_types.js").UpdateGeoLiveViewed_ | import("../tl/2_types.js").UpdateLoginToken_ | import("../tl/2_types.js").UpdateMessagePollVote_ | import("../tl/2_types.js").UpdateDialogFilter_ | import("../tl/2_types.js").UpdateDialogFilterOrder_ | import("../tl/2_types.js").UpdateDialogFilters_ | import("../tl/2_types.js").UpdatePhoneCallSignalingData_ | import("../tl/2_types.js").UpdateChannelMessageForwards_ | import("../tl/2_types.js").UpdateReadChannelDiscussionInbox_ | import("../tl/2_types.js").UpdateReadChannelDiscussionOutbox_ | import("../tl/2_types.js").UpdatePeerBlocked_ | import("../tl/2_types.js").UpdateChannelUserTyping_ | import("../tl/2_types.js").UpdatePinnedMessages_ | import("../tl/2_types.js").UpdatePinnedChannelMessages_ | import("../tl/2_types.js").UpdateChat_ | import("../tl/2_types.js").UpdateGroupCallParticipants_ | import("../tl/2_types.js").UpdateGroupCall_ | import("../tl/2_types.js").UpdatePeerHistoryTTL_ | import("../tl/2_types.js").UpdateChatParticipant_ | import("../tl/2_types.js").UpdateChannelParticipant_ | import("../tl/2_types.js").UpdateBotStopped_ | import("../tl/2_types.js").UpdateGroupCallConnection_ | import("../tl/2_types.js").UpdateBotCommands_ | import("../tl/2_types.js").UpdatePendingJoinRequests_ | import("../tl/2_types.js").UpdateBotChatInviteRequester_ | import("../tl/2_types.js").UpdateMessageReactions_ | import("../tl/2_types.js").UpdateAttachMenuBots_ | import("../tl/2_types.js").UpdateWebViewResultSent_ | import("../tl/2_types.js").UpdateBotMenuButton_ | import("../tl/2_types.js").UpdateSavedRingtones_ | import("../tl/2_types.js").UpdateTranscribedAudio_ | import("../tl/2_types.js").UpdateReadFeaturedEmojiStickers_ | import("../tl/2_types.js").UpdateUserEmojiStatus_ | import("../tl/2_types.js").UpdateRecentEmojiStatuses_ | import("../tl/2_types.js").UpdateRecentReactions_ | import("../tl/2_types.js").UpdateMoveStickerSetToTop_ | import("../tl/2_types.js").UpdateMessageExtendedMedia_ | import("../tl/2_types.js").UpdateChannelPinnedTopic_ | import("../tl/2_types.js").UpdateChannelPinnedTopics_ | import("../tl/2_types.js").UpdateUser_ | import("../tl/2_types.js").UpdateAutoSaveSettings_ | import("../tl/2_types.js").UpdateGroupInvitePrivacyForbidden_ | import("../tl/2_types.js").UpdateStory_ | import("../tl/2_types.js").UpdateReadStories_ | import("../tl/2_types.js").UpdateStoryID_ | import("../tl/2_types.js").UpdateStoriesStealthMode_ | import("../tl/2_types.js").UpdateSentStoryReaction_ | import("../tl/2_types.js").UpdateBotChatBoost_ | import("../tl/2_types.js").UpdateChannelViewForumAsMessages_ | import("../tl/2_types.js").UpdatePeerWallpaper_ | import("../tl/2_types.js").UpdateBotMessageReaction_ | import("../tl/2_types.js").UpdateBotMessageReactions_ | import("../tl/2_types.js").UpdateSavedDialogPinned_ | import("../tl/2_types.js").UpdatePinnedSavedDialogs_ | import("../tl/2_types.js").UpdateSavedReactionTags_] | null>;
124
+ getFirstUpdate(boxId: bigint): Promise<[readonly StorageKeyPart[], enums.Update] | null>;
125
125
  assertUser(source: string): Promise<void>;
126
126
  assertBot(source: string): Promise<void>;
127
127
  deleteFiles(): Promise<void>;
@@ -71,8 +71,8 @@ export class Storage {
71
71
  get isMemoryStorage() {
72
72
  return false;
73
73
  }
74
- setDc(dc) {
75
- return this.set(K.auth.dc(), dc);
74
+ async setDc(dc) {
75
+ await this.set(K.auth.dc(), dc);
76
76
  }
77
77
  getDc() {
78
78
  return this.get(K.auth.dc());
@@ -11,7 +11,7 @@ export declare enum ValueType {
11
11
  export declare const WEB_STORAGE_PREFIX_EXP: RegExp;
12
12
  export declare function toString(value: unknown): string;
13
13
  export declare function fromString<T>(string: string): T;
14
- export declare function fixKey(key: readonly StorageKeyPart[]): (string | number)[];
15
- export declare function restoreKey(key: readonly StorageKeyPart[]): (string | number | bigint)[];
14
+ export declare function fixKey(key: readonly StorageKeyPart[]): IDBValidKey[];
15
+ export declare function restoreKey(key: readonly StorageKeyPart[]): StorageKeyPart[];
16
16
  export declare function getPrefixKeyRange(prefix: any): IDBKeyRange;
17
17
  export declare function isInRange(key: StorageKeyPart[], start: readonly StorageKeyPart[], end: readonly StorageKeyPart[]): boolean;
@@ -16,6 +16,6 @@ export declare class StorageIndexedDB extends Storage {
16
16
  getMany<T>(filter: GetManyFilter, params?: {
17
17
  limit?: number;
18
18
  reverse?: boolean;
19
- }, tx_?: IDBTransaction): AsyncGenerator<[readonly StorageKeyPart[], T], void, unknown>;
19
+ }, tx_?: IDBTransaction): AsyncGenerator<[readonly StorageKeyPart[], T]>;
20
20
  incr(key: readonly StorageKeyPart[], by: number): Promise<void>;
21
21
  }
@@ -10,7 +10,7 @@ export declare class StorageLocalStorage extends Storage implements Storage {
10
10
  getMany<T>(filter: GetManyFilter, params?: {
11
11
  limit?: number;
12
12
  reverse?: boolean;
13
- }): Generator<[readonly StorageKeyPart[], T], void, unknown>;
13
+ }): Generator<[readonly StorageKeyPart[], T]>;
14
14
  set(key_: readonly StorageKeyPart[], value: unknown): void;
15
15
  incr(key: readonly StorageKeyPart[], by: number): void;
16
16
  }
@@ -8,14 +8,14 @@ export declare class StorageMemory extends Storage implements Storage {
8
8
  get isMemoryStorage(): boolean;
9
9
  initialize(): Promise<void>;
10
10
  getMap(key: readonly StorageKeyPart[]): Map<string, unknown>;
11
- getMaps(): Map<string, unknown>[];
11
+ getMaps(): [Map<string, unknown>, Map<string, unknown>];
12
12
  branch(id: string): Storage;
13
13
  get supportsFiles(): boolean;
14
- get<T>(key: readonly StorageKeyPart[]): NonNullable<T> | null;
14
+ get<T>(key: readonly StorageKeyPart[]): T | null;
15
15
  getMany<T>(filter: GetManyFilter, params?: {
16
16
  limit?: number;
17
17
  reverse?: boolean;
18
- }): Generator<[readonly StorageKeyPart[], T], void, unknown>;
18
+ }): Generator<[readonly StorageKeyPart[], T]>;
19
19
  set(key_: readonly StorageKeyPart[], value: unknown): MaybePromise<void>;
20
20
  incr(key: readonly StorageKeyPart[], by: number): void;
21
21
  }
@@ -11,7 +11,7 @@ export declare class StorageSessionStorage extends Storage implements Storage {
11
11
  getMany<T>(filter: GetManyFilter, params?: {
12
12
  limit?: number;
13
13
  reverse?: boolean;
14
- }): Generator<[readonly StorageKeyPart[], T], void, unknown>;
14
+ }): Generator<[readonly StorageKeyPart[], T]>;
15
15
  set(key_: readonly StorageKeyPart[], value: unknown): MaybePromise<void>;
16
16
  incr(key: readonly StorageKeyPart[], by: number): void;
17
17
  }
@@ -2,13 +2,13 @@ export declare class TLRawWriter {
2
2
  protected _buffer: Uint8Array;
3
3
  constructor();
4
4
  get buffer(): Uint8Array;
5
- write(buffer: Uint8Array): this;
6
- writeInt24(int: number, signed?: boolean): this;
7
- writeInt32(int: number, signed?: boolean): this;
8
- writeInt64(int: bigint, signed?: boolean): this;
9
- writeDouble(double: number): this;
10
- writeInt128(int: bigint, signed?: boolean): this;
11
- writeInt256(int: bigint, signed?: boolean): this;
12
- writeBytes(bytes: Uint8Array): this;
13
- writeString(string: string): this;
5
+ write(buffer: Uint8Array): typeof this;
6
+ writeInt24(int: number, signed?: boolean): typeof this;
7
+ writeInt32(int: number, signed?: boolean): typeof this;
8
+ writeInt64(int: bigint, signed?: boolean): typeof this;
9
+ writeDouble(double: number): typeof this;
10
+ writeInt128(int: bigint, signed?: boolean): typeof this;
11
+ writeInt256(int: bigint, signed?: boolean): typeof this;
12
+ writeBytes(bytes: Uint8Array): typeof this;
13
+ writeString(string: string): typeof this;
14
14
  }
@@ -33,7 +33,7 @@ export declare abstract class TLObject {
33
33
  get [length](): number;
34
34
  [serialize](): Uint8Array;
35
35
  [as]<T extends TLObjectConstructor<InstanceType<T>>>(constructor: T): InstanceType<T>;
36
- toJSON(): Record<string, any>;
36
+ toJSON(): object;
37
37
  }
38
38
  export interface TLObjectConstructor<T = TLObject> {
39
39
  new (params: any): T;
@@ -5,9 +5,9 @@ export const id = Symbol("id");
5
5
  export const params = Symbol("params");
6
6
  export const paramDesc = Symbol("paramDesc");
7
7
  export const length = Symbol("length");
8
- export const serialize = Symbol();
9
- export const as = Symbol();
10
- export const name = Symbol();
8
+ export const serialize = Symbol("serialize");
9
+ export const as = Symbol("as");
10
+ export const name = Symbol("name");
11
11
  export function isOptionalParam(ntype) {
12
12
  return ntype.includes("?");
13
13
  }