@telegram.ts/types 1.6.0 → 1.8.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,9 +1,11 @@
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,
8
+ BusinessConnection,
7
9
  ChatAdministratorRights,
8
10
  ChatFromGetChat,
9
11
  ChatInviteLink,
@@ -16,49 +18,42 @@ import type {
16
18
  UserFromGetMe,
17
19
  UserProfilePhotos,
18
20
  WebhookInfo,
19
- } from "./manageTypes";
21
+ } from "./manageTypes.ts";
20
22
  import type {
21
23
  ForceReply,
22
24
  InlineKeyboardMarkup,
23
25
  ReplyKeyboardMarkup,
24
26
  ReplyKeyboardRemove,
25
- } from "./markupTypes";
27
+ } from "./markupTypes.ts";
26
28
  import type {
27
- LinkPreviewOptions,
29
+ File,
28
30
  GameHighScore,
31
+ LinkPreviewOptions,
29
32
  MaskPosition,
30
33
  Message,
31
34
  MessageEntity,
32
35
  MessageId,
33
36
  ParseMode,
34
37
  Poll,
35
- File,
36
38
  ReactionType,
37
39
  ReplyParameters,
38
40
  SentWebAppMessage,
39
41
  Sticker,
40
42
  StickerSet,
41
- } from "./messageTypes";
42
- import type { PassportElementError } from "./passportTypes";
43
- import type { LabeledPrice, ShippingOption } from "./invoiceTypes";
43
+ } from "./messageTypes.ts";
44
+ import type { PassportElementError } from "./passportTypes.ts";
45
+ import type { LabeledPrice, ShippingOption } from "./invoiceTypes.ts";
44
46
  import type {
45
47
  BotCommandScope,
46
48
  BotDescription,
47
49
  BotName,
48
50
  BotShortDescription,
49
51
  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
- };
52
+ } from "./botCommandTypes.ts";
53
+ import type { Update } from "./updateTypes.ts";
54
+
60
55
  /** Wrapper type to bundle all methods of the Telegram Bot API */
61
- export type ApiMethods<F> = {
56
+ export type ApiMethods = {
62
57
  /** Use this method to receive incoming updates using long polling (wiki). Returns an Array of Update objects.
63
58
 
64
59
  Notes
@@ -71,11 +66,12 @@ export type ApiMethods<F> = {
71
66
  limit?: number;
72
67
  /** 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
68
  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.
69
+ /** 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
70
 
76
71
  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
72
  allowed_updates?: ReadonlyArray<Exclude<keyof Update, "update_id">>;
78
73
  }): Update[];
74
+
79
75
  /** 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
76
 
81
77
  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 +86,12 @@ export type ApiMethods<F> = {
90
86
  /** HTTPS URL to send updates to. Use an empty string to remove webhook integration */
91
87
  url: string;
92
88
  /** 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;
89
+ certificate?: Buffer | ReadStream | string;
94
90
  /** The fixed IP address which will be used to send webhook requests instead of the IP address resolved through DNS */
95
91
  ip_address?: string;
96
92
  /** 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
93
  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.
94
+ /** 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
95
 
100
96
  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
97
  allowed_updates?: ReadonlyArray<Exclude<keyof Update, "update_id">>;
@@ -104,21 +100,29 @@ export type ApiMethods<F> = {
104
100
  /** 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
101
  secret_token?: string;
106
102
  }): true;
103
+
107
104
  /** Use this method to remove webhook integration if you decide to switch back to getUpdates. Returns True on success. */
108
105
  deleteWebhook(args?: {
109
106
  /** Pass True to drop all pending updates */
110
107
  drop_pending_updates?: boolean;
111
108
  }): true;
109
+
112
110
  /** 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
111
  getWebhookInfo(): WebhookInfo;
112
+
114
113
  /** 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
114
  getMe(): UserFromGetMe;
115
+
116
116
  /** 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
117
  logOut(): true;
118
+
118
119
  /** 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
120
  close(): true;
121
+
120
122
  /** Use this method to send text messages. On success, the sent Message is returned. */
121
123
  sendMessage(args: {
124
+ /** Unique identifier of the business connection on behalf of which the message will be sent */
125
+ business_connection_id?: string;
122
126
  /** Unique identifier for the target chat or username of the target channel (in the format @channelusername) */
123
127
  chat_id: number | string;
124
128
  /** Unique identifier for the target message thread (topic) of the forum; for forum supergroups only */
@@ -137,14 +141,17 @@ export type ApiMethods<F> = {
137
141
  protect_content?: boolean;
138
142
  /** Description of the message to reply to */
139
143
  reply_parameters?: ReplyParameters;
140
- /** Additional interface options. An object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. */
144
+ /** Additional interface options. An object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user. Not supported for messages sent on behalf of a business account. */
141
145
  reply_markup?:
142
146
  | InlineKeyboardMarkup
143
147
  | ReplyKeyboardMarkup
144
148
  | ReplyKeyboardRemove
145
149
  | ForceReply;
150
+ /** @deprecated Use `reply_parameters` instead. */
151
+ reply_to_message_id?: number;
146
152
  }): 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. **/
153
+
154
+ /** 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
155
  forwardMessage(args: {
149
156
  /** Unique identifier for the target chat or username of the target channel (in the format @channelusername) */
150
157
  chat_id: number | string;
@@ -159,6 +166,7 @@ export type ApiMethods<F> = {
159
166
  /** Message identifier in the chat specified in from_chat_id */
160
167
  message_id: number;
161
168
  }): Message;
169
+
162
170
  /** 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
171
  forwardMessages(args: {
164
172
  /** Unique identifier for the target chat or username of the target channel (in the format @channelusername) */
@@ -167,14 +175,15 @@ export type ApiMethods<F> = {
167
175
  message_thread_id?: number;
168
176
  /** Unique identifier for the chat where the original messages were sent (or channel username in the format @channelusername) */
169
177
  from_chat_id: number | string;
170
- /** Identifiers of 1-100 messages in the chat from_chat_id to forward. The identifiers must be specified in a strictly increasing order. */
178
+ /** A list of 1-100 identifiers of messages in the chat from_chat_id to forward. The identifiers must be specified in a strictly increasing order. */
171
179
  message_ids: number[];
172
180
  /** Sends the messages silently. Users will receive a notification with no sound. */
173
181
  disable_notification?: boolean;
174
182
  /** Protects the contents of the forwarded messages from forwarding and saving */
175
183
  protect_content?: boolean;
176
184
  }): 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. */
185
+
186
+ /** 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
187
  copyMessage(args: {
179
188
  /** Unique identifier for the target chat or username of the target channel (in the format @channelusername) */
180
189
  chat_id: number | string;
@@ -196,13 +205,16 @@ export type ApiMethods<F> = {
196
205
  protect_content?: boolean;
197
206
  /** Description of the message to reply to */
198
207
  reply_parameters?: ReplyParameters;
199
- /** Additional interface options. An object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. */
208
+ /** Additional interface options. An object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user. Not supported for messages sent on behalf of a business account. */
200
209
  reply_markup?:
201
210
  | InlineKeyboardMarkup
202
211
  | ReplyKeyboardMarkup
203
212
  | ReplyKeyboardRemove
204
213
  | ForceReply;
214
+ /** @deprecated Use `reply_parameters` instead. */
215
+ reply_to_message_id?: number;
205
216
  }): MessageId;
217
+
206
218
  /** 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
219
  copyMessages(args: {
208
220
  /** Unique identifier for the target chat or username of the target channel (in the format @channelusername) */
@@ -211,7 +223,7 @@ export type ApiMethods<F> = {
211
223
  message_thread_id?: number;
212
224
  /** Unique identifier for the chat where the original messages were sent (or channel username in the format @channelusername) */
213
225
  from_chat_id: number | string;
214
- /** Identifiers of 1-100 messages in the chat from_chat_id to copy. The identifiers must be specified in a strictly increasing order. */
226
+ /** A list of 1-100 identifiers of messages in the chat from_chat_id to copy. The identifiers must be specified in a strictly increasing order. */
215
227
  message_ids: number[];
216
228
  /** Sends the messages silently. Users will receive a notification with no sound. */
217
229
  disable_notification?: boolean;
@@ -220,14 +232,17 @@ export type ApiMethods<F> = {
220
232
  /** Pass True to copy the messages without their captions */
221
233
  remove_caption?: boolean;
222
234
  }): MessageId[];
235
+
223
236
  /** Use this method to send photos. On success, the sent Message is returned. */
