@telegram.ts/types 1.17.2 → 1.18.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@telegram.ts/types",
3
- "version": "1.17.2",
3
+ "version": "1.18.1",
4
4
  "description": "Comprehensive Type Declarations for Telegram Bot API with telegramsjs",
5
5
  "main": "./src/index.js",
6
6
  "types": "./src/index.d.ts",
@@ -38,6 +38,7 @@ import type {
38
38
  MessageId,
39
39
  ParseMode,
40
40
  Poll,
41
+ PreparedInlineMessage,
41
42
  ReactionType,
42
43
  ReplyParameters,
43
44
  SentWebAppMessage,
@@ -46,6 +47,7 @@ import type {
46
47
  } from "./messageTypes";
47
48
  import type { PassportElementError } from "./passportTypes";
48
49
  import type {
50
+ Gifts,
49
51
  LabeledPrice,
50
52
  ShippingOption,
51
53
  StarTransactions,
@@ -879,6 +881,16 @@ export type ApiMethods = {
879
881
  limit?: number;
880
882
  }): UserProfilePhotos;
881
883
 
884
+ /** 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. */
885
+ setUserEmojiStatus(args: {
886
+ /** Unique identifier of the target user */
887
+ user_id: number;
888
+ /** Custom emoji identifier of the emoji status to set. Pass an empty string to remove the status. */
889
+ emoji_status_custom_emoji_id?: string;
890
+ /** Expiration date of the emoji status, if any */
891
+ emoji_status_expiration_date?: number;
892
+ }): true;
893
+
882
894
  /** 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.
883
895
 
884
896
  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. */
@@ -1691,6 +1703,23 @@ export type ApiMethods = {
1691
1703
  custom_emoji_id?: string;
1692
1704
  }): true;
1693
1705
 
1706
+ /** Returns the list of gifts that can be sent by the bot to users. Requires no parameters. Returns a Gifts object. */
1707
+ getAvailableGifts(): Gifts;
1708
+
1709
+ /** Sends a gift to the given user. The gift can't be converted to Telegram Stars by the user. Returns True on success. */
1710
+ sendGift(args: {
1711
+ /** Unique identifier of the target user that will receive the gift */
1712
+ user_id: number;
1713
+ /** Identifier of the gift */
1714
+ gift_id: string;
1715
+ /** Text that will be shown along with the gift; 0-255 characters */
1716
+ text?: string;
1717
+ /** 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. */
1718
+ text_parse_mode?: ParseMode;
1719
+ /** 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. */
1720
+ text_entities?: MessageEntity[];
1721
+ }): Gifts;
1722
+
1694
1723
  /** Use this method to send answers to an inline query. On success, True is returned.
1695
1724
  No more than 50 results per query are allowed.
1696
1725
 
@@ -1718,6 +1747,22 @@ export type ApiMethods = {
1718
1747
  result: InlineQueryResult;
1719
1748
  }): SentWebAppMessage;
1720
1749
 
1750
+ /** Stores a message that can be sent by a user of a Mini App. Returns a PreparedInlineMessage object. */
1751
+ savePreparedInlineMessage(args: {
1752
+ /** Unique identifier of the target user that can use the prepared message */
1753
+ user_id: number;
1754
+ /** An object describing the message to be sent */
1755
+ result: InlineQueryResult;
1756
+ /** Pass True if the message can be sent to private chats with users */
1757
+ allow_user_chats?: boolean;
1758
+ /** Pass True if the message can be sent to private chats with bots */
1759
+ allow_bot_chats?: boolean;
1760
+ /** Pass True if the message can be sent to group and supergroup chats */
1761
+ allow_group_chats?: boolean;
1762
+ /** Pass True if the message can be sent to channel chats */
1763
+ allow_channel_chats?: boolean;
1764
+ }): PreparedInlineMessage;
1765
+
1721
1766
  /** Use this method to send invoices. On success, the sent Message is returned. */
