@mtkruto/node 0.0.991 → 0.0.992

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 (254) hide show
  1. package/esm/1_utilities.d.ts +12 -0
  2. package/esm/1_utilities.js +12 -0
  3. package/esm/2_connection.d.ts +2 -0
  4. package/esm/2_connection.js +2 -0
  5. package/esm/2_tl.d.ts +10 -0
  6. package/esm/2_tl.js +10 -0
  7. package/esm/3_storage.d.ts +6 -0
  8. package/esm/3_storage.js +6 -0
  9. package/esm/3_transport.d.ts +4 -0
  10. package/esm/3_transport.js +4 -0
  11. package/esm/3_types.d.ts +35 -0
  12. package/esm/3_types.js +35 -0
  13. package/esm/{constants.d.ts → 4_constants.d.ts} +2 -2
  14. package/esm/{constants.js → 4_constants.js} +1 -1
  15. package/esm/5_client.d.ts +2 -0
  16. package/esm/5_client.js +2 -0
  17. package/esm/client/0_html.d.ts +1 -1
  18. package/esm/client/0_html.js +1 -1
  19. package/esm/client/0_message.d.ts +1 -2
  20. package/esm/client/0_message.js +7 -14
  21. package/esm/client/0_password.d.ts +2 -2
  22. package/esm/client/0_password.js +2 -4
  23. package/esm/client/0_utilities.d.ts +3 -5
  24. package/esm/client/0_utilities.js +3 -22
  25. package/esm/client/1_client_abstract.d.ts +2 -2
  26. package/esm/client/1_client_abstract.js +3 -3
  27. package/esm/client/2_client_plain.d.ts +3 -3
  28. package/esm/client/2_client_plain.js +13 -20
  29. package/esm/client/3_client.d.ts +33 -18
  30. package/esm/client/3_client.js +47 -35
  31. package/esm/connection/0_connection.d.ts +1 -1
  32. package/esm/connection/1_connection_web_socket.js +1 -1
  33. package/esm/mod.d.ts +7 -21
  34. package/esm/mod.js +7 -21
  35. package/esm/storage/0_storage.d.ts +4 -5
  36. package/esm/storage/0_storage.js +3 -8
  37. package/esm/storage/0_utilities.js +2 -2
  38. package/esm/storage/1_storage_local_storage.d.ts +1 -1
  39. package/esm/storage/1_storage_memory.d.ts +1 -1
  40. package/esm/storage/1_storage_session_storage.d.ts +1 -1
  41. package/esm/tl/0_tl_raw_reader.js +1 -1
  42. package/esm/tl/0_tl_raw_writer.js +1 -1
  43. package/esm/tl/1_tl_object.js +1 -1
  44. package/esm/tl/3_deserialize.js +1 -1
  45. package/esm/tl/3_utilities.d.ts +3 -0
  46. package/esm/tl/3_utilities.js +20 -0
  47. package/esm/tl/4_tl_writer.js +1 -1
  48. package/esm/transport/0_obfuscation.d.ts +2 -2
  49. package/esm/transport/0_obfuscation.js +1 -2
  50. package/esm/transport/0_transport.d.ts +1 -2
  51. package/esm/transport/1_transport_abridged.d.ts +1 -1
  52. package/esm/transport/1_transport_abridged.js +1 -1
  53. package/esm/transport/1_transport_intermediate.d.ts +1 -1
  54. package/esm/transport/1_transport_intermediate.js +1 -1
  55. package/esm/transport/2_transport_provider.d.ts +1 -1
  56. package/esm/transport/2_transport_provider.js +1 -1
  57. package/esm/types/!0_file_id.js +6 -9
  58. package/esm/types/!0_misc.d.ts +7 -0
  59. package/esm/types/!0_misc.js +1 -0
  60. package/esm/types/0_audio.d.ts +3 -3
  61. package/esm/types/0_audio.js +1 -1
  62. package/esm/types/0_chat_administrator_rights.d.ts +1 -1
  63. package/esm/types/0_chat_administrator_rights.js +1 -1
  64. package/esm/types/0_chat_photo.d.ts +3 -3
  65. package/esm/types/0_chat_photo.js +1 -1
  66. package/esm/types/0_color.d.ts +2 -0
  67. package/esm/types/0_color.js +16 -0
  68. package/esm/types/0_contact.d.ts +2 -2
  69. package/esm/types/0_dice.d.ts +1 -1
  70. package/esm/types/0_force_reply.d.ts +1 -1
  71. package/esm/types/0_force_reply.js +1 -1
  72. package/esm/types/0_location.d.ts +1 -1
  73. package/esm/types/0_location.js +1 -2
  74. package/esm/types/0_mask_position.d.ts +1 -1
  75. package/esm/types/0_message_entity.d.ts +5 -5
  76. package/esm/types/0_message_entity.js +1 -1
  77. package/esm/types/0_poll_option.d.ts +1 -1
  78. package/esm/types/0_reply_keyboard_remove.d.ts +1 -1
  79. package/esm/types/0_reply_keyboard_remove.js +2 -2
  80. package/esm/types/0_thumbnail.d.ts +2 -2
  81. package/esm/types/0_thumbnail.js +1 -1
  82. package/esm/types/0_venue.d.ts +1 -1
  83. package/esm/types/0_venue.js +1 -2
  84. package/esm/types/0_voice.d.ts +3 -3
  85. package/esm/types/0_web_app_info.d.ts +2 -2
  86. package/esm/types/1_animation.d.ts +3 -3
  87. package/esm/types/1_animation.js +1 -1
  88. package/esm/types/1_chat.d.ts +5 -4
  89. package/esm/types/1_chat.js +8 -9
  90. package/esm/types/1_document.d.ts +4 -4
  91. package/esm/types/1_document.js +1 -1
  92. package/esm/types/1_inline_keyboard_button.d.ts +4 -4
  93. package/esm/types/1_inline_keyboard_button.js +2 -2
  94. package/esm/types/1_keyboard_button.d.ts +8 -8
  95. package/esm/types/1_keyboard_button.js +2 -2
  96. package/esm/types/1_photo.d.ts +2 -2
  97. package/esm/types/1_photo.js +1 -1
  98. package/esm/types/1_poll.d.ts +8 -8
  99. package/esm/types/1_poll.js +1 -1
  100. package/esm/types/1_sticker.d.ts +3 -3
  101. package/esm/types/1_sticker.js +1 -2
  102. package/esm/types/1_user.d.ts +4 -3
  103. package/esm/types/1_user.js +4 -4
  104. package/esm/types/1_video.d.ts +3 -3
  105. package/esm/types/1_video.js +1 -1
  106. package/esm/types/1_video_note.d.ts +2 -2
  107. package/esm/types/1_video_note.js +1 -1
  108. package/esm/types/2_game.d.ts +3 -3
  109. package/esm/types/2_game.js +2 -3
  110. package/esm/types/2_inline_keyboard_markup.d.ts +2 -2
  111. package/esm/types/2_inline_keyboard_markup.js +1 -1
  112. package/esm/types/2_inline_query.d.ts +19 -0
  113. package/esm/types/2_inline_query.js +41 -0
  114. package/esm/types/2_reply_keyboard_markup.d.ts +2 -2
  115. package/esm/types/2_reply_keyboard_markup.js +1 -1
  116. package/esm/types/3_message.d.ts +21 -23
  117. package/esm/types/3_message.js +16 -18
  118. package/esm/types/4_callback_query.d.ts +14 -0
  119. package/esm/types/4_callback_query.js +24 -0
  120. package/esm/utilities/0_base64.js +1 -1
  121. package/esm/utilities/0_crypto.js +1 -1
  122. package/esm/utilities/0_queue.js +1 -1
  123. package/esm/utilities/1_auth.js +1 -1
  124. package/package.json +1 -1
  125. package/script/1_utilities.d.ts +12 -0
  126. package/script/1_utilities.js +28 -0
  127. package/script/2_connection.d.ts +2 -0
  128. package/script/2_connection.js +18 -0
  129. package/script/2_tl.d.ts +10 -0
  130. package/script/2_tl.js +40 -0
  131. package/script/3_storage.d.ts +6 -0
  132. package/script/3_storage.js +22 -0
  133. package/script/3_transport.d.ts +4 -0
  134. package/script/3_transport.js +20 -0
  135. package/script/3_types.d.ts +35 -0
  136. package/script/3_types.js +51 -0
  137. package/script/{constants.d.ts → 4_constants.d.ts} +2 -2
  138. package/script/{constants.js → 4_constants.js} +1 -1
  139. package/script/5_client.d.ts +2 -0
  140. package/script/5_client.js +18 -0
  141. package/script/client/0_html.d.ts +1 -1
  142. package/script/client/0_html.js +2 -2
  143. package/script/client/0_message.d.ts +1 -2
  144. package/script/client/0_message.js +32 -39
  145. package/script/client/0_password.d.ts +2 -2
  146. package/script/client/0_password.js +20 -22
  147. package/script/client/0_utilities.d.ts +3 -5
  148. package/script/client/0_utilities.js +24 -68
  149. package/script/client/1_client_abstract.d.ts +2 -2
  150. package/script/client/1_client_abstract.js +6 -6
  151. package/script/client/2_client_plain.d.ts +3 -3
  152. package/script/client/2_client_plain.js +45 -52
  153. package/script/client/3_client.d.ts +33 -18
  154. package/script/client/3_client.js +291 -303
  155. package/script/connection/0_connection.d.ts +1 -1
  156. package/script/connection/1_connection_web_socket.js +5 -5
  157. package/script/mod.d.ts +7 -21
  158. package/script/mod.js +17 -45
  159. package/script/storage/0_storage.d.ts +4 -5
  160. package/script/storage/0_storage.js +11 -39
  161. package/script/storage/0_utilities.js +6 -6
  162. package/script/storage/1_storage_local_storage.d.ts +1 -1
  163. package/script/storage/1_storage_memory.d.ts +1 -1
  164. package/script/storage/1_storage_session_storage.d.ts +1 -1
  165. package/script/tl/0_tl_raw_reader.js +6 -6
  166. package/script/tl/0_tl_raw_writer.js +7 -7
  167. package/script/tl/1_tl_object.js +3 -3
  168. package/script/tl/3_deserialize.js +2 -2
  169. package/script/tl/3_utilities.d.ts +3 -0
  170. package/script/tl/3_utilities.js +48 -0
  171. package/script/tl/4_tl_writer.js +2 -2
  172. package/script/transport/0_obfuscation.d.ts +2 -2
  173. package/script/transport/0_obfuscation.js +5 -6
  174. package/script/transport/0_transport.d.ts +1 -2
  175. package/script/transport/1_transport_abridged.d.ts +1 -1
  176. package/script/transport/1_transport_abridged.js +3 -3
  177. package/script/transport/1_transport_intermediate.d.ts +1 -1
  178. package/script/transport/1_transport_intermediate.js +3 -3
  179. package/script/transport/2_transport_provider.d.ts +1 -1
  180. package/script/transport/2_transport_provider.js +2 -2
  181. package/script/types/!0_file_id.js +24 -27
  182. package/script/types/!0_misc.d.ts +7 -0
  183. package/script/types/!0_misc.js +2 -0
  184. package/script/types/0_audio.d.ts +3 -3
  185. package/script/types/0_audio.js +2 -25
  186. package/script/types/0_chat_administrator_rights.d.ts +1 -1
  187. package/script/types/0_chat_administrator_rights.js +2 -25
  188. package/script/types/0_chat_photo.d.ts +3 -3
  189. package/script/types/0_chat_photo.js +2 -25
  190. package/script/types/0_color.d.ts +2 -0
  191. package/script/types/{!0_id_color.js → 0_color.js} +10 -10
  192. package/script/types/0_contact.d.ts +2 -2
  193. package/script/types/0_dice.d.ts +1 -1
  194. package/script/types/0_force_reply.d.ts +1 -1
  195. package/script/types/0_force_reply.js +2 -25
  196. package/script/types/0_location.d.ts +1 -1
  197. package/script/types/0_location.js +5 -29
  198. package/script/types/0_mask_position.d.ts +1 -1
  199. package/script/types/0_message_entity.d.ts +5 -5
  200. package/script/types/0_message_entity.js +39 -62
  201. package/script/types/0_poll_option.d.ts +1 -1
  202. package/script/types/0_reply_keyboard_remove.d.ts +1 -1
  203. package/script/types/0_reply_keyboard_remove.js +4 -27
  204. package/script/types/0_thumbnail.d.ts +2 -2
  205. package/script/types/0_thumbnail.js +2 -25
  206. package/script/types/0_venue.d.ts +1 -1
  207. package/script/types/0_venue.js +2 -26
  208. package/script/types/0_voice.d.ts +3 -3
  209. package/script/types/0_web_app_info.d.ts +2 -2
  210. package/script/types/1_animation.d.ts +3 -3
  211. package/script/types/1_animation.js +2 -25
  212. package/script/types/1_chat.d.ts +5 -4
  213. package/script/types/1_chat.js +20 -44
  214. package/script/types/1_document.d.ts +4 -4
  215. package/script/types/1_document.js +2 -25
  216. package/script/types/1_inline_keyboard_button.d.ts +4 -4
  217. package/script/types/1_inline_keyboard_button.js +19 -42
  218. package/script/types/1_keyboard_button.d.ts +8 -8
  219. package/script/types/1_keyboard_button.js +24 -47
  220. package/script/types/1_photo.d.ts +2 -2
  221. package/script/types/1_photo.js +4 -27
  222. package/script/types/1_poll.d.ts +8 -8
  223. package/script/types/1_poll.js +2 -2
  224. package/script/types/1_sticker.d.ts +3 -3
  225. package/script/types/1_sticker.js +6 -30
  226. package/script/types/1_user.d.ts +4 -3
  227. package/script/types/1_user.js +6 -29
  228. package/script/types/1_video.d.ts +3 -3
  229. package/script/types/1_video.js +2 -25
  230. package/script/types/1_video_note.d.ts +2 -2
  231. package/script/types/1_video_note.js +2 -25
  232. package/script/types/2_game.d.ts +3 -3
  233. package/script/types/2_game.js +6 -30
  234. package/script/types/2_inline_keyboard_markup.d.ts +2 -2
  235. package/script/types/2_inline_keyboard_markup.js +3 -26
  236. package/script/types/2_inline_query.d.ts +19 -0
  237. package/script/types/2_inline_query.js +45 -0
  238. package/script/types/2_reply_keyboard_markup.d.ts +2 -2
  239. package/script/types/2_reply_keyboard_markup.js +3 -26
  240. package/script/types/3_message.d.ts +21 -23
  241. package/script/types/3_message.js +94 -119
  242. package/script/types/4_callback_query.d.ts +14 -0
  243. package/script/types/4_callback_query.js +28 -0
  244. package/script/utilities/0_base64.js +3 -3
  245. package/script/utilities/0_crypto.js +3 -3
  246. package/script/utilities/0_queue.js +2 -2
  247. package/script/utilities/1_auth.js +5 -5
  248. package/esm/types/!0_id_color.d.ts +0 -1
  249. package/esm/types/!0_id_color.js +0 -16
  250. package/script/types/!0_id_color.d.ts +0 -1
  251. /package/esm/{deps.d.ts → 0_deps.d.ts} +0 -0
  252. /package/esm/{deps.js → 0_deps.js} +0 -0
  253. /package/script/{deps.d.ts → 0_deps.d.ts} +0 -0
  254. /package/script/{deps.js → 0_deps.js} +0 -0
