@telegram.ts/types 1.24.0 → 1.25.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.
@@ -1,4 +1,4 @@
1
- import type { User } from "./manageTypes";
1
+ import type { Chat, User } from "./manageTypes";
2
2
  import type { Message, MessageEntity, ParseMode } from "./messageTypes";
3
3
 
4
4
  /** Describes a task in a checklist. */
@@ -9,8 +9,10 @@ export interface ChecklistTask {
9
9
  text: string;
10
10
  /** Special entities that appear in the task text */
11
11
  text_entities?: MessageEntity[];
12
- /** User that completed the task; omitted if the task wasn't completed */
12
+ /** User that completed the task; omitted if the task wasn't completed by a user */
13
13
  completed_by_user?: User;
14
+ /** Chat that completed the task; omitted if the task wasn't completed by a chat */
15
+ completed_by_chat?: Chat;
14
16
  /** Point in time (Unix timestamp) when the task was completed; 0 if the task wasn't completed */
15
17
  completion_date?: number;
16
18
  }
@@ -36,7 +38,7 @@ export interface InputChecklistTask {
36
38
  /** Text of the task; 1-100 characters after entities parsing */
37
39
  text: string;
38
40
  /** Mode for parsing entities in the text. See formatting options for more details. */
39
- parse_mode?: ParseMode;
41
+ parse_mode?: string;
40
42
  /** List of special entities that appear in the text, which can be specified instead of parse_mode. Currently, only bold, italic, underline, strikethrough, spoiler, and custom_emoji entities are allowed. */
41
43
  text_entities?: MessageEntity[];
42
44
  }
@@ -7,6 +7,7 @@ import type {
7
7
  ParseMode,
8
8
  } from "./messageTypes";
9
9
  import type { LabeledPrice } from "./invoiceTypes";
10
+
10
11
  /** This object represents an incoming inline query. When the user sends an empty query, your bot could return some default or trending results. */