224
237
  sendPhoto(args: {
238
+ /** Unique identifier of the business connection on behalf of which the message will be sent */
239
+ business_connection_id?: string;
225
240
  /** Unique identifier for the target chat or username of the target channel (in the format @channelusername) */
226
241
  chat_id: number | string;
227
242
  /** Unique identifier for the target message thread (topic) of the forum; for forum supergroups only */
228
243
  message_thread_id?: number;
229
244
  /** 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;
245
+ photo: Buffer | ReadStream | string | string;
231
246
  /** Photo caption (may also be used when resending photos by file_id), 0-1024 characters after entities parsing */
232
247
  caption?: string;
233
248
  /** Mode for parsing entities in the photo caption. See formatting options for more details. */
@@ -242,23 +257,28 @@ export type ApiMethods<F> = {
242
257
  protect_content?: boolean;
243
258
  /** Description of the message to reply to */
244
259
  reply_parameters?: ReplyParameters;
245
- /** Additional interface options. An object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. */
260
+ /** Additional interface options. An object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user. Not supported for messages sent on behalf of a business account. */
246
261
  reply_markup?:
247
262
  | InlineKeyboardMarkup
248
263
  | ReplyKeyboardMarkup
249
264
  | ReplyKeyboardRemove
250
265
  | ForceReply;
266
+ /** @deprecated Use `reply_parameters` instead. */
267
+ reply_to_message_id?: number;
251
268
  }): Message.PhotoMessage;
269
+
252
270
  /** 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
271
 
254
272
  For sending voice messages, use the sendVoice method instead. */
255
273
  sendAudio(args: {
274
+ /** Unique identifier of the business connection on behalf of which the message will be sent */
275
+ business_connection_id?: string;
256
276
  /** Unique identifier for the target chat or username of the target channel (in the format @channelusername) */
257
277
  chat_id: number | string;
258
278
  /** Unique identifier for the target message thread (topic) of the forum; for forum supergroups only */
259
279
  message_thread_id?: number;
260
280
  /** 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;
281
+ audio: Buffer | ReadStream | string | string;
262
282
  /** Audio caption, 0-1024 characters after entities parsing */
263
283
  caption?: string;
264
284
  /** Mode for parsing entities in the audio caption. See formatting options for more details. */
@@ -272,30 +292,35 @@ export type ApiMethods<F> = {
272
292
  /** Track name */
273
293
  title?: string;
274
294
  /** 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;
295
+ thumbnail?: Buffer | ReadStream | string;
276
296
  /** Sends the message silently. Users will receive a notification with no sound. */
277
297
  disable_notification?: boolean;
278
298
  /** Protects the contents of the sent message from forwarding and saving */
279
299
  protect_content?: boolean;
280
300
  /** Description of the message to reply to */
281
301
  reply_parameters?: ReplyParameters;
282
- /** Additional interface options. An object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. */
302
+ /** Additional interface options. An object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user. Not supported for messages sent on behalf of a business account. */
283
303
  reply_markup?:
284
304
  | InlineKeyboardMarkup
285
305
  | ReplyKeyboardMarkup
286
306
  | ReplyKeyboardRemove
287
307
  | ForceReply;
308
+ /** @deprecated Use `reply_parameters` instead. */
309
+ reply_to_message_id?: number;
288
310
  }): Message.AudioMessage;
311
+
289
312
  /** 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
313
  sendDocument(args: {
314
+ /** Unique identifier of the business connection on behalf of which the message will be sent */
315
+ business_connection_id?: string;
291
316
  /** Unique identifier for the target chat or username of the target channel (in the format @channelusername) */
292
317
  chat_id: number | string;
293
318
  /** Unique identifier for the target message thread (topic) of the forum; for forum supergroups only */
294
319
  message_thread_id?: number;
295
320
  /** 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;
321
+ document: Buffer | ReadStream | string | string;
297
322
  /** 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;
323
+ thumbnail?: Buffer | ReadStream | string;
299
324
  /** Document caption (may also be used when resending documents by file_id), 0-1024 characters after entities parsing */
300
325
  caption?: string;
301
326
  /** Mode for parsing entities in the document caption. See formatting options for more details. */
@@ -310,21 +335,26 @@ export type ApiMethods<F> = {
310
335
  protect_content?: boolean;
311
336
  /** Description of the message to reply to */
312
337
  reply_parameters?: ReplyParameters;
313
- /** Additional interface options. An object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. */
338
+ /** Additional interface options. An object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user. Not supported for messages sent on behalf of a business account. */
314
339
  reply_markup?:
315
340
  | InlineKeyboardMarkup
316
341
  | ReplyKeyboardMarkup
317
342
  | ReplyKeyboardRemove
318
343
  | ForceReply;
344
+ /** @deprecated Use `reply_parameters` instead. */
345
+ reply_to_message_id?: number;
319
346
  }): Message.DocumentMessage;
347
+
320
348
  /** 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
349
  sendVideo(args: {
350
+ /** Unique identifier of the business connection on behalf of which the message will be sent */
351
+ business_connection_id?: string;
322
352
  /** Unique identifier for the target chat or username of the target channel (in the format @channelusername) */
323
353
  chat_id: number | string;
324
354
  /** Unique identifier for the target message thread (topic) of the forum; for forum supergroups only */
325
355
  message_thread_id?: number;
326
356
  /** 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;
357
+ video: Buffer | ReadStream | string | string;
328
358
  /** Duration of sent video in seconds */
329
359
  duration?: number;
330
360
  /** Video width */
@@ -332,7 +362,7 @@ export type ApiMethods<F> = {
332
362
  /** Video height */
333
363
  height?: number;
334
364
  /** 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;
365
+ thumbnail?: Buffer | ReadStream | string;
336
366
  /** Video caption (may also be used when resending videos by file_id), 0-1024 characters after entities parsing */
337
367
  caption?: string;
338
368
  /** Mode for parsing entities in the video caption. See formatting options for more details. */
@@ -349,21 +379,26 @@ export type ApiMethods<F> = {
349
379
  protect_content?: boolean;
350
380
  /** Description of the message to reply to */
351
381
  reply_parameters?: ReplyParameters;
352
- /** Additional interface options. An object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. */
382
+ /** Additional interface options. An object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user. Not supported for messages sent on behalf of a business account. */
353
383
  reply_markup?:
354
384
  | InlineKeyboardMarkup
355
385
  | ReplyKeyboardMarkup
356
386
  | ReplyKeyboardRemove
357
387
  | ForceReply;
388
+ /** @deprecated Use `reply_parameters` instead. */
389
+ reply_to_message_id?: number;
358
390
  }): Message.VideoMessage;
391
+
359
392
  /** 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
393
  sendAnimation(args: {
394
+ /** Unique identifier of the business connection on behalf of which the message will be sent */
395
+ business_connection_id?: string;
361
396
  /** Unique identifier for the target chat or username of the target channel (in the format @channelusername) */
362
397
  chat_id: number | string;
363
398
  /** Unique identifier for the target message thread (topic) of the forum; for forum supergroups only */
364
399
  message_thread_id?: number;
365
400
  /** 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;
401
+ animation: Buffer | ReadStream | string | string;
367
402
  /** Duration of sent animation in seconds */
368
403
  duration?: number;
369
404
  /** Animation width */
@@ -371,7 +406,7 @@ export type ApiMethods<F> = {
371
406
  /** Animation height */
372
407
  height?: number;
373
408
  /** 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;
409
+ thumbnail?: Buffer | ReadStream | string;
375
410
  /** Animation caption (may also be used when resending animation by file_id), 0-1024 characters after entities parsing */
376
411
  caption?: string;
377
412
  /** Mode for parsing entities in the animation caption. See formatting options for more details. */
@@ -386,21 +421,26 @@ export type ApiMethods<F> = {
386
421
  protect_content?: boolean;
387
422
  /** Description of the message to reply to */
388
423
  reply_parameters?: ReplyParameters;
389
- /** Additional interface options. An object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. */
424
+ /** Additional interface options. An object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user. Not supported for messages sent on behalf of a business account. */
390
425
  reply_markup?:
391
426
  | InlineKeyboardMarkup
392
427
  | ReplyKeyboardMarkup
393
428
  | ReplyKeyboardRemove
394
429
  | ForceReply;
430
+ /** @deprecated Use `reply_parameters` instead. */
431
+ reply_to_message_id?: number;
395
432
  }): Message.AnimationMessage;
433
+
396
434
  /** 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
435
  sendVoice(args: {
436
+ /** Unique identifier of the business connection on behalf of which the message will be sent */
437
+ business_connection_id?: string;
398
438
  /** Unique identifier for the target chat or username of the target channel (in the format @channelusername) */
399
439
  chat_id: number | string;
400
440
  /** Unique identifier for the target message thread (topic) of the forum; for forum supergroups only */
401
441
  message_thread_id?: number;
402
442
  /** 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;
443
+ voice: Buffer | ReadStream | string | string;
404
444
  /** Voice message caption, 0-1024 characters after entities parsing */
405
445
  caption?: string;
406
446
  /** Mode for parsing entities in the voice message caption. See formatting options for more details. */
@@ -415,53 +455,60 @@ export type ApiMethods<F> = {
415
455
  protect_content?: boolean;
416
456
  /** Description of the message to reply to */
417
457
  reply_parameters?: ReplyParameters;
418
- /** Additional interface options. An object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. */
458
+ /** Additional interface options. An object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user. Not supported for messages sent on behalf of a business account. */
419
459
  reply_markup?:
420
460
  | InlineKeyboardMarkup
421
461
  | ReplyKeyboardMarkup
422
462
  | ReplyKeyboardRemove
423
463
  | ForceReply;
464
+ /** @deprecated Use `reply_parameters` instead. */
465
+ reply_to_message_id?: number;
424
466
  }): Message.VoiceMessage;
