@grammyjs/types 3.3.1 → 3.4.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.
package/message.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { Chat, File, User } from "./manage.js";
1
+ import type { Chat, User } from "./manage.js";
2
2
  import type { InlineKeyboardMarkup } from "./markup.js";
3
3
  import type { PassportData } from "./passport.js";
4
4
  import type { Invoice, SuccessfulPayment } from "./payment.js";
@@ -13,30 +13,24 @@ export declare namespace Message {
13
13
  from?: User;
14
14
  /** Sender of the message, sent on behalf of a chat. For example, the channel itself for channel posts, the supergroup itself for messages from anonymous group administrators, the linked channel for messages automatically forwarded to the discussion group. For backward compatibility, the field from contains a fake sender user in non-channel chats, if the message was sent on behalf of a chat. */
15
15
  sender_chat?: Chat;
16
- /** Date the message was sent in Unix time */
16
+ /** Date the message was sent in Unix time. It is always a positive number, representing a valid date. */
17
17
  date: number;
18
- /** Conversation the message belongs to */
18
+ /** Chat the message belongs to */
19
19
  chat: Chat;
20
20
  /** True, if the message is sent to a forum topic */
21
21
  is_topic_message?: boolean;
22
22
  }
23
23
  interface CommonMessage extends ServiceMessage {
24
- /** For forwarded messages, sender of the original message */
25
- forward_from?: User;
26
- /** For messages forwarded from channels or from anonymous administrators, information about the original sender chat */
27
- forward_from_chat?: Chat;
28
- /** For messages forwarded from channels, identifier of the original message in the channel */
29
- forward_from_message_id?: number;
30
- /** For forwarded messages that were originally sent in channels or by an anonymous chat administrator, signature of the message sender if present */
31
- forward_signature?: string;
32
- /** Sender's name for messages forwarded from users who disallow adding a link to their account in forwarded messages */
33
- forward_sender_name?: string;
34
- /** For forwarded messages, date the original message was sent in Unix time */
35
- forward_date?: number;
24
+ /** Information about the original message for forwarded messages */
25
+ forward_origin?: MessageOrigin;
36
26
  /** True, if the message is a channel post that was automatically forwarded to the connected discussion group */
37
27
  is_automatic_forward?: true;
38
- /** For replies, the original message. Note that the Message object in this field will not contain further reply_to_message fields even if it itself is a reply. */
28
+ /** For replies in the same chat and message thread, the original message. Note that the Message object in this field will not contain further reply_to_message fields even if it itself is a reply. */
39
29
  reply_to_message?: ReplyMessage;
30
+ /** Information about the message that is being replied to, which may come from another chat or forum topic */
31
+ external_reply?: ExternalReplyInfo;
32
+ /** For replies that quote part of the original message, the quoted part of the message */
33
+ quote?: TextQuote;
40
34
  /** Bot through which the message was sent */
41
35
  via_bot?: User;
42
36
  /** Date the message was last edited in Unix time */
@@ -45,6 +39,8 @@ export declare namespace Message {
45
39
  has_protected_content?: true;
46
40
  /** Signature of the post author for messages in channels, or the custom title of an anonymous group administrator */
47
41
  author_signature?: string;
42
+ /** Options used for link preview generation for the message, if it is a text message and link preview options were changed */
43
+ link_preview_options?: LinkPreviewOptions;
48
44
  /** Inline keyboard attached to the message. login_url buttons are represented as ordinary url buttons. */
49
45
  reply_markup?: InlineKeyboardMarkup;
50
46
  }
@@ -90,7 +86,7 @@ export declare namespace Message {
90
86
  type PinnedMessageMessage = ServiceMessage & MsgWith<"pinned_message">;
91
87
  type InvoiceMessage = ServiceMessage & MsgWith<"invoice">;
92
88
  type SuccessfulPaymentMessage = ServiceMessage & MsgWith<"successful_payment">;
93
- type UserSharedMessage = ServiceMessage & MsgWith<"user_shared">;
89
+ type UsersSharedMessage = ServiceMessage & MsgWith<"users_shared">;
94
90
  type ChatSharedMessage = ServiceMessage & MsgWith<"chat_shared">;
95
91
  type ConnectedWebsiteMessage = ServiceMessage & MsgWith<"connected_website">;
96
92
  type WriteAccessAllowedMessage = ServiceMessage & MsgWith<"write_access_allowed">;
@@ -102,6 +98,10 @@ export declare namespace Message {
102
98
  type ForumTopicReopenedMessage = ServiceMessage & MsgWith<"forum_topic_reopened">;
103
99
  type GeneralForumTopicHiddenMessage = ServiceMessage & MsgWith<"general_forum_topic_hidden">;
104
100
  type GeneralForumTopicUnhiddenMessage = ServiceMessage & MsgWith<"general_forum_topic_unhidden">;
101
+ type GiveawayCreatedMessage = ServiceMessage & MsgWith<"giveaway_created">;
102
+ type GiveawayMessage = ServiceMessage & MsgWith<"giveaway">;
103
+ type GiveawayWinnersMessage = ServiceMessage & MsgWith<"giveaway_winners">;
104
+ type GiveawayCompletedMessage = ServiceMessage & MsgWith<"giveaway_completed">;
105
105
  type VideoChatScheduledMessage = ServiceMessage & MsgWith<"video_chat_scheduled">;
106
106
  type VideoChatStartedMessage = ServiceMessage & MsgWith<"video_chat_started">;
107
107
  type VideoChatEndedMessage = ServiceMessage & MsgWith<"video_chat_ended">;
@@ -164,18 +164,18 @@ export interface Message extends Message.MediaMessage {
164
164
  channel_chat_created?: true;
165
165
  /** Service message: auto-delete timer settings changed in the chat */
166
166
  message_auto_delete_timer_changed?: MessageAutoDeleteTimerChanged;
167
- /** The group has been migrated to a supergroup with the specified identifier. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this identifier. */
167
+ /** The group has been migrated to a supergroup with the specified identifier. */
168
168
  migrate_to_chat_id?: number;
169
- /** The supergroup has been migrated from a group with the specified identifier. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this identifier. */
169
+ /** The supergroup has been migrated from a group with the specified identifier. */
170
170
  migrate_from_chat_id?: number;
171
- /** Specified message was pinned. Note that the Message object in this field will not contain further reply_to_message fields even if it is itself a reply. */
172
- pinned_message?: ReplyMessage;
171
+ /** Specified message was pinned. Note that the Message object in this field will not contain further reply_to_message fields even if it itself is a reply. */
172
+ pinned_message?: MaybeInaccessibleMessage;
173
173
  /** Message is an invoice for a payment, information about the invoice. More about payments » */
174
174
  invoice?: Invoice;
175
175
  /** Message is a service message about a successful payment, information about the payment. More about payments » */
176
176
  successful_payment?: SuccessfulPayment;
177
- /** Service message: a user was shared with the bot */
178
- user_shared?: UserShared;
177
+ /** Service message: users were shared with the bot */
178
+ users_shared?: UsersShared;
179
179
  /** Service message: a chat was shared with the bot */
180
180
  chat_shared?: ChatShared;
181
181
  /** The domain name of the website on which the user has logged in. More about Telegram Login » */
@@ -198,6 +198,14 @@ export interface Message extends Message.MediaMessage {
198
198
  general_forum_topic_hidden?: GeneralForumTopicHidden;
199
199
  /** Service message: the 'General' forum topic unhidden */
200
200
  general_forum_topic_unhidden?: GeneralForumTopicUnhidden;
201
+ /** Service message: a scheduled giveaway was created */
202
+ giveaway_created?: GiveawayCreated;
203
+ /** The message is a scheduled giveaway message */
204
+ giveaway?: Giveaway;
205
+ /** A giveaway with public winners was completed */
206
+ giveaway_winners?: GiveawayWinners;
207
+ /** Service message: a giveaway without public winners was completed */
208
+ giveaway_completed?: GiveawayCompleted;
201
209
  /** Service message: video chat scheduled */
202
210
  video_chat_scheduled?: VideoChatScheduled;
203
211
  /** Service message: video chat started */
@@ -219,13 +227,27 @@ export interface SentWebAppMessage {
219
227
  /** Identifier of the sent inline message. Available only if there is an inline keyboard attached to the message. */
220
228
  inline_message_id: string;
221
229
  }
222
- /** The Bot API supports basic formatting for messages. You can use bold, italic, underlined, strikethrough, and spoiler text, as well as inline links and pre-formatted code in your bots' messages. Telegram clients will render them accordingly. You can use either markdown-style or HTML-style formatting.
230
+ /** This object describes a message that was deleted or is otherwise inaccessible to the bot. */
231
+ export interface InaccessibleMessage extends Omit<Message, "chat" | "message_id" | "date"> {
232
+ /** Chat the message belonged to */
233
+ chat: Chat;
234
+ /** Unique message identifier inside the chat */
235
+ message_id: number;
236
+ /** Always 0. The field can be used to differentiate regular and inaccessible messages. */
237
+ date: 0;
238
+ }
239
+ /** This object describes a message that can be inaccessible to the bot. It can be one of
240
+ - Message
241
+ - InaccessibleMessage */
242
+ export type MaybeInaccessibleMessage = Message | InaccessibleMessage;
243
+ /** The Bot API supports basic formatting for messages. You can use bold, italic, underlined, strikethrough, spoiler text, block quotations as well as inline links and pre-formatted code in your bots' messages. Telegram clients will render them accordingly. You can specify text entities directly, or use markdown-style or HTML-style formatting.
223
244
 
224
245
  Note that Telegram clients will display an **alert** to the user before opening an inline link ('Open this link?' together with the full URL).
225
246
 
226
247
  Message entities can be nested, providing following restrictions are met:
227
248
  - If two entities have common characters, then one of them is fully contained inside another.
228
249
  - bold, italic, underline, strikethrough, and spoiler entities can contain and can be part of any other entities, except pre and code.
250
+ - blockquote entities can't be nested.
229
251
  - All other entities can't contain each other.
230
252
 
231
253
  Links `tg://user?id=<user_id>` can be used to mention a user by their ID without using a username. Please note:
@@ -233,11 +255,13 @@ Links `tg://user?id=<user_id>` can be used to mention a user by their ID without
233
255
  - These links will work only if they are used inside an inline link or in an inline keyboard button. For example, they will not work, when used in a message text.
234
256
  - Unless the user is a member of the chat where they were mentioned, these mentions are only guaranteed to work if the user has contacted the bot in private in the past or has sent a callback query to the bot via an inline button and doesn't have Forwarded Messages privacy enabled for the bot.
235
257
 
258
+ You can find the list of programming and markup languages for which syntax highlighting is supported at [libprisma#supported-languages](https://github.com/TelegramMessenger/libprisma#supported-languages).
259
+
236
260
  #### MarkdownV2 style
237
261
  To use this mode, pass *MarkdownV2* in the *parse_mode* field. Use the following syntax in your message:
238
262
 
239
263
  ```
240
- *bold \*text*
264
+ *bold \*text*
241
265
  _italic \*text_
242
266
  __underline__
243
267
  ~strikethrough~
@@ -253,6 +277,9 @@ pre-formatted fixed-width code block
253
277
  `​`​`python
254
278
  pre-formatted fixed-width code block written in the Python programming language
255
279
  `​`​`
280
+ >Block quotation started
281
+ >Block quotation continued
282
+ >The last line of the block quotation
256
283
  ```
257
284
  Please note:
258
285
 
@@ -280,6 +307,7 @@ To use this mode, pass *HTML* in the *parse_mode* field. The following tags are
280
307
  <code>inline fixed-width code</code>
281
308
  <pre>pre-formatted fixed-width code block</pre>
282
309
  <pre><code class="language-python">pre-formatted fixed-width code block written in the Python programming language</code></pre>
310
+ <blockquote>Block quotation started\nBlock quotation continued\nThe last line of the block quotation</blockquote>
283
311
  ```
284
312
  Please note:
285
313
 
@@ -296,7 +324,7 @@ Please note:
296
324
  This is a legacy mode, retained for backward compatibility. To use this mode, pass *Markdown* in the *parse_mode* field. Use the following syntax in your message:
297
325
 
298
326
  ```
299
- *bold text*
327
+ *bold text*
300
328
  _italic text_
301
329
  [inline URL](http://www.example.com/)
302
330
  [inline mention of a user](tg://user?id=123456789)
@@ -311,13 +339,13 @@ pre-formatted fixed-width code block written in the Python programming language
311
339
  Please note:
312
340
 
313
341
  - Entities must not be nested, use parse mode MarkdownV2 instead.
314
- - There is no way to specify underline and strikethrough entities, use parse mode MarkdownV2 instead.
342
+ - There is no way to specify underline”, “strikethrough”, “spoiler”, “blockquote” and “custom_emoji” entities, use parse mode MarkdownV2 instead.
315
343
  - To escape characters '_', '*', '`', '[' outside of an entity, prepend the characters '\' before them.
316
344
  - Escaping inside entities is not allowed, so entity must be closed first and reopened again: use `_snake_\__case_` for italic `snake_case` and `*2*\**2=4*` for bold `2*2=4`. */
317
345
  export type ParseMode = "Markdown" | "MarkdownV2" | "HTML";
318
346
  export declare namespace MessageEntity {
319
347
  interface AbstractMessageEntity {
320
- /** Type of the entity. Currently, can be “mention” (@username), “hashtag” (#hashtag), “cashtag” ($USD), “bot_command” (/start@jobs_bot), “url” (https://telegram.org), “email” (do-not-reply@telegram.org), “phone_number” (+1-212-555-0123), “bold” (bold text), “italic” (italic text), “underline” (underlined text), “strikethrough” (strikethrough text), “spoiler” (spoiler message), “code” (monowidth string), “pre” (monowidth block), “text_link” (for clickable text URLs), “text_mention” (for users without usernames), “custom_emoji” (for inline custom emoji stickers) */
348
+ /** Type of the entity. Currently, can be “mention” (@username), “hashtag” (#hashtag), “cashtag” ($USD), “bot_command” (/start@jobs_bot), “url” (https://telegram.org), “email” (do-not-reply@telegram.org), “phone_number” (+1-212-555-0123), “bold” (bold text), “italic” (italic text), “underline” (underlined text), “strikethrough” (strikethrough text), “spoiler” (spoiler message), “blockquote” (block quotation), “code” (monowidth string), “pre” (monowidth block), “text_link” (for clickable text URLs), “text_mention” (for users without usernames), “custom_emoji” (for inline custom emoji stickers) */
321
349
  type: string;
322
350
  /** Offset in UTF-16 code units to the start of the entity */
323
351
  offset: number;
@@ -325,7 +353,7 @@ export declare namespace MessageEntity {
325
353
  length: number;
326
354
  }
327
355
  interface CommonMessageEntity extends AbstractMessageEntity {
328
- type: "mention" | "hashtag" | "cashtag" | "bot_command" | "url" | "email" | "phone_number" | "bold" | "italic" | "underline" | "strikethrough" | "spoiler" | "code";
356
+ type: "mention" | "hashtag" | "cashtag" | "bot_command" | "url" | "email" | "phone_number" | "bold" | "italic" | "underline" | "strikethrough" | "spoiler" | "blockquote" | "code";
329
357
  }
330
358
  interface PreMessageEntity extends AbstractMessageEntity {
331
359
  type: "pre";
@@ -350,6 +378,131 @@ export declare namespace MessageEntity {
350
378
  }
351
379
  /** This object represents one special entity in a text message. For example, hashtags, usernames, URLs, etc. */
352
380
  export type MessageEntity = MessageEntity.CommonMessageEntity | MessageEntity.CustomEmojiMessageEntity | MessageEntity.PreMessageEntity | MessageEntity.TextLinkMessageEntity | MessageEntity.TextMentionMessageEntity;
381
+ /** This object contains information about the quoted part of a message that is replied to by the given message. */
382
+ export interface TextQuote {
383
+ /** Text of the quoted part of a message that is replied to by the given message */
384
+ text: string;
385
+ /** Special entities that appear in the quote. Currently, only bold, italic, underline, strikethrough, spoiler, and custom_emoji entities are kept in quotes. */
386
+ entities?: MessageEntity[];
387
+ /** Approximate quote position in the original message in UTF-16 code units as specified by the sender */
388
+ position: number;
389
+ /** True, if the quote was chosen manually by the message sender. Otherwise, the quote was added automatically by the server. */
390
+ is_manual?: true;
391
+ }
392
+ /** This object contains information about a message that is being replied to, which may come from another chat or forum topic. */
393
+ export interface ExternalReplyInfo {
394
+ /** Origin of the message replied to by the given message */
395
+ origin: MessageOrigin;
396
+ /** Chat the original message belongs to. Available only if the chat is a supergroup or a channel. */
397
+ chat?: Chat;
398
+ /** Unique message identifier inside the original chat. Available only if the original chat is a supergroup or a channel. */
399
+ message_id?: number;
400
+ /** Options used for link preview generation for the original message, if it is a text message */
401
+ link_preview_options?: LinkPreviewOptions;
402
+ /** Message is an animation, information about the animation */
403
+ animation?: Animation;
404
+ /** Message is an audio file, information about the file */
405
+ audio?: Audio;
406
+ /** Message is a general file, information about the file */
407
+ document?: Document;
408
+ /** Message is a photo, available sizes of the photo */
409
+ photo?: PhotoSize[];
410
+ /** Message is a sticker, information about the sticker */
411
+ sticker?: Sticker;
412
+ /** Message is a forwarded story */
413
+ story?: Story;
414
+ /** Message is a video, information about the video */
415
+ video?: Video;
416
+ /** Message is a video note, information about the video message */
417
+ video_note?: VideoNote;
418
+ /** Message is a voice message, information about the file */
419
+ voice?: Voice;
420
+ /** True, if the message media is covered by a spoiler animation */
421
+ has_media_spoiler?: true;
422
+ /** Message is a shared contact, information about the contact */
423
+ contact?: Contact;
424
+ /** Message is a dice with random value */
425
+ dice?: Dice;
426
+ /** Message is a game, information about the game. More about games » */
427
+ game?: Game;
428
+ /** Message is a scheduled giveaway, information about the giveaway */
429
+ giveaway?: Giveaway;
430
+ /** A giveaway with public winners was completed */
431
+ giveaway_winners?: GiveawayWinners;
432
+ /** Message is an invoice for a payment, information about the invoice. More about payments » */
433
+ invoice?: Invoice;
434
+ /** Message is a shared location, information about the location */
435
+ location?: Location;
436
+ /** Message is a native poll, information about the poll */
437
+ poll?: Poll;
438
+ /** Message is a venue, information about the venue */
439
+ venue?: Venue;
440
+ }
441
+ /** Describes reply parameters for the message that is being sent. */
442
+ export interface ReplyParameters {
443
+ /** Identifier of the message that will be replied to in the current chat, or in the chat chat_id if it is specified */
444
+ message_id: number;
445
+ /** If the message to be replied to is from a different chat, unique identifier for the chat or username of the channel (in the format @channelusername) */
446
+ chat_id?: number | string;
447
+ /** Pass True if the message should be sent even if the specified message to be replied to is not found; can be used only for replies in the same chat and forum topic. */
448
+ allow_sending_without_reply?: boolean;
449
+ /** Quoted part of the message to be replied to; 0-1024 characters after entities parsing. The quote must be an exact substring of the message to be replied to, including bold, italic, underline, strikethrough, spoiler, and custom_emoji entities. The message will fail to send if the quote isn't found in the original message. */
450
+ quote?: string;
451
+ /** Mode for parsing entities in the quote. See formatting options for more details. */
452
+ quote_parse_mode?: string;
453
+ /** A JSON-serialized list of special entities that appear in the quote. It can be specified instead of quote_parse_mode. */
454
+ quote_entities?: MessageEntity[];
455
+ /** Position of the quote in the original message in UTF-16 code units */
456
+ quote_position?: number;
457
+ }
458
+ /** This object describes the origin of a message. It can be one of
459
+ - MessageOriginUser
460
+ - MessageOriginHiddenUser
461
+ - MessageOriginChat
462
+ - MessageOriginChannel */
463
+ export type MessageOrigin = MessageOriginUser | MessageOriginHiddenUser | MessageOriginChat | MessageOriginChannel;
464
+ /** The message was originally sent by a known user. */
465
+ export interface MessageOriginUser {
466
+ /** Type of the message origin, always “user” */
467
+ type: "user";
468
+ /** Date the message was sent originally in Unix time */
469
+ date: number;
470
+ /** User that sent the message originally */
471
+ sender_user: User;
472
+ }
473
+ /** The message was originally sent by an unknown user. */
474
+ export interface MessageOriginHiddenUser {
475
+ /** Type of the message origin, always “hidden_user” */
476
+ type: "hidden_user";
477
+ /** Date the message was sent originally in Unix time */
478
+ date: number;
479
+ /** Name of the user that sent the message originally */
480
+ sender_user_name: string;
481
+ }
482
+ /** The message was originally sent on behalf of a chat to a group chat. */
483
+ export interface MessageOriginChat {
484
+ /** Type of the message origin, always “chat” */
485
+ type: "chat";
486
+ /** Date the message was sent originally in Unix time */
487
+ date: number;
488
+ /** Chat that sent the message originally */
489
+ sender_chat: Chat;
490
+ /** For messages originally sent by an anonymous chat administrator, original message author signature */
491
+ author_signature?: string;
492
+ }
493
+ /** The message was originally sent to a channel chat. */
494
+ export interface MessageOriginChannel {
495
+ /** Type of the message origin, always “channel” */
496
+ type: "channel";
497
+ /** Date the message was sent originally in Unix time */
498
+ date: number;
499
+ /** Channel chat to which the message was originally sent */
500
+ chat: Chat;
501
+ /** Unique message identifier inside the chat */
502
+ message_id: number;
503
+ /** Signature of the original post author */
504
+ author_signature?: string;
505
+ }
353
506
  /** This object represents one size of a photo or a file / sticker thumbnail. */
354
507
  export interface PhotoSize {
355
508
  /** Identifier for this file, which can be used to download or reuse the file */
@@ -477,7 +630,7 @@ export interface Contact {
477
630
  first_name: string;
478
631
  /** Contact's last name */
479
632
  last_name?: string;
480
- /** Contact's user identifier in Telegram. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a 64-bit integer or double-precision float type are safe for storing this identifier. */
633
+ /** Contact's user identifier in Telegram. */
481
634
  user_id?: number;
482
635
  /** Additional data about the contact in the form of a vCard */
483
636
  vcard?: string;
@@ -613,18 +766,18 @@ export interface GeneralForumTopicHidden {
613
766
  /** This object represents a service message about General forum topic unhidden in the chat. Currently holds no information. */
614
767
  export interface GeneralForumTopicUnhidden {
615
768
  }
616
- /** This object contains information about the user whose identifier was shared with the bot using a KeyboardButtonRequestUser button. */
617
- export interface UserShared {
769
+ /** This object contains information about the user whose identifier was shared with the bot using a KeyboardButtonRequestUsers button. */
770
+ export interface UsersShared {
618
771
  /** Identifier of the request */
619
772
  request_id: number;
620
- /** Identifier of the shared user. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a 64-bit integer or double-precision float type are safe for storing this identifier. The bot may not have access to the user and could be unable to use this identifier, unless the user is already known to the bot by some other means. */
621
- user_id: number;
773
+ /** Identifiers of the shared users. The bot may not have access to the users and could be unable to use these identifiers, unless the users are already known to the bot by some other means. */
774
+ user_ids: number[];
622
775
  }
623
776
  /** This object contains information about the chat whose identifier was shared with the bot using a KeyboardButtonRequestChat button. */
624
777
  export interface ChatShared {
625
778
  /** Identifier of the request */
626
779
  request_id: number;
627
- /** Identifier of the shared chat. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a 64-bit integer or double-precision float type are safe for storing this identifier. The bot may not have access to the chat and could be unable to use this identifier, unless the chat is already known to the bot by some other means. */
780
+ /** Identifier of the shared chat. The bot may not have access to the chat and could be unable to use this identifier, unless the chat is already known to the bot by some other means. */
628
781
  chat_id: number;
629
782
  }
630
783
  /** This object represents a service message about a user allowing a bot to write messages after adding it to the attachment menu, launching a Web App from a link, or accepting an explicit request from a Web App sent by the method requestWriteAccess. */
@@ -654,6 +807,75 @@ export interface VideoChatParticipantsInvited {
654
807
  /** New members that were invited to the video chat */
655
808
  users: User[];
656
809
  }
810
+ /** This object represents a service message about the creation of a scheduled giveaway. Currently holds no information. */
811
+ export interface GiveawayCreated {
812
+ }
813
+ /** This object represents a message about a scheduled giveaway. */
814
+ export interface Giveaway {
815
+ /** The list of chats which the user must join to participate in the giveaway */
816
+ chats: Chat[];
817
+ /** Point in time (Unix timestamp) when winners of the giveaway will be selected */
818
+ winners_selection_date: number;
819
+ /** The number of users which are supposed to be selected as winners of the giveaway */
820
+ winner_count: number;
821
+ /** True, if only users who join the chats after the giveaway started should be eligible to win */
822
+ only_new_members?: true;
823
+ /** True, if the list of giveaway winners will be visible to everyone */
824
+ has_public_winners?: true;
825
+ /** Description of additional giveaway prize */
826
+ prize_description?: string;
827
+ /** A list of two-letter ISO 3166-1 alpha-2 country codes indicating the countries from which eligible users for the giveaway must come. If empty, then all users can participate in the giveaway. Users with a phone number that was bought on Fragment can always participate in giveaways. */
828
+ country_codes?: string[];
829
+ /** The number of months the Telegram Premium subscription won from the giveaway will be active for */
830
+ premium_subscription_month_count?: number;
831
+ }
832
+ /** This object represents a message about the completion of a giveaway with public winners. */
833
+ export interface GiveawayWinners {
834
+ /** The chat that created the giveaway */
835
+ chat: Chat;
836
+ /** Identifier of the messsage with the giveaway in the chat */
837
+ giveaway_message_id: number;
838
+ /** Point in time (Unix timestamp) when winners of the giveaway were selected */
839
+ winners_selection_date: number;
840
+ /** Total number of winners in the giveaway */
841
+ winner_count: number;
842
+ /** List of up to 100 winners of the giveaway */
843
+ winners: User[];
844
+ /** The number of other chats the user had to join in order to be eligible for the giveaway */
845
+ additional_chat_count?: number;
846
+ /** The number of months the Telegram Premium subscription won from the giveaway will be active for */
847
+ premium_subscription_month_count?: number;
848
+ /** Number of undistributed prizes */
849
+ unclaimed_prize_count?: number;
850
+ /** True, if only users who had joined the chats after the giveaway started were eligible to win */
851
+ only_new_members?: true;
852
+ /** True, if the giveaway was canceled because the payment for it was refunded */
853
+ was_refunded?: true;
854
+ /** Description of additional giveaway prize */
855
+ prize_description?: string;
856
+ }
857
+ /** This object represents a service message about the completion of a giveaway without public winners. */
858
+ export interface GiveawayCompleted {
859
+ /** Number of winners in the giveaway */
860
+ winner_count: number;
861
+ /** Number of undistributed prizes */
862
+ unclaimed_prize_count?: number;
863
+ /** Message with the giveaway that was completed, if it wasn't deleted */
864
+ giveaway_message?: Message;
865
+ }
866
+ /** Describes the options used for link preview generation. */
867
+ export interface LinkPreviewOptions {
868
+ /** True, if the link preview is disabled */
869
+ is_disabled?: boolean;
870
+ /** URL to use for the link preview. If empty, then the first URL found in the message text will be used */
871
+ url?: string;
872
+ /** True, if the media in the link preview is suppposed to be shrunk; ignored if the URL isn't explicitly specified or media size change isn't supported for the preview */
873
+ prefer_small_media?: boolean;
874
+ /** True, if the media in the link preview is suppposed to be enlarged; ignored if the URL isn't explicitly specified or media size change isn't supported for the preview */
875
+ prefer_large_media?: boolean;
876
+ /** True, if the link preview must be shown above the message text; otherwise, the link preview will be shown below the message text */
877
+ show_above_text?: boolean;
878
+ }
657
879
  /** Describes data sent from a Web App to the bot. */
658
880
  export interface WebAppData {
659
881
  /** The data. Be aware that a bad client can send arbitrary data in this field. */
@@ -744,4 +966,66 @@ export interface GameHighScore {
744
966
  /** Score */
745
967
  score: number;
746
968
  }
969
+ /** This object represents a file ready to be downloaded. The file can be downloaded via the link https://api.telegram.org/file/bot<token>/<file_path>. 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. */
970
+ export interface File {
971
+ /** Identifier for this file, which can be used to download or reuse the file */
972
+ file_id: string;
973
+ /** Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. */
974
+ file_unique_id: string;
975
+ /** File size in bytes */
976
+ file_size?: number;
977
+ /** File path. Use https://api.telegram.org/file/bot<token>/<file_path> to get the file. */
978
+ file_path?: string;
979
+ }
980
+ /** This object describes the type of a reaction. Currently, it can be one of */
981
+ export type ReactionType = ReactionTypeEmoji | ReactionTypeCustomEmoji;
982
+ /** The reaction is based on an emoji. */
983
+ export interface ReactionTypeEmoji {
984
+ /** Type of the reaction, always “emoji” */
985
+ type: "emoji";
986
+ /** Reaction emoji. Currently, it can be one of "👍", "👎", "❤", "🔥", "🥰", "👏", "😁", "🤔", "🤯", "😱", "🤬", "😢", "🎉", "🤩", "🤮", "💩", "🙏", "👌", "🕊", "🤡", "🥱", "🥴", "😍", "🐳", "❤‍🔥", "🌚", "🌭", "💯", "🤣", "⚡", "🍌", "🏆", "💔", "🤨", "😐", "🍓", "🍾", "💋", "🖕", "😈", "😴", "😭", "🤓", "👻", "👨‍💻", "👀", "🎃", "🙈", "😇", "😨", "🤝", "✍", "🤗", "🫡", "🎅", "🎄", "☃", "💅", "🤪", "🗿", "🆒", "💘", "🙉", "🦄", "😘", "💊", "🙊", "😎", "👾", "🤷‍♂", "🤷", "🤷‍♀", "😡" */
987
+ emoji: "👍" | "👎" | "❤" | "🔥" | "🥰" | "👏" | "😁" | "🤔" | "🤯" | "😱" | "🤬" | "😢" | "🎉" | "🤩" | "🤮" | "💩" | "🙏" | "👌" | "🕊" | "🤡" | "🥱" | "🥴" | "😍" | "🐳" | "❤‍🔥" | "🌚" | "🌭" | "💯" | "🤣" | "⚡" | "🍌" | "🏆" | "💔" | "🤨" | "😐" | "🍓" | "🍾" | "💋" | "🖕" | "😈" | "😴" | "😭" | "🤓" | "👻" | "👨‍💻" | "👀" | "🎃" | "🙈" | "😇" | "😨" | "🤝" | "✍" | "🤗" | "🫡" | "🎅" | "🎄" | "☃" | "💅" | "🤪" | "🗿" | "🆒" | "💘" | "🙉" | "🦄" | "😘" | "💊" | "🙊" | "😎" | "👾" | "🤷‍♂" | "🤷" | "🤷‍♀" | "😡";
988
+ }
989
+ /** The reaction is based on a custom emoji. */
990
+ export interface ReactionTypeCustomEmoji {
991
+ /** Type of the reaction, always “custom_emoji” */
992
+ type: "custom_emoji";
993
+ /** Custom emoji identifier */
994
+ custom_emoji: string;
995
+ }
996
+ /** Represents a reaction added to a message along with the number of times it was added. */
997
+ export interface ReactionCount {
998
+ /** Type of the reaction */
999
+ type: ReactionType;
1000
+ /** Number of times the reaction was added */
1001
+ total_count: number;
1002
+ }
1003
+ /** This object represents a change of a reaction on a message performed by a user. */
1004
+ export interface MessageReactionUpdated {
1005
+ /** The chat containing the message the user reacted to */
1006
+ chat: Chat;
1007
+ /** Unique identifier of the message inside the chat */
1008
+ message_id: number;
1009
+ /** The user that changed the reaction, if the user isn't anonymous */
1010
+ user?: User;
1011
+ /** The chat on behalf of which the reaction was changed, if the user is anonymous */
1012
+ actor_chat?: Chat;
1013
+ /** Date of the change in Unix time */
1014
+ date: number;
1015
+ /** Previous list of reaction types that were set by the user */
1016
+ old_reaction: ReactionType[];
1017
+ /** New list of reaction types that have been set by the user */
1018
+ new_reaction: ReactionType[];
1019
+ }
1020
+ /** This object represents reaction changes on a message with anonymous reactions. */
1021
+ export interface MessageReactionCountUpdated {
1022
+ /** The chat containing the message */
1023
+ chat: Chat;
1024
+ /** Unique message identifier inside the chat */
1025
+ message_id: number;
1026
+ /** Date of the change in Unix time */
1027
+ date: number;
1028
+ /** List of reactions that are present on the message */
1029
+ reactions: ReactionCount[];
1030
+ }
747
1031
  export {};