11
12
  export interface InlineQuery {
12
13
  /** Unique identifier for this query */
@@ -66,7 +66,7 @@ export interface ShippingOption {
66
66
  prices: LabeledPrice[];
67
67
  }
68
68
 
69
- /** This object contains basic information about a successful payment. */
69
+ /** This object contains basic information about a successful payment. Note that if the buyer initiates a chargeback with the relevant payment provider following this transaction, the funds may be debited from your balance. This is outside of Telegram's control. */
70
70
  export interface SuccessfulPayment {
71
71
  /** Three-letter ISO 4217 currency code, or “XTR” for payments in Telegram Stars */
72
72
  currency: string;
@@ -184,16 +184,16 @@ export interface AffiliateInfo {
184
184
 
185
185
  - TransactionPartnerUser
186
186
  - TransactionPartnerChat
187
- - TransactionPartnerFragment
188
187
  - TransactionPartnerAffiliateProgram
188
+ - TransactionPartnerFragment
189
189
  - TransactionPartnerTelegramAds
190
- - TransactionPartnerTelegramApi
190
+ - TransactionPartnerTelegramApi
191
191
  - TransactionPartnerOther */
192
192
  export type TransactionPartner =
193
193
  | TransactionPartnerUser
194
194
  | TransactionPartnerChat
195
- | TransactionPartnerFragment
196
195
  | TransactionPartnerAffiliateProgram
196
+ | TransactionPartnerFragment
197
197
  | TransactionPartnerTelegramAds
198
198
  | TransactionPartnerTelegramApi
199
199
  | TransactionPartnerOther;
@@ -213,13 +213,13 @@ export interface TransactionPartnerUser {
213
213
  user: User;
214
214
  /** Information about the affiliate that received a commission via this transaction. Can be available only for “invoice_payment” and “paid_media_payment” transactions. */
215
215
  affiliate?: AffiliateInfo;
216
- /** The duration of the paid subscription. Can be available only for “invoice_payment” transactions. */
217
- subscription_period?: number;
218
216
  /** Bot-specified invoice payload. Can be available only for “invoice_payment” transactions. */
219
217
  invoice_payload?: string;
220
- /** Information about the paid media bought by the user. Can be available only for “invoice_payment” transactions. */
218
+ /** The duration of the paid subscription. Can be available only for “invoice_payment” transactions. */
219
+ subscription_period?: number;
220
+ /** Information about the paid media bought by the user; for “paid_media_payment” transactions only */
221
221
  paid_media?: PaidMedia[];
222
- /** Bot-specified paid media payload. Can be available only for “invoice_payment” transactions. */
222
+ /** Bot-specified paid media payload. Can be available only for “paid_media_payment” transactions. */
223
223
  paid_media_payload?: string;
224
224
  /** The gift sent to the user by the bot; for “gift_purchase” transactions only */
225
225
  gift?: Gift;
@@ -255,6 +255,12 @@ export interface TransactionPartnerFragment {
255
255
  withdrawal_state?: RevenueWithdrawalState;
256
256
  }
257
257
 
258
+ /** Describes a withdrawal transaction to the Telegram Ads platform. */
259
+ export interface TransactionPartnerTelegramAds {
260
+ /** Type of the transaction partner, always “telegram_ads” */
261
+ type: "telegram_ads";
262
+ }
263
+
258
264
  /** Describes a transaction with payment for paid broadcasting. */
259
265
  export interface TransactionPartnerTelegramApi {
260
266
  /** Type of the transaction partner, always “telegram_api” */
@@ -263,21 +269,15 @@ export interface TransactionPartnerTelegramApi {
263
269
  request_count: number;
264
270
  }
265
271
 
266
- /** Describes a withdrawal transaction to the Telegram Ads platform. */
267
- export interface TransactionPartnerTelegramAds {
268
- /** Type of the transaction partner, always “telegram_ads” */
269
- type: "telegram_ads";
270
- }
271
-
272
272
  /** Describes a transaction with an unknown source or recipient. */
273
273
  export interface TransactionPartnerOther {
274
274
  /** Type of the transaction partner, always “other” */
275
275
  type: "other";
276
276
  }
277
277
 
278
- /** Describes a Telegram Star transaction. */
278
+ /** Describes a Telegram Star transaction. Note that if the buyer initiates a chargeback with the payment provider from whom they acquired Stars (e.g., Apple, Google) following this transaction, the refunded Stars will be deducted from the bot's balance. This is outside of Telegram's control. */
279
279
  export interface StarTransaction {
280
- /** 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. */
280
+ /** 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. */
281
281
  id: string;
282
282
  /** Integer amount of Telegram Stars transferred by the transaction */
283
283
  amount: number;
@@ -305,6 +305,16 @@ export interface PaidMediaPurchased {
305
305
  paid_media_payload: string;
306
306
  }
307
307
 
308
+ /** This object describes the background of a gift. */
309
+ export interface GiftBackground {
310
+ /** Center color of the background in RGB format */
311
+ center_color: number;
312
+ /** Edge color of the background in RGB format */
313
+ edge_color: number;
314
+ /** Text color of the background in RGB format */
315
+ text_color: number;
316
+ }
317
+
308
318
  /** This object represents a gift that can be sent by the bot. */
309
319
  export interface Gift {
310
320
  /** Unique identifier of the gift */
@@ -313,14 +323,26 @@ export interface Gift {
313
323
  publisher_chat?: Chat;
314
324
  /** The sticker that represents the gift */
315
325
  sticker: Sticker;
326
+ /** Background of the gift */
327
+ background?: GiftBackground;
328
+ /** True, if the gift can only be purchased by Telegram Premium subscribers */
329
+ is_premium?: true;
330
+ /** True, if the gift can be used (after being upgraded) to customize a user's appearance */
331
+ has_colors?: true;
316
332
  /** The number of Telegram Stars that must be paid to send the sticker */
317
333
  star_count: number;
318
334
  /** The number of Telegram Stars that must be paid to upgrade the gift to a unique one */
319
335
  upgrade_star_count?: number;
320
- /** The total number of the gifts of this type that can be sent; for limited gifts only */
336
+ /** The total number of different unique gifts that can be obtained by upgrading the gift */
337
+ unique_gift_variant_count?: number;
338
+ /** The total number of gifts of this type that can be sent by all users; for limited gifts only */
321
339
  total_count?: number;
322
- /** The number of remaining gifts of this type that can be sent; for limited gifts only */
340
+ /** The number of remaining gifts of this type that can be sent by all users; for limited gifts only */
323
341
  remaining_count?: number;
342
+ /** The total number of gifts of this type that can be sent by the bot; for limited gifts only */
343
+ personal_total_count?: number;
344
+ /** The number of remaining gifts of this type that can be sent by the bot; for limited gifts only */
345
+ personal_remaining_count?: number;
324
346
  }
325
347
 
326
348
  /** This object represent a list of gifts. */
@@ -333,8 +355,6 @@ export interface Gifts {
333
355
  export interface UniqueGiftModel {
334
356
  /** Name of the model */
335
357
  name: string;
336
- /** Information about the chat that published the gift */
337
- publisher_chat?: Chat;
338
358
  /** The sticker that represents the unique gift */
339
359
  sticker: Sticker;
340
360
  /** The number of unique gifts that receive this model for every 1000 gifts upgraded */
@@ -375,12 +395,18 @@ export interface UniqueGiftBackdrop {
375
395
 
376
396
  /** This object describes a unique gift that was upgraded from a regular gift. */
377
397
  export interface UniqueGift {
398
+ /** Identifier of the regular gift from which the gift was upgraded */
399
+ gift_id: string;
378
400
  /** Human-readable name of the regular gift from which this unique gift was upgraded */
379
401
  base_name: string;
380
402
  /** Unique name of the gift. This name can be used in https://t.me/nft/... links and story areas */
381
403
  name: string;
382
404
  /** Information about the chat that published the gift */
383
405
  publisher_chat?: Chat;
406
+ /** True, if the original regular gift was exclusively purchaseable by Telegram Premium subscribers */
407
+ is_premium?: true;
408
+ /** True, if the gift is assigned from the TON blockchain and can't be resold or transferred in Telegram */
409
+ is_from_blockchain?: true;
384
410
  /** Unique number of the upgraded gift among gifts upgraded from the same regular gift */
385
411
  number: number;
386
412
  /** Model of the gift */
@@ -389,6 +415,24 @@ export interface UniqueGift {
389
415
  symbol: UniqueGiftSymbol;
390
416
  /** Backdrop of the gift */
391
417
  backdrop: UniqueGiftBackdrop;
418
+ /** The color scheme that can be used by the gift's owner for the chat's name, replies to messages and link previews */
419
+ colors?: UniqueGiftColors;
420
+ }
421
+
422
+ /** This object contains information about the color scheme for a user's name, message replies and link previews based on a unique gift. */
423
+ export interface UniqueGiftColors {
424
+ /** Custom emoji identifier of the unique gift's model */
425
+ model_custom_emoji_id: string;
426
+ /** Custom emoji identifier of the unique gift's symbol */
427
+ symbol_custom_emoji_id: string;
428
+ /** Main color used in light themes; RGB format */
429
+ light_theme_main_color: number;
430
+ /** List of 1-3 additional colors used in light themes; RGB format */
431
+ light_theme_other_colors: number[];
432
+ /** Main color used in dark themes; RGB format */
433
+ dark_theme_main_color: number;
434
+ /** List of 1-3 additional colors used in dark themes; RGB format */
435
+ dark_theme_other_colors: number[];
392
436
  }
393
437
 
394
438
  /** Describes a service message about a regular gift that was sent or received. */
@@ -403,6 +447,10 @@ export interface GiftInfo {
403
447
  prepaid_upgrade_star_count?: number;
404
448
  /** True, if the gift can be upgraded to a unique gift */
405
449
  can_be_upgraded?: true;
450
+ /** True, if the gift's upgrade was purchased after the gift was sent */
451
+ is_upgrade_separate?: true;
452
+ /** Unique number reserved for this gift when upgraded. See the number field in UniqueGift */
453
+ unique_gift_number?: number;
406
454
  /** Text of the message that was added to the gift */
407
455
  text?: string;
408
456
  /** Special entities that appear in the text */
@@ -415,14 +463,16 @@ export interface GiftInfo {
415
463
  export interface UniqueGiftInfo {
416
464
  /** Information about the gift */
417
465
  gift: UniqueGift;
418
- /** Origin of the gift. Currently, either “upgrade” for gifts upgraded from regular gifts, “transfer” for gifts transferred from other users or channels, or “resale” for gifts bought from other users */
419
- origin: "upgrade" | "transfer" | "resale";
466
+ /** Origin of the gift. Currently, either “upgrade” for gifts upgraded from regular gifts, “transfer” for gifts transferred from other users or channels, “resale” for gifts bought from other users, “gifted_upgrade” for upgrades purchased after the gift was sent, or “offer” for gifts bought or sold through gift purchase offers */
467
+ origin: "upgrade" | "transfer" | "resale" | "gifted_upgrade" | "offer";
420
468
  /** Unique identifier of the received gift for the bot; only present for gifts received on behalf of business accounts */
421
469
  owned_gift_id?: string;
422
470
  /** Number of Telegram Stars that must be paid to transfer the gift; omitted if the bot cannot transfer the gift */
423
471
  transfer_star_count?: number;
424
- /** For gifts bought from other users, the price paid for the gift */
425
- last_resale_star_count?: number;
472
+ /** For gifts bought from other users, the currency in which the payment for the gift was done. Currently, one of “XTR” for Telegram Stars or “TON” for toncoins. */
473
+ last_resale_currency?: "XTR" | "TON";
474
+ /** For gifts bought from other users, the price paid for the gift in either Telegram Stars or nanotoncoins */
475
+ last_resale_amount?: number;
426
476
  /** Point in time (Unix timestamp) when the gift can be transferred. If it is in the past, then the gift can be transferred now */
427
477
  next_transfer_date?: number;
428
478
  }
@@ -442,6 +492,7 @@ export interface StarAmount {
442
492
  }
443
493
 
444
494
  /** This object describes a gift received and owned by a user or a chat. Currently, it can be one of
495
+
445
496
  - OwnedGiftRegular
446
497
  - OwnedGiftUnique */
447
498
  export type OwnedGift = OwnedGiftRegular | OwnedGiftUnique;
@@ -458,6 +509,8 @@ export interface OwnedGiftRegular {
458
509
  sender_user?: User;
459
510
  /** Date the gift was sent in Unix time */
460
511
  send_date: number;
512
+ /** Unique number reserved for this gift when upgraded. See the number field in UniqueGift */
513
+ unique_gift_number?: number;
461
514
  /** Text of the message that was added to the gift */
462
515
  text?: string;
463
516
  /** Special entities that appear in the text */
@@ -468,14 +521,14 @@ export interface OwnedGiftRegular {
468
521
  is_saved?: true;
469
522
  /** True, if the gift can be upgraded to a unique gift; for gifts received on behalf of business accounts only */
470
523
  can_be_upgraded?: true;
524
+ /** True, if the gift's upgrade was purchased after the gift was sent */
525
+ is_upgrade_separate?: true;
471
526
  /** True, if the gift was refunded and isn't available anymore */
472
527
  was_refunded?: true;
473
528
  /** Number of Telegram Stars that can be claimed by the receiver instead of the gift; omitted if the gift cannot be converted to Telegram Stars */
474
529
  convert_star_count?: number;
475
530
  /** Number of Telegram Stars that were paid by the sender for the ability to upgrade the gift */
476
531
  prepaid_upgrade_star_count?: number;
477
- /** Point in time (Unix timestamp) when the gift can be transferred. If it is in the past, then the gift can be transferred now */
478
- next_transfer_date?: string;
479
532
  }
480
533
 
481
534
  /** Describes a unique gift received and owned by a user or a chat. */
@@ -510,7 +563,7 @@ export interface OwnedGifts {
510
563
  next_offset?: string;
511
564
  }
512
565
 
513
- /** Desribes price of a suggested post. */
566
+ /** Describes the price of a suggested post. */
514
567
  export interface SuggestedPostPrice {
515
568
  /** Currency in which the post will be paid. Currently, must be one of “XTR” for Telegram Stars or “TON” for toncoins */
516
569
  currency: "XTR" | "TON";