467
+
425
468
  /** Use this method to send video messages. On success, the sent Message is returned.
426
469
  As of v.4.0, Telegram clients support rounded square MPEG4 videos of up to 1 minute long. */
427
470
  sendVideoNote(args: {
471
+ /** Unique identifier of the business connection on behalf of which the message will be sent */
472
+ business_connection_id?: string;
428
473
  /** Unique identifier for the target chat or username of the target channel (in the format @channelusername) */
429
474
  chat_id: number | string;
430
475
  /** Unique identifier for the target message thread (topic) of the forum; for forum supergroups only */
431
476
  message_thread_id?: number;
432
477
  /** 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;
478
+ video_note: Buffer | ReadStream | string | string;
434
479
  /** Duration of sent video in seconds */
435
480
  duration?: number;
436
481
  /** Video width and height, i.e. diameter of the video message */
437
482
  length?: number;
438
483
  /** 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;
484
+ thumbnail?: Buffer | ReadStream | string;
440
485
  /** Sends the message silently. Users will receive a notification with no sound. */
441
486
  disable_notification?: boolean;
442
487
  /** Protects the contents of the sent message from forwarding and saving */
443
488
  protect_content?: boolean;
444
489
  /** Description of the message to reply to */
445
490
  reply_parameters?: ReplyParameters;
446
- /** Additional interface options. An object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. */
491
+ /** Additional interface options. An object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user. Not supported for messages sent on behalf of a business account. */
447
492
  reply_markup?:
448
493
  | InlineKeyboardMarkup
449
494
  | ReplyKeyboardMarkup
450
495
  | ReplyKeyboardRemove
451
496
  | ForceReply;
497
+ /** @deprecated Use `reply_parameters` instead. */
498
+ reply_to_message_id?: number;
452
499
  }): Message.VideoNoteMessage;
500
+
453
501
  /** 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
502
  sendMediaGroup(args: {
503
+ /** Unique identifier of the business connection on behalf of which the message will be sent */
504
+ business_connection_id?: string;
455
505
  /** Unique identifier for the target chat or username of the target channel (in the format @channelusername) */
456
506
  chat_id: number | string;
457
507
  /** An array describing messages to be sent, must include 2-10 items */
458
508
  /** Unique identifier for the target message thread (topic) of the forum; for forum supergroups only */
459
509
  message_thread_id?: number;
460
510
  media: ReadonlyArray<
461
- | InputMediaAudio<F>
462
- | InputMediaDocument<F>
463
- | InputMediaPhoto<F>
464
- | InputMediaVideo<F>
511
+ InputMediaAudio | InputMediaDocument | InputMediaPhoto | InputMediaVideo
465
512
  >;
466
513
  /** Sends the messages silently. Users will receive a notification with no sound. */
467
514
  disable_notification?: boolean;
@@ -469,14 +516,19 @@ export type ApiMethods<F> = {
469
516
  protect_content?: boolean;
470
517
  /** Description of the message to reply to */
471
518
  reply_parameters?: ReplyParameters;
519
+ /** @deprecated Use `reply_parameters` instead. */
520
+ reply_to_message_id?: number;
472
521
  }): Array<
473
522
  | Message.AudioMessage
474
523
  | Message.DocumentMessage
475
524
  | Message.PhotoMessage
476
525
  | Message.VideoMessage
477
526
  >;
527
+
478
528
  /** Use this method to send point on the map. On success, the sent Message is returned. */
479
529
  sendLocation(args: {
530
+ /** Unique identifier of the business connection on behalf of which the message will be sent */
531
+ business_connection_id?: string;
480
532
  /** Unique identifier for the target chat or username of the target channel (in the format @channelusername) */
481
533
  chat_id: number | string;
482
534
  /** Unique identifier for the target message thread (topic) of the forum; for forum supergroups only */
@@ -499,13 +551,16 @@ export type ApiMethods<F> = {
499
551
  protect_content?: boolean;
500
552
  /** Description of the message to reply to */
501
553
  reply_parameters?: ReplyParameters;
502
- /** Additional interface options. An object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. */
554
+ /** Additional interface options. An object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user. Not supported for messages sent on behalf of a business account. */
503
555
  reply_markup?:
504
556
  | InlineKeyboardMarkup
505
557
  | ReplyKeyboardMarkup
506
558
  | ReplyKeyboardRemove
507
559
  | ForceReply;
560
+ /** @deprecated Use `reply_parameters` instead. */
561
+ reply_to_message_id?: number;
508
562
  }): Message.LocationMessage;
563
+
509
564
  /** 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
565
  editMessageLiveLocation(args: {
511
566
  /** 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 +582,7 @@ export type ApiMethods<F> = {
527
582
  /** An object for a new inline keyboard. */
528
583
  reply_markup?: InlineKeyboardMarkup;
529
584
  }): (Update.Edited & Message.LocationMessage) | true;
585
+
530
586
  /** 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
587
  stopMessageLiveLocation(args: {
532
588
  /** 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,8 +594,11 @@ export type ApiMethods<F> = {
538
594
  /** An object for a new inline keyboard. */
539
595
  reply_markup?: InlineKeyboardMarkup;
540
596
  }): (Update.Edited & Message.LocationMessage) | true;
597
+
541
598
  /** Use this method to send information about a venue. On success, the sent Message is returned. */