@@ -1,20 +1,15 @@
1
- import { MaybePromise } from "../utilities/0_types.js";
2
- import { DC } from "../transport/2_transport_provider.js";
3
- import * as types from "../tl/2_types.js";
4
- import { ReadObject } from "../tl/3_tl_reader.js";
5
- import * as functions from "../tl/3_functions.js";
6
- import { ReplyKeyboardRemove } from "../types/0_reply_keyboard_remove.js";
7
- import { MessageEntity } from "../types/0_message_entity.js";
8
- import { ForceReply } from "../types/0_force_reply.js";
9
- import { InlineKeyboardMarkup } from "../types/2_inline_keyboard_markup.js";
10
- import { ReplyKeyboardMarkup } from "../types/2_reply_keyboard_markup.js";
11
- import { Message } from "../types/3_message.js";
12
- import { Storage } from "../storage/0_storage.js";
1
+ import { MaybePromise } from "../1_utilities.js";
2
+ import { functions, ReadObject, types } from "../2_tl.js";
3
+ import { Storage } from "../3_storage.js";
4
+ import { DC } from "../3_transport.js";
5
+ import { CallbackQuery, ForceReply, InlineKeyboardMarkup, InlineQuery, Message, // high-level Telegram API message
6
+ MessageEntity, ReplyKeyboardMarkup, ReplyKeyboardRemove } from "../3_types.js";
13
7
  import { ClientPlainParams } from "./2_client_plain.js";
