@mtkruto/node 0.1.500 → 0.1.700

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 (179) hide show
  1. package/esm/3_types.d.ts +6 -1
  2. package/esm/3_types.js +6 -1
  3. package/esm/4_errors.js +2 -4
  4. package/esm/5_client.d.ts +1 -1
  5. package/esm/5_client.js +1 -1
  6. package/esm/client/0_params.d.ts +33 -7
  7. package/esm/client/0_storage_operations.d.ts +182 -0
  8. package/esm/client/0_storage_operations.js +611 -0
  9. package/esm/client/1_composer.d.ts +2 -0
  10. package/esm/client/1_composer.js +28 -0
  11. package/{script/client/0_types.d.ts → esm/client/1_types.d.ts} +3 -3
  12. package/{script/client/1_account_manager.d.ts → esm/client/2_account_manager.d.ts} +1 -1
  13. package/{script/client/1_bot_info_manager.d.ts → esm/client/2_bot_info_manager.d.ts} +1 -1
  14. package/esm/client/{1_business_connection_manager.d.ts → 2_business_connection_manager.d.ts} +1 -1
  15. package/{script/client/1_file_manager.d.ts → esm/client/2_file_manager.d.ts} +6 -2
  16. package/esm/client/{1_file_manager.js → 2_file_manager.js} +55 -52
  17. package/esm/client/{1_network_statistics_manager.d.ts → 2_network_statistics_manager.d.ts} +1 -1
  18. package/{script/client/1_reaction_manager.d.ts → esm/client/2_reaction_manager.d.ts} +1 -1
  19. package/{script/client/1_update_manager.d.ts → esm/client/2_update_manager.d.ts} +1 -1
  20. package/esm/client/{2_message_manager.d.ts → 3_message_manager.d.ts} +2 -2
  21. package/esm/client/3_video_chat_manager.d.ts +43 -0
  22. package/esm/client/3_video_chat_manager.js +194 -0
  23. package/esm/client/{3_callback_query_manager.d.ts → 4_callback_query_manager.d.ts} +2 -2
  24. package/esm/client/{3_callback_query_manager.js → 4_callback_query_manager.js} +1 -0
  25. package/{script/client/3_chat_list_manager.d.ts → esm/client/4_chat_list_manager.d.ts} +6 -6
  26. package/esm/client/{3_chat_list_manager.js → 4_chat_list_manager.js} +75 -98
  27. package/esm/client/{3_inline_query_manager.d.ts → 4_inline_query_manager.d.ts} +2 -2
  28. package/esm/client/{3_inline_query_manager.js → 4_inline_query_manager.js} +1 -0
  29. package/esm/client/{3_story_manager.d.ts → 4_story_manager.d.ts} +3 -3
  30. package/{script/client/4_client.d.ts → esm/client/5_client.d.ts} +105 -31
  31. package/esm/client/{4_client.js → 5_client.js} +172 -73
  32. package/esm/connection/0_connection.d.ts +6 -15
  33. package/esm/connection/0_connection.js +1 -38
  34. package/esm/connection/1_connection_web_socket.d.ts +3 -2
  35. package/esm/connection/1_connection_web_socket.js +7 -3
  36. package/esm/mod.d.ts +1 -1
  37. package/esm/mod.js +1 -1
  38. package/esm/storage/0_storage.d.ts +9 -145
  39. package/esm/storage/0_storage.js +1 -526
  40. package/esm/storage/2_storage_indexed_db.d.ts +3 -2
  41. package/esm/storage/2_storage_indexed_db.js +9 -8
  42. package/esm/storage/2_storage_local_storage.d.ts +3 -2
  43. package/esm/storage/2_storage_local_storage.js +5 -4
  44. package/esm/storage/2_storage_memory.d.ts +4 -4
  45. package/esm/storage/2_storage_memory.js +12 -19
  46. package/esm/storage/2_storage_session_storage.d.ts +2 -1
  47. package/esm/storage/2_storage_session_storage.js +5 -4
  48. package/esm/tl/3_utilities.d.ts +1 -1
  49. package/esm/tl/3_utilities.js +3 -3
  50. package/esm/types/0_birthday.d.ts +27 -0
  51. package/esm/types/0_birthday.js +26 -0
  52. package/esm/types/0_giveaway_parameters.d.ts +1 -1
  53. package/esm/types/0_id.d.ts +1 -1
  54. package/esm/types/0_live_stream_channel.d.ts +30 -0
  55. package/esm/types/0_live_stream_channel.js +26 -0
  56. package/esm/types/0_opening_hours.d.ts +25 -0
  57. package/esm/types/0_opening_hours.js +25 -0
  58. package/esm/types/0_video_chat.d.ts +60 -0
  59. package/esm/types/0_video_chat.js +53 -0
  60. package/esm/types/1_chat_p.d.ts +4 -0
  61. package/esm/types/1_chat_p.js +1 -0
  62. package/esm/types/2_business_connection.d.ts +6 -0
  63. package/esm/types/2_chat.d.ts +62 -0
  64. package/esm/types/2_chat.js +66 -0
  65. package/esm/types/2_inactive_chat.d.ts +1 -1
  66. package/esm/types/2_invite_link.d.ts +1 -1
  67. package/esm/types/2_message_reaction_count.d.ts +1 -1
  68. package/esm/types/2_message_reactions.d.ts +1 -1
  69. package/esm/types/3_chat_member_updated.d.ts +1 -1
  70. package/esm/types/4_message.d.ts +3 -3
  71. package/esm/types/5_chat_list_item.d.ts +35 -0
  72. package/esm/types/5_chat_list_item.js +86 -0
  73. package/esm/types/6_update.d.ts +14 -5
  74. package/esm/types/_file_id.d.ts +1 -0
  75. package/esm/utilities/0_bigint.d.ts +1 -0
  76. package/esm/utilities/0_bigint.js +7 -3
  77. package/package.json +1 -1
  78. package/script/3_types.d.ts +6 -1
  79. package/script/3_types.js +6 -1
  80. package/script/4_errors.js +2 -4
  81. package/script/5_client.d.ts +1 -1
  82. package/script/5_client.js +1 -1
  83. package/script/client/0_params.d.ts +33 -7
  84. package/script/client/0_storage_operations.d.ts +182 -0
  85. package/script/client/0_storage_operations.js +615 -0
  86. package/script/client/1_composer.d.ts +2 -0
  87. package/script/client/1_composer.js +28 -0
  88. package/{esm/client/0_types.d.ts → script/client/1_types.d.ts} +3 -3
  89. package/{esm/client/1_account_manager.d.ts → script/client/2_account_manager.d.ts} +1 -1
  90. package/{esm/client/1_bot_info_manager.d.ts → script/client/2_bot_info_manager.d.ts} +1 -1
  91. package/script/client/{1_business_connection_manager.d.ts → 2_business_connection_manager.d.ts} +1 -1
  92. package/{esm/client/1_file_manager.d.ts → script/client/2_file_manager.d.ts} +6 -2
  93. package/script/client/{1_file_manager.js → 2_file_manager.js} +54 -51
  94. package/script/client/{1_network_statistics_manager.d.ts → 2_network_statistics_manager.d.ts} +1 -1
  95. package/{esm/client/1_reaction_manager.d.ts → script/client/2_reaction_manager.d.ts} +1 -1
  96. package/{esm/client/1_update_manager.d.ts → script/client/2_update_manager.d.ts} +1 -1
  97. package/script/client/{2_message_manager.d.ts → 3_message_manager.d.ts} +2 -2
  98. package/script/client/3_video_chat_manager.d.ts +43 -0
  99. package/script/client/3_video_chat_manager.js +198 -0
  100. package/script/client/{3_callback_query_manager.d.ts → 4_callback_query_manager.d.ts} +2 -2
  101. package/script/client/{3_callback_query_manager.js → 4_callback_query_manager.js} +1 -0
  102. package/{esm/client/3_chat_list_manager.d.ts → script/client/4_chat_list_manager.d.ts} +6 -6
  103. package/script/client/{3_chat_list_manager.js → 4_chat_list_manager.js} +72 -95
  104. package/script/client/{3_inline_query_manager.d.ts → 4_inline_query_manager.d.ts} +2 -2
  105. package/script/client/{3_inline_query_manager.js → 4_inline_query_manager.js} +1 -0
  106. package/script/client/{3_story_manager.d.ts → 4_story_manager.d.ts} +3 -3
  107. package/{esm/client/4_client.d.ts → script/client/5_client.d.ts} +105 -31
  108. package/script/client/{4_client.js → 5_client.js} +192 -93
  109. package/script/connection/0_connection.d.ts +6 -15
  110. package/script/connection/0_connection.js +0 -41
  111. package/script/connection/1_connection_web_socket.d.ts +3 -2
  112. package/script/connection/1_connection_web_socket.js +7 -3
  113. package/script/mod.d.ts +1 -1
  114. package/script/mod.js +1 -1
  115. package/script/storage/0_storage.d.ts +9 -145
  116. package/script/storage/0_storage.js +0 -528
  117. package/script/storage/2_storage_indexed_db.d.ts +3 -2
  118. package/script/storage/2_storage_indexed_db.js +9 -8
  119. package/script/storage/2_storage_local_storage.d.ts +3 -2
  120. package/script/storage/2_storage_local_storage.js +5 -4
  121. package/script/storage/2_storage_memory.d.ts +4 -4
  122. package/script/storage/2_storage_memory.js +12 -19
  123. package/script/storage/2_storage_session_storage.d.ts +2 -1
  124. package/script/storage/2_storage_session_storage.js +5 -4
  125. package/script/tl/3_utilities.d.ts +1 -1
  126. package/script/tl/3_utilities.js +3 -3
  127. package/script/types/0_birthday.d.ts +27 -0
  128. package/script/types/0_birthday.js +30 -0
  129. package/script/types/0_giveaway_parameters.d.ts +1 -1
  130. package/script/types/0_id.d.ts +1 -1
  131. package/script/types/0_live_stream_channel.d.ts +30 -0
  132. package/script/types/0_live_stream_channel.js +30 -0
  133. package/script/types/0_opening_hours.d.ts +25 -0
  134. package/script/types/0_opening_hours.js +29 -0
  135. package/script/types/0_video_chat.d.ts +60 -0
  136. package/script/types/0_video_chat.js +57 -0
  137. package/script/types/1_chat_p.d.ts +4 -0
  138. package/script/types/1_chat_p.js +1 -0
  139. package/script/types/2_business_connection.d.ts +6 -0
  140. package/script/types/2_chat.d.ts +62 -0
  141. package/script/types/2_chat.js +70 -0
  142. package/script/types/2_inactive_chat.d.ts +1 -1
  143. package/script/types/2_invite_link.d.ts +1 -1
  144. package/script/types/2_message_reaction_count.d.ts +1 -1
  145. package/script/types/2_message_reactions.d.ts +1 -1
  146. package/script/types/3_chat_member_updated.d.ts +1 -1
  147. package/script/types/4_message.d.ts +3 -3
  148. package/script/types/5_chat_list_item.d.ts +35 -0
  149. package/script/types/5_chat_list_item.js +94 -0
  150. package/script/types/6_update.d.ts +14 -5
  151. package/script/types/_file_id.d.ts +1 -0
  152. package/script/utilities/0_bigint.d.ts +1 -0
  153. package/script/utilities/0_bigint.js +7 -3
  154. package/esm/types/5_chat.d.ts +0 -59
  155. package/esm/types/5_chat.js +0 -126
  156. package/script/types/5_chat.d.ts +0 -59
  157. package/script/types/5_chat.js +0 -134
  158. /package/esm/{3_storage.d.ts → 2_storage.d.ts} +0 -0
  159. /package/esm/{3_storage.js → 2_storage.js} +0 -0
  160. /package/esm/client/{0_types.js → 1_types.js} +0 -0
  161. /package/esm/client/{1_account_manager.js → 2_account_manager.js} +0 -0
  162. /package/esm/client/{1_bot_info_manager.js → 2_bot_info_manager.js} +0 -0
  163. /package/esm/client/{1_business_connection_manager.js → 2_business_connection_manager.js} +0 -0
  164. /package/esm/client/{1_network_statistics_manager.js → 2_network_statistics_manager.js} +0 -0
  165. /package/esm/client/{1_reaction_manager.js → 2_reaction_manager.js} +0 -0
  166. /package/esm/client/{1_update_manager.js → 2_update_manager.js} +0 -0
  167. /package/esm/client/{2_message_manager.js → 3_message_manager.js} +0 -0
  168. /package/esm/client/{3_story_manager.js → 4_story_manager.js} +0 -0
  169. /package/script/{3_storage.d.ts → 2_storage.d.ts} +0 -0
  170. /package/script/{3_storage.js → 2_storage.js} +0 -0
  171. /package/script/client/{0_types.js → 1_types.js} +0 -0
  172. /package/script/client/{1_account_manager.js → 2_account_manager.js} +0 -0
  173. /package/script/client/{1_bot_info_manager.js → 2_bot_info_manager.js} +0 -0
  174. /package/script/client/{1_business_connection_manager.js → 2_business_connection_manager.js} +0 -0
  175. /package/script/client/{1_network_statistics_manager.js → 2_network_statistics_manager.js} +0 -0
  176. /package/script/client/{1_reaction_manager.js → 2_reaction_manager.js} +0 -0
  177. /package/script/client/{1_update_manager.js → 2_update_manager.js} +0 -0
  178. /package/script/client/{2_message_manager.js → 3_message_manager.js} +0 -0
  179. /package/script/client/{3_story_manager.js → 4_story_manager.js} +0 -0