542
599
  sendVenue(args: {
600
+ /** Unique identifier of the business connection on behalf of which the message will be sent */
601
+ business_connection_id?: string;
543
602
  /** Unique identifier for the target chat or username of the target channel (in the format @channelusername) */
544
603
  chat_id: number | string;
545
604
  /** Unique identifier for the target message thread (topic) of the forum; for forum supergroups only */
@@ -566,15 +625,20 @@ export type ApiMethods<F> = {
566
625
  protect_content?: boolean;
567
626
  /** Description of the message to reply to */
568
627
  reply_parameters?: ReplyParameters;
569
- /** Additional interface options. An object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. */
628
+ /** Additional interface options. An object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user. Not supported for messages sent on behalf of a business account. */
570
629
  reply_markup?:
571
630
  | InlineKeyboardMarkup
572
631
  | ReplyKeyboardMarkup
573
632
  | ReplyKeyboardRemove
574
633
  | ForceReply;
634
+ /** @deprecated Use `reply_parameters` instead. */
635
+ reply_to_message_id?: number;
575
636
  }): Message.VenueMessage;
637
+
576
638
  /** Use this method to send phone contacts. On success, the sent Message is returned. */
577
639
  sendContact(args: {
640
+ /** Unique identifier of the business connection on behalf of which the message will be sent */
641
+ business_connection_id?: string;
578
642
  /** Unique identifier for the target chat or username of the target channel (in the format @channelusername) */
579
643
  chat_id: number | string;
580
644
  /** Unique identifier for the target message thread (topic) of the forum; for forum supergroups only */
@@ -593,15 +657,20 @@ export type ApiMethods<F> = {
593
657
  protect_content?: boolean;
594
658
  /** Description of the message to reply to */
595
659
  reply_parameters?: ReplyParameters;
596
- /** Additional interface options. An object for an inline keyboard, custom reply keyboard, instructions to remove keyboard or to force a reply from the user. */
660
+ /** Additional interface options. An object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user. Not supported for messages sent on behalf of a business account. */
597
661
  reply_markup?:
598
662
  | InlineKeyboardMarkup
599
663
  | ReplyKeyboardMarkup
600
664
  | ReplyKeyboardRemove
601
665
  | ForceReply;
666
+ /** @deprecated Use `reply_parameters` instead. */
667
+ reply_to_message_id?: number;
602
668
  }): Message.ContactMessage;
669
+
603
670
  /** Use this method to send a native poll. On success, the sent Message is returned. */
604
671
  sendPoll(args: {
672
+ /** Unique identifier of the business connection on behalf of which the message will be sent */
673
+ business_connection_id?: string;
605
674
  /** Unique identifier for the target chat or username of the target channel (in the format @channelusername) */
606
675
  chat_id: number | string;
607
676
  /** Unique identifier for the target message thread (topic) of the forum; for forum supergroups only */
@@ -636,15 +705,20 @@ export type ApiMethods<F> = {
636
705
  protect_content?: boolean;
637
706
  /** Description of the message to reply to */
638
707
  reply_parameters?: ReplyParameters;
639
- /** Additional interface options. An object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. */
708
+ /** Additional interface options. An object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user. Not supported for messages sent on behalf of a business account. */
640
709
  reply_markup?:
641
710
  | InlineKeyboardMarkup
642
711
  | ReplyKeyboardMarkup
643
712
  | ReplyKeyboardRemove
644
713
  | ForceReply;
714
+ /** @deprecated Use `reply_parameters` instead. */
715
+ reply_to_message_id?: number;
645
716
  }): Message.PollMessage;
717
+
646
718
  /** Use this method to send an animated emoji that will display a random value. On success, the sent Message is returned. */
647
719
  sendDice(args: {
720
+ /** Unique identifier of the business connection on behalf of which the message will be sent */
721
+ business_connection_id?: string;
648
722
  /** Unique identifier for the target chat or username of the target channel (in the format @channelusername) */
649
723
  chat_id: number | string;
650
724
  /** Unique identifier for the target message thread (topic) of the forum; for forum supergroups only */
@@ -657,31 +731,24 @@ export type ApiMethods<F> = {
657
731
  protect_content?: boolean;
658
732
  /** Description of the message to reply to */
659
733
  reply_parameters?: ReplyParameters;
660
- /** Additional interface options. An object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. */
734
+ /** Additional interface options. An object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user. Not supported for messages sent on behalf of a business account. */
661
735
  reply_markup?:
662
736
  | InlineKeyboardMarkup
663
737
  | ReplyKeyboardMarkup
664
738
  | ReplyKeyboardRemove
665
739
  | ForceReply;
740
+ /** @deprecated Use `reply_parameters` instead. */
741
+ reply_to_message_id?: number;
666
742
  }): Message.DiceMessage;
667
743
 
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
744
  /** 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
745
 
681
746
  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.
682
747
 
683
748
  We only recommend using this method when a response from the bot will take a noticeable amount of time to arrive. */
684
749
  sendChatAction(args: {
750
+ /** Unique identifier of the business connection on behalf of which the message will be sent */
751
+ business_connection_id?: string;
685
752
  /** Unique identifier for the target chat or username of the target channel (in the format @channelusername) */
686
753
  chat_id: number | string;
687
754
  /** Type of action to broadcast. Choose one, depending on what the user is about to receive: typing for text messages, upload_photo for photos, record_video or upload_video for videos, record_voice or upload_voice for voice notes, upload_document for general files, choose_sticker for stickers, find_location for location data, record_video_note or upload_video_note for video notes. */
@@ -697,9 +764,22 @@ export type ApiMethods<F> = {
697
764
  | "find_location"
698
765
  | "record_video_note"
699
766
  | "upload_video_note";
700
- /** Unique identifier for the target message thread; supergroups only */
767
+ /** Unique identifier for the target message thread; for supergroups only */
701
768
  message_thread_id?: number;
702
769
  }): true;
770
+
771
+ /** 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. */
772
+ setMessageReaction(args: {
773
+ /** Unique identifier for the target chat or username of the target channel (in the format @channelusername) */
774
+ chat_id: number | string;
775
+ /** Identifier of the target message */
776
+ message_id: number;
777
+ /** A 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. */
778
+ reaction?: ReactionType[];
779
+ /** Pass True to set the reaction with a big animation */
780
+ is_big?: boolean;
781
+ }): true;
782
+
703
783
  /** Use this method to get a list of profile pictures for a user. Returns a UserProfilePhotos object. */
704
784
  getUserProfilePhotos(args: {
705
785
  /** Unique identifier of the target user */
@@ -709,6 +789,7 @@ export type ApiMethods<F> = {
709
789
  /** Limits the number of photos to be retrieved. Values between 1-100 are accepted. Defaults to 100. */
710
790
  limit?: number;
711
791
  }): UserProfilePhotos;
792
+
712
793
  /** 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
794
 
714
795
  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 +797,23 @@ export type ApiMethods<F> = {
716
797
  /** File identifier to get information about */
717
798
  file_id: string;
718
799
  }): File;
800
+
719
801
  /** 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
802
  * @deprecated Use `banChatMember` instead. */
721
- kickChatMember: ApiMethods<F>["banChatMember"];
803
+ kickChatMember: ApiMethods["banChatMember"];
804
+
722
805
  /** 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
806
  banChatMember(args: {
724
807
  /** Unique identifier for the target group or username of the target supergroup or channel (in the format @channelusername) */
725
808
  chat_id: number | string;
726
809
  /** Unique identifier of the target user */
727
810
  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. */
811
+ /** 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
812
  until_date?: number;
730
813
  /** 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
814
  revoke_messages?: boolean;
732
815
  }): true;
816
+
733
817
  /** 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
818
  unbanChatMember(args: {
735
819
  /** Unique identifier for the target group or username of the target supergroup or channel (in the format @channelusername) */
@@ -739,6 +823,7 @@ export type ApiMethods<F> = {
739
823
  /** Do nothing if the user is not banned */
740
824
  only_if_banned?: boolean;
741
825
  }): true;
826
+
742
827
  /** 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
828
  restrictChatMember(args: {
744
829
  /** Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) */
@@ -749,9 +834,10 @@ export type ApiMethods<F> = {
749
834
  permissions: ChatPermissions;
750
835
  /** 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
836
  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 */
837
+ /** 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
838
  until_date?: number;
754
839
  }): true;
840
+
755
841
  /** 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
842
  promoteChatMember(args: {
757
843
  /** Unique identifier for the target chat or username of the target channel (in the format @channelusername) */
@@ -760,23 +846,13 @@ export type ApiMethods<F> = {
760
846
  user_id: number;
761
847
  /** Pass True if the administrator's presence in the chat is hidden */
762
848
  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 */
849
+ /** 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
850
  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
851
  /** Pass True if the administrator can delete messages of other users */
770
852
  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
853
  /** Pass True if the administrator can manage video chats */
778
854
  can_manage_video_chats?: boolean;
779
- /** Pass True if the administrator can restrict, ban or unban chat members */
855
+ /** Pass True if the administrator can restrict, ban or unban chat members, or access supergroup statistics */
780
856
  can_restrict_members?: boolean;
781
857
  /** 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
858
  can_promote_members?: boolean;
@@ -784,11 +860,22 @@ export type ApiMethods<F> = {
784
860
  can_change_info?: boolean;
785
861
  /** Pass True if the administrator can invite new users to the chat */
786
862
  can_invite_users?: boolean;
787
- /** Pass True if the administrator can pin messages, supergroups only */
863
+ /** True if the administrator can post stories to the chat */
864
+ can_post_stories?: boolean;
865
+ /** True if the administrator can edit stories posted by other users */
866
+ can_edit_stories?: boolean;
867
+ /** True if the administrator can delete stories posted by other users */
868
+ can_delete_stories?: boolean;
869
+ /** True if the administrator can post messages in the channel, or access channel statistics; for channels only */
870
+ can_post_messages?: boolean;
871
+ /** True if the administrator can edit messages of other users and can pin messages; for channels only */
872
+ can_edit_messages?: boolean;
873
+ /** True if the administrator can pin messages; for supergroups only */
788
874
  can_pin_messages?: boolean;
789
- /** Pass True if the user is allowed to create, rename, close, and reopen forum topics, supergroups only */
875
+ /** True if the user is allowed to create, rename, close, and reopen forum topics; for supergroups only */
790
876
  can_manage_topics?: boolean;
791
877
  }): true;
878
+
792
879
  /** Use this method to set a custom title for an administrator in a supergroup promoted by the bot. Returns True on success. */
793
880
  setChatAdministratorCustomTitle(args: {
794
881
  /** Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) */
@@ -798,6 +885,7 @@ export type ApiMethods<F> = {
798
885
  /** New custom title for the administrator; 0-16 characters, emoji are not allowed */
799
886
  custom_title: string;
800
887
  }): true;
888
+
801
889
  /** 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
890
  banChatSenderChat(args: {
803
891
  /** Unique identifier for the target chat or username of the target channel (in the format @channelusername) */
@@ -805,6 +893,7 @@ export type ApiMethods<F> = {
805
893
  /** Unique identifier of the target sender chat */
806
894
  sender_chat_id: number;
807
895
  }): true;
896
+
808
897
  /** 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
898
  unbanChatSenderChat(args: {
810
899
  /** Unique identifier for the target chat or username of the target channel (in the format @channelusername) */
@@ -812,6 +901,7 @@ export type ApiMethods<F> = {
812
901
  /** Unique identifier of the target sender chat */
813
902
  sender_chat_id: number;
814
903
  }): true;
904
+
815
905
  /** 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
906
  setChatPermissions(args: {
817
907
  /** Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) */
@@ -821,6 +911,7 @@ export type ApiMethods<F> = {
821
911
  /** 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
912
  use_independent_chat_permissions?: boolean;
823
913
  }): true;
914
+
824
915
  /** 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
916
 
826
917
  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 +919,7 @@ export type ApiMethods<F> = {
828
919
  /** Unique identifier for the target chat or username of the target channel (in the format @channelusername) */
829
920
  chat_id: number | string;
830
921
  }): string;
922
+
831
923
  /** 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
924
  createChatInviteLink(args: {
833
925
  /** Unique identifier for the target chat or username of the target channel (in the format @channelusername) */
@@ -841,6 +933,7 @@ export type ApiMethods<F> = {
841
933
  /** 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
934
  creates_join_request?: boolean;
843
935
  }): ChatInviteLink;
936
+
844
937
  /** 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
938
  editChatInviteLink(args: {
846
939
  /** Unique identifier for the target chat or username of the target channel (in the format @channelusername) */
@@ -856,6 +949,7 @@ export type ApiMethods<F> = {
856
949
  /** 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
950
  creates_join_request?: boolean;
858
951
  }): ChatInviteLink;
952
+
859
953
  /** 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
954
  revokeChatInviteLink(args: {
861
955
  /** Unique identifier of the target chat or username of the target channel (in the format @channelusername) */
@@ -863,6 +957,7 @@ export type ApiMethods<F> = {
863
957
  /** The invite link to revoke */
864
958
  invite_link: string;
865
959
  }): ChatInviteLink;
960
+
866
961
  /** 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
962
  approveChatJoinRequest(args: {
868
963
  /** Unique identifier for the target chat or username of the target channel (in the format @channelusername) */
@@ -870,6 +965,7 @@ export type ApiMethods<F> = {
870
965
  /** Unique identifier of the target user */
871
966
  user_id: number;
872
967
  }): true;
968
+
873
969
  /** 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
970
  declineChatJoinRequest(args: {
875
971
  /** Unique identifier for the target chat or username of the target channel (in the format @channelusername) */
@@ -877,18 +973,21 @@ export type ApiMethods<F> = {
877
973
  /** Unique identifier of the target user */
878
974
  user_id: number;
879
975
  }): true;