14
8
  import { ClientAbstract } from "./1_client_abstract.js";
15
9
  export declare const getEntity: unique symbol;
16
10
  export declare const getStickerSetName: unique symbol;
17
11
  export declare const handleMigrationError: unique symbol;
12
+ export declare const getMessageWithReply: unique symbol;
18
13
  export declare const restartAuth: unique symbol;
19
14
  export declare enum ParseMode {
20
15
  None = "none",
@@ -59,6 +54,16 @@ export interface ClientParams extends ClientPlainParams {
59
54
  */
60
55
  autoStart?: boolean;
61
56
  }
57
+ export interface AnswerCallbackQueryParams {
58
+ /** Text of the answer */
59
+ text?: string;
60
+ /** Pass true to show an alert to the user instead of a toast notification */
61
+ alert?: boolean;
62
+ /** URL to be opened */
63
+ url?: string;
64
+ /** Time during which the result of the query can be cached, in seconds */
65
+ cacheTime?: number;
66
+ }
62
67
  /**
63
68
  * A chat identifier as provided by MTKruto or a string starting with a @ that is followed by a username.
64
69
  */
@@ -93,11 +98,11 @@ export interface SendMessagesParams {
93
98
  */
94
99
  messageThreadId?: number;
95
100
  /**
96
- * The identifier of the chat to send the message on behalf of.
101
+ * The identifier of the chat to send the message on behalf of. User-only.
97
102
  */
98
103
  sendAs?: ChatID;
99
104
  /**
100
- * The reply markup of the message.
105
+ * The reply markup of the message. Bot-only.
101
106
  */
102
107
  replyMarkup?: InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply;
103
108
  }
@@ -115,7 +120,7 @@ export interface EditMessageParams {
115
120
  */
116
121
  disableWebPagePreview?: boolean;
117
122
  /**
118
- * The reply markup of the message.
123
+ * The reply markup of the message. Bot-only.
119
124
  */
120
125
  replyMarkup?: InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply;
121
126
  }
@@ -130,7 +135,7 @@ export interface ForwardMessagesParams {
130
135
  */
131
136
  protectContent?: boolean;
132
137
  /**
133
- * The identifier of the chat to forward the message on behalf of.
138
+ * The identifier of the chat to forward the message on behalf of. User-only.
134
139
  */
135
140
  sendAs?: ChatID;
136
141
  /**
@@ -269,6 +274,7 @@ export declare class Client extends ClientAbstract {
269
274
  * @param text The new text of the message.
270
275
  */
271
276
  editMessageText(chatId: ChatID, messageId: number, text: string, params?: EditMessageParams): Promise<void>;
277
+ private getMessagesInner;
272
278
  /**
273
279
  * Retrieve multiple messages.
274
280
  *
@@ -276,6 +282,7 @@ export declare class Client extends ClientAbstract {
276
282
  * @param messageIds The identifiers of the messages to retrieve.
277
283
  */
278
284
  getMessages(chatId_: ChatID, messageIds: number[]): Promise<Omit<Message, "replyToMessage">[]>;
285
+ [getMessageWithReply](chatId: ChatID, messageId: number): Promise<Message | null>;
279
286
  /**
280
287
  * Retrieve a single message.
281
288
  *
@@ -310,26 +317,34 @@ export declare class Client extends ClientAbstract {
310
317
  /**
311
318
  * Get information on the currently authorized user.
312
319
  */
313
- getMe(): Promise<import("../types/1_user.js").User>;
320
+ getMe(): Promise<import("../3_types.js").User>;
314
321
  private handleUpdate;
315
322
  handler: Handler;
316
323
  use(middleware: Handler): void;
317
324
  on<U extends keyof Update, K extends keyof Update[U]>(filter: U extends FilterableUpdates ? U | [U, K, ...K[]] : U, handler: Handler<Pick<{
318
325
  [P in U]: With<Update[U], K>;
319
326
  }, U>>): void;
327
+ /**
328
+ * Answer a callback query. Bot-only.
329
+ *
330
+ * @param id ID of the callback query to answer.
331
+ */
332
+ answerCallbackQuery(id: string, params?: AnswerCallbackQueryParams): Promise<void>;
320
333
  }
321
334
  type With<T, K extends keyof T> = T & Required<Pick<T, K>>;
322
335
  export type ConnectionState = "not-connected" | "updating" | "ready";
323
336
  export type AuthorizationState = {
324
337
  authorized: boolean;
325
338
  };
326
- type FilterableUpdates = "message" | "editedMessage";
339
+ type FilterableUpdates = "message" | "editedMessage" | "callbackQuery";
327
340
  export interface Update {
328
341
  message: Message;
329
342
  editedMessage: Message;
330
343
  connectionState: ConnectionState;
331
344
  authorizationState: AuthorizationState;
332
345
  deletedMessages: [Message, ...Message[]];
346
+ callbackQuery: CallbackQuery;
347
+ inlineQuery: InlineQuery;
333
348
  }
334
349
  export interface Handler<U extends Partial<Update> = Partial<Update>> {
335
350
  (update: U, next: () => Promise<void>): MaybePromise<void>;