@telegram.ts/types 1.6.0 → 1.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,8 @@
1
+ import type { ReadStream } from "node:fs";
1
2
  import type {
2
3
  InlineQueryResult,
3
4
  InlineQueryResultsButton,
4
- } from "./inlineTypes";
5
+ } from "./inlineTypes.ts";
5
6
  import type {
6
7
  BotCommand,
7
8
  ChatAdministratorRights,
@@ -16,49 +17,42 @@ import type {
16
17
  UserFromGetMe,
17
18
  UserProfilePhotos,
18
19
  WebhookInfo,
19
- } from "./manageTypes";
20
+ } from "./manageTypes.ts";
20
21
  import type {
21
22
  ForceReply,
22
23
  InlineKeyboardMarkup,
23
24
  ReplyKeyboardMarkup,
24
25
  ReplyKeyboardRemove,
25
- } from "./markupTypes";
26
+ } from "./markupTypes.ts";
26
27
  import type {
27
- LinkPreviewOptions,
28
+ File,
28
29
  GameHighScore,
30
+ LinkPreviewOptions,
29
31
  MaskPosition,
30
32
  Message,
31
33
  MessageEntity,
32
34
  MessageId,
33
35
  ParseMode,
34
36
  Poll,
35
- File,
36
37
  ReactionType,
37
38
  ReplyParameters,
38
39
  SentWebAppMessage,
39
40
  Sticker,
40
41
  StickerSet,
41
- } from "./messageTypes";
42
- import type { PassportElementError } from "./passportTypes";
43
- import type { LabeledPrice, ShippingOption } from "./invoiceTypes";
42
+ } from "./messageTypes.ts";
43
+ import type { PassportElementError } from "./passportTypes.ts";
44
+ import type { LabeledPrice, ShippingOption } from "./invoiceTypes.ts";
44
45
  import type {
45
46
  BotCommandScope,
46
47
  BotDescription,
47
48
  BotName,
48
49
  BotShortDescription,
49
50
  MenuButton,
50
- } from "./botCommandTypes";
51
- import type { Update } from "./updateTypes";
52
- /** Extracts the parameters of a given method name */
53
- type Params<F, M extends keyof ApiMethods<F>> = Parameters<ApiMethods<F>[M]>;
54
- /** Utility type providing the argument type for the given method name or `{}` if the method does not take any parameters */
55
- export type Opts<F> = {
56
- [M in keyof ApiMethods<F>]: Params<F, M>[0] extends undefined
57
- ? {}
58
- : NonNullable<Params<F, M>[0]>;
59
- };
51
+ } from "./botCommandTypes.ts";
52
+ import type { Update } from "./updateTypes.ts";
53
+
60
54
  /** Wrapper type to bundle all methods of the Telegram Bot API */
61
- export type ApiMethods<F> = {
55
+ export type ApiMethods = {
62
56
  /** Use this method to receive incoming updates using long polling (wiki). Returns an Array of Update objects.
63
57
 
64
58
  Notes
@@ -71,11 +65,12 @@ export type ApiMethods<F> = {
71
65
  limit?: number;
72
66
  /** Timeout in seconds for long polling. Defaults to 0, i.e. usual short polling. Should be positive, short polling should be used for testing purposes only. */
73
67
  timeout?: number;
74
- /** A list of the update types you want your bot to receive. For example, specify [message”, edited_channel_post”, callback_query] to only receive updates of these types. See Update for a complete list of available update types. Specify an empty list to receive all update types except chat_member, message_reaction and message_reaction_count (default). If not specified, the previous setting will be used.
68
+ /** A list of the update types you want your bot to receive. For example, specify ["message", "edited_channel_post", "callback_query"] to only receive updates of these types. See Update for a complete list of available update types. Specify an empty list to receive all update types except chat_member, message_reaction, and message_reaction_count (default). If not specified, the previous setting will be used.
75
69
 
76
70
  Please note that this parameter doesn't affect updates created before the call to the getUpdates, so unwanted updates may be received for a short period of time. */
77
71
  allowed_updates?: ReadonlyArray<Exclude<keyof Update, "update_id">>;
78
72
  }): Update[];
73
+
79
74
  /** Use this method to specify a URL and receive incoming updates via an outgoing webhook. Whenever there is an update for the bot, we will send an HTTPS POST request to the specified URL, containing a JSON-serialized Update. In case of an unsuccessful request, we will give up after a reasonable amount of attempts. Returns True on success.
80
75
 
81
76
  If you'd like to make sure that the webhook was set by you, you can specify secret data in the parameter secret_token. If specified, the request will contain a header “X-Telegram-Bot-Api-Secret-Token” with the secret token as content.
@@ -90,12 +85,12 @@ export type ApiMethods<F> = {
90
85
  /** HTTPS URL to send updates to. Use an empty string to remove webhook integration */
91
86
  url: string;
92
87
  /** Upload your public key certificate so that the root certificate in use can be checked. See our self-signed guide for details. */
93
- certificate?: F;
88
+ certificate?: Buffer | ReadStream | string;
94
89
  /** The fixed IP address which will be used to send webhook requests instead of the IP address resolved through DNS */
95
90
  ip_address?: string;
96
91
  /** The maximum allowed number of simultaneous HTTPS connections to the webhook for update delivery, 1-100. Defaults to 40. Use lower values to limit the load on your bot's server, and higher values to increase your bot's throughput. */
97
92
  max_connections?: number;
98
- /** A list of the update types you want your bot to receive. For example, specify [message”, edited_channel_post”, callback_query] to only receive updates of these types. See Update for a complete list of available update types. Specify an empty list to receive all update types except chat_member, message_reaction and message_reaction_count (default). If not specified, the previous setting will be used.
93
+ /** A list of the update types you want your bot to receive. For example, specify ["message", "edited_channel_post", "callback_query"] to only receive updates of these types. See Update for a complete list of available update types. Specify an empty list to receive all update types except chat_member, message_reaction, and message_reaction_count (default). If not specified, the previous setting will be used.
99
94
 
100
95
  Please note that this parameter doesn't affect updates created before the call to the setWebhook, so unwanted updates may be received for a short period of time. */
101
96
  allowed_updates?: ReadonlyArray<Exclude<keyof Update, "update_id">>;
@@ -104,19 +99,25 @@ export type ApiMethods<F> = {
104
99
  /** A secret token to be sent in a header “X-Telegram-Bot-Api-Secret-Token” in every webhook request, 1-256 characters. Only characters A-Z, a-z, 0-9, _ and - are allowed. The header is useful to ensure that the request comes from a webhook set by you. */
105
100
  secret_token?: string;
106
101
  }): true;
102
+
107
103
  /** Use this method to remove webhook integration if you decide to switch back to getUpdates. Returns True on success. */
108
104
  deleteWebhook(args?: {
109
105
  /** Pass True to drop all pending updates */
110
106
  drop_pending_updates?: boolean;
111
107
  }): true;
108
+
112
109
  /** Use this method to get current webhook status. Requires no parameters. On success, returns a WebhookInfo object. If the bot is using getUpdates, will return an object with the url field empty. */
113
110
  getWebhookInfo(): WebhookInfo;
111
+
114
112
  /** A simple method for testing your bot's authentication token. Requires no parameters. Returns basic information about the bot in form of a User object. */
115
113
  getMe(): UserFromGetMe;
114
+
116
115
  /** Use this method to log out from the cloud Bot API server before launching the bot locally. You must log out the bot before running it locally, otherwise there is no guarantee that the bot will receive updates. After a successful call, you can immediately log in on a local server, but will not be able to log in back to the cloud Bot API server for 10 minutes. Returns True on success. Requires no parameters. */
117
116
  logOut(): true;
117
+
118
118
  /** Use this method to close the bot instance before moving it from one local server to another. You need to delete the webhook before calling this method to ensure that the bot isn't launched again after server restart. The method will return error 429 in the first 10 minutes after the bot is launched. Returns True on success. Requires no parameters. */
119
119
  close(): true;
120
+
120
121
  /** Use this method to send text messages. On success, the sent Message is returned. */
