@telegram.ts/types 1.10.0 → 1.11.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@telegram.ts/types",
3
- "version": "1.10.0",
3
+ "version": "1.11.0",
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",
@@ -11,6 +11,7 @@
11
11
  "api",
12
12
  "types"
13
13
  ],
14
+ "homepage": "https://telegramsjs.vercel.app/",
14
15
  "license": "MIT",
15
16
  "bugs": {
16
17
  "url": "https://github.com/telegramsjs/types/issues"
@@ -43,7 +43,11 @@ import type {
43
43
  StickerSet,
44
44
  } from "./messageTypes.ts";
45
45
  import type { PassportElementError } from "./passportTypes.ts";
46
- import type { LabeledPrice, ShippingOption } from "./invoiceTypes.ts";
46
+ import type {
47
+ LabeledPrice,
48
+ ShippingOption,
49
+ StarTransactions,
50
+ } from "./invoiceTypes.ts";
47
51
  import type {
48
52
  BotCommandScope,
49
53
  BotDescription,
@@ -140,7 +144,7 @@ export type ApiMethods = {
140
144
  disable_notification?: boolean;
141
145
  /** Protects the contents of the sent message from forwarding and saving */
142
146
  protect_content?: boolean;
143
- /** Unique identifier of the message effect to be added to the message */
147
+ /** Unique identifier of the message effect to be added to the message; for private chats only */
144
148
  message_effect_id?: string;
145
149
  /** Description of the message to reply to */
146
150
  reply_parameters?: ReplyParameters;
@@ -262,7 +266,7 @@ export type ApiMethods = {
262
266
  disable_notification?: boolean;
263
267
  /** Protects the contents of the sent message from forwarding and saving */
264
268
  protect_content?: boolean;
265
- /** Unique identifier of the message effect to be added to the message */
269
+ /** Unique identifier of the message effect to be added to the message; for private chats only */
266
270
  message_effect_id?: string;
267
271
  /** Description of the message to reply to */
268
272
  reply_parameters?: ReplyParameters;
@@ -306,7 +310,7 @@ export type ApiMethods = {
306
310
  disable_notification?: boolean;
307
311
  /** Protects the contents of the sent message from forwarding and saving */
308
312
  protect_content?: boolean;
309
- /** Unique identifier of the message effect to be added to the message */
313
+ /** Unique identifier of the message effect to be added to the message; for private chats only */
310
314
  message_effect_id?: string;
311
315
  /** Description of the message to reply to */
312
316
  reply_parameters?: ReplyParameters;
@@ -344,7 +348,7 @@ export type ApiMethods = {
344
348
  disable_notification?: boolean;
345
349
  /** Protects the contents of the sent message from forwarding and saving */
346
350
  protect_content?: boolean;
347
- /** Unique identifier of the message effect to be added to the message */
351
+ /** Unique identifier of the message effect to be added to the message; for private chats only */
348
352
  message_effect_id?: string;
349
353
  /** Description of the message to reply to */
350
354
  reply_parameters?: ReplyParameters;
@@ -392,7 +396,7 @@ export type ApiMethods = {
392
396
  disable_notification?: boolean;
393
397
  /** Protects the contents of the sent message from forwarding and saving */
394
398
  protect_content?: boolean;
395
- /** Unique identifier of the message effect to be added to the message */
399
+ /** Unique identifier of the message effect to be added to the message; for private chats only */
396
400
  message_effect_id?: string;
397
401
  /** Description of the message to reply to */
398
402
  reply_parameters?: ReplyParameters;
@@ -438,7 +442,7 @@ export type ApiMethods = {
438
442
  disable_notification?: boolean;
439
443
  /** Protects the contents of the sent message from forwarding and saving */
440
444
  protect_content?: boolean;
441
- /** Unique identifier of the message effect to be added to the message */
445
+ /** Unique identifier of the message effect to be added to the message; for private chats only */
442
446
  message_effect_id?: string;
443
447
  /** Description of the message to reply to */
444
448
  reply_parameters?: ReplyParameters;
@@ -474,7 +478,7 @@ export type ApiMethods = {
474
478
  disable_notification?: boolean;
475
479
  /** Protects the contents of the sent message from forwarding and saving */
476
480
  protect_content?: boolean;
477
- /** Unique identifier of the message effect to be added to the message */
481
+ /** Unique identifier of the message effect to be added to the message; for private chats only */
478
482
  message_effect_id?: string;
479
483
  /** Description of the message to reply to */
480
484
  reply_parameters?: ReplyParameters;
@@ -509,7 +513,7 @@ export type ApiMethods = {
509
513
  disable_notification?: boolean;
510
514
  /** Protects the contents of the sent message from forwarding and saving */
511
515
  protect_content?: boolean;
512
- /** Unique identifier of the message effect to be added to the message */
516
+ /** Unique identifier of the message effect to be added to the message; for private chats only */
513
517
  message_effect_id?: string;
514
518
  /** Description of the message to reply to */
515
519
  reply_parameters?: ReplyParameters;
@@ -539,7 +543,7 @@ export type ApiMethods = {
539
543
  disable_notification?: boolean;
540
544
  /** Protects the contents of the sent messages from forwarding and saving */
541
545
  protect_content?: boolean;
542
- /** Unique identifier of the message effect to be added to the message */
546
+ /** Unique identifier of the message effect to be added to the message; for private chats only */
543
547
  message_effect_id?: string;
544
548
  /** Description of the message to reply to */
545
549
  reply_parameters?: ReplyParameters;
@@ -576,7 +580,7 @@ export type ApiMethods = {
576
580
  disable_notification?: boolean;
577
581
  /** Protects the contents of the sent message from forwarding and saving */
578
582
  protect_content?: boolean;
579
- /** Unique identifier of the message effect to be added to the message */
583
+ /** Unique identifier of the message effect to be added to the message; for private chats only */
580
584
  message_effect_id?: string;
581
585
  /** Description of the message to reply to */
582
586
  reply_parameters?: ReplyParameters;
@@ -592,6 +596,8 @@ export type ApiMethods = {
592
596
 
593
597
  /** Use this method to edit live location messages. A location can be edited until its live_period expires or editing is explicitly disabled by a call to stopMessageLiveLocation. On success, if the edited message is not an inline message, the edited Message is returned, otherwise True is returned. */
594
598
  editMessageLiveLocation(args: {
599
+ /** Unique identifier of the business connection on behalf of which the message to be edited was sent */
600
+ business_connection_id?: string;
595
601
  /** Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername) */
596
602
  chat_id?: number | string;
597
603
  /** Required if inline_message_id is not specified. Identifier of the message to edit */
@@ -616,6 +622,8 @@ export type ApiMethods = {
616
622
 
617
623
  /** Use this method to stop updating a live location message before live_period expires. On success, if the message is not an inline message, the edited Message is returned, otherwise True is returned. */
618
624
  stopMessageLiveLocation(args: {
625
+ /** Unique identifier of the business connection on behalf of which the message to be edited was sent */
626
+ business_connection_id?: string;
619
627
  /** Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername) */
620
628
  chat_id?: number | string;
621
629
  /** Required if inline_message_id is not specified. Identifier of the message with live location to stop */
@@ -654,7 +662,7 @@ export type ApiMethods = {
654
662
  disable_notification?: boolean;
655
663
  /** Protects the contents of the sent message from forwarding and saving */
656
664
  protect_content?: boolean;
657
- /** Unique identifier of the message effect to be added to the message */
665
+ /** Unique identifier of the message effect to be added to the message; for private chats only */
658
666
  message_effect_id?: string;
659
667
  /** Description of the message to reply to */
660
668
  reply_parameters?: ReplyParameters;
@@ -688,7 +696,7 @@ export type ApiMethods = {
688
696
  disable_notification?: boolean;
689
697
  /** Protects the contents of the sent message from forwarding and saving */
690
698
  protect_content?: boolean;
691
- /** Unique identifier of the message effect to be added to the message */
699
+ /** Unique identifier of the message effect to be added to the message; for private chats only */
692
700
  message_effect_id?: string;
693
701
  /** Description of the message to reply to */
694
702
  reply_parameters?: ReplyParameters;
@@ -742,7 +750,7 @@ export type ApiMethods = {
742
750
  disable_notification?: boolean;
743
751
  /** Protects the contents of the sent message from forwarding and saving */
744
752
  protect_content?: boolean;
745
- /** Unique identifier of the message effect to be added to the message */
753
+ /** Unique identifier of the message effect to be added to the message; for private chats only */
746
754
  message_effect_id?: string;
747
755
  /** Description of the message to reply to */
748
756
  reply_parameters?: ReplyParameters;
@@ -770,7 +778,7 @@ export type ApiMethods = {
770
778
  disable_notification?: boolean;
771
779
  /** Protects the contents of the sent message from forwarding */
772
780
  protect_content?: boolean;
773
- /** Unique identifier of the message effect to be added to the message */
781
+ /** Unique identifier of the message effect to be added to the message; for private chats only */
774
782
  message_effect_id?: string;
775
783
  /** Description of the message to reply to */
776
784
  reply_parameters?: ReplyParameters;
@@ -1351,8 +1359,10 @@ export type ApiMethods = {
1351
1359
  for_channels?: boolean;
1352
1360
  }): ChatAdministratorRights;
1353
1361
 
1354
- /** Use this method to edit text and game messages. On success, if the edited message is not an inline message, the edited Message is returned, otherwise True is returned. */
1362
+ /** Use this method to edit text and game messages. 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. */
1355
1363
  editMessageText(args: {
1364
+ /** Unique identifier of the business connection on behalf of which the message to be edited was sent */
1365
+ business_connection_id?: string;
1356
1366
  /** Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername) */
1357
1367
  chat_id?: number | string;
1358
1368
  /** Required if inline_message_id is not specified. Identifier of the message to edit */
@@ -1371,8 +1381,10 @@ export type ApiMethods = {
1371
1381
  reply_markup?: InlineKeyboardMarkup;
1372
1382
  }): (Update.Edited & Message.TextMessage) | true;
1373
1383
 
1374
- /** Use this method to edit captions of messages. On success, if the edited message is not an inline message, the edited Message is returned, otherwise True is returned. */
1384
+ /** Use this method to edit captions of messages. 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. */
1375
1385
  editMessageCaption(args: {
1386
+ /** Unique identifier of the business connection on behalf of which the message to be edited was sent */
1387
+ business_connection_id?: string;
1376
1388
  /** Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername) */
1377
1389
  chat_id?: number | string;
1378
1390
  /** Required if inline_message_id is not specified. Identifier of the message to edit */
@@ -1391,8 +1403,10 @@ export type ApiMethods = {
1391
1403
  reply_markup?: InlineKeyboardMarkup;
1392
1404
  }): (Update.Edited & Message.CaptionableMessage) | true;
1393
1405
 
1394
- /** 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. */
1406
+ /** 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. */
1395
1407
  editMessageMedia(args: {
1408
+ /** Unique identifier of the business connection on behalf of which the message to be edited was sent */
1409
+ business_connection_id?: string;
1396
1410
  /** Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername) */
1397
1411
  chat_id?: number | string;
1398
1412
  /** Required if inline_message_id is not specified. Identifier of the message to edit */
@@ -1405,8 +1419,10 @@ export type ApiMethods = {
1405
1419
  reply_markup?: InlineKeyboardMarkup;
1406
1420
  }): (Update.Edited & Message) | true;
1407
1421
 
1408
- /** Use this method to edit only the reply markup of messages. On success, if the edited message is not an inline message, the edited Message is returned, otherwise True is returned. */
1422
+ /** Use this method to edit only the reply markup of messages. 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. */
1409
1423
  editMessageReplyMarkup(args: {
1424
+ /** Unique identifier of the business connection on behalf of which the message to be edited was sent */
1425
+ business_connection_id?: string;
1410
1426
  /** Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername) */
1411
1427
  chat_id?: number | string;
1412
1428
  /** Required if inline_message_id is not specified. Identifier of the message to edit */
@@ -1419,6 +1435,8 @@ export type ApiMethods = {
1419
1435
 
1420
1436
  /** Use this method to stop a poll which was sent by the bot. On success, the stopped Poll is returned. */
1421
1437
  stopPoll(args: {
1438
+ /** Unique identifier of the business connection on behalf of which the message to be edited was sent */
1439
+ business_connection_id?: string;
1422
1440
  /** Unique identifier for the target chat or username of the target channel (in the format @channelusername) */
1423
1441
  chat_id: number | string;
1424
1442
  /** Identifier of the original message with the poll */
@@ -1468,7 +1486,7 @@ export type ApiMethods = {
1468
1486
  disable_notification?: boolean;
1469
1487
  /** Protects the contents of the sent message from forwarding and saving */
1470
1488
  protect_content?: boolean;
1471
- /** Unique identifier of the message effect to be added to the message */
1489
+ /** Unique identifier of the message effect to be added to the message; for private chats only */
1472
1490
  message_effect_id?: string;
1473
1491
  /** Description of the message to reply to */
1474
1492
  reply_parameters?: ReplyParameters;
@@ -1693,7 +1711,7 @@ export type ApiMethods = {
1693
1711
  disable_notification?: boolean;
1694
1712
  /** Protects the contents of the sent message from forwarding and saving */
1695
1713
  protect_content?: boolean;
1696
- /** Unique identifier of the message effect to be added to the message */
1714
+ /** Unique identifier of the message effect to be added to the message; for private chats only */
1697
1715
  message_effect_id?: string;
1698
1716
  /** Description of the message to reply to */
1699
1717
  reply_parameters?: ReplyParameters;
@@ -1777,6 +1795,14 @@ export type ApiMethods = {
1777
1795
  telegram_payment_charge_id: string;
1778
1796
  }): true;
1779
1797
 
1798
+ /** Returns the bot's Telegram Star transactions in chronological order. On success, returns a StarTransactions object. */
1799
+ getStarTransactions(args: {
1800
+ /** Number of transactions to skip in the response */
1801
+ offset?: number;
1802
+ /** The maximum number of transactions to be retrieved. Values between 1-100 are accepted. Defaults to 100. */
1803
+ limit?: number;
1804
+ }): StarTransactions;
1805
+
1780
1806
  /** 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.
1781
1807
 
1782
1808
  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. */
@@ -1801,7 +1827,7 @@ export type ApiMethods = {
1801
1827
  disable_notification?: boolean;
1802
1828
  /** Protects the contents of the sent message from forwarding and saving */
1803
1829
  protect_content?: boolean;
1804
- /** Unique identifier of the message effect to be added to the message */
1830
+ /** Unique identifier of the message effect to be added to the message; for private chats only */
1805
1831
  message_effect_id?: string;
1806
1832
  /** Description of the message to reply to */
1807
1833
  reply_parameters?: ReplyParameters;
@@ -143,3 +143,85 @@ export interface PreCheckoutQuery {
143
143
  /** The order information provided by the user. */
144
144
  order_info?: OrderInfo;
145
145
  }
146
+
147
+ /** This object describes the state of a revenue withdrawal operation. Currently, it can be one of
148
+ - RevenueWithdrawalStatePending
149
+ - RevenueWithdrawalStateSucceeded
150
+ - RevenueWithdrawalStateFailed */
151
+ export type RevenueWithdrawalState =
152
+ | RevenueWithdrawalStatePending
153
+ | RevenueWithdrawalStateSucceeded
154
+ | RevenueWithdrawalStateFailed;
155
+
156
+ /** The withdrawal is in progress. */
157
+ export interface RevenueWithdrawalStatePending {
158
+ /** Type of the state, always “pending” */
159
+ type: "pending";
160
+ }
161
+
162
+ /** The withdrawal succeeded. */
163
+ export interface RevenueWithdrawalStateSucceeded {
164
+ /** Type of the state, always “succeeded” */
165
+ type: "succeeded";
166
+ /** Date the withdrawal was completed in Unix time */
167
+ date: number;
168
+ /** An HTTPS URL that can be used to see transaction details */
169
+ url: string;
170
+ }
171
+
172
+ /** The withdrawal failed and the transaction was refunded. */
173
+ export interface RevenueWithdrawalStateFailed {
174
+ /** Type of the state, always “failed” */
175
+ type: "failed";
176
+ }
177
+
178
+ /** This object describes the source of a transaction, or its recipient for outgoing transactions. Currently, it can be one of
179
+ - TransactionPartnerFragment
180
+ - TransactionPartnerUser
181
+ - TransactionPartnerOther */
182
+ export type TransactionPartner =
183
+ | TransactionPartnerFragment
184
+ | TransactionPartnerUser
185
+ | TransactionPartnerOther;
186
+
187
+ /** Describes a withdrawal transaction with Fragment. */
188
+ export interface TransactionPartnerFragment {
189
+ /** Type of the transaction partner, always “fragment” */
190
+ type: "fragment";
191
+ /** State of the transaction if the transaction is outgoing */
192
+ withdrawal_state?: RevenueWithdrawalState;
193
+ }
194
+
195
+ /** Describes a transaction with a user. */
196
+ export interface TransactionPartnerUser {
197
+ /** Type of the transaction partner, always “user” */
198
+ type: "user";
199
+ /** Information about the user */
200
+ user: User;
201
+ }
202
+
203
+ /** Describes a transaction with an unknown source or recipient. */
204
+ export interface TransactionPartnerOther {
205
+ /** Type of the transaction partner, always “other” */
206
+ type: "other";
207
+ }
208
+
209
+ /** Describes a Telegram Star transaction. */
210
+ export interface StarTransaction {
211
+ /** 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. */
212
+ id: string;
213
+ /** Number of Telegram Stars transferred by the transaction */
214
+ amount: number;
215
+ /** Date the transaction was created in Unix time */
216
+ date: number;
217
+ /** Source of an incoming transaction (e.g., a user purchasing goods or services, Fragment refunding a failed withdrawal). Only for incoming transactions */
218
+ source?: TransactionPartner;
219
+ /** Receiver of an outgoing transaction (e.g., a user for a purchase refund, Fragment for a withdrawal). Only for outgoing transactions */
220
+ receiver?: TransactionPartner;
221
+ }
222
+
223
+ /** Contains a list of Telegram Star transactions. */
224
+ export interface StarTransactions {
225
+ /** The list of transactions */
226
+ transactions: StarTransaction[];
227
+ }
@@ -17,7 +17,7 @@ export declare namespace InlineKeyboardButton {
17
17
  url: string;
18
18
  }
19
19
  export interface CallbackButton extends AbstractInlineKeyboardButton {
20
- /** Data to be sent in a callback query to the bot when button is pressed, 1-64 bytes. Not supported for messages sent on behalf of a Telegram Business account. */
20
+ /** Data to be sent in a callback query to the bot when the button is pressed, 1-64 bytes. */
21
21
  callback_data: string;
22
22
  }
23
23
  export interface WebAppButton extends AbstractInlineKeyboardButton {