976
+
880
977
  /** 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
978
  setChatPhoto(args: {
882
979
  /** Unique identifier for the target chat or username of the target channel (in the format @channelusername) */
883
980
  chat_id: number | string;
884
981
  /** New chat photo, uploaded using multipart/form-data */
885
- photo: F;
982
+ photo: Buffer | ReadStream | string;
886
983
  }): true;
984
+
887
985
  /** 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
986
  deleteChatPhoto(args: {
889
987
  /** Unique identifier for the target chat or username of the target channel (in the format @channelusername) */
890
988
  chat_id: number | string;
891
989
  }): true;
990
+
892
991
  /** 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
992
  setChatTitle(args: {
894
993
  /** Unique identifier for the target chat or username of the target channel (in the format @channelusername) */
@@ -896,6 +995,7 @@ export type ApiMethods<F> = {
896
995
  /** New chat title, 1-128 characters */
897
996
  title: string;
898
997
  }): true;
998
+
899
999
  /** 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
1000
  setChatDescription(args: {
901
1001
  /** Unique identifier for the target chat or username of the target channel (in the format @channelusername) */
@@ -903,6 +1003,7 @@ export type ApiMethods<F> = {
903
1003
  /** New chat description, 0-255 characters */
904
1004
  description?: string;
905
1005
  }): true;
1006
+
906
1007
  /** 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
1008
  pinChatMessage(args: {
908
1009
  /** Unique identifier for the target chat or username of the target channel (in the format @channelusername) */
@@ -912,6 +1013,7 @@ export type ApiMethods<F> = {
912
1013
  /** 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
1014
  disable_notification?: boolean;
914
1015
  }): true;
1016
+
915
1017
  /** 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
1018
  unpinChatMessage(args: {
917
1019
  /** Unique identifier for the target chat or username of the target channel (in the format @channelusername) */
@@ -919,34 +1021,41 @@ export type ApiMethods<F> = {
919
1021
  /** Identifier of a message to unpin. If not specified, the most recent pinned message (by sending date) will be unpinned. */
920
1022
  message_id?: number;
921
1023
  }): true;
1024
+
922
1025
  /** 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
1026
  unpinAllChatMessages(args: {
924
1027
  /** Unique identifier for the target chat or username of the target channel (in the format @channelusername) */
925
1028
  chat_id: number | string;
926
1029
  }): true;
1030
+
927
1031
  /** Use this method for your bot to leave a group, supergroup or channel. Returns True on success. */
928
1032
  leaveChat(args: {
929
1033
  /** Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername) */
930
1034
  chat_id: number | string;
931
1035
  }): true;
1036
+
932
1037
  /** Use this method to get up to date information about the chat. Returns a Chat object on success. */
933
1038
  getChat(args: {
934
1039
  /** Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername) */
935
1040
  chat_id: number | string;
936
1041
  }): ChatFromGetChat;
1042
+
937
1043
  /** Use this method to get a list of administrators in a chat, which aren't bots. Returns an Array of ChatMember objects. */
938
1044
  getChatAdministrators(args: {
939
1045
  /** Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername) */
940
1046
  chat_id: number | string;
941
1047
  }): Array<ChatMemberOwner | ChatMemberAdministrator>;
1048
+
942
1049
  /** Use this method to get the number of members in a chat. Returns Int on success.
943
1050
  * @deprecated Use `getChatMemberCount` instead. */
944
- getChatMembersCount: ApiMethods<F>["getChatMemberCount"];
1051
+ getChatMembersCount: ApiMethods["getChatMemberCount"];
1052
+
945
1053
  /** Use this method to get the number of members in a chat. Returns Int on success. */
946
1054
  getChatMemberCount(args: {
947
1055
  /** Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername) */
948
1056
  chat_id: number | string;
949
1057
  }): number;
1058
+
950
1059
  /** 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
1060
  getChatMember(args: {
952
1061
  /** Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername) */
@@ -954,6 +1063,7 @@ export type ApiMethods<F> = {
954
1063
  /** Unique identifier of the target user */
955
1064
  user_id: number;
956
1065
  }): ChatMember;
1066
+
957
1067
  /** 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
1068
  setChatStickerSet(args: {
959
1069
  /** Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) */
@@ -961,11 +1071,13 @@ export type ApiMethods<F> = {
961
1071
  /** Name of the sticker set to be set as the group sticker set */
962
1072
  sticker_set_name: string;
963
1073
  }): true;
1074
+
964
1075
  /** 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
1076
  deleteChatStickerSet(args: {
966
1077
  /** Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) */
967
1078
  chat_id: number | string;
968
1079
  }): true;
1080
+
969
1081
  /** 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
1082
  getForumTopicIconStickers(): Sticker[];
971
1083
  /** 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 +1097,7 @@ export type ApiMethods<F> = {
985
1097
  /** Unique identifier of the custom emoji shown as the topic icon. Use getForumTopicIconStickers to get all allowed custom emoji identifiers. */
986
1098
  icon_custom_emoji_id?: string;
987
1099
  }): ForumTopic;
1100
+
988
1101
  /** 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
1102
  editForumTopic(args: {
990
1103
  /** Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) */
@@ -996,6 +1109,7 @@ export type ApiMethods<F> = {
996
1109
  /** 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
1110
  icon_custom_emoji_id?: string;
998
1111
  }): true;
1112
+
999
1113
  /** 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
1114
  closeForumTopic(args: {
1001
1115
  /** Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) */
@@ -1003,6 +1117,7 @@ export type ApiMethods<F> = {
1003
1117
  /** Unique identifier for the target message thread of the forum topic */
1004
1118
  message_thread_id: number;
1005
1119
  }): true;
1120
+
1006
1121
  /** 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
1122
  reopenForumTopic(args: {
1008
1123
  /** Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) */
@@ -1010,6 +1125,7 @@ export type ApiMethods<F> = {
1010
1125
  /** Unique identifier for the target message thread of the forum topic */
1011
1126
  message_thread_id: number;
1012
1127
  }): true;
1128
+
1013
1129
  /** 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
1130
  deleteForumTopic(args: {
1015
1131
  /** Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) */
@@ -1017,6 +1133,7 @@ export type ApiMethods<F> = {
1017
1133
  /** Unique identifier for the target message thread of the forum topic */
1018
1134
  message_thread_id: number;
1019
1135
  }): true;
1136
+
1020
1137
  /** 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
1138
  unpinAllForumTopicMessages(args: {
1022
1139
  /** Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) */
@@ -1024,6 +1141,7 @@ export type ApiMethods<F> = {
1024
1141
  /** Unique identifier for the target message thread of the forum topic */
1025
1142
  message_thread_id: number;
1026
1143
  }): true;
1144
+
1027
1145
  /** 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
1146
  editGeneralForumTopic(args: {
1029
1147
  /** Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) */
@@ -1031,31 +1149,37 @@ export type ApiMethods<F> = {
1031
1149
  /** New topic name, 1-128 characters */
1032
1150
  name: string;
1033
1151
  }): true;
1152
+
1034
1153
  /** 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
1154
  closeGeneralForumTopic(args: {
1036
1155
  /** Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) */
1037
1156
  chat_id: number | string;
1038
1157
  }): true;
1158
+
1039
1159
  /** 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
1160
  reopenGeneralForumTopic(args: {
1041
1161
  /** Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) */
1042
1162
  chat_id: number | string;
1043
1163
  }): true;
1164
+
1044
1165
  /** 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
1166
  hideGeneralForumTopic(args: {
1046
1167
  /** Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) */
1047
1168
  chat_id: number | string;
1048
1169
  }): true;
1170
+
1049
1171
  /** 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
1172
  unhideGeneralForumTopic(args: {
1051
1173
  /** Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) */
1052
1174
  chat_id: number | string;
1053
1175
  }): true;
1176
+
1054
1177
  /** 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
1178
  unpinAllGeneralForumTopicMessages(args: {
1056
1179
  /** Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) */
1057
1180
  chat_id: number | string;
1058
1181
  }): true;
1182
+
1059
1183
  /** 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
1184
 
1061
1185
  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 +1197,7 @@ export type ApiMethods<F> = {
1073
1197
  /** 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
1198
  cache_time?: number;
1075
1199
  }): true;
1200
+
1076
1201
  /** 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
1202
  getUserChatBoosts(args: {
1078
1203
  /** Unique identifier for the chat or username of the channel (in the format @channelusername) */
@@ -1080,18 +1205,13 @@ export type ApiMethods<F> = {
1080
1205
  /** Unique identifier of the target user */
1081
1206
  user_id: number;
1082
1207
  }): 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;
