@grammyjs/types 3.14.0 → 3.16.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/markup.d.ts CHANGED
@@ -40,6 +40,10 @@ export declare namespace InlineKeyboardButton {
40
40
  /** If set, pressing the button will prompt the user to select one of their chats of the specified type, open that chat and insert the bot's username and the specified inline query in the input field. Not supported for messages sent on behalf of a Telegram Business account. */
41
41
  switch_inline_query_chosen_chat: SwitchInlineQueryChosenChat;
42
42
  }
43
+ interface CopyTextButtonButton extends AbstractInlineKeyboardButton {
44
+ /** Description of the button that copies the specified text to the clipboard. */
45
+ copy_text: CopyTextButton;
46
+ }
43
47
  interface GameButton extends AbstractInlineKeyboardButton {
44
48
  /** Description of the game that will be launched when the user presses the button.
45
49
 
@@ -54,7 +58,7 @@ export declare namespace InlineKeyboardButton {
54
58
  }
55
59
  }
56
60
  /** This object represents one button of an inline keyboard. You must use exactly one of the optional fields. */
57
- export type InlineKeyboardButton = InlineKeyboardButton.CallbackButton | InlineKeyboardButton.GameButton | InlineKeyboardButton.LoginButton | InlineKeyboardButton.PayButton | InlineKeyboardButton.SwitchInlineButton | InlineKeyboardButton.SwitchInlineCurrentChatButton | InlineKeyboardButton.SwitchInlineChosenChatButton | InlineKeyboardButton.UrlButton | InlineKeyboardButton.WebAppButton;
61
+ export type InlineKeyboardButton = InlineKeyboardButton.CallbackButton | InlineKeyboardButton.GameButton | InlineKeyboardButton.LoginButton | InlineKeyboardButton.PayButton | InlineKeyboardButton.SwitchInlineButton | InlineKeyboardButton.SwitchInlineCurrentChatButton | InlineKeyboardButton.SwitchInlineChosenChatButton | InlineKeyboardButton.CopyTextButtonButton | InlineKeyboardButton.UrlButton | InlineKeyboardButton.WebAppButton;
58
62
  /** This object represents a parameter of the inline keyboard button used to automatically authorize a user. Serves as a great replacement for the Telegram Login Widget when the user is coming from Telegram. All the user needs to do is tap/click a button and confirm that they want to log in.
59
63
  Telegram apps support these buttons as of version 5.7. */
60
64
  export interface LoginUrl {
@@ -184,6 +188,11 @@ export interface ForceReply {
184
188
  /** Use this parameter if you want to force reply from specific users only. Targets: 1) users that are @mentioned in the text of the Message object; 2) if the bot's message is a reply to a message in the same chat and forum topic, sender of the original message. */
185
189
  selective?: boolean;
186
190
  }
191
+ /** This object represents an inline keyboard button that copies specified text to the clipboard. */
192
+ export interface CopyTextButton {
193
+ /** The text to be copied to the clipboard; 1-256 characters */
194
+ text: string;
195
+ }
187
196
  /** Describes a Web App. */
188
197
  export interface WebAppInfo {
189
198
  /** An HTTPS URL of a Web App to be opened with additional data as specified in Initializing Web Apps */
package/message.d.ts CHANGED
@@ -5,7 +5,7 @@ import type { Invoice, RefundedPayment, SuccessfulPayment } from "./payment.js";
5
5
  type MsgWith<P extends keyof Message> = Record<P, NonNullable<Message[P]>>;
6
6
  export declare namespace Message {
7
7
  interface ServiceMessage {
8
- /** Unique message identifier inside this chat */
8
+ /** Unique message identifier inside this chat. In specific instances (e.g., message containing a video sent to a big chat), the server might automatically schedule a message instead of sending it immediately. In such cases, this field will be 0 and the relevant message will be unusable until it is actually sent */
9
9
  message_id: number;
10
10
  /** Unique identifier of a message thread or a forum topic to which the message belongs; for supergroups only */
11
11
  message_thread_id?: number;
@@ -245,7 +245,7 @@ export interface Message extends Message.MediaMessage {
245
245
  }
246
246
  /** This object represents a unique message identifier. */
247
247
  export interface MessageId {
248
- /** Unique message identifier */
248
+ /** Unique message identifier. In specific instances (e.g., message containing a video sent to a big chat), the server might automatically schedule a message instead of sending it immediately. In such cases, this field will be 0 and the relevant message will be unusable until it is actually sent */
249
249
  message_id: number;
250
250
  }
251
251
  /** Describes an inline message sent by a Web App on behalf of a user. */
@@ -381,7 +381,7 @@ Please note:
381
381
  export type ParseMode = "Markdown" | "MarkdownV2" | "HTML";
382
382
  export declare namespace MessageEntity {
383
383
  interface AbstractMessageEntity {
384
- /** 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), “expandable_blockquote” (collapsed-by-default 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) */
384
+ /** Type of the entity. Currently, can be “mention” (@username), “hashtag” (#hashtag or #hashtag@chatusername), “cashtag” ($USD or $USD@chatusername), “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), “expandable_blockquote” (collapsed-by-default 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) */
385
385
  type: string;
386
386
  /** Offset in UTF-16 code units to the start of the entity */
387
387
  offset: number;
@@ -1247,4 +1247,11 @@ export interface MessageReactionCountUpdated {
1247
1247
  /** List of reactions that are present on the message */
1248
1248
  reactions: ReactionCount[];
1249
1249
  }
1250
+ /** Describes an inline message to be sent by a user of a Mini App. */
1251
+ export interface PreparedInlineMessage {
1252
+ /** Unique identifier of the prepared message */
1253
+ id: string;
1254
+ /** Expiration date of the prepared message, in Unix time. Expired prepared messages can no longer be used */
1255
+ expiration_date: number;
1256
+ }
1250
1257
  export {};
package/methods.d.ts CHANGED
@@ -1,13 +1,12 @@
1
1
  import type { InlineQueryResult, InlineQueryResultsButton } from "./inline.js";
2
- import type { BotCommand, BusinessConnection, ChatAdministratorRights, ChatInviteLink, ChatMember, ChatMemberAdministrator, ChatMemberOwner, ChatPermissions, ForumTopic, UserChatBoosts, UserFromGetMe, UserProfilePhotos, WebhookInfo } from "./manage.js";
3
- import type { ChatFullInfo } from "./manage.js";
2
+ import type { LanguageCode } from "./langs.js";
3
+ import type { BotCommand, BusinessConnection, ChatAdministratorRights, ChatFullInfo, ChatInviteLink, ChatMember, ChatMemberAdministrator, ChatMemberOwner, ChatPermissions, ForumTopic, UserChatBoosts, UserFromGetMe, UserProfilePhotos, WebhookInfo } from "./manage.js";
4
4
  import type { ForceReply, InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove } from "./markup.js";
5
- import type { File, GameHighScore, InputPollOption, LinkPreviewOptions, MaskPosition, Message, MessageEntity, MessageId, ParseMode, Poll, ReactionType, ReplyParameters, SentWebAppMessage, Sticker, StickerSet } from "./message.js";
5
+ import type { File, GameHighScore, InputPollOption, LinkPreviewOptions, MaskPosition, Message, MessageEntity, MessageId, ParseMode, Poll, PreparedInlineMessage, ReactionType, ReplyParameters, SentWebAppMessage, Sticker, StickerSet } from "./message.js";
6
6
  import type { PassportElementError } from "./passport.js";
7
- import type { LabeledPrice, ShippingOption, StarTransactions } from "./payment.js";
7
+ import type { Gifts, LabeledPrice, ShippingOption, StarTransactions } from "./payment.js";
8
8
  import type { BotCommandScope, BotDescription, BotName, BotShortDescription, MenuButton } from "./settings.js";
9
9
  import type { Update } from "./update.js";
10
- import type { LanguageCode } from "./langs.js";
11
10
  /** Extracts the parameters of a given method name */
12
11
  type Params<F, M extends keyof ApiMethods<F>> = Parameters<ApiMethods<F>[M]>;
13
12
  /** Utility type providing the argument type for the given method name or `{}` if the method does not take any parameters */
@@ -94,6 +93,8 @@ export type ApiMethods<F> = {
94
93
  disable_notification?: boolean;
95
94
  /** Protects the contents of the sent message from forwarding and saving */
96
95
  protect_content?: boolean;
96
+ /** Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance */
97
+ allow_paid_broadcast?: boolean;
97
98
  /** Unique identifier of the message effect to be added to the message; for private chats only */
98
99
  message_effect_id?: string;
99
100
  /** Description of the message to reply to */
@@ -155,6 +156,8 @@ export type ApiMethods<F> = {
155
156
  disable_notification?: boolean;
156
157
  /** Protects the contents of the sent message from forwarding and saving */
157
158
  protect_content?: boolean;
159
+ /** Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance */
160
+ allow_paid_broadcast?: boolean;
158
161
  /** Description of the message to reply to */
159
162
  reply_parameters?: ReplyParameters;
160
163
  /** 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. */
@@ -203,6 +206,8 @@ export type ApiMethods<F> = {
203
206
  disable_notification?: boolean;
204
207
  /** Protects the contents of the sent message from forwarding and saving */
205
208
  protect_content?: boolean;
209
+ /** Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance */
210
+ allow_paid_broadcast?: boolean;
206
211
  /** Unique identifier of the message effect to be added to the message; for private chats only */
207
212
  message_effect_id?: string;
208
213
  /** Description of the message to reply to */
@@ -242,6 +247,8 @@ export type ApiMethods<F> = {
242
247
  disable_notification?: boolean;
243
248
  /** Protects the contents of the sent message from forwarding and saving */
244
249
  protect_content?: boolean;
250
+ /** Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance */
251
+ allow_paid_broadcast?: boolean;
245
252
  /** Unique identifier of the message effect to be added to the message; for private chats only */
246
253
  message_effect_id?: string;
247
254
  /** Description of the message to reply to */
@@ -275,6 +282,8 @@ export type ApiMethods<F> = {
275
282
  disable_notification?: boolean;
276
283
  /** Protects the contents of the sent message from forwarding and saving */
277
284
  protect_content?: boolean;
285
+ /** Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance */
286
+ allow_paid_broadcast?: boolean;
278
287
  /** Unique identifier of the message effect to be added to the message; for private chats only */
279
288
  message_effect_id?: string;
280
289
  /** Description of the message to reply to */
@@ -318,6 +327,8 @@ export type ApiMethods<F> = {
318
327
  disable_notification?: boolean;
319
328
  /** Protects the contents of the sent message from forwarding and saving */
320
329
  protect_content?: boolean;
330
+ /** Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance */
331
+ allow_paid_broadcast?: boolean;
321
332
  /** Unique identifier of the message effect to be added to the message; for private chats only */
322
333
  message_effect_id?: string;
323
334
  /** Description of the message to reply to */
@@ -359,6 +370,8 @@ export type ApiMethods<F> = {
359
370
  disable_notification?: boolean;
360
371
  /** Protects the contents of the sent message from forwarding and saving */
361
372
  protect_content?: boolean;
373
+ /** Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance */
374
+ allow_paid_broadcast?: boolean;
362
375
  /** Unique identifier of the message effect to be added to the message; for private chats only */
363
376
  message_effect_id?: string;
364
377
  /** Description of the message to reply to */
@@ -390,6 +403,8 @@ export type ApiMethods<F> = {
390
403
  disable_notification?: boolean;
391
404
  /** Protects the contents of the sent message from forwarding and saving */
392
405
  protect_content?: boolean;
406
+ /** Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance */
407
+ allow_paid_broadcast?: boolean;
393
408
  /** Unique identifier of the message effect to be added to the message; for private chats only */
394
409
  message_effect_id?: string;
395
410
  /** Description of the message to reply to */
@@ -420,6 +435,8 @@ export type ApiMethods<F> = {
420
435
  disable_notification?: boolean;
421
436
  /** Protects the contents of the sent message from forwarding and saving */
422
437
  protect_content?: boolean;
438
+ /** Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance */
439
+ allow_paid_broadcast?: boolean;
423
440
  /** Unique identifier of the message effect to be added to the message; for private chats only */
424
441
  message_effect_id?: string;
425
442
  /** Description of the message to reply to */
@@ -435,14 +452,16 @@ export type ApiMethods<F> = {
435
452
  business_connection_id?: string;
436
453
  /** Unique identifier for the target chat or username of the target channel (in the format @channelusername) */
437
454
  chat_id: number | string;
438
- /** An array describing messages to be sent, must include 2-10 items */
439
455
  /** Unique identifier for the target message thread (topic) of the forum; for forum supergroups only */
440
456
  message_thread_id?: number;
457
+ /** An array describing messages to be sent, must include 2-10 items */
441
458
  media: ReadonlyArray<InputMediaAudio<F> | InputMediaDocument<F> | InputMediaPhoto<F> | InputMediaVideo<F>>;
442
459
  /** Sends the messages silently. Users will receive a notification with no sound. */
443
460
  disable_notification?: boolean;
444
461
  /** Protects the contents of the sent messages from forwarding and saving */
445
462
  protect_content?: boolean;
463
+ /** Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance */
464
+ allow_paid_broadcast?: boolean;
446
465
  /** Unique identifier of the message effect to be added to the message; for private chats only */
447
466
  message_effect_id?: string;
448
467
  /** Description of the message to reply to */
@@ -474,6 +493,8 @@ export type ApiMethods<F> = {
474
493
  disable_notification?: boolean;
475
494
  /** Protects the contents of the sent message from forwarding and saving */
476
495
  protect_content?: boolean;
496
+ /** Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance */
497
+ allow_paid_broadcast?: boolean;
477
498
  /** Unique identifier of the message effect to be added to the message; for private chats only */
478
499
  message_effect_id?: string;
479
500
  /** Description of the message to reply to */
@@ -545,6 +566,8 @@ export type ApiMethods<F> = {
545
566
  disable_notification?: boolean;
546
567
  /** Protects the contents of the sent message from forwarding and saving */
547
568
  protect_content?: boolean;
569
+ /** Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance */
570
+ allow_paid_broadcast?: boolean;
548
571
  /** Description of the message to reply to */
549
572
  reply_parameters?: ReplyParameters;
550
573
  /** Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user */
@@ -578,6 +601,8 @@ export type ApiMethods<F> = {
578
601
  disable_notification?: boolean;
579
602
  /** Protects the contents of the sent message from forwarding and saving */
580
603
  protect_content?: boolean;
604
+ /** Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance */
605
+ allow_paid_broadcast?: boolean;
581
606
  /** Unique identifier of the message effect to be added to the message; for private chats only */
582
607
  message_effect_id?: string;
583
608
  /** Description of the message to reply to */
@@ -607,6 +632,8 @@ export type ApiMethods<F> = {
607
632
  disable_notification?: boolean;
608
633
  /** Protects the contents of the sent message from forwarding and saving */
609
634
  protect_content?: boolean;
635
+ /** Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance */
636
+ allow_paid_broadcast?: boolean;
610
637
  /** Unique identifier of the message effect to be added to the message; for private chats only */
611
638
  message_effect_id?: string;
612
639
  /** Description of the message to reply to */
@@ -656,6 +683,8 @@ export type ApiMethods<F> = {
656
683
  disable_notification?: boolean;
657
684
  /** Protects the contents of the sent message from forwarding and saving */
658
685
  protect_content?: boolean;
686
+ /** Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance */
687
+ allow_paid_broadcast?: boolean;
659
688
  /** Unique identifier of the message effect to be added to the message; for private chats only */
660
689
  message_effect_id?: string;
661
690
  /** Description of the message to reply to */
@@ -679,6 +708,8 @@ export type ApiMethods<F> = {
679
708
  disable_notification?: boolean;
680
709
  /** Protects the contents of the sent message from forwarding */
681
710
  protect_content?: boolean;
711
+ /** Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance */
712
+ allow_paid_broadcast?: boolean;
682
713
  /** Unique identifier of the message effect to be added to the message; for private chats only */
683
714
  message_effect_id?: string;
684
715
  /** Description of the message to reply to */
@@ -723,6 +754,15 @@ export type ApiMethods<F> = {
723
754
  /** Limits the number of photos to be retrieved. Values between 1-100 are accepted. Defaults to 100. */
724
755
  limit?: number;
725
756
  }): UserProfilePhotos;
757
+ /** Changes the emoji status for a given user that previously allowed the bot to manage their emoji status via the Mini App method requestEmojiStatusAccess. Returns True on success. */
758
+ setUserEmojiStatus(args: {
759
+ /** Unique identifier of the target user */
760
+ user_id: number;
761
+ /** Custom emoji identifier of the emoji status to set. Pass an empty string to remove the status. */
762
+ emoji_status_custom_emoji_id?: string;
763
+ /** Expiration date of the emoji status, if any */
764
+ emoji_status_expiration_date?: number;
765
+ }): true;
726
766
  /** 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.
727
767
 
728
768
  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. */
@@ -1242,7 +1282,7 @@ export type ApiMethods<F> = {
1242
1282
  /** An object for an inline keyboard. */
1243
1283
  reply_markup?: InlineKeyboardMarkup;
1244
1284
  }): (Update.Edited & Message.CaptionableMessage) | true;
1245
- /** 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. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within 48 hours from the time they were sent. */
1285
+ /** Use this method to edit animation, audio, document, photo, or video messages, or to add media to text 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. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within 48 hours from the time they were sent. */
1246
1286
  editMessageMedia(args: {
1247
1287
  /** Unique identifier of the business connection on behalf of which the message to be edited was sent */
1248
1288
  business_connection_id?: string;
@@ -1320,6 +1360,8 @@ export type ApiMethods<F> = {
1320
1360
  disable_notification?: boolean;
1321
1361
  /** Protects the contents of the sent message from forwarding and saving */
1322
1362
  protect_content?: boolean;
1363
+ /** Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance */
1364
+ allow_paid_broadcast?: boolean;
1323
1365
  /** Unique identifier of the message effect to be added to the message; for private chats only */
1324
1366
  message_effect_id?: string;
1325
1367
  /** Description of the message to reply to */
@@ -1446,6 +1488,21 @@ export type ApiMethods<F> = {
1446
1488
  /** 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. */
1447
1489
  custom_emoji_id?: string;
1448
1490
  }): true;
1491
+ /** Returns the list of gifts that can be sent by the bot to users. Requires no parameters. Returns a Gifts object. */
1492
+ getAvailableGifts(): Gifts;
1493
+ /** Sends a gift to the given user. The gift can't be converted to Telegram Stars by the user. Returns True on success. */
1494
+ sendGift(args: {
1495
+ /** Unique identifier of the target user that will receive the gift */
1496
+ user_id: number;
1497
+ /** Identifier of the gift */
1498
+ gift_id: string;
1499
+ /** Text that will be shown along with the gift; 0-255 characters */
1500
+ text?: string;
1501
+ /** Mode for parsing entities in the text. See formatting options for more details. Entities other than “bold”, “italic”, “underline”, “strikethrough”, “spoiler”, and “custom_emoji” are ignored. */
1502
+ text_parse_mode?: ParseMode;
1503
+ /** A list of special entities that appear in the gift text. It can be specified instead of text_parse_mode. Entities other than “bold”, “italic”, “underline”, “strikethrough”, “spoiler”, and “custom_emoji” are ignored. */
1504
+ text_entities?: MessageEntity[];
1505
+ }): Gifts;
1449
1506
  /** Use this method to send answers to an inline query. On success, True is returned.
1450
1507
  No more than 50 results per query are allowed.
1451
1508
 
@@ -1471,6 +1528,21 @@ export type ApiMethods<F> = {
1471
1528
  /** An object describing the message to be sent */
1472
1529
  result: InlineQueryResult;
1473
1530
  }): SentWebAppMessage;
1531
+ /** Stores a message that can be sent by a user of a Mini App. Returns a PreparedInlineMessage object. */
1532
+ savePreparedInlineMessage(args: {
1533
+ /** Unique identifier of the target user that can use the prepared message */
1534
+ user_id: number;
1535
+ /** An object describing the message to be sent */
1536
+ result: InlineQueryResult;
1537
+ /** Pass True if the message can be sent to private chats with users */
1538
+ allow_user_chats?: boolean;
1539
+ /** Pass True if the message can be sent to private chats with bots */
1540
+ allow_bot_chats?: boolean;
1541
+ /** Pass True if the message can be sent to group and supergroup chats */
1542
+ allow_group_chats?: boolean;
1543
+ /** Pass True if the message can be sent to channel chats */
1544
+ allow_channel_chats?: boolean;
1545
+ }): PreparedInlineMessage;
1474
1546
  /** Use this method to send invoices. On success, the sent Message is returned. */
1475
1547
  sendInvoice(args: {
1476
1548
  /** Unique identifier for the target chat or username of the target channel (in the format @channelusername) */
@@ -1523,6 +1595,8 @@ export type ApiMethods<F> = {
1523
1595
  disable_notification?: boolean;
1524
1596
  /** Protects the contents of the sent message from forwarding and saving */
1525
1597
  protect_content?: boolean;
1598
+ /** Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance */
1599
+ allow_paid_broadcast?: boolean;
1526
1600
  /** Unique identifier of the message effect to be added to the message; for private chats only */
1527
1601
  message_effect_id?: string;
1528
1602
  /** Description of the message to reply to */
@@ -1534,6 +1608,8 @@ export type ApiMethods<F> = {
1534
1608
  }): Message.InvoiceMessage;
1535
1609
  /** Use this method to create a link for an invoice. Returns the created invoice link as String on success. */
1536
1610
  createInvoiceLink(args: {
1611
+ /** Unique identifier of the business connection on behalf of which the link will be created */
1612
+ business_connection_id?: string;
1537
1613
  /** Product name, 1-32 characters */
1538
1614
  title: string;
1539
1615
  /** Product description, 1-255 characters */
@@ -1546,6 +1622,8 @@ export type ApiMethods<F> = {
1546
1622
  currency: string;
1547
1623
  /** Price breakdown, a list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.) */
1548
1624
  prices: LabeledPrice[];
1625
+ /** The number of seconds the subscription will be active for before the next payment. The currency must be set to “XTR” (Telegram Stars) if the parameter is used. Currently, it must always be 2592000 (30 days) if specified. */
1626
+ subscription_period?: number;
1549
1627
  /** The maximum accepted amount for tips in the smallest units of the currency (integer, not float/double). For example, for a maximum tip of US$ 1.45 pass max_tip_amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). Defaults to 0 */
1550
1628
  max_tip_amount?: number;
1551
1629
  /** An array of suggested amounts of tips in the smallest units of the currency (integer, not float/double). At most 4 suggested tip amounts can be specified. The suggested tip amounts must be positive, passed in a strictly increased order and must not exceed max_tip_amount. */
@@ -1609,6 +1687,15 @@ export type ApiMethods<F> = {
1609
1687
  /** Telegram payment identifier */
1610
1688
  telegram_payment_charge_id: string;
1611
1689
  }): true;
1690
+ /** Allows the bot to cancel or re-enable extension of a subscription paid in Telegram Stars. Returns True on success. */
1691
+ editUserStarSubscription(args: {
1692
+ /** Identifier of the user whose subscription will be edited */
1693
+ user_id: number;
1694
+ /** Telegram payment identifier for the subscription */
1695
+ telegram_payment_charge_id: string;
1696
+ /** Pass True to cancel extension of the user subscription; the subscription must be active up to the end of the current subscription period. Pass False to allow the user to re-enable a subscription that was previously canceled by the bot. */
1697
+ is_canceled: boolean;
1698
+ }): true;
1612
1699
  /** 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.
1613
1700
 
1614
1701
  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. */
@@ -1632,6 +1719,8 @@ export type ApiMethods<F> = {
1632
1719
  disable_notification?: boolean;
1633
1720
  /** Protects the contents of the sent message from forwarding and saving */
1634
1721
  protect_content?: boolean;
1722
+ /** Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance */
1723
+ allow_paid_broadcast?: boolean;
1635
1724
  /** Unique identifier of the message effect to be added to the message; for private chats only */
1636
1725
  message_effect_id?: string;
1637
1726
  /** Description of the message to reply to */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grammyjs/types",
3
- "version": "3.14.0",
3
+ "version": "3.16.0",
4
4
  "description": "Telegram Bot API type declarations for grammY",
5
5
  "main": "mod.js",
6
6
  "repository": {
@@ -15,7 +15,7 @@
15
15
  "types"
16
16
  ],
17
17
  "scripts": {
18
- "prepare": "deno task backport"
18
+ "prepare": "deno task build"
19
19
  },
20
20
  "author": "KnorpelSenf",
21
21
  "types": "mod.d.ts",
package/payment.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { User } from "./manage.js";
2
- import type { PaidMedia } from "./message.js";
2
+ import type { PaidMedia, Sticker } from "./message.js";
3
3
  /** This object represents a portion of the price for goods or services. */
4
4
  export interface LabeledPrice {
5
5
  /** Portion label */
@@ -63,6 +63,12 @@ export interface SuccessfulPayment {
63
63
  total_amount: number;
64
64
  /** Bot specified invoice payload */
65
65
  invoice_payload: string;
66
+ /** Expiration date of the subscription, in Unix time; for recurring payments only */
67
+ subscription_expiration_date?: number;
68
+ /** True, if the payment is a recurring payment for a subscription */
69
+ is_recurring?: true;
70
+ /** True, if the payment is the first payment for a subscription */
71
+ is_first_recurring?: true;
66
72
  /** Identifier of the shipping option chosen by the user */
67
73
  shipping_option_id?: string;
68
74
  /** Order information provided by the user */
@@ -143,8 +149,9 @@ export interface RevenueWithdrawalStateFailed {
143
149
  - TransactionPartnerUser
144
150
  - TransactionPartnerFragment
145
151
  - TransactionPartnerTelegramAds
152
+ - TransactionPartnerTelegramApi
146
153
  - TransactionPartnerOther */
147
- export type TransactionPartner = TransactionPartnerUser | TransactionPartnerFragment | TransactionPartnerTelegramAds | TransactionPartnerOther;
154
+ export type TransactionPartner = TransactionPartnerUser | TransactionPartnerFragment | TransactionPartnerTelegramAds | TransactionPartnerTelegramApi | TransactionPartnerOther;
148
155
  /** Describes a transaction with a user. */
149
156
  export interface TransactionPartnerUser {
150
157
  /** Type of the transaction partner, always “user” */
@@ -153,10 +160,14 @@ export interface TransactionPartnerUser {
153
160
  user: User;
154
161
  /** Bot-specified invoice payload */
155
162
  invoice_payload?: string;
163
+ /** The duration of the paid subscription */
164
+ subscription_period?: number;
156
165
  /** Information about the paid media bought by the user */
157
166
  paid_media?: PaidMedia[];
158
167
  /** Bot-specified paid media payload */
159
168
  paid_media_payload?: string;
169
+ /** The gift sent to the user by the bot */
170
+ gift?: string;
160
171
  }
161
172
  /** Describes a withdrawal transaction with Fragment. */
162
173
  export interface TransactionPartnerFragment {
@@ -170,6 +181,13 @@ export interface TransactionPartnerTelegramAds {
170
181
  /** Type of the transaction partner, always “telegram_ads” */
171
182
  type: "telegram_ads";
172
183
  }
184
+ /** Describes a transaction with payment for paid broadcasting. */
185
+ export interface TransactionPartnerTelegramApi {
186
+ /** Type of the transaction partner, always “telegram_api” */
187
+ type: "telegram_api";
188
+ /** The number of successful requests that exceeded regular limits and were therefore billed */
189
+ request_count: number;
190
+ }
173
191
  /** Describes a transaction with an unknown source or recipient. */
174
192
  export interface TransactionPartnerOther {
175
193
  /** Type of the transaction partner, always “other” */
@@ -177,7 +195,7 @@ export interface TransactionPartnerOther {
177
195
  }
178
196
  /** Describes a Telegram Star transaction. */
179
197
  export interface StarTransaction {
180
- /** Unique identifier of the transaction. Coincides with the identifer of the original transaction for refund transactions. Coincides with SuccessfulPayment.telegram_payment_charge_id for successful incoming payments from users. */
198
+ /** Unique identifier of the transaction. Coincides with the identifier of the original transaction for refund transactions. Coincides with SuccessfulPayment.telegram_payment_charge_id for successful incoming payments from users. */
181
199
  id: string;
182
200
  /** Number of Telegram Stars transferred by the transaction */
183
201
  amount: number;
@@ -200,3 +218,21 @@ export interface PaidMediaPurchased {
200
218
  /** Bot-specified paid media payload */
201
219
  paid_media_payload: string;
202
220
  }
221
+ /** This object represents a gift that can be sent by the bot. */
222
+ export interface Gift {
223
+ /** Unique identifier of the gift */
224
+ id: string;
225
+ /** The sticker that represents the gift */
226
+ sticker: Sticker;
227
+ /** The number of Telegram Stars that must be paid to send the sticker */
228
+ star_count: number;
229
+ /** The total number of the gifts of this type that can be sent; for limited gifts only */
230
+ total_count?: number;
231
+ /** The number of remaining gifts of this type that can be sent; for limited gifts only */
232
+ remaining_count?: number;
233
+ }
234
+ /** This object represent a list of gifts. */
235
+ export interface Gifts {
236
+ /** The list of gifts */
237
+ gifts: Gift[];
238
+ }