@mtkruto/node 0.1.105 → 0.1.107

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 (85) hide show
  1. package/esm/4_constants.d.ts +2 -2
  2. package/esm/4_constants.js +2 -2
  3. package/esm/client/3_types.d.ts +17 -12
  4. package/esm/client/4_client.d.ts +70 -15
  5. package/esm/client/4_client.js +73 -27
  6. package/esm/tl/2_types.d.ts +231 -55
  7. package/esm/tl/2_types.js +782 -150
  8. package/esm/tl/3_functions.d.ts +159 -53
  9. package/esm/tl/3_functions.js +488 -147
  10. package/esm/types/0_audio.d.ts +9 -9
  11. package/esm/types/0_bot_command.d.ts +2 -0
  12. package/esm/types/0_chat_action.d.ts +1 -0
  13. package/esm/types/0_chat_administrator_rights.d.ts +13 -13
  14. package/esm/types/0_chat_photo.d.ts +7 -6
  15. package/esm/types/0_chat_photo.js +1 -1
  16. package/esm/types/0_contact.d.ts +6 -6
  17. package/esm/types/0_dice.d.ts +3 -3
  18. package/esm/types/0_force_reply.d.ts +4 -4
  19. package/esm/types/0_input_contact_message_content.d.ts +5 -0
  20. package/esm/types/0_input_location_message_content.d.ts +7 -0
  21. package/esm/types/0_input_venue_message_content.d.ts +10 -1
  22. package/esm/types/0_keyboard_button_poll_type.d.ts +3 -3
  23. package/esm/types/0_location.d.ts +7 -7
  24. package/esm/types/0_login_url.d.ts +4 -5
  25. package/esm/types/0_mask_position.d.ts +0 -1
  26. package/esm/types/0_message_entity.d.ts +5 -5
  27. package/esm/types/0_parse_mode.d.ts +1 -0
  28. package/esm/types/0_poll_option.d.ts +2 -2
  29. package/esm/types/0_reply_keyboard_remove.d.ts +3 -3
  30. package/esm/types/0_thumbnail.d.ts +6 -6
  31. package/esm/types/0_venue.d.ts +6 -6
  32. package/esm/types/0_voice.d.ts +6 -6
  33. package/esm/types/0_web_app_info.d.ts +1 -2
  34. package/esm/types/1_animation.d.ts +9 -9
  35. package/esm/types/1_chat.d.ts +29 -34
  36. package/esm/types/1_document.d.ts +6 -7
  37. package/esm/types/1_keyboard_button.d.ts +1 -1
  38. package/esm/types/1_photo.d.ts +3 -3
  39. package/esm/types/1_sticker.d.ts +2 -2
  40. package/esm/types/1_user.d.ts +2 -1
  41. package/esm/types/1_video.d.ts +4 -4
  42. package/esm/types/1_video_note.d.ts +3 -3
  43. package/package.json +1 -1
  44. package/script/4_constants.d.ts +2 -2
  45. package/script/4_constants.js +2 -2
  46. package/script/client/3_types.d.ts +17 -12
  47. package/script/client/4_client.d.ts +70 -15
  48. package/script/client/4_client.js +85 -39
  49. package/script/tl/2_types.d.ts +231 -55
  50. package/script/tl/2_types.js +824 -179
  51. package/script/tl/3_functions.d.ts +159 -53
  52. package/script/tl/3_functions.js +510 -159
  53. package/script/types/0_audio.d.ts +9 -9
  54. package/script/types/0_bot_command.d.ts +2 -0
  55. package/script/types/0_chat_action.d.ts +1 -0
  56. package/script/types/0_chat_administrator_rights.d.ts +13 -13
  57. package/script/types/0_chat_photo.d.ts +7 -6
  58. package/script/types/0_chat_photo.js +1 -1
  59. package/script/types/0_contact.d.ts +6 -6
  60. package/script/types/0_dice.d.ts +3 -3
  61. package/script/types/0_force_reply.d.ts +4 -4
  62. package/script/types/0_input_contact_message_content.d.ts +5 -0
  63. package/script/types/0_input_location_message_content.d.ts +7 -0
  64. package/script/types/0_input_venue_message_content.d.ts +10 -1
  65. package/script/types/0_keyboard_button_poll_type.d.ts +3 -3
  66. package/script/types/0_location.d.ts +7 -7
  67. package/script/types/0_login_url.d.ts +4 -5
  68. package/script/types/0_mask_position.d.ts +0 -1
  69. package/script/types/0_message_entity.d.ts +5 -5
  70. package/script/types/0_parse_mode.d.ts +1 -0
  71. package/script/types/0_poll_option.d.ts +2 -2
  72. package/script/types/0_reply_keyboard_remove.d.ts +3 -3
  73. package/script/types/0_thumbnail.d.ts +6 -6
  74. package/script/types/0_venue.d.ts +6 -6
  75. package/script/types/0_voice.d.ts +6 -6
  76. package/script/types/0_web_app_info.d.ts +1 -2
  77. package/script/types/1_animation.d.ts +9 -9
  78. package/script/types/1_chat.d.ts +29 -34
  79. package/script/types/1_document.d.ts +6 -7
  80. package/script/types/1_keyboard_button.d.ts +1 -1
  81. package/script/types/1_photo.d.ts +3 -3
  82. package/script/types/1_sticker.d.ts +2 -2
  83. package/script/types/1_user.d.ts +2 -1
  84. package/script/types/1_video.d.ts +4 -4
  85. package/script/types/1_video_note.d.ts +3 -3