1208
+
1209
+ /** Use this method to get information about the connection of the bot with a business account. Returns a BusinessConnection object on success. */
1210
+ getBusinessConnection(args: {
1211
+ /** Unique identifier of the business connection */
1212
+ business_connection_id: string;
1213
+ }): BusinessConnection;
1214
+
1095
1215
  /** 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
1216
  setMyCommands(args: {
1097
1217
  /** 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 +1221,7 @@ export type ApiMethods<F> = {
1101
1221
  /** 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
1222
  language_code?: string;
1103
1223
  }): true;
1224
+
1104
1225
  /** 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
1226
  deleteMyCommands(args: {
1106
1227
  /** An object, describing scope of users for which the commands are relevant. Defaults to BotCommandScopeDefault. */
@@ -1108,6 +1229,7 @@ export type ApiMethods<F> = {
1108
1229
  /** 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
1230
  language_code?: string;
1110
1231
  }): true;
1232
+
1111
1233
  /** 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
1234
  getMyCommands(args: {
1113
1235
  /** An object, describing scope of users. Defaults to BotCommandScopeDefault. */
@@ -1115,6 +1237,21 @@ export type ApiMethods<F> = {
1115
1237
  /** A two-letter ISO 639-1 language code or an empty string */
1116
1238
  language_code?: string;
1117
1239
  }): BotCommand[];
1240
+
1241
+ /** Use this method to change the bot's name. Returns True on success. */
1242
+ setMyName(args: {
1243
+ /** New bot name; 0-64 characters. Pass an empty string to remove the dedicated name for the given language. */
1244
+ name?: string;
1245
+ /** 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. */
1246
+ language_code?: string;
1247
+ }): true;
1248
+
1249
+ /** Use this method to get the current bot name for the given user language. Returns BotName on success. */
1250
+ getMyName(args: {
1251
+ /** A two-letter ISO 639-1 language code or an empty string */
1252
+ language_code?: string;
1253
+ }): BotName;
1254
+
1118
1255
  /** 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
1256
  setMyDescription(args: {
1120
1257
  /** New bot description; 0-512 characters. Pass an empty string to remove the dedicated description for the given language. */
@@ -1122,11 +1259,13 @@ export type ApiMethods<F> = {
1122
1259
  /** 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
1260
  language_code?: string;
1124
1261
  }): true;
1262
+
1125
1263
  /** Use this method to get the current bot description for the given user language. Returns BotDescription on success. */
1126
1264
  getMyDescription(args: {
1127
1265
  /** A two-letter ISO 639-1 language code or an empty string */
1128
1266
  language_code?: string;
1129
1267
  }): BotDescription;
1268
+
1130
1269
  /** 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
1270
  setMyShortDescription(args: {
1132
1271
  /** 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 +1273,13 @@ export type ApiMethods<F> = {
1134
1273
  /** 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
1274
  language_code?: string;
1136
1275
  }): true;
1276
+
1137
1277
  /** Use this method to get the current bot short description for the given user language. Returns BotShortDescription on success. */
1138
1278
  getMyShortDescription(args: {
1139
1279
  /** A two-letter ISO 639-1 language code or an empty string */
1140
1280
  language_code?: string;
1141
1281
  }): BotShortDescription;
1282
+
1142
1283
  /** Use this method to change the bot's menu button in a private chat, or the default menu button. Returns True on success. */
1143
1284
  setChatMenuButton(args: {
1144
1285
  /** Unique identifier for the target private chat. If not specified, default bot's menu button will be changed */
@@ -1146,11 +1287,13 @@ export type ApiMethods<F> = {
1146
1287
  /** An object for the bot's new menu button. Defaults to MenuButtonDefault */
1147
1288
  menu_button?: MenuButton;
1148
1289
  }): true;
1290
+
1149
1291
  /** 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
1292
  getChatMenuButton(args: {
1151
1293
  /** Unique identifier for the target private chat. If not specified, default bot's menu button will be returned */
1152
1294
  chat_id?: number;
1153
1295
  }): MenuButton;
1296
+
1154
1297
  /** 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
1298
  setMyDefaultAdministratorRights(args: {
1156
1299
  /** An object describing new default administrator rights. If not specified, the default administrator rights will be cleared. */
@@ -1158,11 +1301,13 @@ export type ApiMethods<F> = {
1158
1301
  /** 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
1302
  for_channels?: boolean;
1160
1303
  }): true;
1304
+
1161
1305
  /** Use this method to get the current default administrator rights of the bot. Returns ChatAdministratorRights on success. */
1162
1306
  getMyDefaultAdministratorRights(args: {
1163
1307
  /** 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
1308
  for_channels?: boolean;
1165
1309
  }): ChatAdministratorRights;
1310
+
1166
1311
  /** 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
1312
  editMessageText(args: {
1168
1313
  /** 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 +1322,12 @@ export type ApiMethods<F> = {
1177
1322
  parse_mode?: ParseMode;
1178
1323
  /** A list of special entities that appear in message text, which can be specified instead of parse_mode */
1179
1324
  entities?: MessageEntity[];
1180
- /** Disables link previews for links in this message */
1181
- disable_web_page_preview?: boolean;
1325
+ /** Link preview generation options for the message */
1326
+ link_preview_options?: LinkPreviewOptions;
1182
1327
  /** An object for an inline keyboard. */
1183
1328
  reply_markup?: InlineKeyboardMarkup;
1184
1329
  }): (Update.Edited & Message.TextMessage) | true;
1330
+
1185
1331
  /** 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
1332
  editMessageCaption(args: {
1187
1333
  /** 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 +1345,7 @@ export type ApiMethods<F> = {
1199
1345
  /** An object for an inline keyboard. */
1200
1346
  reply_markup?: InlineKeyboardMarkup;
1201
1347
  }): (Update.Edited & Message.CaptionableMessage) | true;
1348
+
1202
1349
  /** 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
1350
  editMessageMedia(args: {
1204
1351
  /** 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 +1355,11 @@ export type ApiMethods<F> = {
1208
1355
  /** Required if chat_id and message_id are not specified. Identifier of the inline message */
1209
1356
  inline_message_id?: string;
1210
1357
  /** An object for a new media content of the message */
1211
- media: InputMedia<F>;
1358
+ media: InputMedia;
1212
1359
  /** An object for a new inline keyboard. */
1213
1360
  reply_markup?: InlineKeyboardMarkup;
1214
1361
  }): (Update.Edited & Message) | true;
1362
+
1215
1363
  /** 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
1364
  editMessageReplyMarkup(args: {
1217
1365
  /** 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 +1371,7 @@ export type ApiMethods<F> = {
1223
1371
  /** An object for an inline keyboard. */
1224
1372
  reply_markup?: InlineKeyboardMarkup;
1225
1373
  }): (Update.Edited & Message) | true;
1374
+
1226
1375
  /** Use this method to stop a poll which was sent by the bot. On success, the stopped Poll is returned. */
1227
1376
  stopPoll(args: {
1228
1377
  /** Unique identifier for the target chat or username of the target channel (in the format @channelusername) */
@@ -1232,6 +1381,7 @@ export type ApiMethods<F> = {
1232
1381
  /** An object for a new message inline keyboard. */
1233
1382
  reply_markup?: InlineKeyboardMarkup;
1234
1383
  }): Poll;
1384
+
1235
1385
  /** Use this method to delete a message, including service messages, with the following limitations:
1236
1386
  - A message can only be deleted if it was sent less than 48 hours ago.
1237
1387
  - Service messages about a supergroup, channel, or forum topic creation can't be deleted.
@@ -1248,21 +1398,25 @@ export type ApiMethods<F> = {
1248
1398
  /** Identifier of the message to delete */
1249
1399
  message_id: number;
1250
1400
  }): true;
1401
+
1251
1402
  /** Use this method to delete multiple messages simultaneously. Returns True on success. */
1252
1403
  deleteMessages(args: {
1253
1404
  /** Unique identifier for the target chat or username of the target channel (in the format @channelusername) */
1254
1405
  chat_id: number | string;
1255
- /** Identifiers of 1-100 messages to delete. See deleteMessage for limitations on which messages can be deleted */
1406
+ /** A list of 1-100 identifiers of messages to delete. See deleteMessage for limitations on which messages can be deleted */
1256
1407
  message_ids: number[];
1257
1408
  }): true;
1409
+
1258
1410
  /** Use this method to send static .WEBP, animated .TGS, or video .WEBM stickers. On success, the sent Message is returned. */