121
122
  sendMessage(args: {
122
123
  /** Unique identifier for the target chat or username of the target channel (in the format @channelusername) */
@@ -143,8 +144,11 @@ export type ApiMethods<F> = {
143
144
  | ReplyKeyboardMarkup
144
145
  | ReplyKeyboardRemove
145
146
  | ForceReply;
147
+ /** @deprecated Use `reply_parameters` instead. */
148
+ reply_to_message_id?: number;
146
149
  }): Message.TextMessage;
147
- /** Use this method to forward messages of any kind. Service messages and messages with protected content can't be forwarded. On success, the sent Message is returned. **/
150
+
151
+ /** Use this method to forward messages of any kind. Service messages and messages with protected content can't be forwarded. On success, the sent Message is returned. */
148
152
  forwardMessage(args: {
149
153
  /** Unique identifier for the target chat or username of the target channel (in the format @channelusername) */
150
154
  chat_id: number | string;
@@ -159,6 +163,7 @@ export type ApiMethods<F> = {
159
163
  /** Message identifier in the chat specified in from_chat_id */
160
164
  message_id: number;
161
165
  }): Message;
166
+
162
167
  /** Use this method to forward multiple messages of any kind. If some of the specified messages can't be found or forwarded, they are skipped. Service messages and messages with protected content can't be forwarded. Album grouping is kept for forwarded messages. On success, an array of MessageId of the sent messages is returned. */
163
168
  forwardMessages(args: {
164
169
  /** Unique identifier for the target chat or username of the target channel (in the format @channelusername) */
@@ -174,7 +179,8 @@ export type ApiMethods<F> = {
174
179
  /** Protects the contents of the forwarded messages from forwarding and saving */
175
180
  protect_content?: boolean;
176
181
  }): MessageId[];
177
- /** Use this method to copy messages of any kind. Service messages and invoice messages can't be copied. A quiz poll can be copied only if the value of the field correct_option_id is known to the bot. The method is analogous to the method forwardMessage, but the copied message doesn't have a link to the original message. Returns the MessageId of the sent message on success. */
182
+
183
+ /** Use this method to copy messages of any kind. Service messages, giveaway messages, giveaway winners messages, and invoice messages can't be copied. A quiz poll can be copied only if the value of the field correct_option_id is known to the bot. The method is analogous to the method forwardMessage, but the copied message doesn't have a link to the original message. Returns the MessageId of the sent message on success. */
178
184
  copyMessage(args: {
179
185
  /** Unique identifier for the target chat or username of the target channel (in the format @channelusername) */
180
186
  chat_id: number | string;
@@ -202,7 +208,10 @@ export type ApiMethods<F> = {
202
208
  | ReplyKeyboardMarkup
203
209
  | ReplyKeyboardRemove
204
210
  | ForceReply;
211
+ /** @deprecated Use `reply_parameters` instead. */
212
+ reply_to_message_id?: number;
205
213
  }): MessageId;
214
+
206
215
  /** Use this method to copy messages of any kind. If some of the specified messages can't be found or copied, they are skipped. Service messages, giveaway messages, giveaway winners messages, and invoice messages can't be copied. A quiz poll can be copied only if the value of the field correct_option_id is known to the bot. The method is analogous to the method forwardMessages, but the copied messages don't have a link to the original message. Album grouping is kept for copied messages. On success, an array of MessageId of the sent messages is returned. */
207
216
  copyMessages(args: {
208
217
  /** Unique identifier for the target chat or username of the target channel (in the format @channelusername) */
@@ -220,6 +229,7 @@ export type ApiMethods<F> = {
220
229
  /** Pass True to copy the messages without their captions */
221
230
  remove_caption?: boolean;
222
231
  }): MessageId[];
232
+
223
233
  /** Use this method to send photos. On success, the sent Message is returned. */
224
234
  sendPhoto(args: {
225
235
  /** Unique identifier for the target chat or username of the target channel (in the format @channelusername) */
@@ -227,7 +237,7 @@ export type ApiMethods<F> = {
227
237
  /** Unique identifier for the target message thread (topic) of the forum; for forum supergroups only */
228
238
  message_thread_id?: number;
229
239
  /** Photo to send. Pass a file_id as String to send a photo that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a photo from the Internet, or upload a new photo using multipart/form-data. The photo must be at most 10 MB in size. The photo's width and height must not exceed 10000 in total. Width and height ratio must be at most 20. */
230
- photo: F | string;
240
+ photo: Buffer | ReadStream | string | string;
231
241
  /** Photo caption (may also be used when resending photos by file_id), 0-1024 characters after entities parsing */
232
242
  caption?: string;
233
243
  /** Mode for parsing entities in the photo caption. See formatting options for more details. */
@@ -248,7 +258,10 @@ export type ApiMethods<F> = {
248
258
  | ReplyKeyboardMarkup
249
259
  | ReplyKeyboardRemove
250
260
  | ForceReply;
261
+ /** @deprecated Use `reply_parameters` instead. */
262
+ reply_to_message_id?: number;
251
263
  }): Message.PhotoMessage;
264
+
252
265
  /** Use this method to send audio files, if you want Telegram clients to display them in the music player. Your audio must be in the .MP3 or .M4A format. On success, the sent Message is returned. Bots can currently send audio files of up to 50 MB in size, this limit may be changed in the future.
253
266
 
254
267
  For sending voice messages, use the sendVoice method instead. */
@@ -258,7 +271,7 @@ export type ApiMethods<F> = {
258
271
  /** Unique identifier for the target message thread (topic) of the forum; for forum supergroups only */
259
272
  message_thread_id?: number;
260
273
  /** Audio file to send. Pass a file_id as String to send an audio file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get an audio file from the Internet, or upload a new one using multipart/form-data. */
261
- audio: F | string;
274
+ audio: Buffer | ReadStream | string | string;
262
275
  /** Audio caption, 0-1024 characters after entities parsing */
263
276
  caption?: string;
264
277
  /** Mode for parsing entities in the audio caption. See formatting options for more details. */
@@ -272,7 +285,7 @@ export type ApiMethods<F> = {
272
285
  /** Track name */
273
286
  title?: string;
274
287
  /** Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass "attach://<file_attach_name>" if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. */
275
- thumbnail?: F;
288
+ thumbnail?: Buffer | ReadStream | string;
276
289
  /** Sends the message silently. Users will receive a notification with no sound. */
277
290
  disable_notification?: boolean;
278
291
  /** Protects the contents of the sent message from forwarding and saving */
@@ -285,7 +298,10 @@ export type ApiMethods<F> = {
285
298
  | ReplyKeyboardMarkup
286
299
  | ReplyKeyboardRemove
287
300
  | ForceReply;
301
+ /** @deprecated Use `reply_parameters` instead. */
302
+ reply_to_message_id?: number;
288
303
  }): Message.AudioMessage;
304
+
289
305
  /** Use this method to send general files. On success, the sent Message is returned. Bots can currently send files of any type of up to 50 MB in size, this limit may be changed in the future. */
290
306
  sendDocument(args: {
291
307
  /** Unique identifier for the target chat or username of the target channel (in the format @channelusername) */
@@ -293,9 +309,9 @@ export type ApiMethods<F> = {
293
309
  /** Unique identifier for the target message thread (topic) of the forum; for forum supergroups only */
294
310
  message_thread_id?: number;
295
311
  /** File to send. Pass a file_id as String to send a file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. */
296
- document: F | string;
312
+ document: Buffer | ReadStream | string | string;
297
313
  /** Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass "attach://<file_attach_name>" if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. */
298
- thumbnail?: F;
314
+ thumbnail?: Buffer | ReadStream | string;
299
315
  /** Document caption (may also be used when resending documents by file_id), 0-1024 characters after entities parsing */
300
316
  caption?: string;
301
317
  /** Mode for parsing entities in the document caption. See formatting options for more details. */
@@ -316,7 +332,10 @@ export type ApiMethods<F> = {
316
332
  | ReplyKeyboardMarkup
317
333
  | ReplyKeyboardRemove
318
334
  | ForceReply;
335
+ /** @deprecated Use `reply_parameters` instead. */
336
+ reply_to_message_id?: number;
319
337
  }): Message.DocumentMessage;
338
+
320
339
  /** Use this method to send video files, Telegram clients support MPEG4 videos (other formats may be sent as Document). On success, the sent Message is returned. Bots can currently send video files of up to 50 MB in size, this limit may be changed in the future. */
321
340
  sendVideo(args: {
322
341
  /** Unique identifier for the target chat or username of the target channel (in the format @channelusername) */
@@ -324,7 +343,7 @@ export type ApiMethods<F> = {
324
343
  /** Unique identifier for the target message thread (topic) of the forum; for forum supergroups only */
325
344
  message_thread_id?: number;
326
345
  /** Video to send. Pass a file_id as String to send a video that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a video from the Internet, or upload a new video using multipart/form-data. */
327
- video: F | string;
346
+ video: Buffer | ReadStream | string | string;
328
347
  /** Duration of sent video in seconds */
329
348
  duration?: number;
330
349
  /** Video width */
@@ -332,7 +351,7 @@ export type ApiMethods<F> = {
332
351
  /** Video height */
333
352
  height?: number;
334
353
  /** Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass "attach://<file_attach_name>" if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. */
335
- thumbnail?: F;
354
+ thumbnail?: Buffer | ReadStream | string;
336
355
  /** Video caption (may also be used when resending videos by file_id), 0-1024 characters after entities parsing */
337
356
  caption?: string;
338
357
  /** Mode for parsing entities in the video caption. See formatting options for more details. */
@@ -355,7 +374,10 @@ export type ApiMethods<F> = {
355
374
  | ReplyKeyboardMarkup
356
375
  | ReplyKeyboardRemove
357
376
  | ForceReply;
377
+ /** @deprecated Use `reply_parameters` instead. */
378
+ reply_to_message_id?: number;
358
379
  }): Message.VideoMessage;
380
+
359
381
  /** Use this method to send animation files (GIF or H.264/MPEG-4 AVC video without sound). On success, the sent Message is returned. Bots can currently send animation files of up to 50 MB in size, this limit may be changed in the future. */
360
382
  sendAnimation(args: {
361
383
  /** Unique identifier for the target chat or username of the target channel (in the format @channelusername) */
@@ -363,7 +385,7 @@ export type ApiMethods<F> = {
363
385
  /** Unique identifier for the target message thread (topic) of the forum; for forum supergroups only */
364
386
  message_thread_id?: number;
365
387
  /** Animation to send. Pass a file_id as String to send an animation that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get an animation from the Internet, or upload a new animation using multipart/form-data. */
366
- animation: F | string;
388
+ animation: Buffer | ReadStream | string | string;
367
389
  /** Duration of sent animation in seconds */
368
390
  duration?: number;
369
391
  /** Animation width */
@@ -371,7 +393,7 @@ export type ApiMethods<F> = {
371
393
  /** Animation height */
372
394
  height?: number;
373
395
  /** Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass "attach://<file_attach_name>" if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. */
374
- thumbnail?: F;
396
+ thumbnail?: Buffer | ReadStream | string;
375
397
  /** Animation caption (may also be used when resending animation by file_id), 0-1024 characters after entities parsing */
376
398
  caption?: string;
377
399
  /** Mode for parsing entities in the animation caption. See formatting options for more details. */
@@ -392,7 +414,10 @@ export type ApiMethods<F> = {
392
414
  | ReplyKeyboardMarkup
393
415
  | ReplyKeyboardRemove
394
416
  | ForceReply;
417
+ /** @deprecated Use `reply_parameters` instead. */
418
+ reply_to_message_id?: number;
395
419
  }): Message.AnimationMessage;
420
+
396
421
  /** Use this method to send audio files, if you want Telegram clients to display the file as a playable voice message. For this to work, your audio must be in an .OGG file encoded with OPUS (other formats may be sent as Audio or Document). On success, the sent Message is returned. Bots can currently send voice messages of up to 50 MB in size, this limit may be changed in the future. */
397
422
  sendVoice(args: {
398
423
  /** Unique identifier for the target chat or username of the target channel (in the format @channelusername) */
@@ -400,7 +425,7 @@ export type ApiMethods<F> = {
400
425
  /** Unique identifier for the target message thread (topic) of the forum; for forum supergroups only */
401
426
  message_thread_id?: number;
402
427
  /** Audio file to send. Pass a file_id as String to send a file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. */
403
- voice: F | string;
428
+ voice: Buffer | ReadStream | string | string;
404
429
  /** Voice message caption, 0-1024 characters after entities parsing */
405
430
  caption?: string;
406
431
  /** Mode for parsing entities in the voice message caption. See formatting options for more details. */
@@ -421,7 +446,10 @@ export type ApiMethods<F> = {
421
446
  | ReplyKeyboardMarkup
422
447
  | ReplyKeyboardRemove
423
448
  | ForceReply;
449
+ /** @deprecated Use `reply_parameters` instead. */
450
+ reply_to_message_id?: number;
424
451
  }): Message.VoiceMessage;
452
+
425
453
  /** Use this method to send video messages. On success, the sent Message is returned.
426
454
  As of v.4.0, Telegram clients support rounded square MPEG4 videos of up to 1 minute long. */
427
455
  sendVideoNote(args: {
@@ -430,13 +458,13 @@ export type ApiMethods<F> = {
430
458
  /** Unique identifier for the target message thread (topic) of the forum; for forum supergroups only */
431
459
  message_thread_id?: number;
432
460
  /** Video note to send. Pass a file_id as String to send a video note that exists on the Telegram servers (recommended) or upload a new video using multipart/form-data.. Sending video notes by a URL is currently unsupported */
433
- video_note: F | string;
461
+ video_note: Buffer | ReadStream | string | string;
434
462
  /** Duration of sent video in seconds */
435
463
  duration?: number;
436
464
  /** Video width and height, i.e. diameter of the video message */
437
465
  length?: number;
438
466
  /** Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass "attach://<file_attach_name>" if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. */
439
- thumbnail?: F;
467
+ thumbnail?: Buffer | ReadStream | string;
440
468
  /** Sends the message silently. Users will receive a notification with no sound. */
441
469
  disable_notification?: boolean;
442
470
  /** Protects the contents of the sent message from forwarding and saving */
@@ -449,7 +477,10 @@ export type ApiMethods<F> = {
449
477
  | ReplyKeyboardMarkup
450
478
  | ReplyKeyboardRemove
451
479
  | ForceReply;
480
+ /** @deprecated Use `reply_parameters` instead. */
481
+ reply_to_message_id?: number;
452
482
  }): Message.VideoNoteMessage;
483
+
453
484
  /** Use this method to send a group of photos, videos, documents or audios as an album. Documents and audio files can be only grouped in an album with messages of the same type. On success, an array of Messages that were sent is returned. */
454
485
  sendMediaGroup(args: {
455
486
  /** Unique identifier for the target chat or username of the target channel (in the format @channelusername) */
@@ -458,10 +489,7 @@ export type ApiMethods<F> = {
458
489
  /** Unique identifier for the target message thread (topic) of the forum; for forum supergroups only */
459
490
  message_thread_id?: number;
460
491
  media: ReadonlyArray<
461
- | InputMediaAudio<F>
462
- | InputMediaDocument<F>
463
- | InputMediaPhoto<F>
464
- | InputMediaVideo<F>
492
+ InputMediaAudio | InputMediaDocument | InputMediaPhoto | InputMediaVideo
465
493
  >;
466
494
  /** Sends the messages silently. Users will receive a notification with no sound. */
467
495
  disable_notification?: boolean;
@@ -469,12 +497,15 @@ export type ApiMethods<F> = {
469
497
  protect_content?: boolean;
470
498
  /** Description of the message to reply to */
471
499
  reply_parameters?: ReplyParameters;
500
+ /** @deprecated Use `reply_parameters` instead. */
501
+ reply_to_message_id?: number;
472
502
  }): Array<
473
503
  | Message.AudioMessage
474
504
  | Message.DocumentMessage
475
505
  | Message.PhotoMessage
476
506
  | Message.VideoMessage
477
507
  >;
508
+
478
509
  /** Use this method to send point on the map. On success, the sent Message is returned. */
479
510
  sendLocation(args: {
480
511
  /** Unique identifier for the target chat or username of the target channel (in the format @channelusername) */
@@ -505,7 +536,10 @@ export type ApiMethods<F> = {
505
536
  | ReplyKeyboardMarkup
506
537
  | ReplyKeyboardRemove
507
538
  | ForceReply;
539
+ /** @deprecated Use `reply_parameters` instead. */
540
+ reply_to_message_id?: number;
508
541
  }): Message.LocationMessage;
542
+
509
543
  /** Use this method to edit live location messages. A location can be edited until its live_period expires or editing is explicitly disabled by a call to stopMessageLiveLocation. On success, if the edited message is not an inline message, the edited Message is returned, otherwise True is returned. */
510
544
  editMessageLiveLocation(args: {
511
545
  /** Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername) */
@@ -527,6 +561,7 @@ export type ApiMethods<F> = {
527
561
  /** An object for a new inline keyboard. */
528
562
  reply_markup?: InlineKeyboardMarkup;
529
563
  }): (Update.Edited & Message.LocationMessage) | true;
564
+
530
565
  /** Use this method to stop updating a live location message before live_period expires. On success, if the message is not an inline message, the edited Message is returned, otherwise True is returned. */
531
566
  stopMessageLiveLocation(args: {
532
567
  /** Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername) */
@@ -538,6 +573,7 @@ export type ApiMethods<F> = {
538
573
  /** An object for a new inline keyboard. */
539
574
  reply_markup?: InlineKeyboardMarkup;
540
575
  }): (Update.Edited & Message.LocationMessage) | true;
576
+
541
577
  /** Use this method to send information about a venue. On success, the sent Message is returned. */
542
578
  sendVenue(args: {
543
579
  /** Unique identifier for the target chat or username of the target channel (in the format @channelusername) */
@@ -572,7 +608,10 @@ export type ApiMethods<F> = {
572
608
  | ReplyKeyboardMarkup
573
609
  | ReplyKeyboardRemove
574
610
  | ForceReply;
611
+ /** @deprecated Use `reply_parameters` instead. */
612
+ reply_to_message_id?: number;
575
613
  }): Message.VenueMessage;
614
+
576
615
  /** Use this method to send phone contacts. On success, the sent Message is returned. */
577
616
  sendContact(args: {
578
617
  /** Unique identifier for the target chat or username of the target channel (in the format @channelusername) */
@@ -599,7 +638,10 @@ export type ApiMethods<F> = {
599
638
  | ReplyKeyboardMarkup
600
639
  | ReplyKeyboardRemove
601
640
  | ForceReply;
641
+ /** @deprecated Use `reply_parameters` instead. */
642
+ reply_to_message_id?: number;
602
643
  }): Message.ContactMessage;
644
+
603
645
  /** Use this method to send a native poll. On success, the sent Message is returned. */
604
646
  sendPoll(args: {
605
647
  /** Unique identifier for the target chat or username of the target channel (in the format @channelusername) */
@@ -642,7 +684,10 @@ export type ApiMethods<F> = {
642
684
  | ReplyKeyboardMarkup
643
685
  | ReplyKeyboardRemove
644
686
  | ForceReply;
687
+ /** @deprecated Use `reply_parameters` instead. */
688
+ reply_to_message_id?: number;
645
689
  }): Message.PollMessage;
690
+
646
691
  /** Use this method to send an animated emoji that will display a random value. On success, the sent Message is returned. */
647
692
  sendDice(args: {
648
693
  /** Unique identifier for the target chat or username of the target channel (in the format @channelusername) */
@@ -663,19 +708,10 @@ export type ApiMethods<F> = {
663
708
  | ReplyKeyboardMarkup
664
709
  | ReplyKeyboardRemove
665
710
  | ForceReply;
711
+ /** @deprecated Use `reply_parameters` instead. */
712
+ reply_to_message_id?: number;
666
713
  }): Message.DiceMessage;
667
714
 
668
- /** Use this method to change the chosen reactions on a message. Service messages can't be reacted to. Automatically forwarded messages from a channel to its discussion group have the same available reactions as messages in the channel. In albums, bots must react to the first message. Returns True on success. */
669
- setMessageReaction(args: {
670
- /** Unique identifier for the target chat or username of the target channel (in the format @channelusername) */
671
- chat_id: number | string;
672
- /** Identifier of the target message */
673
- message_id: number;
674
- /** New list of reaction types to set on the message. Currently, as non-premium users, bots can set up to one reaction per message. A custom emoji reaction can be used if it is either already present on the message or explicitly allowed by chat administrators. */
675
- reaction?: ReactionType[];
676
- /** Pass True to set the reaction with a big animation */
677
- is_big?: boolean;
678
- }): true;
679
715
  /** Use this method when you need to tell the user that something is happening on the bot's side. The status is set for 5 seconds or less (when a message arrives from your bot, Telegram clients clear its typing status). Returns True on success.
680
716
 
681
717
  Example: The ImageBot needs some time to process a request and upload the image. Instead of sending a text message along the lines of "Retrieving image, please wait...", the bot may use sendChatAction with action = upload_photo. The user will see a "sending photo" status for the bot.
@@ -700,6 +736,19 @@ export type ApiMethods<F> = {
700
736
  /** Unique identifier for the target message thread; supergroups only */
701
737
  message_thread_id?: number;
702
738
  }): true;
739
+
740
+ /** Use this method to change the chosen reactions on a message. Service messages can't be reacted to. Automatically forwarded messages from a channel to its discussion group have the same available reactions as messages in the channel. In albums, bots must react to the first message. Returns True on success. */
741
+ setMessageReaction(args: {
742
+ /** Unique identifier for the target chat or username of the target channel (in the format @channelusername) */
743
+ chat_id: number | string;
744
+ /** Identifier of the target message */
745
+ message_id: number;
746
+ /** New list of reaction types to set on the message. Currently, as non-premium users, bots can set up to one reaction per message. A custom emoji reaction can be used if it is either already present on the message or explicitly allowed by chat administrators. */
747
+ reaction?: ReactionType[];
748
+ /** Pass True to set the reaction with a big animation */
749
+ is_big?: boolean;
750
+ }): true;
751
+
703
752
  /** Use this method to get a list of profile pictures for a user. Returns a UserProfilePhotos object. */
704
753
  getUserProfilePhotos(args: {
705
754
  /** Unique identifier of the target user */
@@ -709,6 +758,7 @@ export type ApiMethods<F> = {
709
758
  /** Limits the number of photos to be retrieved. Values between 1-100 are accepted. Defaults to 100. */
710
759
  limit?: number;
711
760
  }): UserProfilePhotos;
761
+
712
762
  /** Use this method to get basic information about a file and prepare it for downloading. For the moment, bots can download files of up to 20MB in size. On success, a File object is returned. The file can then be downloaded via the link https://api.telegram.org/file/bot<token>/<file_path>, where <file_path> is taken from the response. It is guaranteed that the link will be valid for at least 1 hour. When the link expires, a new one can be requested by calling getFile again.
713
763
 
714
764
  Note: This function may not preserve the original file name and MIME type. You should save the file's MIME type and name (if available) when the File object is received. */
@@ -716,20 +766,23 @@ export type ApiMethods<F> = {
716
766
  /** File identifier to get information about */
717
767
  file_id: string;
718
768
  }): File;
769
+
719
770
  /** Use this method to ban a user in a group, a supergroup or a channel. In the case of supergroups and channels, the user will not be able to return to the chat on their own using invite links, etc., unless unbanned first. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns True on success.
720
771
  * @deprecated Use `banChatMember` instead. */
721
- kickChatMember: ApiMethods<F>["banChatMember"];
772
+ kickChatMember: ApiMethods["banChatMember"];
773
+
722
774
  /** Use this method to ban a user in a group, a supergroup or a channel. In the case of supergroups and channels, the user will not be able to return to the chat on their own using invite links, etc., unless unbanned first. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns True on success. */
723
775
  banChatMember(args: {
724
776
  /** Unique identifier for the target group or username of the target supergroup or channel (in the format @channelusername) */
725
777
  chat_id: number | string;
726
778
  /** Unique identifier of the target user */
727
779
  user_id: number;
728
- /** Date when the user will be unbanned, unix time. If user is banned for more than 366 days or less than 30 seconds from the current time they are considered to be banned forever. Applied for supergroups and channels only. */
780
+ /** Date when the user will be unbanned; Unix time. If user is banned for more than 366 days or less than 30 seconds from the current time they are considered to be banned forever. Applied for supergroups and channels only. */
729
781
  until_date?: number;
730
782
  /** Pass True to delete all messages from the chat for the user that is being removed. If False, the user will be able to see messages in the group that were sent before the user was removed. Always True for supergroups and channels. */
731
783
  revoke_messages?: boolean;
732
784
  }): true;
785
+
733
786
  /** Use this method to unban a previously banned user in a supergroup or channel. The user will not return to the group or channel automatically, but will be able to join via link, etc. The bot must be an administrator for this to work. By default, this method guarantees that after the call the user is not a member of the chat, but will be able to join it. So if the user is a member of the chat they will also be removed from the chat. If you don't want this, use the parameter only_if_banned. Returns True on success. */
734
787
  unbanChatMember(args: {
735
788
  /** Unique identifier for the target group or username of the target supergroup or channel (in the format @channelusername) */
@@ -739,6 +792,7 @@ export type ApiMethods<F> = {
739
792
  /** Do nothing if the user is not banned */
740
793
  only_if_banned?: boolean;
741
794
  }): true;
795
+
742
796
  /** Use this method to restrict a user in a supergroup. The bot must be an administrator in the supergroup for this to work and must have the appropriate administrator rights. Pass True for all permissions to lift restrictions from a user. Returns True on success. */
743
797
  restrictChatMember(args: {
744
798
  /** Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) */
@@ -749,9 +803,10 @@ export type ApiMethods<F> = {
749
803
  permissions: ChatPermissions;
750
804
  /** Pass True if chat permissions are set independently. Otherwise, the can_send_other_messages and can_add_web_page_previews permissions will imply the can_send_messages, can_send_audios, can_send_documents, can_send_photos, can_send_videos, can_send_video_notes, and can_send_voice_notes permissions; the can_send_polls permission will imply the can_send_messages permission. */
751
805
  use_independent_chat_permissions?: boolean;
752
- /** Date when restrictions will be lifted for the user, unix time. If user is restricted for more than 366 days or less than 30 seconds from the current time, they are considered to be restricted forever */
806
+ /** Date when restrictions will be lifted for the user; Unix time. If user is restricted for more than 366 days or less than 30 seconds from the current time, they are considered to be restricted forever */
753
807
  until_date?: number;
754
808
  }): true;
809
+
755
810
  /** Use this method to promote or demote a user in a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Pass False for all boolean parameters to demote a user. Returns True on success. */
756
811
  promoteChatMember(args: {
757
812
  /** Unique identifier for the target chat or username of the target channel (in the format @channelusername) */
@@ -760,23 +815,13 @@ export type ApiMethods<F> = {
760
815
  user_id: number;
761
816
  /** Pass True if the administrator's presence in the chat is hidden */
762
817
  is_anonymous?: boolean;
763
- /** Pass True if the administrator can access the chat event log, chat statistics, message statistics in channels, see channel members, see anonymous administrators in supergroups and ignore slow mode. Implied by any other administrator privilege */
818
+ /** Pass True if the administrator can access the chat event log, get boost list, see hidden supergroup and channel members, report spam messages and ignore slow mode. Implied by any other administrator privilege. */
764
819
  can_manage_chat?: boolean;
765
- /** Pass True if the administrator can create channel posts, channels only */
766
- can_post_messages?: boolean;
767
- /** Pass True if the administrator can edit messages of other users and can pin messages, channels only */
768
- can_edit_messages?: boolean;
769
820
  /** Pass True if the administrator can delete messages of other users */
770
821
  can_delete_messages?: boolean;
771
- /** Pass True if the administrator can post stories in the channel; channels only */
772
- can_post_stories?: boolean;
773
- /** Pass True if the administrator can edit stories posted by other users; channels only */
774
- can_edit_stories?: boolean;
775
- /** Pass True if the administrator can delete stories posted by other users; channels only */
776
- can_delete_stories?: boolean;
777
822
  /** Pass True if the administrator can manage video chats */
778
823
  can_manage_video_chats?: boolean;
779
- /** Pass True if the administrator can restrict, ban or unban chat members */
824
+ /** Pass True if the administrator can restrict, ban or unban chat members, or access supergroup statistics */
780
825
  can_restrict_members?: boolean;
781
826
  /** Pass True if the administrator can add new administrators with a subset of their own privileges or demote administrators that they have promoted, directly or indirectly (promoted by administrators that were appointed by him) */
782
827
  can_promote_members?: boolean;
@@ -784,11 +829,22 @@ export type ApiMethods<F> = {
784
829
  can_change_info?: boolean;
785
830
  /** Pass True if the administrator can invite new users to the chat */
786
831
  can_invite_users?: boolean;
832
+ /** Pass True if the administrator can post messages in the channel, or access channel statistics; channels only */
833
+ can_post_messages?: boolean;
834
+ /** Pass True if the administrator can edit messages of other users and can pin messages; channels only */
835
+ can_edit_messages?: boolean;
787
836
  /** Pass True if the administrator can pin messages, supergroups only */
788
837
  can_pin_messages?: boolean;
838
+ /** Pass True if the administrator can post stories to the chat */
839
+ can_post_stories?: boolean;
840
+ /** Pass True if the administrator can edit stories posted by other users */
841
+ can_edit_stories?: boolean;
842
+ /** Pass True if the administrator can delete stories posted by other users */
843
+ can_delete_stories?: boolean;
789
844
  /** Pass True if the user is allowed to create, rename, close, and reopen forum topics, supergroups only */
790
845
  can_manage_topics?: boolean;
791
846
  }): true;
847
+
792
848
  /** Use this method to set a custom title for an administrator in a supergroup promoted by the bot. Returns True on success. */
793
849
  setChatAdministratorCustomTitle(args: {
794
850
  /** Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) */
@@ -798,6 +854,7 @@ export type ApiMethods<F> = {
798
854
  /** New custom title for the administrator; 0-16 characters, emoji are not allowed */
799
855
  custom_title: string;
800
856
  }): true;
857
+
801
858
  /** Use this method to ban a channel chat in a supergroup or a channel. Until the chat is unbanned, the owner of the banned chat won't be able to send messages on behalf of any of their channels. The bot must be an administrator in the supergroup or channel for this to work and must have the appropriate administrator rights. Returns True on success. */
802
859
  banChatSenderChat(args: {
803
860
  /** Unique identifier for the target chat or username of the target channel (in the format @channelusername) */
@@ -805,6 +862,7 @@ export type ApiMethods<F> = {
805
862
  /** Unique identifier of the target sender chat */
806
863
  sender_chat_id: number;
807
864
  }): true;
865
+
808
866
  /** Use this method to unban a previously banned channel chat in a supergroup or channel. The bot must be an administrator for this to work and must have the appropriate administrator rights. Returns True on success. */
809
867
  unbanChatSenderChat(args: {
810
868
  /** Unique identifier for the target chat or username of the target channel (in the format @channelusername) */
@@ -812,6 +870,7 @@ export type ApiMethods<F> = {
812
870
  /** Unique identifier of the target sender chat */
813
871
  sender_chat_id: number;
814
872
  }): true;
873
+
815
874
  /** Use this method to set default chat permissions for all members. The bot must be an administrator in the group or a supergroup for this to work and must have the can_restrict_members administrator rights. Returns True on success. */
816
875
  setChatPermissions(args: {
817
876
  /** Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) */
@@ -821,6 +880,7 @@ export type ApiMethods<F> = {
821
880
  /** Pass True if chat permissions are set independently. Otherwise, the can_send_other_messages and can_add_web_page_previews permissions will imply the can_send_messages, can_send_audios, can_send_documents, can_send_photos, can_send_videos, can_send_video_notes, and can_send_voice_notes permissions; the can_send_polls permission will imply the can_send_messages permission. */
822
881
  use_independent_chat_permissions?: boolean;
823
882
  }): true;
883
+
824
884
  /** Use this method to generate a new primary invite link for a chat; any previously generated primary link is revoked. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns the new invite link as String on success.
825
885
 
826
886
  Note: Each administrator in a chat generates their own invite links. Bots can't use invite links generated by other administrators. If you want your bot to work with invite links, it will need to generate its own link using exportChatInviteLink or by calling the getChat method. If your bot needs to generate a new primary invite link replacing its previous one, use exportChatInviteLink again. */
@@ -828,6 +888,7 @@ export type ApiMethods<F> = {
828
888
  /** Unique identifier for the target chat or username of the target channel (in the format @channelusername) */
829
889
  chat_id: number | string;
830
890
  }): string;
891
+
831
892
  /** Use this method to create an additional invite link for a chat. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. The link can be revoked using the method revokeChatInviteLink. Returns the new invite link as ChatInviteLink object. */
832
893
  createChatInviteLink(args: {
833
894
  /** Unique identifier for the target chat or username of the target channel (in the format @channelusername) */
@@ -841,6 +902,7 @@ export type ApiMethods<F> = {
841
902
  /** True, if users joining the chat via the link need to be approved by chat administrators. If True, member_limit can't be specified */
842
903
  creates_join_request?: boolean;
843
904
  }): ChatInviteLink;
905
+
844
906
  /** Use this method to edit a non-primary invite link created by the bot. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns the edited invite link as a ChatInviteLink object. */
845
907
  editChatInviteLink(args: {
846
908
  /** Unique identifier for the target chat or username of the target channel (in the format @channelusername) */
@@ -856,6 +918,7 @@ export type ApiMethods<F> = {
856
918
  /** True, if users joining the chat via the link need to be approved by chat administrators. If True, member_limit can't be specified */
857
919
  creates_join_request?: boolean;
858
920
  }): ChatInviteLink;
921
+
859
922
  /** Use this method to revoke an invite link created by the bot. If the primary link is revoked, a new link is automatically generated. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns the revoked invite link as ChatInviteLink object. */
860
923
  revokeChatInviteLink(args: {
861
924
  /** Unique identifier of the target chat or username of the target channel (in the format @channelusername) */
@@ -863,6 +926,7 @@ export type ApiMethods<F> = {
863
926
  /** The invite link to revoke */
864
927
  invite_link: string;
865
928
  }): ChatInviteLink;
929
+
866
930
  /** Use this method to approve a chat join request. The bot must be an administrator in the chat for this to work and must have the can_invite_users administrator right. Returns True on success. */
867
931
  approveChatJoinRequest(args: {
868
932
  /** Unique identifier for the target chat or username of the target channel (in the format @channelusername) */
@@ -870,6 +934,7 @@ export type ApiMethods<F> = {
870
934
  /** Unique identifier of the target user */
871
935
  user_id: number;
872
936
  }): true;
937
+
873
938
  /** Use this method to decline a chat join request. The bot must be an administrator in the chat for this to work and must have the can_invite_users administrator right. Returns True on success. */
874
939
  declineChatJoinRequest(args: {
875
940
  /** Unique identifier for the target chat or username of the target channel (in the format @channelusername) */
@@ -877,18 +942,21 @@ export type ApiMethods<F> = {
877
942
  /** Unique identifier of the target user */
878
943
  user_id: number;
879
944
  }): true;
945
+
880
946
  /** Use this method to set a new profile photo for the chat. Photos can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns True on success. */
881
947
  setChatPhoto(args: {
882
948
  /** Unique identifier for the target chat or username of the target channel (in the format @channelusername) */
883
949
  chat_id: number | string;
884
950
  /** New chat photo, uploaded using multipart/form-data */
885
- photo: F;
951
+ photo: Buffer | ReadStream | string;
886
952
  }): true;
953
+
887
954
  /** Use this method to delete a chat photo. Photos can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns True on success. */
888
955
  deleteChatPhoto(args: {
889
956
  /** Unique identifier for the target chat or username of the target channel (in the format @channelusername) */
890
957
  chat_id: number | string;
891
958
  }): true;
959
+
892
960
  /** Use this method to change the title of a chat. Titles can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns True on success. */
893
961
  setChatTitle(args: {
894
962
  /** Unique identifier for the target chat or username of the target channel (in the format @channelusername) */
@@ -896,6 +964,7 @@ export type ApiMethods<F> = {
896
964
  /** New chat title, 1-128 characters */
897
965
  title: string;
898
966
  }): true;
967
+
899
968
  /** Use this method to change the description of a group, a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns True on success. */
900
969
  setChatDescription(args: {
901
970
  /** Unique identifier for the target chat or username of the target channel (in the format @channelusername) */
@@ -903,6 +972,7 @@ export type ApiMethods<F> = {
903
972
  /** New chat description, 0-255 characters */
904
973
  description?: string;
905
974
  }): true;
975
+
906
976
  /** Use this method to add a message to the list of pinned messages in a chat. If the chat is not a private chat, the bot must be an administrator in the chat for this to work and must have the 'can_pin_messages' admin right in a supergroup or 'can_edit_messages' admin right in a channel. Returns True on success. */
907
977
  pinChatMessage(args: {
908
978
  /** Unique identifier for the target chat or username of the target channel (in the format @channelusername) */
@@ -912,6 +982,7 @@ export type ApiMethods<F> = {
912
982
  /** Pass True if it is not necessary to send a notification to all chat members about the new pinned message. Notifications are always disabled in channels and private chats. */
913
983
  disable_notification?: boolean;
914
984
  }): true;
985
+
915
986
  /** Use this method to remove a message from the list of pinned messages in a chat. If the chat is not a private chat, the bot must be an administrator in the chat for this to work and must have the 'can_pin_messages' admin right in a supergroup or 'can_edit_messages' admin right in a channel. Returns True on success. */
916
987
  unpinChatMessage(args: {
917
988
  /** Unique identifier for the target chat or username of the target channel (in the format @channelusername) */
@@ -919,34 +990,41 @@ export type ApiMethods<F> = {
919
990
  /** Identifier of a message to unpin. If not specified, the most recent pinned message (by sending date) will be unpinned. */
920
991
  message_id?: number;
921
992
  }): true;
993
+
922
994
  /** Use this method to clear the list of pinned messages in a chat. If the chat is not a private chat, the bot must be an administrator in the chat for this to work and must have the 'can_pin_messages' admin right in a supergroup or 'can_edit_messages' admin right in a channel. Returns True on success. */
923
995
  unpinAllChatMessages(args: {
924
996
  /** Unique identifier for the target chat or username of the target channel (in the format @channelusername) */
925
997
  chat_id: number | string;
926
998
  }): true;
999
+
927
1000
  /** Use this method for your bot to leave a group, supergroup or channel. Returns True on success. */
928
1001
  leaveChat(args: {
929
1002
  /** Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername) */
930
1003
  chat_id: number | string;
931
1004
  }): true;
1005
+
932
1006
  /** Use this method to get up to date information about the chat. Returns a Chat object on success. */
933
1007
  getChat(args: {
934
1008
  /** Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername) */
935
1009
  chat_id: number | string;
936
1010
  }): ChatFromGetChat;
1011
+
937
1012
  /** Use this method to get a list of administrators in a chat, which aren't bots. Returns an Array of ChatMember objects. */
938
1013
  getChatAdministrators(args: {
939
1014
  /** Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername) */
940
1015
  chat_id: number | string;
941
1016
  }): Array<ChatMemberOwner | ChatMemberAdministrator>;
1017
+
942
1018
  /** Use this method to get the number of members in a chat. Returns Int on success.
943
1019
  * @deprecated Use `getChatMemberCount` instead. */
944
- getChatMembersCount: ApiMethods<F>["getChatMemberCount"];
1020
+ getChatMembersCount: ApiMethods["getChatMemberCount"];
1021
+
945
1022
  /** Use this method to get the number of members in a chat. Returns Int on success. */
946
1023
  getChatMemberCount(args: {
947
1024
  /** Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername) */
948
1025
  chat_id: number | string;
949
1026
  }): number;
1027
+
950
1028
  /** Use this method to get information about a member of a chat. The method is only guaranteed to work for other users if the bot is an administrator in the chat. Returns a ChatMember object on success. */
951
1029
  getChatMember(args: {
952
1030
  /** Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername) */
@@ -954,6 +1032,7 @@ export type ApiMethods<F> = {
954
1032
  /** Unique identifier of the target user */
955
1033
  user_id: number;
956
1034
  }): ChatMember;
1035
+
957
1036
  /** Use this method to set a new group sticker set for a supergroup. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Use the field can_set_sticker_set ly returned in getChat requests to check if the bot can use this method. Returns True on success. */
958
1037
  setChatStickerSet(args: {
959
1038
  /** Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) */
@@ -961,11 +1040,13 @@ export type ApiMethods<F> = {
961
1040
  /** Name of the sticker set to be set as the group sticker set */
962
1041
  sticker_set_name: string;
963
1042
  }): true;
1043
+
964
1044
  /** Use this method to delete a group sticker set from a supergroup. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Use the field can_set_sticker_set ly returned in getChat requests to check if the bot can use this method. Returns True on success. */
965
1045
  deleteChatStickerSet(args: {
966
1046
  /** Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) */
967
1047
  chat_id: number | string;
968
1048
  }): true;
1049
+
969
1050
  /** Use this method to get custom emoji stickers, which can be used as a forum topic icon by any user. Requires no parameters. Returns an Array of Sticker objects. */
970
1051
  getForumTopicIconStickers(): Sticker[];
971
1052
  /** Use this method to create a topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights. Returns information about the created topic as a ForumTopic object. */
@@ -985,6 +1066,7 @@ export type ApiMethods<F> = {
985
1066
  /** Unique identifier of the custom emoji shown as the topic icon. Use getForumTopicIconStickers to get all allowed custom emoji identifiers. */
986
1067
  icon_custom_emoji_id?: string;
987
1068
  }): ForumTopic;
1069
+
988
1070
  /** Use this method to edit name and icon of a topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have can_manage_topics administrator rights, unless it is the creator of the topic. Returns True on success. */
989
1071
  editForumTopic(args: {
990
1072
  /** Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) */
@@ -996,6 +1078,7 @@ export type ApiMethods<F> = {
996
1078
  /** New unique identifier of the custom emoji shown as the topic icon. Use getForumTopicIconStickers to get all allowed custom emoji identifiers. Pass an empty string to remove the icon. If not specified, the current icon will be kept */
997
1079
  icon_custom_emoji_id?: string;
998
1080
  }): true;
1081
+
999
1082
  /** Use this method to close an open topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights, unless it is the creator of the topic. Returns True on success. */
1000
1083
  closeForumTopic(args: {
1001
1084
  /** Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) */
@@ -1003,6 +1086,7 @@ export type ApiMethods<F> = {
1003
1086
  /** Unique identifier for the target message thread of the forum topic */
1004
1087
  message_thread_id: number;
1005
1088
  }): true;
1089
+
1006
1090
  /** Use this method to reopen a closed topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights, unless it is the creator of the topic. Returns True on success. */
1007
1091
  reopenForumTopic(args: {
1008
1092
  /** Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) */
@@ -1010,6 +1094,7 @@ export type ApiMethods<F> = {
1010
1094
  /** Unique identifier for the target message thread of the forum topic */
1011
1095
  message_thread_id: number;
1012
1096
  }): true;
1097
+
1013
1098
  /** Use this method to delete a forum topic along with all its messages in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_delete_messages administrator rights. Returns True on success. */
1014
1099
  deleteForumTopic(args: {
1015
1100
  /** Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) */
@@ -1017,6 +1102,7 @@ export type ApiMethods<F> = {
1017
1102
  /** Unique identifier for the target message thread of the forum topic */
1018
1103
  message_thread_id: number;
1019
1104
  }): true;
1105
+
1020
1106
  /** Use this method to clear the list of pinned messages in a forum topic. The bot must be an administrator in the chat for this to work and must have the can_pin_messages administrator right in the supergroup. Returns True on success. */
1021
1107
  unpinAllForumTopicMessages(args: {
1022
1108
  /** Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) */
@@ -1024,6 +1110,7 @@ export type ApiMethods<F> = {
1024
1110
  /** Unique identifier for the target message thread of the forum topic */
1025
1111
  message_thread_id: number;
1026
1112
  }): true;
1113
+
1027
1114
  /** Use this method to edit the name of the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have can_manage_topics administrator rights. Returns True on success. */
1028
1115
  editGeneralForumTopic(args: {
1029
1116
  /** Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) */
@@ -1031,31 +1118,37 @@ export type ApiMethods<F> = {
1031
1118
  /** New topic name, 1-128 characters */
1032
1119
  name: string;
1033
1120
  }): true;
1121
+
1034
1122
  /** Use this method to close an open 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights. Returns True on success. */
1035
1123
  closeGeneralForumTopic(args: {
1036
1124
  /** Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) */
1037
1125
  chat_id: number | string;
1038
1126
  }): true;
1127
+
1039
1128
  /** Use this method to reopen a closed 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights. The topic will be automatically unhidden if it was hidden. Returns True on success. */
1040
1129
  reopenGeneralForumTopic(args: {
1041
1130
  /** Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) */
1042
1131
  chat_id: number | string;
1043
1132
  }): true;
1133
+
1044
1134
  /** Use this method to hide the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights. The topic will be automatically closed if it was open. Returns True on success. */
1045
1135
  hideGeneralForumTopic(args: {
1046
1136
  /** Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) */
1047
1137
  chat_id: number | string;
1048
1138
  }): true;
1139
+
1049
1140
  /** Use this method to unhide the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights. Returns True on success. */
1050
1141
  unhideGeneralForumTopic(args: {
1051
1142
  /** Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) */
1052
1143
  chat_id: number | string;
1053
1144
  }): true;
1145
+
1054
1146
  /** Use this method to clear the list of pinned messages in a General forum topic. The bot must be an administrator in the chat for this to work and must have the can_pin_messages administrator right in the supergroup. Returns True on success. */
1055
1147
  unpinAllGeneralForumTopicMessages(args: {
1056
1148
  /** Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) */
1057
1149
  chat_id: number | string;
1058
1150
  }): true;
1151
+
1059
1152
  /** Use this method to send answers to callback queries sent from inline keyboards. The answer will be displayed to the user as a notification at the top of the chat screen or as an alert. On success, True is returned.
1060
1153
 
1061
1154
  Alternatively, the user can be redirected to the specified Game URL. For this option to work, you must first create a game for your bot via @BotFather and accept the terms. Otherwise, you may use links like t.me/your_bot?start=XXXX that open your bot with a parameter. */
@@ -1073,6 +1166,7 @@ export type ApiMethods<F> = {
1073
1166
  /** The maximum amount of time in seconds that the result of the callback query may be cached client-side. Telegram apps will support caching starting in version 3.14. Defaults to 0. */
1074
1167
  cache_time?: number;
1075
1168
  }): true;
1169
+
1076
1170
  /** Use this method to get the list of boosts added to a chat by a user. Requires administrator rights in the chat. Returns a UserChatBoosts object. */
1077
1171
  getUserChatBoosts(args: {
1078
1172
  /** Unique identifier for the chat or username of the channel (in the format @channelusername) */
@@ -1080,18 +1174,7 @@ export type ApiMethods<F> = {
1080
1174
  /** Unique identifier of the target user */
1081
1175
  user_id: number;
1082
1176
  }): UserChatBoosts;
1083
- /** Use this method to change the bot's name. Returns True on success. */
1084
- setMyName(args: {
1085
- /** New bot name; 0-64 characters. Pass an empty string to remove the dedicated name for the given language. */
1086
- name?: string;
1087
- /** A two-letter ISO 639-1 language code. If empty, the name will be shown to all users for whose language there is no dedicated name. */
1088
- language_code?: string;
1089
- }): true;
1090
- /** Use this method to get the current bot name for the given user language. Returns BotName on success. */
1091
- getMyName(args: {
1092
- /** A two-letter ISO 639-1 language code or an empty string */
1093
- language_code?: string;
1094
- }): BotName;
1177
+
1095
1178
  /** Use this method to change the list of the bot's commands. See https://core.telegram.org/bots#commands for more details about bot commands. Returns True on success. */
1096
1179
  setMyCommands(args: {
1097
1180
  /** A list of bot commands to be set as the list of the bot's commands. At most 100 commands can be specified. */
@@ -1101,6 +1184,7 @@ export type ApiMethods<F> = {
1101
1184
  /** A two-letter ISO 639-1 language code. If empty, commands will be applied to all users from the given scope, for whose language there are no dedicated commands */
1102
1185
  language_code?: string;
1103
1186
  }): true;
1187
+
1104
1188
  /** Use this method to delete the list of the bot's commands for the given scope and user language. After deletion, higher level commands will be shown to affected users. Returns True on success. */
1105
1189
  deleteMyCommands(args: {
1106
1190
  /** An object, describing scope of users for which the commands are relevant. Defaults to BotCommandScopeDefault. */
@@ -1108,6 +1192,7 @@ export type ApiMethods<F> = {
1108
1192
  /** A two-letter ISO 639-1 language code. If empty, commands will be applied to all users from the given scope, for whose language there are no dedicated commands */
1109
1193
  language_code?: string;
1110
1194
  }): true;
1195
+
1111
1196
  /** Use this method to get the current list of the bot's commands for the given scope and user language. Returns an Array of BotCommand objects. If commands aren't set, an empty list is returned. */
1112
1197
  getMyCommands(args: {
1113
1198
  /** An object, describing scope of users. Defaults to BotCommandScopeDefault. */
@@ -1115,6 +1200,21 @@ export type ApiMethods<F> = {
1115
1200
  /** A two-letter ISO 639-1 language code or an empty string */
1116
1201
  language_code?: string;
1117
1202
  }): BotCommand[];
1203
+
1204
+ /** Use this method to change the bot's name. Returns True on success. */
1205
+ setMyName(args: {
1206
+ /** New bot name; 0-64 characters. Pass an empty string to remove the dedicated name for the given language. */
1207
+ name?: string;
1208
+ /** A two-letter ISO 639-1 language code. If empty, the name will be shown to all users for whose language there is no dedicated name. */
1209
+ language_code?: string;
1210
+ }): true;
1211
+
1212
+ /** Use this method to get the current bot name for the given user language. Returns BotName on success. */
1213
+ getMyName(args: {
1214
+ /** A two-letter ISO 639-1 language code or an empty string */
1215
+ language_code?: string;
1216
+ }): BotName;
1217
+
1118
1218
  /** Use this method to change the bot's description, which is shown in the chat with the bot if the chat is empty. Returns True on success. */
1119
1219
  setMyDescription(args: {
1120
1220
  /** New bot description; 0-512 characters. Pass an empty string to remove the dedicated description for the given language. */
@@ -1122,11 +1222,13 @@ export type ApiMethods<F> = {
1122
1222
  /** A two-letter ISO 639-1 language code. If empty, the description will be applied to all users for whose language there is no dedicated description. */
1123
1223
  language_code?: string;
1124
1224
  }): true;
1225
+
1125
1226
  /** Use this method to get the current bot description for the given user language. Returns BotDescription on success. */
1126
1227
  getMyDescription(args: {
1127
1228
  /** A two-letter ISO 639-1 language code or an empty string */
1128
1229
  language_code?: string;
1129
1230
  }): BotDescription;
1231
+
1130
1232
  /** Use this method to change the bot's short description, which is shown on the bot's profile page and is sent together with the link when users share the bot. Returns True on success. */
1131
1233
  setMyShortDescription(args: {
1132
1234
  /** New short description for the bot; 0-120 characters. Pass an empty string to remove the dedicated short description for the given language. */
@@ -1134,11 +1236,13 @@ export type ApiMethods<F> = {
1134
1236
  /** A two-letter ISO 639-1 language code. If empty, the short description will be applied to all users for whose language there is no dedicated short description. */
1135
1237
  language_code?: string;
1136
1238
  }): true;
1239
+
1137
1240
  /** Use this method to get the current bot short description for the given user language. Returns BotShortDescription on success. */
1138
1241
  getMyShortDescription(args: {
1139
1242
  /** A two-letter ISO 639-1 language code or an empty string */
1140
1243
  language_code?: string;
1141
1244
  }): BotShortDescription;
1245
+
1142
1246
  /** Use this method to change the bot's menu button in a private chat, or the default menu button. Returns True on success. */
1143
1247
  setChatMenuButton(args: {
1144
1248
  /** Unique identifier for the target private chat. If not specified, default bot's menu button will be changed */
@@ -1146,11 +1250,13 @@ export type ApiMethods<F> = {
1146
1250
  /** An object for the bot's new menu button. Defaults to MenuButtonDefault */
1147
1251
  menu_button?: MenuButton;
1148
1252
  }): true;
1253
+
1149
1254
  /** Use this method to get the current value of the bot's menu button in a private chat, or the default menu button. Returns MenuButton on success. */
1150
1255
  getChatMenuButton(args: {
1151
1256
  /** Unique identifier for the target private chat. If not specified, default bot's menu button will be returned */
1152
1257
  chat_id?: number;
1153
1258
  }): MenuButton;
1259
+
1154
1260
  /** Use this method to change the default administrator rights requested by the bot when it's added as an administrator to groups or channels. These rights will be suggested to users, but they are free to modify the list before adding the bot. Returns True on success. */
1155
1261
  setMyDefaultAdministratorRights(args: {
1156
1262
  /** An object describing new default administrator rights. If not specified, the default administrator rights will be cleared. */
@@ -1158,11 +1264,13 @@ export type ApiMethods<F> = {
1158
1264
  /** Pass True to change the default administrator rights of the bot in channels. Otherwise, the default administrator rights of the bot for groups and supergroups will be changed. */
1159
1265
  for_channels?: boolean;
1160
1266
  }): true;
1267
+
1161
1268
  /** Use this method to get the current default administrator rights of the bot. Returns ChatAdministratorRights on success. */
1162
1269
  getMyDefaultAdministratorRights(args: {
1163
1270
  /** Pass True to get default administrator rights of the bot in channels. Otherwise, default administrator rights of the bot for groups and supergroups will be returned. */
1164
1271
  for_channels?: boolean;
1165
1272
  }): ChatAdministratorRights;
1273
+
1166
1274
  /** Use this method to edit text and game messages. On success, if the edited message is not an inline message, the edited Message is returned, otherwise True is returned. */
1167
1275
  editMessageText(args: {
1168
1276
  /** Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername) */
@@ -1177,11 +1285,12 @@ export type ApiMethods<F> = {
1177
1285
  parse_mode?: ParseMode;
1178
1286
  /** A list of special entities that appear in message text, which can be specified instead of parse_mode */
1179
1287
  entities?: MessageEntity[];
1180
- /** Disables link previews for links in this message */
1181
- disable_web_page_preview?: boolean;
1288
+ /** Link preview generation options for the message */
1289
+ link_preview_options?: LinkPreviewOptions;
1182
1290
  /** An object for an inline keyboard. */
1183
1291
  reply_markup?: InlineKeyboardMarkup;
1184
1292
  }): (Update.Edited & Message.TextMessage) | true;
1293
+
1185
1294
  /** Use this method to edit captions of messages. On success, if the edited message is not an inline message, the edited Message is returned, otherwise True is returned. */
1186
1295
  editMessageCaption(args: {
1187
1296
  /** Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername) */
@@ -1199,6 +1308,7 @@ export type ApiMethods<F> = {
1199
1308
  /** An object for an inline keyboard. */
1200
1309
  reply_markup?: InlineKeyboardMarkup;
1201
1310
  }): (Update.Edited & Message.CaptionableMessage) | true;
1311
+
1202
1312
  /** Use this method to edit animation, audio, document, photo, or video messages. If a message is part of a message album, then it can be edited only to an audio for audio albums, only to a document for document albums and to a photo or a video otherwise. When an inline message is edited, a new file can't be uploaded; use a previously uploaded file via its file_id or specify a URL. On success, if the edited message is not an inline message, the edited Message is returned, otherwise True is returned. */
1203
1313
  editMessageMedia(args: {
1204
1314
  /** Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername) */
@@ -1208,10 +1318,11 @@ export type ApiMethods<F> = {
1208
1318
  /** Required if chat_id and message_id are not specified. Identifier of the inline message */
1209
1319
  inline_message_id?: string;
1210
1320
  /** An object for a new media content of the message */
1211
- media: InputMedia<F>;
1321
+ media: InputMedia;
1212
1322
  /** An object for a new inline keyboard. */
1213
1323
  reply_markup?: InlineKeyboardMarkup;
1214
1324
  }): (Update.Edited & Message) | true;
1325
+
1215
1326
  /** Use this method to edit only the reply markup of messages. On success, if the edited message is not an inline message, the edited Message is returned, otherwise True is returned. */
1216
1327
  editMessageReplyMarkup(args: {
1217
1328
  /** Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername) */
@@ -1223,6 +1334,7 @@ export type ApiMethods<F> = {
1223
1334
  /** An object for an inline keyboard. */
1224
1335
  reply_markup?: InlineKeyboardMarkup;
1225
1336
  }): (Update.Edited & Message) | true;
1337
+
1226
1338
  /** Use this method to stop a poll which was sent by the bot. On success, the stopped Poll is returned. */
1227
1339
  stopPoll(args: {
1228
1340
  /** Unique identifier for the target chat or username of the target channel (in the format @channelusername) */
@@ -1232,6 +1344,7 @@ export type ApiMethods<F> = {
1232
1344
  /** An object for a new message inline keyboard. */
1233
1345
  reply_markup?: InlineKeyboardMarkup;
1234
1346
  }): Poll;
1347
+
1235
1348
  /** Use this method to delete a message, including service messages, with the following limitations:
1236
1349
  - A message can only be deleted if it was sent less than 48 hours ago.
1237
1350
  - Service messages about a supergroup, channel, or forum topic creation can't be deleted.
@@ -1248,6 +1361,7 @@ export type ApiMethods<F> = {
1248
1361
  /** Identifier of the message to delete */
1249
1362
  message_id: number;
1250
1363
  }): true;
1364
+
1251
1365
  /** Use this method to delete multiple messages simultaneously. Returns True on success. */
1252
1366
  deleteMessages(args: {
1253
1367
  /** Unique identifier for the target chat or username of the target channel (in the format @channelusername) */
@@ -1255,6 +1369,7 @@ export type ApiMethods<F> = {
1255
1369
  /** Identifiers of 1-100 messages to delete. See deleteMessage for limitations on which messages can be deleted */
1256
1370
  message_ids: number[];
1257
1371
  }): true;
1372
+
1258
1373
  /** Use this method to send static .WEBP, animated .TGS, or video .WEBM stickers. On success, the sent Message is returned. */
1259
1374
  sendSticker(args: {
1260
1375
  /** Unique identifier for the target chat or username of the target channel (in the format @channelusername) */
@@ -1262,7 +1377,7 @@ export type ApiMethods<F> = {
1262
1377
  /** Unique identifier for the target message thread (topic) of the forum; for forum supergroups only */
1263
1378
  message_thread_id?: number;
1264
1379
  /** Sticker to send. Pass a file_id as String to send a file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a .WEBP sticker from the Internet, or upload a new .WEBP or .TGS sticker using multipart/form-data. Video stickers can only be sent by a file_id. Animated stickers can't be sent via an HTTP URL. */
1265
- sticker: F | string;
1380
+ sticker: Buffer | ReadStream | string | string;
1266
1381
  /** Emoji associated with the sticker; only for just uploaded stickers */
1267
1382
  emoji?: string;
1268
1383
  /** Sends the message silently. Users will receive a notification with no sound. */
@@ -1277,17 +1392,22 @@ export type ApiMethods<F> = {
1277
1392
  | ReplyKeyboardMarkup
1278
1393
  | ReplyKeyboardRemove
1279
1394
  | ForceReply;
1395
+ /** @deprecated Use `reply_parameters` instead. */
1396
+ reply_to_message_id?: number;
1280
1397
  }): Message.StickerMessage;
1398
+
1281
1399
  /** Use this method to get a sticker set. On success, a StickerSet object is returned. */
1282
1400
  getStickerSet(args: {
1283
1401
  /** Name of the sticker set */
1284
1402
  name: string;
1285
1403
  }): StickerSet;
1404
+
1286
1405
  /** Use this method to get information about custom emoji stickers by their identifiers. Returns an Array of Sticker objects. */
1287
1406
  getCustomEmojiStickers(args: {
1288
1407
  /** List of custom emoji identifiers. At most 200 custom emoji identifiers can be specified. */
1289
1408
  custom_emoji_ids: string[];
1290
1409
  }): Sticker[];
1410
+
1291
1411
  /** Use this method to upload a file with a sticker for later use in the createNewStickerSet and addStickerToSet methods (the file can be used multiple times). Returns the uploaded File on success. */
1292
1412
  uploadStickerFile(args: {
1293
1413
  /** User identifier of sticker file owner */
@@ -1295,8 +1415,9 @@ export type ApiMethods<F> = {
1295
1415
  /** Format of the sticker, must be one of “static”, “animated”, “video” */
1296
1416
  sticker_format: "static" | "animated" | "video";
1297
1417
  /** A file with the sticker in .WEBP, .PNG, .TGS, or .WEBM format. See https://core.telegram.org/stickers for technical requirements. */
1298
- sticker: F;
1418
+ sticker: Buffer | ReadStream | string;
1299
1419
  }): File;
1420
+
1300
1421
  /** Use this method to create a new sticker set owned by a user. The bot will be able to edit the sticker set thus created. Returns True on success. */
1301
1422
  createNewStickerSet(args: {
1302
1423
  /** User identifier of created sticker set owner */
@@ -1306,7 +1427,7 @@ export type ApiMethods<F> = {
1306
1427
  /** Sticker set title, 1-64 characters */
1307
1428
  title: string;
1308
1429
  /** A list of 1-50 initial stickers to be added to the sticker set */
1309
- stickers: InputSticker<F>[];
1430
+ stickers: InputSticker[];
1310
1431
  /** Format of the sticker, must be one of “static”, “animated”, “video” */
1311
1432
  sticker_format: "static" | "animated" | "video";
1312
1433
  /** Type of stickers in the set, pass “regular”, “mask”, or “custom_emoji”. By default, a regular sticker set is created. */
@@ -1314,6 +1435,7 @@ export type ApiMethods<F> = {
1314
1435
  /** Pass True if stickers in the sticker set must be repainted to the color of text when used in messages, the accent color if used as emoji status, white on chat photos, or another appropriate color based on context; for custom emoji sticker sets only */
1315
1436
  needs_repainting?: boolean;
1316
1437
  }): true;
1438
+
1317
1439
  /** Use this method to add a new sticker to a set created by the bot. The format of the added sticker must match the format of the other stickers in the set. Emoji sticker sets can have up to 200 stickers. Animated and video sticker sets can have up to 50 stickers. Static sticker sets can have up to 120 stickers. Returns True on success. */
1318
1440
  addStickerToSet(args: {
1319
1441
  /** User identifier of sticker set owner */
@@ -1321,8 +1443,9 @@ export type ApiMethods<F> = {
1321
1443
  /** Sticker set name */
1322
1444
  name: string;
1323
1445
  /** An object with information about the added sticker. If exactly the same sticker had already been added to the set, then the set isn't changed. */
1324
- sticker: InputSticker<F>;
1446
+ sticker: InputSticker;
1325
1447
  }): true;
1448
+
1326
1449
  /** Use this method to move a sticker in a set created by the bot to a specific position. Returns True on success. */
1327
1450
  setStickerPositionInSet(args: {
1328
1451
  /** File identifier of the sticker */
@@ -1330,11 +1453,13 @@ export type ApiMethods<F> = {
1330
1453
  /** New sticker position in the set, zero-based */
1331
1454
  position: number;
1332
1455
  }): true;
1456
+
1333
1457
  /** Use this method to delete a sticker from a set created by the bot. Returns True on success. */
1334
1458
  deleteStickerFromSet(args: {
1335
1459
  /** File identifier of the sticker */
1336
1460
  sticker: string;
1337
1461
  }): true;
1462
+
1338
1463
  /** Use this method to change the list of emoji assigned to a regular or custom emoji sticker. The sticker must belong to a sticker set created by the bot. Returns True on success. */
1339
1464
  setStickerEmojiList(args: {
1340
1465
  /** File identifier of the sticker */
@@ -1342,6 +1467,7 @@ export type ApiMethods<F> = {
1342
1467
  /** A list of 1-20 emoji associated with the sticker */
1343
1468
  emoji_list: string[];
1344
1469
  }): true;
1470
+
1345
1471
  /** Use this method to change search keywords assigned to a regular or custom emoji sticker. The sticker must belong to a sticker set created by the bot. Returns True on success. */
1346
1472
  setStickerKeywords(args: {
1347
1473
  /** File identifier of the sticker */
@@ -1349,6 +1475,7 @@ export type ApiMethods<F> = {
1349
1475
  /** A list of 0-20 search keywords for the sticker with total length of up to 64 characters */
1350
1476
  keywords?: string[];
1351
1477
  }): true;
1478
+
1352
1479
  /** Use this method to change the mask position of a mask sticker. The sticker must belong to a sticker set that was created by the bot. Returns True on success. */
1353
1480
  setStickerMaskPosition(args: {
1354
1481
  /** File identifier of the sticker */
@@ -1356,6 +1483,7 @@ export type ApiMethods<F> = {
1356
1483
  /** An object with the position where the mask should be placed on faces. Omit the parameter to remove the mask position. */
1357
1484
  mask_position?: MaskPosition;
1358
1485
  }): true;
1486
+
1359
1487
  /** Use this method to set the title of a created sticker set. Returns True on success. */
1360
1488
  setStickerSetTitle(args: {
1361
1489
  /** Sticker set name */
@@ -1363,11 +1491,13 @@ export type ApiMethods<F> = {
1363
1491
  /** Sticker set title, 1-64 characters */
1364
1492
  title: string;
1365
1493
  }): true;
1494
+
1366
1495
  /** Use this method to delete a sticker set that was created by the bot. Returns True on success. */
1367
1496
  deleteStickerSet(args: {
1368
1497
  /** Sticker set name */
1369
1498
  name: string;
1370
1499
  }): true;
1500
+
1371
1501
  /** Use this method to set the thumbnail of a regular or mask sticker set. The format of the thumbnail file must match the format of the stickers in the set. Returns True on success. */
1372
1502
  setStickerSetThumbnail(args: {
1373
1503
  /** Sticker set name */
@@ -1375,8 +1505,9 @@ export type ApiMethods<F> = {
1375
1505
  /** User identifier of the sticker set owner */
1376
1506
  user_id: number;
1377
1507
  /** A .WEBP or .PNG image with the thumbnail, must be up to 128 kilobytes in size and have a width and height of exactly 100px, or a .TGS animation with a thumbnail up to 32 kilobytes in size (see https://core.telegram.org/stickers#animated-sticker-requirements for animated sticker technical requirements), or a WEBM video with the thumbnail up to 32 kilobytes in size; see https://core.telegram.org/stickers#video-sticker-requirements for video sticker technical requirements. Pass a file_id as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. More information on Sending Files ». Animated and video sticker set thumbnails can't be uploaded via HTTP URL. If omitted, then the thumbnail is dropped and the first sticker is used as the thumbnail. */
1378
- thumbnail?: F | string;
1508
+ thumbnail?: Buffer | ReadStream | string | string;
1379
1509
  }): true;
1510
+
1380
1511
  /** Use this method to set the thumbnail of a custom emoji sticker set. Returns True on success. */
1381
1512
  setCustomEmojiStickerSetThumbnail(args: {
1382
1513
  /** Sticker set name */
@@ -1384,6 +1515,7 @@ export type ApiMethods<F> = {
1384
1515
  /** Custom emoji identifier of a sticker from the sticker set; pass an empty string to drop the thumbnail and use the first sticker as the thumbnail. */
1385
1516
  custom_emoji_id?: string;
1386
1517
  }): true;
1518
+
1387
1519
  /** Use this method to send answers to an inline query. On success, True is returned.
1388
1520
  No more than 50 results per query are allowed.
1389
1521
 
@@ -1395,13 +1527,14 @@ export type ApiMethods<F> = {
1395
1527
  results: readonly InlineQueryResult[];
1396
1528
  /** The maximum amount of time in seconds that the result of the inline query may be cached on the server. Defaults to 300. */
1397
1529
  cache_time?: number;
1398
- /** Pass True if results may be cached on the server side only for the user that sent the query. By default, results may be returned to any user who sends the same query */
1530
+ /** Pass True if results may be cached on the server side only for the user that sent the query. By default, results may be returned to any user who sends the same query. */
1399
1531
  is_personal?: boolean;
1400
1532
  /** Pass the offset that a client should send in the next query with the same text to receive more results. Pass an empty string if there are no more results or if you don't support pagination. Offset length can't exceed 64 bytes. */
1401
1533
  next_offset?: string;
1402
1534
  /** An object describing a button to be shown above inline query results */
1403
1535
  button?: InlineQueryResultsButton;
1404
1536
  }): true;
1537
+
1405
1538
  /** Use this method to set the result of an interaction with a Web App and send a corresponding message on behalf of the user to the chat from which the query originated. On success, a SentWebAppMessage object is returned. */
1406
1539
  answerWebAppQuery(args: {
1407
1540
  /** Unique identifier for the query to be answered */
@@ -1409,6 +1542,7 @@ export type ApiMethods<F> = {
1409
1542
  /** An object describing the message to be sent */
1410
1543
  result: InlineQueryResult;
1411
1544
  }): SentWebAppMessage;
1545
+
1412
1546
  /** Use this method to send invoices. On success, the sent Message is returned. */
1413
1547
  sendInvoice(args: {
1414
1548
  /** Unique identifier for the target chat or username of the target channel (in the format @channelusername) */
@@ -1465,7 +1599,10 @@ export type ApiMethods<F> = {
1465
1599
  reply_parameters?: ReplyParameters;
1466
1600
  /** An object for an inline keyboard. If empty, one 'Pay total price' button will be shown. If not empty, the first button must be a Pay button. */
1467
1601
  reply_markup?: InlineKeyboardMarkup;
1602
+ /** @deprecated Use `reply_parameters` instead. */
1603
+ reply_to_message_id?: number;
1468
1604
  }): Message.InvoiceMessage;
1605
+
1469
1606
  /** Use this method to create a link for an invoice. Returns the created invoice link as String on success. */
1470
1607
  createInvoiceLink(args: {
1471
1608
  /** Product name, 1-32 characters */
@@ -1509,6 +1646,7 @@ export type ApiMethods<F> = {
1509
1646
  /** Pass True if the final price depends on the shipping method */
1510
1647
  is_flexible?: boolean;
1511
1648
  }): string;
1649
+
1512
1650
  /** If you sent an invoice requesting a shipping address and the parameter is_flexible was specified, the Bot API will send an Update with a shipping_query field to the bot. Use this method to reply to shipping queries. On success, True is returned. */
1513
1651
  answerShippingQuery(args: {
1514
1652
  /** Unique identifier for the query to be answered */
@@ -1520,6 +1658,7 @@ export type ApiMethods<F> = {
1520
1658
  /** Required if ok is False. Error message in human readable form that explains why it is impossible to complete the order (e.g. "Sorry, delivery to your desired address is unavailable'). Telegram will display this message to the user. */
1521
1659
  error_message?: string;
1522
1660
  }): true;
1661
+
1523
1662
  /** Once the user has confirmed their payment and shipping details, the Bot API sends the final confirmation in the form of an Update with the field pre_checkout_query. Use this method to respond to such pre-checkout queries. On success, True is returned. Note: The Bot API must receive an answer within 10 seconds after the pre-checkout query was sent. */
1524
1663
  answerPreCheckoutQuery(args: {
1525
1664
  /** Unique identifier for the query to be answered */
@@ -1529,6 +1668,7 @@ export type ApiMethods<F> = {
1529
1668
  /** Required if ok is False. Error message in human readable form that explains the reason for failure to proceed with the checkout (e.g. "Sorry, somebody just bought the last of our amazing black T-shirts while you were busy filling out your payment details. Please choose a different color or garment!"). Telegram will display this message to the user. */
1530
1669
  error_message?: string;
1531
1670
  }): true;
1671
+
1532
1672
  /** Informs a user that some of the Telegram Passport elements they provided contains errors. The user will not be able to re-submit their Passport to you until the errors are fixed (the contents of the field for which you returned the error must change). Returns True on success.
1533
1673
 
1534
1674
  Use this if the data submitted by the user doesn't satisfy the standards your service requires for any reason. For example, if a birthday date seems invalid, a submitted document is blurry, a scan shows evidence of tampering, etc. Supply some details in the error message to make sure the user knows how to correct the issues. */
@@ -1538,6 +1678,7 @@ export type ApiMethods<F> = {
1538
1678
  /** An array describing the errors */
1539
1679
  errors: readonly PassportElementError[];
1540
1680
  }): true;
1681
+
1541
1682
  /** Use this method to send a game. On success, the sent Message is returned. */
1542
1683
  sendGame(args: {
1543
1684
  /** Unique identifier for the target chat */
@@ -1554,7 +1695,10 @@ export type ApiMethods<F> = {
1554
1695
  reply_parameters?: ReplyParameters;
1555
1696
  /** An object for an inline keyboard. If empty, one 'Play game_title' button will be shown. If not empty, the first button must launch the game. */
1556
1697
  reply_markup?: InlineKeyboardMarkup;
1698
+ /** @deprecated Use `reply_parameters` instead. */
1699
+ reply_to_message_id?: number;
1557
1700
  }): Message.GameMessage;
1701
+
1558
1702
  /** Use this method to set the score of the specified user in a game message. On success, if the message is not an inline message, the Message is returned, otherwise True is returned. Returns an error, if the new score is not greater than the user's current score in the chat and force is False. */
1559
1703
  setGameScore(args: {
1560
1704
  /** User identifier */
@@ -1572,6 +1716,7 @@ export type ApiMethods<F> = {
1572
1716
  /** Required if chat_id and message_id are not specified. Identifier of the inline message */
1573
1717
  inline_message_id?: string;
1574
1718
  }): (Update.Edited & Message.GameMessage) | true;
1719
+
1575
1720
  /** Use this method to get data for high score tables. Will return the score of the specified user and several of their neighbors in a game. Returns an Array of GameHighScore objects.
1576
1721
 
1577
1722
  This method will currently return scores for the target user, plus two of their closest neighbors on each side. Will also return the top three users if the user and their neighbors are not among them. Please note that this behavior is subject to change. */
@@ -1586,10 +1731,11 @@ export type ApiMethods<F> = {
1586
1731
  inline_message_id?: string;
1587
1732
  }): GameHighScore[];
1588
1733
  };
1734
+
1589
1735
  /** This object describes a sticker to be added to a sticker set. */
1590
- export interface InputSticker<F> {
1736
+ export interface InputSticker {
1591
1737
  /** The added sticker. Pass a file_id as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. Animated and video stickers can't be uploaded via HTTP URL. */
1592
- sticker: F | string;
1738
+ sticker: Buffer | ReadStream | string;
1593
1739
  /** List of 1-20 emoji associated with the sticker */
1594
1740
  emoji_list: string[];
1595
1741
  /** Position where the mask should be placed on faces. For “mask” stickers only. */
@@ -1597,24 +1743,26 @@ export interface InputSticker<F> {
1597
1743
  /** List of 0-20 search keywords for the sticker with total length of up to 64 characters. For “regular” and “custom_emoji” stickers only. */
1598
1744
  keywords?: string[];
1599
1745
  }
1746
+
1600
1747
  /** This object represents the content of a media message to be sent. It should be one of
1601
- - InputMediaAnimation
1602
- - InputMediaDocument
1603
- - InputMediaAudio
1604
- - InputMediaPhoto
1605
- - InputMediaVideo */
1606
- export type InputMedia<F> =
1607
- | InputMediaAnimation<F>
1608
- | InputMediaDocument<F>
1609
- | InputMediaAudio<F>
1610
- | InputMediaPhoto<F>
1611
- | InputMediaVideo<F>;
1748
+ - InputMediaAnimation
1749
+ - InputMediaDocument
1750
+ - InputMediaAudio
1751
+ - InputMediaPhoto
1752
+ - InputMediaVideo */
1753
+ export type InputMedia =
1754
+ | InputMediaAnimation
1755
+ | InputMediaDocument
1756
+ | InputMediaAudio
1757
+ | InputMediaPhoto
1758
+ | InputMediaVideo;
1759
+
1612
1760
  /** Represents a photo to be sent. */
1613
- export interface InputMediaPhoto<F> {
1761
+ export interface InputMediaPhoto {
1614
1762
  /** Type of the result, must be photo */
1615
1763
  type: "photo";
1616
1764
  /** File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass "attach://<file_attach_name>" to upload a new one using multipart/form-data under <file_attach_name> name. */
1617
- media: F | string;
1765
+ media: Buffer | ReadStream | string;
1618
1766
  /** Caption of the photo to be sent, 0-1024 characters after entities parsing */
1619
1767
  caption?: string;
1620
1768
  /** Mode for parsing entities in the photo caption. See formatting options for more details. */
@@ -1624,14 +1772,15 @@ export interface InputMediaPhoto<F> {
1624
1772
  /** Pass True if the photo needs to be covered with a spoiler animation */
1625
1773
  has_spoiler?: boolean;
1626
1774
  }
1775
+
1627
1776
  /** Represents a video to be sent. */
1628
- export interface InputMediaVideo<F> {
1777
+ export interface InputMediaVideo {
1629
1778
  /** Type of the result, must be video */
1630
1779
  type: "video";
1631
1780
  /** File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass "attach://<file_attach_name>" to upload a new one using multipart/form-data under <file_attach_name> name. */
1632
- media: F | string;
1781
+ media: Buffer | ReadStream | string;
1633
1782
  /** Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass "attach://<file_attach_name>" if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. */
1634
- thumbnail?: F;
1783
+ thumbnail?: Buffer | ReadStream | string;
1635
1784
  /** Caption of the video to be sent, 0-1024 characters after entities parsing */
1636
1785
  caption?: string;
1637
1786
  /** Mode for parsing entities in the video caption. See formatting options for more details. */
@@ -1649,14 +1798,15 @@ export interface InputMediaVideo<F> {
1649
1798
  /** Pass True if the photo needs to be covered with a spoiler animation */
1650
1799
  has_spoiler?: boolean;
1651
1800
  }
1801
+
1652
1802
  /** Represents an animation file (GIF or H.264/MPEG-4 AVC video without sound) to be sent. */
1653
- export interface InputMediaAnimation<F> {
1803
+ export interface InputMediaAnimation {
1654
1804
  /** Type of the result, must be animation */
1655
1805
  type: "animation";
1656
1806
  /** File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass "attach://<file_attach_name>" to upload a new one using multipart/form-data under <file_attach_name> name. */
1657
- media: F | string;
1807
+ media: Buffer | ReadStream | string;
1658
1808
  /** Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass "attach://<file_attach_name>" if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. */
1659
- thumbnail?: F;
1809
+ thumbnail?: Buffer | ReadStream | string;
1660
1810
  /** Caption of the animation to be sent, 0-1024 characters after entities parsing */
1661
1811
  caption?: string;
1662
1812
  /** Mode for parsing entities in the animation caption. See formatting options for more details. */
@@ -1672,14 +1822,15 @@ export interface InputMediaAnimation<F> {
1672
1822
  /** Pass True if the photo needs to be covered with a spoiler animation */
1673
1823
  has_spoiler?: boolean;
1674
1824
  }
1825
+
1675
1826
  /** Represents an audio file to be treated as music to be sent. */
1676
- export interface InputMediaAudio<F> {
1827
+ export interface InputMediaAudio {
1677
1828
  /** Type of the result, must be audio */
1678
1829
  type: "audio";
1679
1830
  /** File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass "attach://<file_attach_name>" to upload a new one using multipart/form-data under <file_attach_name> name. */
1680
- media: F | string;
1831
+ media: Buffer | ReadStream | string;
1681
1832
  /** Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass "attach://<file_attach_name>" if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. */
1682
- thumbnail?: F;
1833
+ thumbnail?: Buffer | ReadStream | string;
1683
1834
  /** Caption of the audio to be sent, 0-1024 characters after entities parsing */
1684
1835
  caption?: string;
1685
1836
  /** Mode for parsing entities in the audio caption. See formatting options for more details. */
@@ -1693,14 +1844,15 @@ export interface InputMediaAudio<F> {
1693
1844
  /** Title of the audio */
1694
1845
  title?: string;
1695
1846
  }
1847
+
1696
1848
  /** Represents a general file to be sent. */
1697
- export interface InputMediaDocument<F> {
1849
+ export interface InputMediaDocument {
1698
1850
  /** Type of the result, must be document */
1699
1851
  type: "document";
1700
1852
  /** File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass "attach://<file_attach_name>" to upload a new one using multipart/form-data under <file_attach_name> name. */
1701
- media: F | string;
1853
+ media: Buffer | ReadStream | string;
1702
1854
  /** Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass "attach://<file_attach_name>" if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. */
1703
- thumbnail?: F;
1855
+ thumbnail?: Buffer | ReadStream | string;
1704
1856
  /** Caption of the document to be sent, 0-1024 characters after entities parsing */
1705
1857
  caption?: string;
1706
1858
  /** Mode for parsing entities in the document caption. See formatting options for more details. */
@@ -1710,4 +1862,3 @@ export interface InputMediaDocument<F> {
1710
1862
  /** Disables automatic server-side content type detection for files uploaded using multipart/form-data. Always true, if the document is sent as part of an album. */
1711
1863
  disable_content_type_detection?: boolean;
1712
1864
  }
1713
- export {};