@grammyjs/types 3.15.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/message.d.ts CHANGED
@@ -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 */
@@ -755,6 +754,15 @@ export type ApiMethods<F> = {
755
754
  /** Limits the number of photos to be retrieved. Values between 1-100 are accepted. Defaults to 100. */
756
755
  limit?: number;
757
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;
758
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.
759
767
 
760
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. */
@@ -1480,6 +1488,21 @@ export type ApiMethods<F> = {
1480
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. */
1481
1489
  custom_emoji_id?: string;
1482
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;
1483
1506
  /** Use this method to send answers to an inline query. On success, True is returned.
1484
1507
  No more than 50 results per query are allowed.
1485
1508
 
@@ -1505,6 +1528,21 @@ export type ApiMethods<F> = {
1505
1528
  /** An object describing the message to be sent */
1506
1529
  result: InlineQueryResult;
1507
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;
1508
1546
  /** Use this method to send invoices. On success, the sent Message is returned. */
1509
1547
  sendInvoice(args: {
1510
1548
  /** Unique identifier for the target chat or username of the target channel (in the format @channelusername) */
@@ -1570,6 +1608,8 @@ export type ApiMethods<F> = {
1570
1608
  }): Message.InvoiceMessage;
1571
1609
  /** Use this method to create a link for an invoice. Returns the created invoice link as String on success. */
1572
1610
  createInvoiceLink(args: {
1611
+ /** Unique identifier of the business connection on behalf of which the link will be created */
1612
+ business_connection_id?: string;
1573
1613
  /** Product name, 1-32 characters */
1574
1614
  title: string;
1575
1615
  /** Product description, 1-255 characters */
@@ -1582,6 +1622,8 @@ export type ApiMethods<F> = {
1582
1622
  currency: string;
1583
1623
  /** Price breakdown, a list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.) */
1584
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;
1585
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 */
1586
1628
  max_tip_amount?: number;
1587
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. */
@@ -1645,6 +1687,15 @@ export type ApiMethods<F> = {
1645
1687
  /** Telegram payment identifier */
1646
1688
  telegram_payment_charge_id: string;
1647
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;
1648
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.
1649
1700
 
1650
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. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grammyjs/types",
3
- "version": "3.15.0",
3
+ "version": "3.16.0",
4
4
  "description": "Telegram Bot API type declarations for grammY",
5
5
  "main": "mod.js",
6
6
  "repository": {
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 */
@@ -154,10 +160,14 @@ export interface TransactionPartnerUser {
154
160
  user: User;
155
161
  /** Bot-specified invoice payload */
156
162
  invoice_payload?: string;
163
+ /** The duration of the paid subscription */
164
+ subscription_period?: number;
157
165
  /** Information about the paid media bought by the user */
158
166
  paid_media?: PaidMedia[];
159
167
  /** Bot-specified paid media payload */
160
168
  paid_media_payload?: string;
169
+ /** The gift sent to the user by the bot */
170
+ gift?: string;
161
171
  }
162
172
  /** Describes a withdrawal transaction with Fragment. */
163
173
  export interface TransactionPartnerFragment {
@@ -208,3 +218,21 @@ export interface PaidMediaPurchased {
208
218
  /** Bot-specified paid media payload */
209
219
  paid_media_payload: string;
210
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
+ }