@grammyjs/types 3.15.0 → 3.17.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 +7 -0
- package/methods.d.ts +56 -5
- package/package.json +1 -1
- package/payment.d.ts +59 -4
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 {
|
|
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
package/payment.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { User } from "./manage.js";
|
|
2
|
-
import type { PaidMedia } from "./message.js";
|
|
1
|
+
import type { Chat, User } from "./manage.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 */
|
|
@@ -138,26 +144,55 @@ export interface RevenueWithdrawalStateFailed {
|
|
|
138
144
|
/** Type of the state, always “failed” */
|
|
139
145
|
type: "failed";
|
|
140
146
|
}
|
|
147
|
+
/** Contains information about the affiliate that received a commission via this transaction. */
|
|
148
|
+
export interface AffiliateInfo {
|
|
149
|
+
/** The bot or the user that received an affiliate commission if it was received by a bot or a user */
|
|
150
|
+
affiliate_user?: User;
|
|
151
|
+
/** The chat that received an affiliate commission if it was received by a chat */
|
|
152
|
+
affiliate_chat?: Chat;
|
|
153
|
+
/** The number of Telegram Stars received by the affiliate for each 1000 Telegram Stars received by the bot from referred users */
|
|
154
|
+
commission_per_mille: number;
|
|
155
|
+
/** Integer amount of Telegram Stars received by the affiliate from the transaction, rounded to 0; can be negative for refunds */
|
|
156
|
+
amount: number;
|
|
157
|
+
/** The number of 1/1000000000 shares of Telegram Stars received by the affiliate; from -999999999 to 999999999; can be negative for refunds */
|
|
158
|
+
nanostar_amount?: number;
|
|
159
|
+
}
|
|
141
160
|
/** This object describes the source of a transaction, or its recipient for outgoing transactions. Currently, it can be one of
|
|
142
161
|
|
|
143
162
|
- TransactionPartnerUser
|
|
163
|
+
- TransactionPartnerAffiliateProgram
|
|
144
164
|
- TransactionPartnerFragment
|
|
145
165
|
- TransactionPartnerTelegramAds
|
|
146
166
|
- TransactionPartnerTelegramApi
|
|
147
167
|
- TransactionPartnerOther */
|
|
148
|
-
export type TransactionPartner = TransactionPartnerUser | TransactionPartnerFragment | TransactionPartnerTelegramAds | TransactionPartnerTelegramApi | TransactionPartnerOther;
|
|
168
|
+
export type TransactionPartner = TransactionPartnerUser | TransactionPartnerAffiliateProgram | TransactionPartnerFragment | TransactionPartnerTelegramAds | TransactionPartnerTelegramApi | TransactionPartnerOther;
|
|
149
169
|
/** Describes a transaction with a user. */
|
|
150
170
|
export interface TransactionPartnerUser {
|
|
151
171
|
/** Type of the transaction partner, always “user” */
|
|
152
172
|
type: "user";
|
|
153
173
|
/** Information about the user */
|
|
154
174
|
user: User;
|
|
175
|
+
/** Information about the affiliate that received a commission via this transaction */
|
|
176
|
+
affiliate?: AffiliateInfo;
|
|
155
177
|
/** Bot-specified invoice payload */
|
|
156
178
|
invoice_payload?: string;
|
|
179
|
+
/** The duration of the paid subscription */
|
|
180
|
+
subscription_period?: number;
|
|
157
181
|
/** Information about the paid media bought by the user */
|
|
158
182
|
paid_media?: PaidMedia[];
|
|
159
183
|
/** Bot-specified paid media payload */
|
|
160
184
|
paid_media_payload?: string;
|
|
185
|
+
/** The gift sent to the user by the bot */
|
|
186
|
+
gift?: string;
|
|
187
|
+
}
|
|
188
|
+
/** Describes the affiliate program that issued the affiliate commission received via this transaction. */
|
|
189
|
+
export interface TransactionPartnerAffiliateProgram {
|
|
190
|
+
/** Type of the transaction partner, always “affiliate_program” */
|
|
191
|
+
type: "affiliate_program";
|
|
192
|
+
/** Information about the bot that sponsored the affiliate program */
|
|
193
|
+
sponsor_user?: User;
|
|
194
|
+
/** The number of Telegram Stars received by the bot for each 1000 Telegram Stars received by the affiliate program sponsor from referred users */
|
|
195
|
+
commission_per_mille: number;
|
|
161
196
|
}
|
|
162
197
|
/** Describes a withdrawal transaction with Fragment. */
|
|
163
198
|
export interface TransactionPartnerFragment {
|
|
@@ -187,8 +222,10 @@ export interface TransactionPartnerOther {
|
|
|
187
222
|
export interface StarTransaction {
|
|
188
223
|
/** 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. */
|
|
189
224
|
id: string;
|
|
190
|
-
/**
|
|
225
|
+
/** Integer amount of Telegram Stars transferred by the transaction */
|
|
191
226
|
amount: number;
|
|
227
|
+
/** The number of 1/1000000000 shares of Telegram Stars transferred by the transaction; from 0 to 999999999 */
|
|
228
|
+
nanostar_amount?: number;
|
|
192
229
|
/** Date the transaction was created in Unix time */
|
|
193
230
|
date: number;
|
|
194
231
|
/** Source of an incoming transaction (e.g., a user purchasing goods or services, Fragment refunding a failed withdrawal). Only for incoming transactions */
|
|
@@ -208,3 +245,21 @@ export interface PaidMediaPurchased {
|
|
|
208
245
|
/** Bot-specified paid media payload */
|
|
209
246
|
paid_media_payload: string;
|
|
210
247
|
}
|
|
248
|
+
/** This object represents a gift that can be sent by the bot. */
|
|
249
|
+
export interface Gift {
|
|
250
|
+
/** Unique identifier of the gift */
|
|
251
|
+
id: string;
|
|
252
|
+
/** The sticker that represents the gift */
|
|
253
|
+
sticker: Sticker;
|
|
254
|
+
/** The number of Telegram Stars that must be paid to send the sticker */
|
|
255
|
+
star_count: number;
|
|
256
|
+
/** The total number of the gifts of this type that can be sent; for limited gifts only */
|
|
257
|
+
total_count?: number;
|
|
258
|
+
/** The number of remaining gifts of this type that can be sent; for limited gifts only */
|
|
259
|
+
remaining_count?: number;
|
|
260
|
+
}
|
|
261
|
+
/** This object represent a list of gifts. */
|
|
262
|
+
export interface Gifts {
|
|
263
|
+
/** The list of gifts */
|
|
264
|
+
gifts: Gift[];
|
|
265
|
+
}
|