1259
1411
  sendSticker(args: {
1412
+ /** Unique identifier of the business connection on behalf of which the message will be sent */
1413
+ business_connection_id?: string;
1260
1414
  /** Unique identifier for the target chat or username of the target channel (in the format @channelusername) */
1261
1415
  chat_id: number | string;
1262
1416
  /** Unique identifier for the target message thread (topic) of the forum; for forum supergroups only */
1263
1417
  message_thread_id?: number;
1264
- /** 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;
1418
+ /** 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, .TGS, or .WEBM sticker using multipart/form-data. Video and animated stickers can't be sent via an HTTP URL. */
1419
+ sticker: Buffer | ReadStream | string | string;
1266
1420
  /** Emoji associated with the sticker; only for just uploaded stickers */
1267
1421
  emoji?: string;
1268
1422
  /** Sends the message silently. Users will receive a notification with no sound. */
@@ -1271,32 +1425,38 @@ export type ApiMethods<F> = {
1271
1425
  protect_content?: boolean;
1272
1426
  /** Description of the message to reply to */
1273
1427
  reply_parameters?: ReplyParameters;
1274
- /** Additional interface options. An object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. */
1428
+ /** Additional interface options. An object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user. Not supported for messages sent on behalf of a business account. */
1275
1429
  reply_markup?:
1276
1430
  | InlineKeyboardMarkup
1277
1431
  | ReplyKeyboardMarkup
1278
1432
  | ReplyKeyboardRemove
1279
1433
  | ForceReply;
1434
+ /** @deprecated Use `reply_parameters` instead. */
1435
+ reply_to_message_id?: number;
1280
1436
  }): Message.StickerMessage;
1437
+
1281
1438
  /** Use this method to get a sticker set. On success, a StickerSet object is returned. */
1282
1439
  getStickerSet(args: {
1283
1440
  /** Name of the sticker set */
1284
1441
  name: string;
1285
1442
  }): StickerSet;
1443
+
1286
1444
  /** Use this method to get information about custom emoji stickers by their identifiers. Returns an Array of Sticker objects. */
1287
1445
  getCustomEmojiStickers(args: {
1288
1446
  /** List of custom emoji identifiers. At most 200 custom emoji identifiers can be specified. */
1289
1447
  custom_emoji_ids: string[];
1290
1448
  }): Sticker[];
1291
- /** 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. */
1449
+
1450
+ /** Use this method to upload a file with a sticker for later use in the createNewStickerSet, addStickerToSet, or replaceStickerInSet methods (the file can be used multiple times). Returns the uploaded File on success. */
1292
1451
  uploadStickerFile(args: {
1293
1452
  /** User identifier of sticker file owner */
1294
1453
  user_id: number;
1295
1454
  /** Format of the sticker, must be one of “static”, “animated”, “video” */
1296
1455
  sticker_format: "static" | "animated" | "video";
1297
1456
  /** A file with the sticker in .WEBP, .PNG, .TGS, or .WEBM format. See https://core.telegram.org/stickers for technical requirements. */
1298
- sticker: F;
1457
+ sticker: Buffer | ReadStream | string;
1299
1458
  }): File;
1459
+
1300
1460
  /** 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
1461
  createNewStickerSet(args: {
1302
1462
  /** User identifier of created sticker set owner */
@@ -1306,23 +1466,35 @@ export type ApiMethods<F> = {
1306
1466
  /** Sticker set title, 1-64 characters */
1307
1467
  title: string;
1308
1468
  /** A list of 1-50 initial stickers to be added to the sticker set */
1309
- stickers: InputSticker<F>[];
1310
- /** Format of the sticker, must be one of “static”, “animated”, “video” */
1311
- sticker_format: "static" | "animated" | "video";
1469
+ stickers: InputSticker[];
1312
1470
  /** Type of stickers in the set, pass “regular”, “mask”, or “custom_emoji”. By default, a regular sticker set is created. */
1313
1471
  sticker_type?: "regular" | "mask" | "custom_emoji";
1314
1472
  /** 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
1473
  needs_repainting?: boolean;
1316
1474
  }): true;
1317
- /** 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. */
1475
+
1476
+ /** Use this method to add a new sticker to a set created by the bot. Emoji sticker sets can have up to 200 stickers. Other sticker sets can have up to 120 stickers. Returns True on success. */
1318
1477
  addStickerToSet(args: {
1319
1478
  /** User identifier of sticker set owner */
1320
1479
  user_id: number;
1321
1480
  /** Sticker set name */
1322
1481
  name: string;
1323
1482
  /** 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>;
1483
+ sticker: InputSticker;
1484
+ }): true;
1485
+
1486
+ /** Use this method to replace an existing sticker in a sticker set with a new one. The method is equivalent to calling deleteStickerFromSet, then addStickerToSet, then setStickerPositionInSet. Returns True on success. */
1487
+ replaceStickerInSet(args: {
1488
+ /** User identifier of the sticker set owner */
1489
+ user_id: number;
1490
+ /** Sticker set name */
1491
+ name: string;
1492
+ /** File identifier of the replaced sticker */
1493
+ old_sticker: string;
1494
+ /** An object with information about the added sticker. If exactly the same sticker had already been added to the set, then the set remains unchanged.:x */
1495
+ sticker: InputSticker;
1325
1496
  }): true;
1497
+
1326
1498
  /** Use this method to move a sticker in a set created by the bot to a specific position. Returns True on success. */
1327
1499
  setStickerPositionInSet(args: {
1328
1500
  /** File identifier of the sticker */
@@ -1330,11 +1502,13 @@ export type ApiMethods<F> = {
1330
1502
  /** New sticker position in the set, zero-based */
1331
1503
  position: number;
1332
1504
  }): true;
1505
+
1333
1506
  /** Use this method to delete a sticker from a set created by the bot. Returns True on success. */
1334
1507
  deleteStickerFromSet(args: {
1335
1508
  /** File identifier of the sticker */
1336
1509
  sticker: string;
1337
1510
  }): true;
1511
+
1338
1512
  /** 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
1513
  setStickerEmojiList(args: {
1340
1514
  /** File identifier of the sticker */
@@ -1342,6 +1516,7 @@ export type ApiMethods<F> = {
1342
1516
  /** A list of 1-20 emoji associated with the sticker */
1343
1517
  emoji_list: string[];
1344
1518
  }): true;
1519
+
1345
1520
  /** 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
1521
  setStickerKeywords(args: {
1347
1522
  /** File identifier of the sticker */
@@ -1349,6 +1524,7 @@ export type ApiMethods<F> = {
1349
1524
  /** A list of 0-20 search keywords for the sticker with total length of up to 64 characters */
1350
1525
  keywords?: string[];
1351
1526
  }): true;
1527
+
1352
1528
  /** 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
1529
  setStickerMaskPosition(args: {
1354
1530
  /** File identifier of the sticker */
@@ -1356,6 +1532,7 @@ export type ApiMethods<F> = {
1356
1532
  /** An object with the position where the mask should be placed on faces. Omit the parameter to remove the mask position. */
1357
1533
  mask_position?: MaskPosition;
1358
1534
  }): true;
1535
+
1359
1536
  /** Use this method to set the title of a created sticker set. Returns True on success. */
1360
1537
  setStickerSetTitle(args: {
1361
1538
  /** Sticker set name */
@@ -1363,11 +1540,13 @@ export type ApiMethods<F> = {
1363
1540
  /** Sticker set title, 1-64 characters */
1364
1541
  title: string;
1365
1542
  }): true;
1543
+
1366
1544
  /** Use this method to delete a sticker set that was created by the bot. Returns True on success. */
1367
1545
  deleteStickerSet(args: {
1368
1546
  /** Sticker set name */
1369
1547
  name: string;
1370
1548
  }): true;
1549
+
1371
1550
  /** 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
1551
  setStickerSetThumbnail(args: {
1373
1552
  /** Sticker set name */
@@ -1375,8 +1554,11 @@ export type ApiMethods<F> = {
1375
1554
  /** User identifier of the sticker set owner */
1376
1555
  user_id: number;
1377
1556
  /** 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;
1557
+ thumbnail?: Buffer | ReadStream | string | string;
1558
+ /** Format of the thumbnail, must be one of “static” for a .WEBP or .PNG image, “animated” for a .TGS animation, or “video” for a WEBM video */
1559
+ format: "static" | "animated" | "video";
1379
1560
  }): true;
1561
+
1380
1562
  /** Use this method to set the thumbnail of a custom emoji sticker set. Returns True on success. */
1381
1563
  setCustomEmojiStickerSetThumbnail(args: {
1382
1564
  /** Sticker set name */
@@ -1384,6 +1566,7 @@ export type ApiMethods<F> = {
1384
1566
  /** 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
1567
  custom_emoji_id?: string;
1386
1568
  }): true;
1569
+
1387
1570
  /** Use this method to send answers to an inline query. On success, True is returned.
1388
1571
  No more than 50 results per query are allowed.
1389
1572
 
@@ -1395,13 +1578,14 @@ export type ApiMethods<F> = {
1395
1578
  results: readonly InlineQueryResult[];
1396
1579
  /** The maximum amount of time in seconds that the result of the inline query may be cached on the server. Defaults to 300. */
1397
1580
  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 */
1581
+ /** 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
1582
  is_personal?: boolean;
1400
1583
  /** 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
1584
  next_offset?: string;
1402
1585
  /** An object describing a button to be shown above inline query results */
1403
1586
  button?: InlineQueryResultsButton;
1404
1587
  }): true;
1588
+
1405
1589
  /** 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
1590
  answerWebAppQuery(args: {
1407
1591
  /** Unique identifier for the query to be answered */
@@ -1409,6 +1593,7 @@ export type ApiMethods<F> = {
1409
1593
  /** An object describing the message to be sent */
1410
1594
  result: InlineQueryResult;
1411
1595
  }): SentWebAppMessage;
1596
+
1412
1597
  /** Use this method to send invoices. On success, the sent Message is returned. */
1413
1598
  sendInvoice(args: {
1414
1599
  /** Unique identifier for the target chat or username of the target channel (in the format @channelusername) */
@@ -1465,7 +1650,10 @@ export type ApiMethods<F> = {
1465
1650
  reply_parameters?: ReplyParameters;
1466
1651
  /** 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
1652
  reply_markup?: InlineKeyboardMarkup;
1653
+ /** @deprecated Use `reply_parameters` instead. */
1654
+ reply_to_message_id?: number;
1468
1655
  }): Message.InvoiceMessage;
1656
+
1469
1657
  /** Use this method to create a link for an invoice. Returns the created invoice link as String on success. */
1470
1658
  createInvoiceLink(args: {
1471
1659
  /** Product name, 1-32 characters */
@@ -1509,6 +1697,7 @@ export type ApiMethods<F> = {
1509
1697
  /** Pass True if the final price depends on the shipping method */
1510
1698
  is_flexible?: boolean;
1511
1699
  }): string;
1700
+
1512
1701
  /** 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
1702
  answerShippingQuery(args: {
1514
1703
  /** Unique identifier for the query to be answered */
@@ -1520,6 +1709,7 @@ export type ApiMethods<F> = {
1520
1709
  /** 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
1710
  error_message?: string;
1522
1711
  }): true;
1712
+
1523
1713
  /** 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
1714
  answerPreCheckoutQuery(args: {
1525
1715
  /** Unique identifier for the query to be answered */
@@ -1529,6 +1719,7 @@ export type ApiMethods<F> = {
1529
1719
  /** 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
1720
  error_message?: string;
1531
1721
  }): true;
1722
+
1532
1723
  /** 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
1724
 
1534
1725
  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,8 +1729,11 @@ export type ApiMethods<F> = {
1538
1729
  /** An array describing the errors */
1539
1730
  errors: readonly PassportElementError[];
1540
1731
  }): true;
1732
+
1541
1733
  /** Use this method to send a game. On success, the sent Message is returned. */
1542
1734
  sendGame(args: {
1735
+ /** Unique identifier of the business connection on behalf of which the message will be sent */
1736
+ business_connection_id?: string;
1543
1737
  /** Unique identifier for the target chat */
1544
1738
  chat_id: number;
1545
1739
  /** Unique identifier for the target message thread (topic) of the forum; for forum supergroups only */
@@ -1552,9 +1746,12 @@ export type ApiMethods<F> = {
1552
1746
  protect_content?: boolean;
1553
1747
  /** Description of the message to reply to */
1554
1748
  reply_parameters?: ReplyParameters;
1555
- /** 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. */
1749
+ /** Additional interface options. An object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user. Not supported for messages sent on behalf of a business account. */
1556
1750
  reply_markup?: InlineKeyboardMarkup;
1751
+ /** @deprecated Use `reply_parameters` instead. */
1752
+ reply_to_message_id?: number;
1557
1753
  }): Message.GameMessage;
1754
+
1558
1755
  /** 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
1756
  setGameScore(args: {
1560
1757
  /** User identifier */
@@ -1572,6 +1769,7 @@ export type ApiMethods<F> = {
1572
1769
  /** Required if chat_id and message_id are not specified. Identifier of the inline message */
1573
1770
  inline_message_id?: string;
1574
1771
  }): (Update.Edited & Message.GameMessage) | true;
1772
+
1575
1773
  /** 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
1774
 
1577
1775
  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 +1784,13 @@ export type ApiMethods<F> = {
1586
1784
  inline_message_id?: string;
1587
1785
  }): GameHighScore[];
1588
1786
  };
1787
+
1589
1788
  /** This object describes a sticker to be added to a sticker set. */
1590
- export interface InputSticker<F> {
1789
+ export interface InputSticker {
1790
+ /** Format of the thumbnail, must be one of “static” for a .WEBP or .PNG image, “animated” for a .TGS animation, or “video” for a WEBM video */
1791
+ format: "static" | "animated" | "video";
1591
1792
  /** 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;
1793
+ sticker: Buffer | ReadStream | string;
1593
1794
  /** List of 1-20 emoji associated with the sticker */
1594
1795
  emoji_list: string[];
1595
1796
  /** Position where the mask should be placed on faces. For “mask” stickers only. */
@@ -1597,24 +1798,26 @@ export interface InputSticker<F> {
1597
1798
  /** 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
1799
  keywords?: string[];
1599
1800
  }
1801
+
1600
1802
  /** 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>;
1803
+ - InputMediaAnimation
1804
+ - InputMediaDocument
1805
+ - InputMediaAudio
1806
+ - InputMediaPhoto
1807
+ - InputMediaVideo */
1808
+ export type InputMedia =
1809
+ | InputMediaAnimation
1810
+ | InputMediaDocument
1811
+ | InputMediaAudio
1812
+ | InputMediaPhoto
1813
+ | InputMediaVideo;
1814
+
1612
1815
  /** Represents a photo to be sent. */
1613
- export interface InputMediaPhoto<F> {
1816
+ export interface InputMediaPhoto {
1614
1817
  /** Type of the result, must be photo */
1615
1818
  type: "photo";
1616
1819
  /** 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;
1820
+ media: Buffer | ReadStream | string;
1618
1821
  /** Caption of the photo to be sent, 0-1024 characters after entities parsing */
1619
1822
  caption?: string;
1620
1823
  /** Mode for parsing entities in the photo caption. See formatting options for more details. */
@@ -1624,14 +1827,15 @@ export interface InputMediaPhoto<F> {
1624
1827
  /** Pass True if the photo needs to be covered with a spoiler animation */
1625
1828
  has_spoiler?: boolean;
1626
1829
  }
1830
+
1627
1831
  /** Represents a video to be sent. */
1628
- export interface InputMediaVideo<F> {
1832
+ export interface InputMediaVideo {
1629
1833
  /** Type of the result, must be video */
1630
1834
  type: "video";
1631
1835
  /** 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;
1836
+ media: Buffer | ReadStream | string;
1633
1837
  /** 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;
1838
+ thumbnail?: Buffer | ReadStream | string;
1635
1839
  /** Caption of the video to be sent, 0-1024 characters after entities parsing */
1636
1840
  caption?: string;
1637
1841
  /** Mode for parsing entities in the video caption. See formatting options for more details. */
@@ -1649,14 +1853,15 @@ export interface InputMediaVideo<F> {
1649
1853
  /** Pass True if the photo needs to be covered with a spoiler animation */
1650
1854
  has_spoiler?: boolean;
1651
1855
  }
1856
+
1652
1857
  /** Represents an animation file (GIF or H.264/MPEG-4 AVC video without sound) to be sent. */
1653
- export interface InputMediaAnimation<F> {
1858
+ export interface InputMediaAnimation {
1654
1859
  /** Type of the result, must be animation */
1655
1860
  type: "animation";
1656
1861
  /** 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;
1862
+ media: Buffer | ReadStream | string;
1658
1863
  /** 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;
1864
+ thumbnail?: Buffer | ReadStream | string;
1660
1865
  /** Caption of the animation to be sent, 0-1024 characters after entities parsing */
1661
1866
  caption?: string;
1662
1867
  /** Mode for parsing entities in the animation caption. See formatting options for more details. */
@@ -1672,14 +1877,15 @@ export interface InputMediaAnimation<F> {
1672
1877
  /** Pass True if the photo needs to be covered with a spoiler animation */
1673
1878
  has_spoiler?: boolean;
1674
1879
  }
1880
+
1675
1881
  /** Represents an audio file to be treated as music to be sent. */
1676
- export interface InputMediaAudio<F> {
1882
+ export interface InputMediaAudio {
1677
1883
  /** Type of the result, must be audio */
1678
1884
  type: "audio";
1679
1885
  /** 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;
1886
+ media: Buffer | ReadStream | string;
1681
1887
  /** 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;
1888
+ thumbnail?: Buffer | ReadStream | string;
1683
1889
  /** Caption of the audio to be sent, 0-1024 characters after entities parsing */
1684
1890
  caption?: string;
1685
1891
  /** Mode for parsing entities in the audio caption. See formatting options for more details. */
@@ -1693,14 +1899,15 @@ export interface InputMediaAudio<F> {
1693
1899
  /** Title of the audio */
1694
1900
  title?: string;
1695
1901
  }
1902
+
1696
1903
  /** Represents a general file to be sent. */
1697
- export interface InputMediaDocument<F> {
1904
+ export interface InputMediaDocument {
1698
1905
  /** Type of the result, must be document */
1699
1906
  type: "document";
1700
1907
  /** 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;
1908
+ media: Buffer | ReadStream | string;
1702
1909
  /** 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;
1910
+ thumbnail?: Buffer | ReadStream | string;
1704
1911
  /** Caption of the document to be sent, 0-1024 characters after entities parsing */
1705
1912
  caption?: string;
1706
1913
  /** Mode for parsing entities in the document caption. See formatting options for more details. */
@@ -1710,4 +1917,3 @@ export interface InputMediaDocument<F> {
1710
1917
  /** 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
1918
  disable_content_type_detection?: boolean;
1712
1919
  }
1713
- export {};