1722
1767
  sendInvoice(args: {
1723
1768
  /** Unique identifier for the target chat or username of the target channel (in the format @channelusername) */
@@ -1782,6 +1827,8 @@ export type ApiMethods = {
1782
1827
 
1783
1828
  /** Use this method to create a link for an invoice. Returns the created invoice link as String on success. */
1784
1829
  createInvoiceLink(args: {
1830
+ /** Unique identifier of the business connection on behalf of which the link will be created */
1831
+ business_connection_id?: string;
1785
1832
  /** Product name, 1-32 characters */
1786
1833
  title: string;
1787
1834
  /** Product description, 1-255 characters */
@@ -1794,6 +1841,8 @@ export type ApiMethods = {
1794
1841
  currency: string;
1795
1842
  /** Price breakdown, a list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.) */
1796
1843
  prices: LabeledPrice[];
1844
+ /** 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. */
1845
+ subscription_period?: number;
1797
1846
  /** 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 */
1798
1847
  max_tip_amount?: number;
1799
1848
  /** 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. */
@@ -1824,6 +1873,16 @@ export type ApiMethods = {
1824
1873
  is_flexible?: boolean;
1825
1874
  }): string;
1826
1875
 
1876
+ /** Allows the bot to cancel or re-enable extension of a subscription paid in Telegram Stars. Returns True on success. */
1877
+ editUserStarSubscription(args: {
1878
+ /** Identifier of the user whose subscription will be edited */
1879
+ user_id: number;
1880
+ /** Telegram payment identifier for the subscription */
1881
+ telegram_payment_charge_id: string;
1882
+ /** 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. */
1883
+ is_canceled: boolean;
1884
+ }): true;
1885
+
1827
1886
  /** If you sent an invoice requesting a shipping address and the parameter is_flexible was specified, the Bot API will send an Update with a shipping_query field to the bot. Use this method to reply to shipping queries. On success, True is returned. */
1828
1887
  answerShippingQuery(args: {
1829
1888
  /** Unique identifier for the query to be answered */
@@ -1,5 +1,5 @@
1
1
  import type { User } from "./manageTypes";
2
- import type { PaidMedia } from "./messageTypes";
2
+ import type { PaidMedia, Sticker } from "./messageTypes";
3
3
 
4
4
  /** This object represents a portion of the price for goods or services. */
5
5
  export interface LabeledPrice {
@@ -69,6 +69,12 @@ export interface SuccessfulPayment {
69
69
  total_amount: number;
70
70
  /** Bot specified invoice payload */
71
71
  invoice_payload: string;
72
+ /** Expiration date of the subscription, in Unix time; for recurring payments only */
73
+ subscription_expiration_date?: number;
74
+ /** True, if the payment is a recurring payment for a subscription */
75
+ is_recurring?: true;
76
+ /** True, if the payment is the first payment for a subscription */
77
+ is_first_recurring?: true;
72
78
  /** Identifier of the shipping option chosen by the user */
73
79
  shipping_option_id?: string;
74
80
  /** Order information provided by the user */
@@ -175,12 +181,16 @@ export interface TransactionPartnerUser {
175
181
  type: "user";
176
182
  /** Information about the user */
177
183
  user: User;
184
+ /** The duration of the paid subscription */
185
+ subscription_period?: number;
178
186
  /** Bot-specified invoice payload */
179
187
  invoice_payload?: string;
180
188
  /** Information about the paid media bought by the user */
181
189
  paid_media?: PaidMedia[];
182
190
  /** Bot-specified paid media payload */
183
191
  paid_media_payload?: string;
192
+ /** The gift sent to the user by the bot */
193
+ gift?: string;
184
194
  }
185
195
 
186
196
  /** Describes a withdrawal transaction with Fragment. */
@@ -238,3 +248,23 @@ export interface PaidMediaPurchased {
238
248
  /** Bot-specified paid media payload */
239
249
  paid_media_payload: string;
240
250
  }
251
+
252
+ /** This object represents a gift that can be sent by the bot. */
253
+ export interface Gift {
254
+ /** Unique identifier of the gift */
255
+ id: string;
256
+ /** The sticker that represents the gift */
257
+ sticker: Sticker;
258
+ /** The number of Telegram Stars that must be paid to send the sticker */
259
+ star_count: number;
260
+ /** The total number of the gifts of this type that can be sent; for limited gifts only */
261
+ total_count?: number;
262
+ /** The number of remaining gifts of this type that can be sent; for limited gifts only */
263
+ remaining_count?: number;
264
+ }
265
+
266
+ /** This object represent a list of gifts. */
267
+ export interface Gifts {
268
+ /** The list of gifts */
269
+ gifts: Gift[];
270
+ }
@@ -1483,3 +1483,11 @@ export interface MessageReactionCountUpdated {
1483
1483
  /** List of reactions that are present on the message */
1484
1484
  reactions: ReactionCount[];
1485
1485
  }
1486
+
1487
+ /** Describes an inline message to be sent by a user of a Mini App. */
1488
+ export interface PreparedInlineMessage {
1489
+ /** Unique identifier of the prepared message */
1490
+ id: string;
1491
+ /** Expiration date of the prepared message, in Unix time. Expired prepared messages can no longer be used */
1492
+ expiration_date: number;
1493
+ }