@@ -4,8 +4,8 @@ export type PublicKeys = readonly [bigint, [bigint, bigint]][];
4
4
  export declare const PUBLIC_KEYS: PublicKeys;
5
5
  export declare const VECTOR_CONSTRUCTOR = 481674261;
6
6
  export declare const INITIAL_DC: DC;
7
- export declare const LAYER = 161;
8
- export declare const APP_VERSION = "MTKruto 0.1.105";
7
+ export declare const LAYER = 165;
8
+ export declare const APP_VERSION = "MTKruto 0.1.107";
9
9
  export declare const DEVICE_MODEL: string;
10
10
  export declare const LANG_CODE: string;
11
11
  export declare const LANG_PACK = "";
@@ -53,8 +53,8 @@ export const PUBLIC_KEYS = Object.freeze([
53
53
  ]);
54
54
  export const VECTOR_CONSTRUCTOR = 0x1CB5C415;
55
55
  export const INITIAL_DC = "2-test";
56
- export const LAYER = 161;
57
- export const APP_VERSION = "MTKruto 0.1.105";
56
+ export const LAYER = 165;
57
+ export const APP_VERSION = "MTKruto 0.1.107";
58
58
  // @ts-ignore: lib
59
59
  export const DEVICE_MODEL = typeof dntShim.Deno === "undefined" ? typeof navigator === "undefined" ? typeof process === "undefined" ? "Unknown" : process.platform + "-" + process.arch : navigator.userAgent.split(" ")[0] : dntShim.Deno.build.os + "-" + dntShim.Deno.build.arch;
60
60
  export const LANG_CODE = typeof navigator === "undefined" ? "en" : navigator.language.split("-")[0];
@@ -40,13 +40,13 @@ export interface ClientParams extends ClientPlainParams {
40
40
  errorHandler?: (err: unknown, function_: types.Type | functions.Function<unknown>, n: number) => MaybePromise<boolean>;
41
41
  }
42
42
  export interface AnswerCallbackQueryParams {
43
- /** Text of the answer */
43
+ /** A text to be shown to the user. */
44
44
  text?: string;
45
- /** Pass true to show an alert to the user instead of a toast notification */
45
+ /** Whether to show the text as an alert (popup). */
46
46
  alert?: boolean;
47
- /** URL to be opened */
47
+ /** A URL to be opened. */
48
48
  url?: string;
49
- /** Time during which the result of the query can be cached, in seconds */
49
+ /** TTL of answer caches in seconds. */
50
50
  cacheTime?: number;
51
51
  }