@@ -29,7 +29,7 @@ export interface ChatMemberUpdated {
29
29
  chat: ChatP;
30
30
  /** The one who made the change. */
31
31
  from: User;
32
- /** The point of time in which the chat member's status was changed. */
32
+ /** The point in time in which the chat member's status was changed. */
33
33
  date: Date;
34
34
  /** The old status of the chat member. */
35
35
  oldChatMember: ChatMember;
@@ -57,7 +57,7 @@ export interface _MessageBase {
57
57
  from?: User;
58
58
  /** The chat which the message was sent on behalf of. */
59
59
  senderChat?: ChatP;
60
- /** The point of time in which the message was sent. */
60
+ /** The point in time in which the message was sent. */
61
61
  date: Date;
62
62
  /** The chat where the message was sent to. */
63
63
  chat: ChatP;
@@ -73,7 +73,7 @@ export interface _MessageBase {
73
73
  forwardSignature?: string;
74
74
  /** The name of the original sender of the message. */
75
75
  forwardSenderName?: string;
76
- /** The point of time in which the original message was sent. */
76
+ /** The point in time in which the original message was sent. */
77
77
  forwardDate?: Date;
78
78
  /** Whether the message was sent in a topic thread. */
79
79
  isTopicMessage: boolean;
@@ -89,7 +89,7 @@ export interface _MessageBase {
89
89
  replyQuote?: ReplyQuote;
90
90
  /** The inline bot that was used to send this message. */
91
91
  viaBot?: User;
92
- /** The point of time in which the message's last edit was made. */
92
+ /** The point in time in which the message's last edit was made. */
93
93
  editDate?: Date;
94
94
  /** Whether the contents of the message is protected. */
95
95
  hasProtectedContent?: boolean;
@@ -0,0 +1,35 @@
1
+ /**
2
+ * MTKruto - Cross-runtime JavaScript library for building Telegram clients
3
+ * Copyright (C) 2023-2024 Roj <https://roj.im/>
4
+ *
5
+ * This file is part of MTKruto.
6
+ *
7
+ * This program is free software: you can redistribute it and/or modify
8
+ * it under the terms of the GNU Lesser General Public License as published by
9
+ * the Free Software Foundation, either version 3 of the License, or
10
+ * (at your option) any later version.
11
+ *
12
+ * This program is distributed in the hope that it will be useful,
13
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ * GNU Lesser General Public License for more details.
16
+ *
17
+ * You should have received a copy of the GNU Lesser General Public License
18
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
19
+ */
20
+ import { enums, types } from "../2_tl.js";
21
+ import { EntityGetter } from "./_getters.js";
22
+ import { ChatP } from "./1_chat_p.js";
23
+ import { StickerSetNameGetter } from "./1_sticker.js";
24
+ import { Message, MessageGetter } from "./4_message.js";
25
+ export interface ChatListItem {
26
+ chat: ChatP;
27
+ order: string;
28
+ pinned: number;
29
+ lastMessage?: Omit<Message, "replyToMessage">;
30
+ }
31
+ export declare function getChatListItemOrder(lastMessage: Omit<Message, "replyToMessage"> | undefined, pinned: number): string;
32
+ export declare function constructChatListItem(chatId: number, pinned: number, lastMessageId: number, getEntity: EntityGetter, getMessage: MessageGetter): Promise<ChatListItem | null>;
33
+ export declare function constructChatListItem2(entity: types.User | types.Chat | types.ChatForbidden | types.Channel | types.ChannelForbidden, pinned: number, lastMessage: Omit<Message, "replyToMessage"> | undefined): ChatListItem;
34
+ export declare function constructChatListItem3(chatId: number, pinned: number, lastMessage: Omit<Message, "replyToMessage"> | undefined, getEntity: EntityGetter): Promise<ChatListItem | null>;
35
+ export declare function constructChatListItem4(dialog: enums.Dialog, dialogs: types.messages.Dialogs | types.messages.DialogsSlice, pinnedChats: number[], getEntity: EntityGetter, getMessage: MessageGetter, getStickerSetName: StickerSetNameGetter): Promise<ChatListItem>;
@@ -0,0 +1,86 @@
1
+ /**
2
+ * MTKruto - Cross-runtime JavaScript library for building Telegram clients
3
+ * Copyright (C) 2023-2024 Roj <https://roj.im/>
4
+ *
5
+ * This file is part of MTKruto.
6
+ *
7
+ * This program is free software: you can redistribute it and/or modify
8
+ * it under the terms of the GNU Lesser General Public License as published by
9
+ * the Free Software Foundation, either version 3 of the License, or
10
+ * (at your option) any later version.
11
+ *
12
+ * This program is distributed in the hope that it will be useful,
13
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ * GNU Lesser General Public License for more details.
16
+ *
17
+ * You should have received a copy of the GNU Lesser General Public License
18
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
19
+ */
20
+ import { unreachable } from "../0_deps.js";
21
+ import { chatIdToPeer, peerToChatId, types } from "../2_tl.js";
22
+ import { constructChatP } from "./1_chat_p.js";
23
+ import { constructMessage } from "./4_message.js";
24
+ export function getChatListItemOrder(lastMessage, pinned) {
25
+ const p = pinned == -1 ? "" : `P${100 - pinned}`;
26
+ if (!lastMessage) {
27
+ return p + "0";
28
+ }
29
+ return p + String((BigInt(Math.floor(lastMessage.date.getTime())) << 32n) + BigInt(lastMessage.id));
30
+ }
31
+ export async function constructChatListItem(chatId, pinned, lastMessageId, getEntity, getMessage) {
32
+ const entity = await getEntity(chatIdToPeer(chatId));
33
+ if (entity == null) {
34
+ return null;
35
+ }
36
+ const lastMessage_ = lastMessageId > 0 ? await getMessage(chatId, lastMessageId) : null;
37
+ const lastMessage = lastMessage_ == null ? undefined : lastMessage_;
38
+ return {
39
+ chat: constructChatP(entity),
40
+ order: getChatListItemOrder(lastMessage, pinned),
41
+ pinned,
42
+ lastMessage,
43
+ };
44
+ }
45
+ export function constructChatListItem2(entity, pinned, lastMessage) {
46
+ return {
47
+ chat: constructChatP(entity),
48
+ order: getChatListItemOrder(lastMessage, pinned),
49
+ pinned,
50
+ lastMessage,
51
+ };
52
+ }
53
+ export async function constructChatListItem3(chatId, pinned, lastMessage, getEntity) {
54
+ const entity = await getEntity(chatIdToPeer(chatId));
55
+ if (entity == null) {
56
+ return null;
57
+ }
58
+ return {
59
+ chat: constructChatP(entity),
60
+ order: getChatListItemOrder(lastMessage, pinned),
61
+ pinned,
62
+ lastMessage,
63
+ };
64
+ }
65
+ export async function constructChatListItem4(dialog, dialogs, pinnedChats, getEntity, getMessage, getStickerSetName) {
66
+ const topMessage_ = dialogs.messages.find((v) => "id" in v && v.id == dialog.top_message);
67
+ if (!topMessage_) {
68
+ unreachable();
69
+ }
70
+ const pinned = pinnedChats.indexOf(peerToChatId(dialog.peer));
71
+ const lastMessage = await constructMessage(topMessage_, getEntity, getMessage, getStickerSetName, false);
72
+ const order = getChatListItemOrder(lastMessage, pinned);
73
+ const userId = "user_id" in dialog.peer ? dialog.peer.user_id : null;
74
+ const chatId = "chat_id" in dialog.peer ? dialog.peer.chat_id : null;
75
+ const channelId = "channel_id" in dialog.peer ? dialog.peer.channel_id : null;
76
+ const chat__ = chatId != null ? dialogs.chats.find((v) => v instanceof types.Chat && v.id == chatId) : channelId != null ? dialogs.chats.find((v) => v instanceof types.Channel && v.id == channelId) : userId != null ? dialogs.users.find((v) => v instanceof types.User && v.id == userId) : unreachable();
77
+ if (!chat__) {
78
+ unreachable();
79
+ }
80
+ return {
81
+ chat: constructChatP(chat__),
82
+ order,
83
+ lastMessage,
84
+ pinned,
85
+ };
86
+ }
@@ -31,7 +31,8 @@ import { ChatMemberUpdated } from "./3_chat_member_updated.js";
31
31
  import { Story } from "./3_story.js";
32
32
  import { Message } from "./4_message.js";
33
33
  import { CallbackQuery } from "./5_callback_query.js";
34
- import { Chat } from "./5_chat.js";
34
+ import { ChatListItem } from "./5_chat_list_item.js";
35
+ import { VideoChat } from "./0_video_chat.js";
35
36
  /**
36
37
  * A client's connection state was changed.
37
38
  *
@@ -165,14 +166,14 @@ export interface UpdateChosenInlineResult {
165
166
  */
166
167
  export interface UpdateNewChat {
167
168
  /** The newly added chat. */
168
- newChat: Chat;
169
+ newChat: ChatListItem;
169
170
  }
170
171
  /**
171
172
  * A chat in the chat list was edited. User-only.
172
173
  * @unlisted
173
174
  */
174
175
  export interface UpdateEditedChat {
175
- editedChat: Chat;
176
+ editedChat: ChatListItem;
176
177
  }
177
178
  /**
178
179
  * A chat was removed from the chat list. User-only.
@@ -242,6 +243,13 @@ export interface UpdateNewStory {
242
243
  export interface UpdateBusinessConnection {
243
244
  businessConnection: BusinessConnection;
244
245
  }
246
+ /**
247
+ * A video chat was started, scheduled, or ended.
248
+ * @unlisted
249
+ */
250
+ export interface UpdateVideoChat {
251
+ videoChat: VideoChat;
252
+ }
245
253
  /** @unlisted */
246
254
  export interface UpdateMap {
247
255
  message: UpdateNewMessage;
@@ -263,8 +271,9 @@ export interface UpdateMap {
263
271
  deletedStory: UpdateDeletedStory;
264
272
  story: UpdateNewStory;
265
273
  businessConnection: UpdateBusinessConnection;
274
+ videoChat: UpdateVideoChat;
266
275
  }
267
276
  /** @unlisted */
268
- export type UpdateIntersection<T> = T & Partial<UpdateConnectionState & UpdateAuthorizationState & UpdateNewMessage & UpdateEditedMessage & UpdateDeletedMessages & UpdateCallbackQuery & UpdateInlineQuery & UpdateChosenInlineResult & UpdateNewChat & UpdateEditedChat & UpdateDeletedChat & UpdateMessageInteractions & UpdateMessageReactionCount & UpdateMessageReactions & UpdateChatMember & UpdateMyChatMember & UpdateDeletedStory & UpdateNewStory & UpdateBusinessConnection>;
277
+ export type UpdateIntersection<T> = T & Partial<UpdateConnectionState & UpdateAuthorizationState & UpdateNewMessage & UpdateEditedMessage & UpdateDeletedMessages & UpdateCallbackQuery & UpdateInlineQuery & UpdateChosenInlineResult & UpdateNewChat & UpdateEditedChat & UpdateDeletedChat & UpdateMessageInteractions & UpdateMessageReactionCount & UpdateMessageReactions & UpdateChatMember & UpdateMyChatMember & UpdateDeletedStory & UpdateNewStory & UpdateBusinessConnection & UpdateVideoChat>;
269
278
  /** An incoming update. */
270
- export type Update = UpdateConnectionState | UpdateAuthorizationState | UpdateNewMessage | UpdateEditedMessage | UpdateDeletedMessages | UpdateCallbackQuery | UpdateInlineQuery | UpdateChosenInlineResult | UpdateNewChat | UpdateEditedChat | UpdateDeletedChat | UpdateMessageInteractions | UpdateMessageReactionCount | UpdateMessageReactions | UpdateChatMember | UpdateMyChatMember | UpdateDeletedStory | UpdateNewStory | UpdateBusinessConnection;
279
+ export type Update = UpdateConnectionState | UpdateAuthorizationState | UpdateNewMessage | UpdateEditedMessage | UpdateDeletedMessages | UpdateCallbackQuery | UpdateInlineQuery | UpdateChosenInlineResult | UpdateNewChat | UpdateEditedChat | UpdateDeletedChat | UpdateMessageInteractions | UpdateMessageReactionCount | UpdateMessageReactions | UpdateChatMember | UpdateMyChatMember | UpdateDeletedStory | UpdateNewStory | UpdateBusinessConnection | UpdateVideoChat;
@@ -110,6 +110,7 @@ type FileLocation = {
110
110
  id: bigint;
111
111
  accessHash: bigint;
112
112
  };
113
+ /** @unlisted */
113
114
  export interface FileId {
114
115
  type: FileType;
115
116
  dcId: number;
@@ -4,5 +4,6 @@ export declare function mod(n: number, m: number): number;
4
4
  export declare function bigIntFromBuffer(buffer: Uint8Array, little?: boolean, signed?: boolean): bigint;
5
5
  export declare function getRandomBigInt(byteLength: number, little?: boolean, signed?: boolean): bigint;
6
6
  /** Get a random ID. Useful when calling API functions directly. */
7
+ export declare function getRandomId(number: true): number;
7
8
  export declare function getRandomId(): bigint;
8
9
  export declare function gcd(a: bigint, b: bigint): bigint;
@@ -56,9 +56,13 @@ export function getRandomBigInt(byteLength, little, signed) {
56
56
  dntShim.crypto.getRandomValues(randomBytes);
57
57
  return bigIntFromBuffer(randomBytes, little, signed);
58
58
  }
59
- /** Get a random ID. Useful when calling API functions directly. */
60
- export function getRandomId() {
61
- return getRandomBigInt(8, true, true);
59
+ export function getRandomId(number) {
60
+ if (number) {
61
+ return Number(getRandomBigInt(4, true, true));
62
+ }
63
+ else {
64
+ return getRandomBigInt(8, true, true);
65
+ }
62
66
  }
63
67
  export function gcd(a, b) {
64
68
  if (a == 0n) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mtkruto/node",
3
- "version": "0.1.500",
3
+ "version": "0.1.700",
4
4
  "description": "MTKruto for Node.js",
5
5
  "author": "Roj <rojvv@icloud.com>",
6
6
  "repository": {
@@ -20,6 +20,7 @@
20
20
  export * from "./types/_file_id.js";
21
21
  export * from "./types/_getters.js";
22
22
  export * from "./types/0_authorization_state.js";
23
+ export * from "./types/0_birthday.js";
23
24
  export * from "./types/0_bot_command.js";
24
25
  export * from "./types/0_callback_query_answer.js";
25
26
  export * from "./types/0_callback_query_question.js";
@@ -35,6 +36,7 @@ export * from "./types/0_giveaway_parameters.js";
35
36
  export * from "./types/0_id.js";
36
37
  export * from "./types/0_keyboard_button_poll_type.js";
37
38
  export * from "./types/0_link_preview.js";
39
+ export * from "./types/0_live_stream_channel.js";
38
40
  export * from "./types/0_location.js";
39
41
  export * from "./types/0_login_url.js";
40
42
  export * from "./types/0_mask_position.js";
@@ -43,6 +45,7 @@ export * from "./types/0_message_reference.js";
43
45
  export * from "./types/0_message_search_filter.js";
44
46
  export * from "./types/0_mini_app_info.js";
45
47
  export * from "./types/0_network_statistics_entry.js";
48
+ export * from "./types/0_opening_hours.js";
46
49
  export * from "./types/0_parse_mode.js";
47
50
  export * from "./types/0_poll_option.js";
48
51
  export * from "./types/0_price_tag.js";
@@ -51,6 +54,7 @@ export * from "./types/0_restriction_reason.js";
51
54
  export * from "./types/0_self_destruct_option.js";
52
55
  export * from "./types/0_story_reference.js";
53
56
  export * from "./types/0_thumbnail.js";
57
+ export * from "./types/0_video_chat.js";
54
58
  export * from "./types/0_voice.js";
55
59
  export * from "./types/1_animation.js";
56
60
  export * from "./types/1_audio.js";
@@ -96,6 +100,7 @@ export * from "./types/3_story.js";
96
100
  export * from "./types/4_inline_query_result.js";
97
101
  export * from "./types/4_message.js";
98
102
  export * from "./types/5_callback_query.js";
99
- export * from "./types/5_chat.js";
103
+ export * from "./types/5_chat_list_item.js";
104
+ export * from "./types/2_chat.js";
100
105
  export * from "./types/5_inline_query_answer.js";
101
106
  export * from "./types/6_update.js";
package/script/3_types.js CHANGED
@@ -36,6 +36,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
36
36
  __exportStar(require("./types/_file_id.js"), exports);
37
37
  __exportStar(require("./types/_getters.js"), exports);
38
38
  __exportStar(require("./types/0_authorization_state.js"), exports);
39
+ __exportStar(require("./types/0_birthday.js"), exports);
39
40
  __exportStar(require("./types/0_bot_command.js"), exports);
40
41
  __exportStar(require("./types/0_callback_query_answer.js"), exports);
41
42
  __exportStar(require("./types/0_callback_query_question.js"), exports);
@@ -51,6 +52,7 @@ __exportStar(require("./types/0_giveaway_parameters.js"), exports);
51
52
  __exportStar(require("./types/0_id.js"), exports);
52
53
  __exportStar(require("./types/0_keyboard_button_poll_type.js"), exports);
53
54
  __exportStar(require("./types/0_link_preview.js"), exports);
55
+ __exportStar(require("./types/0_live_stream_channel.js"), exports);
54
56
  __exportStar(require("./types/0_location.js"), exports);
55
57
  __exportStar(require("./types/0_login_url.js"), exports);
56
58
  __exportStar(require("./types/0_mask_position.js"), exports);
@@ -59,6 +61,7 @@ __exportStar(require("./types/0_message_reference.js"), exports);
59
61
  __exportStar(require("./types/0_message_search_filter.js"), exports);
60
62
  __exportStar(require("./types/0_mini_app_info.js"), exports);
61
63
  __exportStar(require("./types/0_network_statistics_entry.js"), exports);
64
+ __exportStar(require("./types/0_opening_hours.js"), exports);
62
65
  __exportStar(require("./types/0_parse_mode.js"), exports);
63
66
  __exportStar(require("./types/0_poll_option.js"), exports);
64
67
  __exportStar(require("./types/0_price_tag.js"), exports);
@@ -67,6 +70,7 @@ __exportStar(require("./types/0_restriction_reason.js"), exports);
67
70
  __exportStar(require("./types/0_self_destruct_option.js"), exports);
68
71
  __exportStar(require("./types/0_story_reference.js"), exports);
69
72
  __exportStar(require("./types/0_thumbnail.js"), exports);
73
+ __exportStar(require("./types/0_video_chat.js"), exports);
70
74
  __exportStar(require("./types/0_voice.js"), exports);
71
75
  __exportStar(require("./types/1_animation.js"), exports);
72
76
  __exportStar(require("./types/1_audio.js"), exports);
@@ -112,6 +116,7 @@ __exportStar(require("./types/3_story.js"), exports);
112
116
  __exportStar(require("./types/4_inline_query_result.js"), exports);
113
117
  __exportStar(require("./types/4_message.js"), exports);
114
118
  __exportStar(require("./types/5_callback_query.js"), exports);
115
- __exportStar(require("./types/5_chat.js"), exports);
119
+ __exportStar(require("./types/5_chat_list_item.js"), exports);
120
+ __exportStar(require("./types/2_chat.js"), exports);
116
121
  __exportStar(require("./types/5_inline_query_answer.js"), exports);
117
122
  __exportStar(require("./types/6_update.js"), exports);
@@ -96,10 +96,8 @@ function upgradeInstance(error, call) {
96
96
  return new v({ ...error, call });
97
97
  }
98
98
  }
99
- for (const [k, v] of Object.entries(_3_errors_js_1.map)) {
100
- if (error.error_message == k) {
101
- return new v({ ...error, call });
102
- }
99
+ if (error.error_message in _3_errors_js_1.map) {
100
+ return new _3_errors_js_1.map[error.error_message]({ ...error, call });
103
101
  }
104
102
  return error;
105
103
  }
@@ -20,4 +20,4 @@
20
20
  export * from "./client/0_params.js";
21
21
  export * from "./client/1_client_encrypted.js";
22
22
  export * from "./client/1_client_plain.js";
23
- export * from "./client/4_client.js";
23
+ export * from "./client/5_client.js";
@@ -36,4 +36,4 @@ Object.defineProperty(exports, "__esModule", { value: true });
36
36
  __exportStar(require("./client/0_params.js"), exports);
37
37
  __exportStar(require("./client/1_client_encrypted.js"), exports);
38
38
  __exportStar(require("./client/1_client_plain.js"), exports);
39
- __exportStar(require("./client/4_client.js"), exports);
39
+ __exportStar(require("./client/5_client.js"), exports);
@@ -18,7 +18,7 @@
18
18
  * along with this program. If not, see <https://www.gnu.org/licenses/>.
19
19
  */
20
20
  import { MaybePromise } from "../1_utilities.js";
21
- import { BotCommandScope, Chat, ChatMemberRights, FileSource, ID, InlineQueryResultButton, LinkPreview, Message, MessageEntity, MessageSearchFilter, ParseMode, ReplyMarkup, ReplyQuote, SelfDestructOption, StoryInteractiveArea, StoryPrivacy } from "../3_types.js";
21
+ import { BotCommandScope, ChatListItem, ChatMemberRights, FileSource, ID, InlineQueryResultButton, LinkPreview, Message, MessageEntity, MessageSearchFilter, ParseMode, ReplyMarkup, ReplyQuote, SelfDestructOption, StoryInteractiveArea, StoryPrivacy } from "../3_types.js";
22
22
  export interface AnswerCallbackQueryParams {
23
23
  /** A text to be shown to the user. */
24
24
  text?: string;
@@ -29,11 +29,15 @@ export interface AnswerCallbackQueryParams {
29
29
  /** TTL of answer caches in seconds. */
30
30
  cacheTime?: number;
31
31
  }
32
- export interface AuthorizeUserParams<S = string> {
32
+ export interface SignInParamsUser<S = string> {
33
33
  phone: S | (() => MaybePromise<S>);
34
34
  code: S | (() => MaybePromise<S>);
35
35
  password: S | ((hint: string | null) => MaybePromise<S>);
36
36
  }
37
+ export interface SignInParamsBot {
38
+ botToken: string;
39
+ }
40
+ export type SignInParams = SignInParamsUser | SignInParamsBot;
37
41
  export interface _BusinessConnectionIdCommon {
38
42
  businessConnectionId?: string;
39
43
  }
@@ -48,7 +52,7 @@ export interface _SendCommon extends _BusinessConnectionIdCommon {
48
52
  replyQuote?: ReplyQuote;
49
53
  /** The identifier of a thread to send the message to. */
50
54
  messageThreadId?: number;
51
- /** The identifier of the chat to send the message on behalf of. User-only. */
55
+ /** The identifier of a chat to send the message on behalf of. User-only. */
52
56
  sendAs?: ID;
53
57
  /** The reply markup of the message. Bot-only. */
54
58
  replyMarkup?: ReplyMarkup;
@@ -276,7 +280,7 @@ export interface GetChatsParams {
276
280
  /** The chat list to get the chats from. Defaults to main. */
277
281
  from?: "main" | "archived";
278
282
  /** The last chat to get chats after. */
279
- after?: Chat;
283
+ after?: ChatListItem;
280
284
  /** The maximum number of results to return. Must be in the range of 1-100. Defaults to 100. */
281
285
  limit?: number;
282
286
  }
@@ -287,7 +291,7 @@ export interface PinMessageParams {
287
291
  disableNotification?: boolean;
288
292
  }
289
293
  export interface BanChatMemberParams {
290
- /** A point of time in the future to automatically withdraw the ban. */
294
+ /** A point in time within the future in which the ban will be reverted. */
291
295
  untilDate?: Date;
292
296
  /** Whether to delete all of the user's messages. */
293
297
  deleteMessages?: boolean;
@@ -295,7 +299,7 @@ export interface BanChatMemberParams {
295
299
  export interface SetChatMemberRightsParams {
296
300
  /** The member's new rights. All fields default to `true` if the chat's default member rights allow. This means that this method is the same as unbanChatMember if this parameter is not provided or all of its fields are `true`. */
297
301
  rights?: ChatMemberRights;
298
- /** A point of time in the future to automatically withdraw the restrictions. */
302
+ /** A point in time within the future in which the restriction will be reverted. */
299
303
  untilDate?: Date;
300
304
  }
301
305
  export interface CreateStoryParams extends _CaptionCommon, _UploadCommon {
@@ -325,7 +329,7 @@ export interface SearchMessagesParams {
325
329
  export interface CreateInviteLinkParams {
326
330
  /** An optional title to be attached to the link that can only be seen by admins. */
327
331
  title?: string;
328
- /** The point of time in which the invite link must no longer work. */
332
+ /** A point in time within the future in which the invite link will be invalidated. */
329
333
  expireAt?: Date;
330
334
  /** The times the invite link can be used. Cannot be specified while `requireApproval` is `true`. */
331
335
  limit?: number;
@@ -359,3 +363,25 @@ export interface SendInlineQueryParams {
359
363
  query?: string;
360
364
  offset?: string;
361
365
  }
366
+ export interface StartVideoChatParams {
367
+ /** The video chat's title. */
368
+ title?: string;
369
+ /** Whether this is going to be a live stream. */
370
+ liveStream?: boolean;
371
+ }
372
+ export interface ScheduleVideoChatParams extends StartVideoChatParams {
373
+ }
374
+ export interface JoinVideoChatParams {
375
+ /** The identifier of a chat to join the video chat on behalf of. */
376
+ joinAs?: ID;
377
+ /** Invite hash. */
378
+ inviteHash?: string;
379
+ /** Whether to enable audio. Enabled by default. */
380
+ audio?: boolean;
381
+ /** Whether to enable video. Enabled by default. */
382
+ video?: boolean;
383
+ }
384
+ export interface DownloadLiveStreamChunkParams {
385
+ /** Video quality. */
386
+ quality?: "low" | "medium" | "high";
387
+ }
@@ -0,0 +1,182 @@
1
+ /**
2
+ * MTKruto - Cross-runtime JavaScript library for building Telegram clients
3
+ * Copyright (C) 2023-2024 Roj <https://roj.im/>
4
+ *
5
+ * This file is part of MTKruto.
6
+ *
7
+ * This program is free software: you can redistribute it and/or modify
8
+ * it under the terms of the GNU Lesser General Public License as published by
9
+ * the Free Software Foundation, either version 3 of the License, or
10
+ * (at your option) any later version.
11
+ *
12
+ * This program is distributed in the hope that it will be useful,
13
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ * GNU Lesser General Public License for more details.
16
+ *
17
+ * You should have received a copy of the GNU Lesser General Public License
18
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
19
+ */
20
+ import { MaybePromise } from "../1_utilities.js";
21
+ import { AnyEntity, enums, ReadObject, TLObject, types } from "../2_tl.js";
22
+ import { DC } from "../3_transport.js";
23
+ import { Storage, StorageKeyPart } from "../2_storage.js";
24
+ export declare const K: {
25
+ connection: {
26
+ P: (string: string) => string;
27
+ apiId: () => StorageKeyPart[];
28
+ };
29
+ session: {
30
+ P: (string: string) => string;
31
+ serverSalt: () => StorageKeyPart[];
32
+ };
33
+ auth: {
34
+ P: (string: string) => string;
35
+ dc: () => StorageKeyPart[];
36
+ key: () => StorageKeyPart[];
37
+ accountId: () => StorageKeyPart[];
38
+ accountType: () => StorageKeyPart[];
39
+ };
40
+ updates: {
41
+ P: (string: string) => string;
42
+ state: () => StorageKeyPart[];
43
+ all: () => StorageKeyPart[];
44
+ updates: (boxId: bigint) => StorageKeyPart[];
45
+ update: (boxId: bigint, id: bigint) => StorageKeyPart[];
46
+ channelPts: (channelId: bigint) => StorageKeyPart[];
47
+ };
48
+ cache: {
49
+ P: (string: string) => string;
50
+ usernames: () => StorageKeyPart[];
51
+ username: (v: string) => StorageKeyPart[];
52
+ peers: () => StorageKeyPart[];
53
+ peer: (id: number) => StorageKeyPart[];
54
+ stickerSetNames: () => StorageKeyPart[];
55
+ stickerSetName: (id: bigint, accessHash: bigint) => StorageKeyPart[];
56
+ files: () => StorageKeyPart[];
57
+ file: (fileId: bigint) => StorageKeyPart[];
58
+ fileParts: () => StorageKeyPart[];
59
+ filePart: (fileId: bigint, n: number) => StorageKeyPart[];
60
+ customEmojiDocuments: () => StorageKeyPart[];
61
+ customEmojiDocument: (id: bigint) => StorageKeyPart[];
62
+ businessConnections: () => StorageKeyPart[];
63
+ businessConnection: (id: string) => StorageKeyPart[];
64
+ inlineQueryAnswers: () => StorageKeyPart[];
65
+ inlineQueryAnswer: (userId: number, chatId: number, query: string, offset: string) => StorageKeyPart[];
66
+ callbackQueryAnswers: () => StorageKeyPart[];
67
+ callbackQueryAnswer: (chatId: number, messageId: number, question: string) => StorageKeyPart[];
68
+ fullChats: () => StorageKeyPart[];
69
+ fullChat: (chatId: number) => StorageKeyPart[];
70
+ groupCalls: () => StorageKeyPart[];
71
+ groupCall: (id: bigint) => StorageKeyPart[];
72
+ groupCallAccessHashes: () => StorageKeyPart[];
73
+ groupCallAccessHash: (id: bigint) => StorageKeyPart[];
74
+ };
75
+ messages: {
76
+ P: (string: string) => string;
77
+ messages: (chatId: number) => StorageKeyPart[];
78
+ message: (chatId: number, messageId: number) => StorageKeyPart[];
79
+ allMessageRefs: () => StorageKeyPart[];
80
+ messageRef: (messageId: number) => StorageKeyPart[];
81
+ };
82
+ chatlists: {
83
+ P: (string: string) => string;
84
+ hasAllChats: (listId: number) => StorageKeyPart[];
85
+ chats: (listId: number) => StorageKeyPart[];
86
+ chat: (listId: number, chatId: number) => StorageKeyPart[];
87
+ pinnedChats: (listId: number) => StorageKeyPart[];
88
+ };
89
+ };
90
+ export declare class StorageOperations {
91
+ #private;
92
+ constructor(storage: Storage);
93
+ get provider(): Storage;
94
+ get supportsFiles(): boolean;
95
+ initialize(): Promise<void>;
96
+ set(...args: Parameters<Storage["set"]>): ReturnType<Storage["set"]>;
97
+ incr(...args: Parameters<Storage["incr"]>): ReturnType<Storage["incr"]>;
98
+ get<T>(...args: Parameters<Storage["get"]>): ReturnType<Storage["get"]>;
99
+ getMany<T>(...args: Parameters<Storage["getMany"]>): ReturnType<Storage["getMany"]>;
100
+ setDc(dc: DC | null): Promise<void>;
101
+ getDc(): MaybePromise<DC | null>;
102
+ getAuthKey(): Promise<Uint8Array | null>;
103
+ setAuthKey(authKey: Uint8Array | null): Promise<void>;
104
+ get authKeyId(): bigint | null;
105
+ exportAuthString(apiId_?: number | null): Promise<string>;
106
+ importAuthString(string: string): Promise<void>;
107
+ getChannelAccessHash(id: number): Promise<bigint | null>;
108
+ getUserAccessHash(id: number): Promise<bigint | null>;
109
+ updateUsernames(id: number, usernames: string[]): Promise<void>;
110
+ getUsername(username: string): Promise<[number, Date] | null>;
111
+ setTlObject(key: readonly StorageKeyPart[], value: TLObject | null): Promise<void>;
112
+ getTlObject(keyOrBuffer: TLObject | Uint8Array | readonly StorageKeyPart[]): Promise<ReadObject | null>;
113
+ setState(state: enums.updates.State): Promise<void>;
114
+ getState(): Promise<enums.updates.State | null>;
115
+ setMessage(chatId: number, messageId: number, message: enums.Message | null): Promise<void>;
116
+ deleteMessages(): Promise<void>;
117
+ getMessageChat(messageId: number): MaybePromise<number | null>;
118
+ getMessage(chatId: number, messageId: number): Promise<enums.Message | null>;
119
+ getLastMessage(chatId: number): Promise<enums.Message | null>;
120
+ setChannelPts(channelId: bigint, pts: number): Promise<void>;
121
+ getChannelPts(channelId: bigint): MaybePromise<number | null>;
122
+ setEntity(entity: AnyEntity): Promise<void>;
123
+ getEntity(key: number): Promise<ReadObject | null>;
124
+ setAccountId(accountId: number): Promise<void>;
125
+ getAccountId(): Promise<number | null>;
126
+ setAccountType(type: "user" | "bot"): Promise<void>;
127
+ getAccountType(): Promise<"user" | "bot" | null>;
128
+ updateStickerSetName(id: bigint, accessHash: bigint, name: string): Promise<void>;
129
+ getStickerSetName(id: bigint, accessHash: bigint): MaybePromise<[string, Date] | null>;
130
+ setServerSalt(serverSalt: bigint): Promise<void>;
131
+ getServerSalt(): MaybePromise<bigint | null>;
132
+ setChat(listId: number, chatId: number, pinned: number, topMessageId: number, topMessageDate: Date): Promise<void>;
133
+ getChats(listId: number): Promise<{
134
+ chatId: number;
135
+ pinned: number;
136
+ topMessageId: number;
137
+ topMessageDate: Date;
138
+ }[]>;
139
+ removeChats(listId: number): Promise<void>;
140
+ setHasAllChats(listId: number, hasAllChats: boolean): Promise<void>;
141
+ hasAllChats(listId: number): Promise<boolean>;
142
+ setPinnedChats(listId: number, chatIds: number[] | null): Promise<void>;
143
+ getPinnedChats(listId: number): Promise<number[] | null>;
144
+ getHistory(chatId: number, offsetId: number, limit: number): Promise<enums.Message[]>;
145
+ getFile(id: bigint): Promise<[number, number] | null>;
146
+ iterFileParts(id: bigint, partCount: number, offset: number): AsyncGenerator<Uint8Array>;
147
+ saveFilePart(id: bigint, index: number, bytes: Uint8Array): Promise<void>;
148
+ setFilePartCount(id: bigint, partCount: number, chunkSize: number): Promise<void>;
149
+ setCustomEmojiDocument(id: bigint, document: types.Document): Promise<void>;
150
+ getCustomEmojiDocument(id: bigint): Promise<[types.Document, Date] | null>;
151
+ setBusinessConnection(id: string, connection: types.BotBusinessConnection | null): Promise<void>;
152
+ getBusinessConnection(id: string): Promise<types.BotBusinessConnection | null>;
153
+ setInlineQueryAnswer(userId: number, chatId: number, query: string, offset: string, results: types.messages.BotResults, date: Date): Promise<void>;
154
+ getInlineQueryAnswer(userId: number, chatId: number, query: string, offset: string): Promise<[types.messages.BotResults, Date] | null>;
155
+ setCallbackQueryAnswer(chatId: number, messageId: number, question: string, answer: types.messages.BotCallbackAnswer): Promise<void>;
156
+ getCallbackQueryAnswer(chatId: number, messageId: number, question: string): Promise<[types.messages.BotCallbackAnswer, Date] | null>;
157
+ setFullChat(chatId: number, fullChat: types.UserFull | types.ChannelFull | types.ChatFull | null): Promise<void>;
158
+ getFullChat(chatId: number): Promise<types.UserFull | types.ChannelFull | types.ChatFull | null>;
159
+ setGroupCall(id: bigint, groupCall: types.GroupCall | null): Promise<void>;
160
+ getGroupCall(id: bigint): Promise<types.GroupCall | null>;
161
+ setGroupCallAccessHash(id: bigint, accessHash: bigint | null): Promise<void>;
162
+ getGroupCallAccessHash(id: bigint): Promise<bigint | null>;
163
+ setUpdate(boxId: bigint, update: enums.Update): Promise<void>;
164
+ deleteUpdates(): Promise<void>;
165
+ getFirstUpdate(boxId: bigint): Promise<[readonly StorageKeyPart[], enums.Update] | null>;
166
+ assertUser(source: string): Promise<void>;
167
+ assertBot(source: string): Promise<void>;
168
+ deleteFiles(): Promise<void>;
169
+ deleteCustomEmojiDocuments(): Promise<void>;
170
+ deleteBusinessConnections(): Promise<void>;
171
+ deleteInlineQueryAnswers(): Promise<void>;
172
+ deleteCallbackQueryAnswers(): Promise<void>;
173
+ deleteFullChats(): Promise<void>;
174
+ deleteGroupCalls(): Promise<void>;
175
+ deleteStickerSetNames(): Promise<void>;
176
+ deletePeers(): Promise<void>;
177
+ deleteUsernames(): Promise<void>;
178
+ clear(): Promise<void>;
179
+ setApiId(apiId: number): Promise<void>;
180
+ getApiId(): Promise<number | null>;
181
+ reset(): Promise<void>;
182
+ }