52
52
  export interface AuthorizeUserParams<S = string> {
@@ -135,19 +135,24 @@ export interface ForwardMessagesParams {
135
135
  }
136
136
  export interface SendPollParams {
137
137
  /**
138
- * True, if the poll needs to be anonymous, defaults to True */
138
+ * Whether the poll should be anonymous.
139
+ */
139
140
  isAnonymous?: boolean;
140
141
  /**
141
- * The type of the poll. Defaults to regular. */
142
+ * The type of the poll.
143
+ */
142
144
  type?: "quiz" | "regular";
143
145
  /**
144
- * True, if the poll allows multiple answers, ignored for polls in quiz mode, defaults to False */
146
+ * Whether multiple selections should be allowed. Only valid for regular polls.
147
+ */
145
148
  allowMultipleAnswers?: boolean;
146
149
  /**
147
- * Index of the correct option. Required for quizzes. */
150
+ * Index of the correct option. Required for quiz polls.
151
+ */
148
152
  correctOptionIndex?: number;
149
153
  /**
150
- * Text that is shown when a user chooses an incorrect answer or taps on the lamp icon in a quiz-style poll, 0-200 characters with at most 2 line feeds after entities parsing */
154
+ * A text that will be shown to the user when the poll is answered. Only valid for quiz polls.
155
+ */
151
156
  explanation?: string;
152
157
  /**
153
158
  * The parse mode to use for the explanation. If not provided, the default parse mode will be used.
@@ -158,15 +163,15 @@ export interface SendPollParams {
158
163
  */
159
164
  explanationEntities?: MessageEntity[];
160
165
  /**
161
- * Amount of time in seconds the poll will be active after creation, 5-600. Can't be used together with close_date.
166
+ * Duration of the poll in seconds. Must be in the range of 5-600. Cannot be used simultaneously with `closeDate`.
162
167
  */
163
168
  openPeriod?: number;
164
169
  /**
165
- * Point in time when the poll will be automatically closed. Must be at least 5 and no more than 600 seconds in the future. Can't be used together with open_period.
170
+ * The time in which the poll will be closed. Must be at least 5 seconds in the future, and no more than 600. Cannot be used simultaneously with `openPeriod`.
166
171
  */
167
172
  closeDate?: Date;
168
173
  /**
169
- * Pass True if the poll needs to be immediately closed. This can be useful for poll preview.
174
+ * Whether the poll should be closed as soon as it is sent, allowing no answers.
170
175
  */
171
176
  isClosed?: boolean;
172
177
  /**
@@ -2,15 +2,15 @@ import { MaybePromise } from "../1_utilities.js";
2
2
  import { functions, ReadObject, types } from "../2_tl.js";
3
3
  import { Storage } from "../3_storage.js";
4
4
  import { DC } from "../3_transport.js";
5
- import { BotCommand, ChatAction, ChatID, InlineQueryResult, Message } from "../3_types.js";
5
+ import { BotCommand, ChatAction, ChatID, InlineQueryResult, Message, User } from "../3_types.js";
6
6
  import { Migrate } from "../4_errors.js";
7
7
  import { With } from "./0_utilities.js";
8
8
  import { ClientAbstract } from "./1_client_abstract.js";
9
9
  import { AnswerCallbackQueryParams, AnswerInlineQueryParams, AuthorizeUserParams, ClientParams, DownloadParams, EditMessageParams, FilterableUpdates, FilterUpdate, ForwardMessagesParams, GetMyCommandsParams, Handler, ParseMode, SendMessagesParams, SendPollParams, SetMyCommandsParams, Update, UploadParams } from "./3_types.js";
10
- export declare const getEntity: unique symbol;
11
- export declare const getStickerSetName: unique symbol;
10
+ declare const getEntity: unique symbol;
11
+ declare const getStickerSetName: unique symbol;
12
12
  export declare const handleMigrationError: unique symbol;
13
- export declare const getMessageWithReply: unique symbol;
13
+ declare const getMessageWithReply: unique symbol;
14
14
  export declare const restartAuth: unique symbol;
15
15
  export declare class ConnectionError extends Error {
16
16
  }
@@ -126,76 +126,104 @@ export declare class Client extends ClientAbstract {
126
126
  private getChannelAccessHash;
127
127
  getInputPeer(id: ChatID): Promise<types.InputPeerChat | types.InputPeerUser | types.InputPeerChannel>;
128
128
  private getInputPeerInner;
129
- [getEntity](peer: types.PeerUser): Promise<types.User | null>;
130
- [getEntity](peer: types.PeerChat): Promise<types.Chat | null>;
131
- [getEntity](peer: types.PeerChannel): Promise<types.Channel | null>;
129
+ private [getEntity];
130
+ private [getEntity];
131
+ private [getEntity];
132
132
  processResult(result: ReadObject): Promise<void>;
133
133
  private updatesToMessages;
134
134
  private resolveSendAs;
135
135
  /**
136
136
  * Send a text message.
137
137
  *
138
+ * @method
138
139
  * @param chatId The chat to send the message to.
139
140
  * @param text The message's text.
141
+ * @returns The sent text message.
140
142
  */
141
143
  sendMessage(chatId: ChatID, text: string, params?: SendMessagesParams): Promise<With<Message, "text">>;
142
144
  private parseText;
143
145
  /**
144
146
  * Edit a message's text.
145
147
  *
148
+ * @method
146
149
  * @param chatId The chat where the message is.
147
150
  * @param messageId The ID of the message.
148
151
  * @param text The new text of the message.
152
+ * @returns The edited text message.
149
153
  */
150
154
  editMessageText(chatId: ChatID, messageId: number, text: string, params?: EditMessageParams): Promise<With<Message, "text">>;
151
155
  private getMessagesInner;
152
156
  /**
153
157
  * Retrieve multiple messages.
154
158
  *
159
+ * @method
155
160
  * @param chatId The identifier of the chat to retrieve the messages from.
156
161
  * @param messageIds The identifiers of the messages to retrieve.
162
+ * @example ```ts
163
+ * const message = await client.getMessages("@MTKruto", [210, 212]);
164
+ * ```
165
+ * @returns The retrieved messages.
157
166
  */
158
- getMessages(chatId_: ChatID, messageIds: number[]): Promise<Omit<Message, "replyToMessage">[]>;
159
- [getMessageWithReply](chatId: ChatID, messageId: number): Promise<Message | null>;
167
+ getMessages(chatId: ChatID, messageIds: number[]): Promise<Omit<Message, "replyToMessage">[]>;
168
+ private [getMessageWithReply];
160
169
  /**
161
170
  * Retrieve a single message.
162
171
  *
172
+ * @method
163
173
  * @param chatId The identifier of the chat to retrieve the message from.
164
174
  * @param messageId The identifier of the message to retrieve.
175
+ * @example ```ts
176
+ * const message = await client.getMessage("@MTKruto", 212);
177
+ * ```
178
+ * @returns The retrieved message.
165
179
  */
166
180
  getMessage(chatId: ChatID, messageId: number): Promise<Omit<Message, "replyToMessage"> | null>;
167
181
  private downloadInner;
168
182
  /**
169
183
  * Download a file.
170
184
  *
185
+ * @method
171
186
  * @param fileId The identifier of the file to download.
187
+ * @example ```ts
188
+ * for await (const chunk of client.download(fileId, { chunkSize: 256 * 1024 })) {
189
+ * await outFile.write(chunk);
190
+ * }
191
+ * ```
192
+ * @returns A generator yielding the contents of the file.
172
193
  */
173
194
  download(fileId: string, params?: DownloadParams): Promise<AsyncGenerator<Uint8Array, void, unknown>>;
174
- [getStickerSetName](inputStickerSet: types.InputStickerSetID, hash?: number): Promise<string>;
195
+ private [getStickerSetName];
175
196
  /**
176
197
  * Forward multiple messages.
177
198
  *
199
+ * @method
178
200
  * @param from The identifier of the chat to forward the messages from.
179
201
  * @param to The identifier of the chat to forward the messages to.
180
202
  * @param messageIds The identifiers of the messages to forward.
203
+ * @returns The forwarded messages.
181
204
  */
182
205
  forwardMessages(from: ChatID, to: ChatID, messageIds: number[], params?: ForwardMessagesParams): Promise<Message[]>;
183
206
  /**
184
207
  * Forward a single message.
185
208
  *
209
+ * @method
186
210
  * @param from The identifier of the chat to forward the message from.
187
211
  * @param to The identifier of the chat to forward the message to.
188
212
  * @param messageId The identifier of the message to forward.
213
+ * @returns The forwarded message.
189
214
  */
190
215
  forwardMessage(from: ChatID, to: ChatID, messageId: number, params?: ForwardMessagesParams): Promise<Message>;
191
216
  /**
192
217
  * Get information on the currently authorized user.
218
+ *
219
+ * @method
193
220
  */
194
- getMe(): Promise<import("../3_types.js").User>;
221
+ getMe(): Promise<User>;
195
222
  private handleUpdate;
196
223
  /**
197
224
  * Answer a callback query. Bot-only.
198
225
  *
226
+ * @method
199
227
  * @param id ID of the callback query to answer.
200
228
  */
201
229
  answerCallbackQuery(id: string, params?: AnswerCallbackQueryParams): Promise<void>;
@@ -205,28 +233,35 @@ export declare class Client extends ClientAbstract {
205
233
  /**
206
234
  * Send a poll.
207
235
  *
236
+ * @method
208
237
  * @param chatId The chat to send the poll to.
209
238
  * @param question The poll's question.
210
239
  * @param options The poll's options.
240
+ * @returns The sent poll.
211
241
  */
212
242
  sendPoll(chatId: ChatID, question: string, options: [string, string, ...string[]], params?: SendPollParams): Promise<With<Message, "poll">>;
213
243
  /**
214
244
  * Send a chat action.
215
245
  *
246
+ * @method
216
247
  * @param chatId The chat to send the chat action to.
217
248
  * @param action The chat action.
218
249
  * @param messageThreadId The thread to send the chat action to.
219
250
  */
220
- sendChatAction(chatId: ChatID, action_: ChatAction, messageThreadId?: number): Promise<void>;
251
+ sendChatAction(chatId: ChatID, action: ChatAction, params?: {
252
+ messageThreadId?: number;
253
+ }): Promise<void>;
221
254
  /**
222
255
  * Upload a file.
223
256
  *
257
+ * @method
224
258
  * @param contents The contents of the file.
225
259
  */
226
260
  upload(contents: Uint8Array, params?: UploadParams): Promise<types.InputFile | types.InputFileBig>;
227
261
  /**
228
262
  * Set the bot's commands in the given scope and/or language. Bot-only.
229
263
  *
264
+ * @method
230
265
  * @param commands The commands to set.
231
266
  */
232
267
  setMyCommands(commands: BotCommand[], params?: SetMyCommandsParams): Promise<void>;
@@ -237,6 +272,7 @@ export declare class Client extends ClientAbstract {
237
272
  /**
238
273
  * Answer an inline query. Bot-only.
239
274
  *
275
+ * @method
240
276
  * @param id The ID of the inline query to answer.
241
277
  * @param results The results to answer with.
242
278
  */
@@ -250,6 +286,8 @@ export declare class Client extends ClientAbstract {
250
286
  private setMyInfo;
251
287
  /**
252
288
  * Set the bot's description in the given language. Bot-only.
289
+ *
290
+ * @method
253
291
  */
254
292
  setMyDescription({ description, languageCode }: {
255
293
  description?: string;
@@ -257,6 +295,8 @@ export declare class Client extends ClientAbstract {
257
295
  }): Promise<void>;
258
296
  /**
259
297
  * Set the bot's name in the given language. Bot-only.
298
+ *
299
+ * @method
260
300
  */
261
301
  setMyName({ name, languageCode }: {
262
302
  name?: string;
@@ -264,6 +304,8 @@ export declare class Client extends ClientAbstract {
264
304
  }): Promise<void>;
265
305
  /**
266
306
  * Set the bot's short description in the given language. Bot-only.
307
+ *
308
+ * @method
267
309
  */
268
310
  setMyShortDescription({ shortDescription: about, languageCode }: {
269
311
  shortDescription?: string;
@@ -272,14 +314,27 @@ export declare class Client extends ClientAbstract {
272
314
  private getMyInfo;
273
315
  /**
274
316
  * Get the bot's description in the given language. Bot-only.
317
+ *
318
+ * @method
275
319
  */
276
- getMyDescription(languageCode?: string): Promise<string>;
320
+ getMyDescription(params?: {
321
+ languageCode?: string;
322
+ }): Promise<string>;
277
323
  /**
278
324
  * Set the bot's name in the given language. Bot-only.
325
+ *
326
+ * @method
279
327
  */
280
- getMyName(languageCode?: string): Promise<string>;
328
+ getMyName(params?: {
329
+ languageCode?: string;
330
+ }): Promise<string>;
281
331
  /**
282
332
  * Get the bot's short description in the given language. Bot-only.
333
+ *
334
+ * @method
283
335
  */
284
- getMyShortDescription(languageCode?: string): Promise<string>;
336
+ getMyShortDescription(params?: {
337
+ languageCode?: string;
338
+ }): Promise<string>;
285
339
  }
340
+ export {};
@@ -18,10 +18,10 @@ const dGapC = debug("Client/recoverChannelUpdateGap");
18
18
  const dAuth = debug("Client/authorize");
19
19
  const dRecv = debug("Client/receiveLoop");
20
20
  const dUpload = debug("Client/upload");
21
- export const getEntity = Symbol();
22
- export const getStickerSetName = Symbol();
21
+ const getEntity = Symbol();
22
+ const getStickerSetName = Symbol();
23
23
  export const handleMigrationError = Symbol();
24
- export const getMessageWithReply = Symbol();
24
+ const getMessageWithReply = Symbol();
25
25
  export const restartAuth = Symbol();
26
26
  export class ConnectionError extends Error {
27
27
  }
@@ -1239,8 +1239,10 @@ export class Client extends ClientAbstract {
1239
1239
  /**
1240
1240
  * Send a text message.
1241
1241
  *
1242
+ * @method
1242
1243
  * @param chatId The chat to send the message to.
1243
1244
  * @param text The message's text.
1245
+ * @returns The sent text message.
1244
1246
  */
1245
1247
  async sendMessage(chatId, text, params) {
1246
1248
  const [message, entities] = this.parseText(text, params);
@@ -1291,9 +1293,11 @@ export class Client extends ClientAbstract {
1291
1293
  /**
1292
1294
  * Edit a message's text.
1293
1295
  *
1296
+ * @method
1294
1297
  * @param chatId The chat where the message is.
1295
1298
  * @param messageId The ID of the message.
1296
1299
  * @param text The new text of the message.
1300
+ * @returns The edited text message.
1297
1301
  */
1298
1302
  async editMessageText(chatId, messageId, text, params) {
1299
1303
  const [message, entities] = this.parseText(text, params);
@@ -1348,11 +1352,16 @@ export class Client extends ClientAbstract {
1348
1352
  /**
1349
1353
  * Retrieve multiple messages.
1350
1354
  *
1355
+ * @method
1351
1356
  * @param chatId The identifier of the chat to retrieve the messages from.
1352
1357
  * @param messageIds The identifiers of the messages to retrieve.
1358
+ * @example ```ts
1359
+ * const message = await client.getMessages("@MTKruto", [210, 212]);
1360
+ * ```
1361
+ * @returns The retrieved messages.
1353
1362
  */
1354
- async getMessages(chatId_, messageIds) {
1355
- return await this.getMessagesInner(chatId_, messageIds).then((v) => v.map((v) => v.message));
1363
+ async getMessages(chatId, messageIds) {
1364
+ return await this.getMessagesInner(chatId, messageIds).then((v) => v.map((v) => v.message));
1356
1365
  }
1357
1366
  async [getMessageWithReply](chatId, messageId) {
1358
1367
  const messages = await this.getMessagesInner(chatId, [messageId]);
@@ -1361,8 +1370,13 @@ export class Client extends ClientAbstract {
1361
1370
  /**
1362
1371
  * Retrieve a single message.
1363
1372
  *
1373
+ * @method
1364
1374
  * @param chatId The identifier of the chat to retrieve the message from.
1365
1375
  * @param messageId The identifier of the message to retrieve.
1376
+ * @example ```ts
1377
+ * const message = await client.getMessage("@MTKruto", 212);
1378
+ * ```
1379
+ * @returns The retrieved message.
1366
1380
  */
1367
1381
  async getMessage(chatId, messageId) {
1368
1382
  const messages = await this.getMessages(chatId, [messageId]);
@@ -1412,7 +1426,14 @@ export class Client extends ClientAbstract {
1412
1426
  /**
1413
1427
  * Download a file.
1414
1428
  *
1429
+ * @method
1415
1430
  * @param fileId The identifier of the file to download.
1431
+ * @example ```ts
1432
+ * for await (const chunk of client.download(fileId, { chunkSize: 256 * 1024 })) {
1433
+ * await outFile.write(chunk);
1434
+ * }
1435
+ * ```
1436
+ * @returns A generator yielding the contents of the file.
1416
1437
  */
1417
1438
  async download(fileId, params) {
1418
1439
  const fileId_ = FileID.decode(fileId);
@@ -1454,9 +1475,11 @@ export class Client extends ClientAbstract {
1454
1475
  /**
1455
1476
  * Forward multiple messages.
1456
1477
  *
1478
+ * @method
1457
1479
  * @param from The identifier of the chat to forward the messages from.
1458
1480
  * @param to The identifier of the chat to forward the messages to.
1459
1481
  * @param messageIds The identifiers of the messages to forward.
1482
+ * @returns The forwarded messages.
1460
1483
  */
1461
1484
  async forwardMessages(from, to, messageIds, params) {
1462
1485
  const result = await this.invoke(new functions.MessagesForwardMessages({
@@ -1476,15 +1499,19 @@ export class Client extends ClientAbstract {
1476
1499
  /**
1477
1500
  * Forward a single message.
1478
1501
  *
1502
+ * @method
1479
1503
  * @param from The identifier of the chat to forward the message from.
1480
1504
  * @param to The identifier of the chat to forward the message to.
1481
1505
  * @param messageId The identifier of the message to forward.
1506
+ * @returns The forwarded message.
1482
1507
  */
1483
1508
  async forwardMessage(from, to, messageId, params) {
1484
1509
  return await this.forwardMessages(from, to, [messageId], params).then((v) => v[0]);
1485
1510
  }
1486
1511
  /**
1487
1512
  * Get information on the currently authorized user.
1513
+ *
1514
+ * @method
1488
1515
  */
1489
1516
  async getMe() {
1490
1517
  const users = await this.invoke(new functions.UsersGetUsers({ id: [new types.InputUserSelf()] }));
@@ -1592,6 +1619,7 @@ export class Client extends ClientAbstract {
1592
1619
  /**
1593
1620
  * Answer a callback query. Bot-only.
1594
1621
  *
1622
+ * @method
1595
1623
  * @param id ID of the callback query to answer.
1596
1624
  */
1597
1625
  async answerCallbackQuery(id, params) {
@@ -1618,9 +1646,11 @@ export class Client extends ClientAbstract {
1618
1646
  /**
1619
1647
  * Send a poll.
1620
1648
  *
1649
+ * @method
1621
1650
  * @param chatId The chat to send the poll to.
1622
1651
  * @param question The poll's question.
1623
1652
  * @param options The poll's options.
1653
+ * @returns The sent poll.
1624
1654
  */
1625
1655
  async sendPoll(chatId, question, options, params) {
1626
1656
  const peer = await this.getInputPeer(chatId);
@@ -1670,54 +1700,56 @@ export class Client extends ClientAbstract {
1670
1700
  /**
1671
1701
  * Send a chat action.
1672
1702
  *
1703
+ * @method
1673
1704
  * @param chatId The chat to send the chat action to.
1674
1705
  * @param action The chat action.
1675
1706
  * @param messageThreadId The thread to send the chat action to.
1676
1707
  */
1677
- async sendChatAction(chatId, action_, messageThreadId) {
1678
- let action;
1679
- switch (action_) {
1708
+ async sendChatAction(chatId, action, params) {
1709
+ let action_;
1710
+ switch (action) {
1680
1711
  case "type":
1681
- action = new types.SendMessageTypingAction();
1712
+ action_ = new types.SendMessageTypingAction();
1682
1713
  break;
1683
1714
  case "uploadPhoto":
1684
- action = new types.SendMessageUploadPhotoAction({ progress: 0 });
1715
+ action_ = new types.SendMessageUploadPhotoAction({ progress: 0 });
1685
1716
  break;
1686
1717
  case "recordVideo":
1687
- action = new types.SendMessageRecordVideoAction();
1718
+ action_ = new types.SendMessageRecordVideoAction();
1688
1719
  break;
1689
1720
  case "uploadVideo":
1690
- action = new types.SendMessageRecordVideoAction();
1721
+ action_ = new types.SendMessageRecordVideoAction();
1691
1722
  break;
1692
1723
  case "recordVoice":
1693
- action = new types.SendMessageRecordAudioAction();
1724
+ action_ = new types.SendMessageRecordAudioAction();
1694
1725
  break;
1695
1726
  case "uploadAudio":
1696
- action = new types.SendMessageUploadAudioAction({ progress: 0 });
1727
+ action_ = new types.SendMessageUploadAudioAction({ progress: 0 });
1697
1728
  break;
1698
1729
  case "uploadDocument":
1699
- action = new types.SendMessageUploadDocumentAction({ progress: 0 });
1730
+ action_ = new types.SendMessageUploadDocumentAction({ progress: 0 });
1700
1731
  break;
1701
1732
  case "chooseSticker":
1702
- action = new types.SendMessageChooseStickerAction();
1733
+ action_ = new types.SendMessageChooseStickerAction();
1703
1734
  break;
1704
1735
  case "findLocation":
1705
- action = new types.SendMessageGeoLocationAction();
1736
+ action_ = new types.SendMessageGeoLocationAction();
1706
1737
  break;
1707
1738
  case "recordVideoNote":
1708
- action = new types.SendMessageRecordRoundAction();
1739
+ action_ = new types.SendMessageRecordRoundAction();
1709
1740
  break;
1710
1741
  case "uploadVideoNote":
1711
- action = new types.SendMessageUploadRoundAction({ progress: 0 });
1742
+ action_ = new types.SendMessageUploadRoundAction({ progress: 0 });
1712
1743
  break;
1713
1744
  default:
1714
- throw new Error("Invalid chat action: " + action_);
1745
+ throw new Error("Invalid chat action: " + action);
1715
1746
  }
1716
- await this.invoke(new functions.MessagesSetTyping({ peer: await this.getInputPeer(chatId), action, topMsgId: messageThreadId }));
1747
+ await this.invoke(new functions.MessagesSetTyping({ peer: await this.getInputPeer(chatId), action: action_, topMsgId: params?.messageThreadId }));
1717
1748
  }
1718
1749
  /**
1719
1750
  * Upload a file.
1720
1751
  *
1752
+ * @method
1721
1753
  * @param contents The contents of the file.
1722
1754
  */
1723
1755
  async upload(contents, params) {
@@ -1808,6 +1840,7 @@ export class Client extends ClientAbstract {
1808
1840
  /**
1809
1841
  * Set the bot's commands in the given scope and/or language. Bot-only.
1810
1842
  *
1843
+ * @method
1811
1844
  * @param commands The commands to set.
1812
1845
  */
1813
1846
  async setMyCommands(commands, params) {
@@ -1830,6 +1863,7 @@ export class Client extends ClientAbstract {
1830
1863
  /**
1831
1864
  * Answer an inline query. Bot-only.
1832
1865
  *
1866
+ * @method
1833
1867
  * @param id The ID of the inline query to answer.
1834
1868
  * @param results The results to answer with.
1835
1869
  */
@@ -1896,6 +1930,8 @@ export class Client extends ClientAbstract {
1896
1930
  }
1897
1931
  /**
1898
1932
  * Set the bot's description in the given language. Bot-only.
1933
+ *
1934
+ * @method
1899
1935
  */
1900
1936
  async setMyDescription({ description, languageCode }) {
1901
1937
  await this.assertBot("setMyDescription");
@@ -1903,6 +1939,8 @@ export class Client extends ClientAbstract {
1903
1939
  }
1904
1940
  /**
1905
1941
  * Set the bot's name in the given language. Bot-only.
1942
+ *
1943
+ * @method
1906
1944
  */
1907
1945
  async setMyName({ name, languageCode }) {
1908
1946
  await this.assertBot("setMyName");
@@ -1910,6 +1948,8 @@ export class Client extends ClientAbstract {
1910
1948
  }
1911
1949
  /**
1912
1950
  * Set the bot's short description in the given language. Bot-only.
1951
+ *
1952
+ * @method
1913
1953
  */
1914
1954
  async setMyShortDescription({ shortDescription: about, languageCode }) {
1915
1955
  await this.assertBot("setMyShortDescription");
@@ -1920,23 +1960,29 @@ export class Client extends ClientAbstract {
1920
1960
  }
1921
1961
  /**
1922
1962
  * Get the bot's description in the given language. Bot-only.
1963
+ *
1964
+ * @method
1923
1965
  */
1924
- async getMyDescription(languageCode) {
1966
+ async getMyDescription(params) {
1925
1967
  await this.assertBot("getMyDescription");
1926
- return await this.getMyInfo(languageCode).then((v) => v.description);
1968
+ return await this.getMyInfo(params?.languageCode).then((v) => v.description);
1927
1969
  }
1928
1970
  /**
1929
1971
  * Set the bot's name in the given language. Bot-only.
1972
+ *
1973
+ * @method
1930
1974
  */
1931
- async getMyName(languageCode) {
1975
+ async getMyName(params) {
1932
1976
  await this.assertBot("getMyName");
1933
- return await this.getMyInfo(languageCode).then((v) => v.description);
1977
+ return await this.getMyInfo(params?.languageCode).then((v) => v.description);
1934
1978
  }
1935
1979
  /**
1936
1980
  * Get the bot's short description in the given language. Bot-only.
1981
+ *
1982
+ * @method
1937
1983
  */
1938
- async getMyShortDescription(languageCode) {
1984
+ async getMyShortDescription(params) {
1939
1985
  await this.assertBot("getMyShortDescription");
1940
- return await this.getMyInfo(languageCode).then((v) => v.about);
1986
+ return await this.getMyInfo(params?.languageCode).then((v) => v.about);
1941
1987
  }
1942
1988
  }