@tgify/types 9.2.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 ADDED
@@ -0,0 +1,36 @@
1
+ {
2
+ "name": "@tgify/types",
3
+ "private": false,
4
+ "version": "9.2.0",
5
+ "description": "Type declarations for the Telegram API",
6
+ "main": "index.js",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/tgify/types.git"
10
+ },
11
+ "keywords": [
12
+ "telegram",
13
+ "tgify",
14
+ "bot",
15
+ "api",
16
+ "types",
17
+ "typings"
18
+ ],
19
+ "scripts": {
20
+ "prepare": "deno task backport"
21
+ },
22
+ "author": "IATNAOD",
23
+ "types": "index.d.ts",
24
+ "license": "MIT",
25
+ "bugs": {
26
+ "url": "https://github.com/tgify/types/issues"
27
+ },
28
+ "homepage": "https://github.com/tgify/types#readme",
29
+ "files": [
30
+ "*.d.ts",
31
+ "index.js"
32
+ ],
33
+ "devDependencies": {
34
+ "deno-bin": "^2.1.6"
35
+ }
36
+ }
package/passport.d.ts ADDED
@@ -0,0 +1,163 @@
1
+ /** Describes Telegram Passport data shared with the bot by the user. */
2
+ export interface PassportData {
3
+ /** Array with information about documents and other Telegram Passport elements that was shared with the bot */
4
+ data: EncryptedPassportElement[];
5
+ /** Encrypted credentials required to decrypt the data */
6
+ credentials: EncryptedCredentials;
7
+ }
8
+ /** This object represents a file uploaded to Telegram Passport. Currently all Telegram Passport files are in JPEG format when decrypted and don't exceed 10MB. */
9
+ export interface PassportFile {
10
+ /** Identifier for this file, which can be used to download or reuse the file */
11
+ file_id: string;
12
+ /** Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. */
13
+ file_unique_id: string;
14
+ /** File size in bytes */
15
+ file_size: number;
16
+ /** Unix time when the file was uploaded */
17
+ file_date: number;
18
+ }
19
+ /** Describes documents or other Telegram Passport elements shared with the bot by the user. */
20
+ export interface EncryptedPassportElement {
21
+ /** Element type. One of “personal_details”, “passport”, “driver_license”, “identity_card”, “internal_passport”, “address”, “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration”, “temporary_registration”, “phone_number”, “email”. */
22
+ type: "personal_details" | "passport" | "driver_license" | "identity_card" | "internal_passport" | "address" | "utility_bill" | "bank_statement" | "rental_agreement" | "passport_registration" | "temporary_registration" | "phone_number" | "email";
23
+ /** Base64-encoded encrypted Telegram Passport element data provided by the user; available only for “personal_details”, “passport”, “driver_license”, “identity_card”, “internal_passport” and “address” types. Can be decrypted and verified using the accompanying EncryptedCredentials. */
24
+ data?: string;
25
+ /** User's verified phone number; available only for “phone_number” type */
26
+ phone_number?: string;
27
+ /** User's verified email address; available only for “email” type */
28
+ email?: string;
29
+ /** Array of encrypted files with documents provided by the user; available only for “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration” and “temporary_registration” types. Files can be decrypted and verified using the accompanying EncryptedCredentials. */
30
+ files?: PassportFile[];
31
+ /** Encrypted file with the front side of the document, provided by the user; available only for “passport”, “driver_license”, “identity_card” and “internal_passport”. The file can be decrypted and verified using the accompanying EncryptedCredentials. */
32
+ front_side?: PassportFile;
33
+ /** Encrypted file with the reverse side of the document, provided by the user; available only for “driver_license” and “identity_card”. The file can be decrypted and verified using the accompanying EncryptedCredentials. */
34
+ reverse_side?: PassportFile;
35
+ /** Encrypted file with the selfie of the user holding a document, provided by the user; available if requested for “passport”, “driver_license”, “identity_card” and “internal_passport”. The file can be decrypted and verified using the accompanying EncryptedCredentials. */
36
+ selfie?: PassportFile;
37
+ /** Array of encrypted files with translated versions of documents provided by the user; available if requested for “passport”, “driver_license”, “identity_card”, “internal_passport”, “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration” and “temporary_registration” types. Files can be decrypted and verified using the accompanying EncryptedCredentials. */
38
+ translation?: PassportFile[];
39
+ /** Base64-encoded element hash for using in PassportElementErrorUnspecified */
40
+ hash: string;
41
+ }
42
+ /** Describes data required for decrypting and authenticating EncryptedPassportElement. See the Telegram Passport Documentation for a complete description of the data decryption and authentication processes. */
43
+ export interface EncryptedCredentials {
44
+ /** Base64-encoded encrypted JSON-serialized data with unique user's payload, data hashes and secrets required for EncryptedPassportElement decryption and authentication */
45
+ data: string;
46
+ /** Base64-encoded data hash for data authentication */
47
+ hash: string;
48
+ /** Base64-encoded secret, encrypted with the bot's public RSA key, required for data decryption */
49
+ secret: string;
50
+ }
51
+ /** This object represents an error in the Telegram Passport element which was submitted that should be resolved by the user. It should be one of:
52
+ - PassportElementErrorDataField
53
+ - PassportElementErrorFrontSide
54
+ - PassportElementErrorReverseSide
55
+ - PassportElementErrorSelfie
56
+ - PassportElementErrorFile
57
+ - PassportElementErrorFiles
58
+ - PassportElementErrorTranslationFile
59
+ - PassportElementErrorTranslationFiles
60
+ - PassportElementErrorUnspecified
61
+ */
62
+ export type PassportElementError = PassportElementErrorDataField | PassportElementErrorFrontSide | PassportElementErrorReverseSide | PassportElementErrorSelfie | PassportElementErrorFile | PassportElementErrorFiles | PassportElementErrorTranslationFile | PassportElementErrorTranslationFiles | PassportElementErrorUnspecified;
63
+ /** Represents an issue in one of the data fields that was provided by the user. The error is considered resolved when the field's value changes. */
64
+ export interface PassportElementErrorDataField {
65
+ /** Error source, must be data */
66
+ source: "data";
67
+ /** The section of the user's Telegram Passport which has the error, one of “personal_details”, “passport”, “driver_license”, “identity_card”, “internal_passport”, “address” */
68
+ type: "personal_details" | "passport" | "driver_license" | "identity_card" | "internal_passport" | "address";
69
+ /** Name of the data field which has the error */
70
+ field_name: string;
71
+ /** Base64-encoded data hash */
72
+ data_hash: string;
73
+ /** Error message */
74
+ message: string;
75
+ }
76
+ /** Represents an issue with the front side of a document. The error is considered resolved when the file with the front side of the document changes. */
77
+ export interface PassportElementErrorFrontSide {
78
+ /** Error source, must be front_side */
79
+ source: "front_side";
80
+ /** The section of the user's Telegram Passport which has the issue, one of “passport”, “driver_license”, “identity_card”, “internal_passport” */
81
+ type: "passport" | "driver_license" | "identity_card" | "internal_passport";
82
+ /** Base64-encoded hash of the file with the front side of the document */
83
+ file_hash: string;
84
+ /** Error message */
85
+ message: string;
86
+ }
87
+ /** Represents an issue with the reverse side of a document. The error is considered resolved when the file with reverse side of the document changes. */
88
+ export interface PassportElementErrorReverseSide {
89
+ /** Error source, must be reverse_side */
90
+ source: "reverse_side";
91
+ /** The section of the user's Telegram Passport which has the issue, one of “driver_license”, “identity_card” */
92
+ type: "driver_license" | "identity_card";
93
+ /** Base64-encoded hash of the file with the reverse side of the document */
94
+ file_hash: string;
95
+ /** Error message */
96
+ message: string;
97
+ }
98
+ /** Represents an issue with the selfie with a document. The error is considered resolved when the file with the selfie changes. */
99
+ export interface PassportElementErrorSelfie {
100
+ /** Error source, must be selfie */
101
+ source: "selfie";
102
+ /** The section of the user's Telegram Passport which has the issue, one of “passport”, “driver_license”, “identity_card”, “internal_passport” */
103
+ type: "passport" | "driver_license" | "identity_card" | "internal_passport";
104
+ /** Base64-encoded hash of the file with the selfie */
105
+ file_hash: string;
106
+ /** Error message */
107
+ message: string;
108
+ }
109
+ /** Represents an issue with a document scan. The error is considered resolved when the file with the document scan changes. */
110
+ export interface PassportElementErrorFile {
111
+ /** Error source, must be file */
112
+ source: "file";
113
+ /** The section of the user's Telegram Passport which has the issue, one of “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration”, “temporary_registration” */
114
+ type: "utility_bill" | "bank_statement" | "rental_agreement" | "passport_registration" | "temporary_registration";
115
+ /** Base64-encoded file hash */
116
+ file_hash: string;
117
+ /** Error message */
118
+ message: string;
119
+ }
120
+ /** Represents an issue with a list of scans. The error is considered resolved when the list of files containing the scans changes. */
121
+ export interface PassportElementErrorFiles {
122
+ /** Error source, must be files */
123
+ source: "files";
124
+ /** The section of the user's Telegram Passport which has the issue, one of “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration”, “temporary_registration” */
125
+ type: "utility_bill" | "bank_statement" | "rental_agreement" | "passport_registration" | "temporary_registration";
126
+ /** List of base64-encoded file hashes */
127
+ file_hashes: string[];
128
+ /** Error message */
129
+ message: string;
130
+ }
131
+ /** Represents an issue with one of the files that constitute the translation of a document. The error is considered resolved when the file changes. */
132
+ export interface PassportElementErrorTranslationFile {
133
+ /** Error source, must be translation_file */
134
+ source: "translation_file";
135
+ /** Type of element of the user's Telegram Passport which has the issue, one of “passport”, “driver_license”, “identity_card”, “internal_passport”, “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration”, “temporary_registration” */
136
+ type: "passport" | "driver_license" | "identity_card" | "internal_passport" | "utility_bill" | "bank_statement" | "rental_agreement" | "passport_registration" | "temporary_registration";
137
+ /** Base64-encoded file hash */
138
+ file_hash: string;
139
+ /** Error message */
140
+ message: string;
141
+ }
142
+ /** Represents an issue with the translated version of a document. The error is considered resolved when a file with the document translation change. */
143
+ export interface PassportElementErrorTranslationFiles {
144
+ /** Error source, must be translation_files */
145
+ source: "translation_files";
146
+ /** Type of element of the user's Telegram Passport which has the issue, one of “passport”, “driver_license”, “identity_card”, “internal_passport”, “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration”, “temporary_registration” */
147
+ type: "passport" | "driver_license" | "identity_card" | "internal_passport" | "utility_bill" | "bank_statement" | "rental_agreement" | "passport_registration" | "temporary_registration";
148
+ /** List of base64-encoded file hashes */
149
+ file_hashes: string[];
150
+ /** Error message */
151
+ message: string;
152
+ }
153
+ /** Represents an issue in an unspecified place. The error is considered resolved when new data is added. */
154
+ export interface PassportElementErrorUnspecified {
155
+ /** Error source, must be unspecified */
156
+ source: "unspecified";
157
+ /** Type of element of the user's Telegram Passport which has the issue */
158
+ type: string;
159
+ /** Base64-encoded element hash */
160
+ element_hash: string;
161
+ /** Error message */
162
+ message: string;
163
+ }
package/payment.d.ts ADDED
@@ -0,0 +1,281 @@
1
+ import type { Chat, Gift, User } from "./manage.js";
2
+ import { PaidMedia } from "./message.js";
3
+ /** This object represents a portion of the price for goods or services. */
4
+ export interface LabeledPrice {
5
+ /** Portion label */
6
+ label: string;
7
+ /** Price of the product in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45 pass 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). */
8
+ amount: number;
9
+ }
10
+ /** This object contains basic information about an invoice. */
11
+ export interface Invoice {
12
+ /** Product name */
13
+ title: string;
14
+ /** Product description */
15
+ description: string;
16
+ /** Unique bot deep-linking parameter that can be used to generate this invoice */
17
+ start_parameter: string;
18
+ /** Three-letter ISO 4217 currency code, or “XTR” for payments in Telegram Stars */
19
+ currency: string;
20
+ /** Total price in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45 pass 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). */
21
+ total_amount: number;
22
+ }
23
+ /** This object represents a shipping address. */
24
+ export interface ShippingAddress {
25
+ /** Two-letter ISO 3166-1 alpha-2 country code */
26
+ country_code: string;
27
+ /** State, if applicable */
28
+ state: string;
29
+ /** City */
30
+ city: string;
31
+ /** First line for the address */
32
+ street_line1: string;
33
+ /** Second line for the address */
34
+ street_line2: string;
35
+ /** Address post code */
36
+ post_code: string;
37
+ }
38
+ /** This object represents information about an order. */
39
+ export interface OrderInfo {
40
+ /** User name */
41
+ name?: string;
42
+ /** User's phone number */
43
+ phone_number?: string;
44
+ /** User email */
45
+ email?: string;
46
+ /** User shipping address */
47
+ shipping_address?: ShippingAddress;
48
+ }
49
+ /** This object represents one shipping option. */
50
+ export interface ShippingOption {
51
+ /** Shipping option identifier */
52
+ id: string;
53
+ /** Option title */
54
+ title: string;
55
+ /** List of price portions */
56
+ prices: LabeledPrice[];
57
+ }
58
+ /** 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. */
59
+ export interface SuccessfulPayment {
60
+ /** Three-letter ISO 4217 currency code, or “XTR” for payments in Telegram Stars */
61
+ currency: string;
62
+ /** Total price in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45 pass 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). */
63
+ total_amount: number;
64
+ /** Bot specified invoice payload */
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?: boolean;
70
+ /** True, if the payment is the first payment for a subscription */
71
+ is_first_recurring?: boolean;
72
+ /** Identifier of the shipping option chosen by the user */
73
+ shipping_option_id?: string;
74
+ /** Order information provided by the user */
75
+ order_info?: OrderInfo;
76
+ /** Telegram payment identifier */
77
+ telegram_payment_charge_id: string;
78
+ /** Provider payment identifier */
79
+ provider_payment_charge_id: string;
80
+ }
81
+ /** This object contains basic information about a refunded payment. */
82
+ export interface RefundedPayment {
83
+ /** Three-letter ISO 4217 currency code, or “XTR” for payments in Telegram Stars. Currently, always “XTR” */
84
+ currency: "XTR";
85
+ /** Total refunded price in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45, total_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). */
86
+ total_amount: number;
87
+ /** Bot-specified invoice payload */
88
+ invoice_payload: string;
89
+ /** Telegram payment identifier */
90
+ telegram_payment_charge_id: string;
91
+ /** Provider payment identifier */
92
+ provider_payment_charge_id?: string;
93
+ }
94
+ /** This object contains information about an incoming shipping query. */
95
+ export interface ShippingQuery {
96
+ /** Unique query identifier */
97
+ id: string;
98
+ /** User who sent the query */
99
+ from: User;
100
+ /** Bot-specified invoice payload */
101
+ invoice_payload: string;
102
+ /** User specified shipping address */
103
+ shipping_address: ShippingAddress;
104
+ }
105
+ /** This object contains information about an incoming pre-checkout query. */
106
+ export interface PreCheckoutQuery {
107
+ /** Unique query identifier */
108
+ id: string;
109
+ /** User who sent the query */
110
+ from: User;
111
+ /** Three-letter ISO 4217 currency code, or “XTR” for payments in Telegram Stars */
112
+ currency: string;
113
+ /** Total price in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45 pass 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). */
114
+ total_amount: number;
115
+ /** Bot-specified invoice payload */
116
+ invoice_payload: string;
117
+ /** Identifier of the shipping option chosen by the user */
118
+ shipping_option_id?: string;
119
+ /** Order information provided by the user */
120
+ order_info?: OrderInfo;
121
+ }
122
+ /** This object contains information about a paid media purchase. */
123
+ export interface PaidMediaPurchased {
124
+ /** User who purchased the media */
125
+ from: User;
126
+ /** Bot-specified paid media payload */
127
+ paid_media_payload: string;
128
+ }
129
+ /** This object describes the state of a revenue withdrawal operation. Currently, it can be one of
130
+
131
+ - RevenueWithdrawalStatePending
132
+ - RevenueWithdrawalStateSucceeded
133
+ - RevenueWithdrawalStateFailed */
134
+ export type RevenueWithdrawalState = RevenueWithdrawalStatePending | RevenueWithdrawalStateSucceeded | RevenueWithdrawalStateFailed;
135
+ /** The withdrawal is in progress. */
136
+ export interface RevenueWithdrawalStatePending {
137
+ /** Type of the state, always “pending” */
138
+ type: "pending";
139
+ }
140
+ /** The withdrawal succeeded. */
141
+ export interface RevenueWithdrawalStateSucceeded {
142
+ /** Type of the state, always “succeeded” */
143
+ type: "succeeded";
144
+ /** Date the withdrawal was completed in Unix time */
145
+ date: number;
146
+ /** An HTTPS URL that can be used to see transaction details */
147
+ url: string;
148
+ }
149
+ /** The withdrawal failed and the transaction was refunded. */
150
+ export interface RevenueWithdrawalStateFailed {
151
+ /** Type of the state, always “failed” */
152
+ type: "failed";
153
+ }
154
+ /** Contains information about the affiliate that received a commission via this transaction. */
155
+ export interface AffiliateInfo {
156
+ /** The bot or the user that received an affiliate commission if it was received by a bot or a user */
157
+ affiliate_user?: User;
158
+ /** The chat that received an affiliate commission if it was received by a chat */
159
+ affiliate_chat?: Chat;
160
+ /** The number of Telegram Stars received by the affiliate for each 1000 Telegram Stars received by the bot from referred users */
161
+ commission_per_mille: number;
162
+ /** Integer amount of Telegram Stars received by the affiliate from the transaction, rounded to 0; can be negative for refunds */
163
+ amount: number;
164
+ /** The number of 1/1000000000 shares of Telegram Stars received by the affiliate; from -999999999 to 999999999; can be negative for refunds */
165
+ nanostar_amount?: number;
166
+ }
167
+ /** This object describes the source of a transaction, or its recipient for outgoing transactions. Currently, it can be one of
168
+
169
+ - TransactionPartnerUser
170
+ - TransactionPartnerChat
171
+ - TransactionPartnerAffiliateProgram
172
+ - TransactionPartnerFragment
173
+ - TransactionPartnerTelegramAds
174
+ - TransactionPartnerTelegramApi
175
+ - TransactionPartnerOther */
176
+ export type TransactionPartner = TransactionPartnerUser | TransactionPartnerChat | TransactionPartnerAffiliateProgram | TransactionPartnerFragment | TransactionPartnerTelegramAds | TransactionPartnerTelegramApi | TransactionPartnerOther;
177
+ export declare namespace TransactionPartnerUser {
178
+ interface Abstract {
179
+ /** Type of the transaction partner, always “user” */
180
+ type: "user";
181
+ /** Type of the transaction, currently one of “invoice_payment” for payments via invoices, “paid_media_payment” for payments for paid media, “gift_purchase” for gifts sent by the bot, “premium_purchase” for Telegram Premium subscriptions gifted by the bot, “business_account_transfer” for direct transfers from managed business accounts */
182
+ transaction_type: "invoice_payment" | "paid_media_payment" | "gift_purchase" | "premium_purchase" | "business_account_transfer";
183
+ /** Information about the user */
184
+ user: User;
185
+ }
186
+ interface InvoicePayment extends Abstract {
187
+ transaction_type: "invoice_payment";
188
+ /** Information about the affiliate that received a commission via this transaction. Can be available only for “invoice_payment” and “paid_media_payment” transactions. */
189
+ affiliate?: AffiliateInfo;
190
+ /** Bot-specified invoice payload. Can be available only for “invoice_payment” transactions. */
191
+ invoice_payload?: string;
192
+ /** The duration of the paid subscription. Can be available only for “invoice_payment” transactions. */
193
+ subscription_period?: number;
194
+ }
195
+ interface PaidMediaPayment extends Abstract {
196
+ transaction_type: "paid_media_payment";
197
+ /** Information about the affiliate that received a commission via this transaction. Can be available only for “invoice_payment” and “paid_media_payment” transactions. */
198
+ affiliate?: AffiliateInfo;
199
+ /** Information about the paid media bought by the user; for “paid_media_payment” transactions only */
200
+ paid_media?: PaidMedia[];
201
+ /** Bot-specified paid media payload. Can be available only for “paid_media_payment” transactions. */
202
+ paid_media_payload?: string;
203
+ }
204
+ interface GiftPurchase extends Abstract {
205
+ transaction_type: "gift_purchase";
206
+ /** The gift sent to the user by the bot; for “gift_purchase” transactions only */
207
+ gift?: Gift;
208
+ }
209
+ interface PremiumPurchase extends Abstract {
210
+ transaction_type: "premium_purchase";
211
+ /** Number of months the gifted Telegram Premium subscription will be active for; for “premium_purchase” transactions only */
212
+ premium_subscription_duration?: number;
213
+ }
214
+ interface BusinessAccountTransfer extends Abstract {
215
+ transaction_type: "business_account_transfer";
216
+ }
217
+ }
218
+ /** Describes a transaction with a user. */
219
+ export type TransactionPartnerUser = TransactionPartnerUser.InvoicePayment | TransactionPartnerUser.PaidMediaPayment | TransactionPartnerUser.GiftPurchase | TransactionPartnerUser.PremiumPurchase | TransactionPartnerUser.BusinessAccountTransfer;
220
+ /** Describes a transaction with a chat. */
221
+ export interface TransactionPartnerChat {
222
+ /** Type of the transaction partner, always “chat” */
223
+ type: "chat";
224
+ /** Information about the chat */
225
+ chat: Chat;
226
+ /** The gift sent to the chat by the bot */
227
+ gift?: Gift;
228
+ }
229
+ /** Describes the affiliate program that issued the affiliate commission received via this transaction. */
230
+ export interface TransactionPartnerAffiliateProgram {
231
+ /** Type of the transaction partner, always “affiliate_program” */
232
+ type: "affiliate_program";
233
+ /** Information about the bot that sponsored the affiliate program */
234
+ sponsor_user?: User;
235
+ /** The number of Telegram Stars received by the bot for each 1000 Telegram Stars received by the affiliate program sponsor from referred users */
236
+ commission_per_mille: number;
237
+ }
238
+ /** Describes a withdrawal transaction with Fragment. */
239
+ export interface TransactionPartnerFragment {
240
+ /** Type of the transaction partner, always “fragment” */
241
+ type: "fragment";
242
+ /** State of the transaction if the transaction is outgoing */
243
+ withdrawal_state?: RevenueWithdrawalState;
244
+ }
245
+ /** Describes a withdrawal transaction to the Telegram Ads platform. */
246
+ export interface TransactionPartnerTelegramAds {
247
+ /** Type of the transaction partner, always “telegram_ads” */
248
+ type: "telegram_ads";
249
+ }
250
+ /** Describes a transaction with payment for paid broadcasting. */
251
+ export interface TransactionPartnerTelegramApi {
252
+ /** Type of the transaction partner, always “telegram_api” */
253
+ type: "telegram_api";
254
+ /** The number of successful requests that exceeded regular limits and were therefore billed */
255
+ request_count: number;
256
+ }
257
+ /** Describes a transaction with an unknown source or recipient. */
258
+ export interface TransactionPartnerOther {
259
+ /** Type of the transaction partner, always “other” */
260
+ type: "other";
261
+ }
262
+ /** 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. */
263
+ export interface StarTransaction {
264
+ /** 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. */
265
+ id: string;
266
+ /** Integer amount of Telegram Stars transferred by the transaction */
267
+ amount: number;
268
+ /** The number of 1/1000000000 shares of Telegram Stars transferred by the transaction; from 0 to 999999999 */
269
+ nanostar_amount?: number;
270
+ /** Date the transaction was created in Unix time */
271
+ date: number;
272
+ /** Source of an incoming transaction (e.g., a user purchasing goods or services, Fragment refunding a failed withdrawal). Only for incoming transactions */
273
+ source?: TransactionPartner;
274
+ /** Receiver of an outgoing transaction (e.g., a user for a purchase refund, Fragment for a withdrawal). Only for outgoing transactions */
275
+ receiver?: TransactionPartner;
276
+ }
277
+ /** Contains a list of Telegram Star transactions. */
278
+ export interface StarTransactions {
279
+ /** The list of transactions */
280
+ transactions: StarTransaction[];
281
+ }
package/settings.d.ts ADDED
@@ -0,0 +1,120 @@
1
+ import type { WebAppInfo } from "./markup.js";
2
+ /** This object represents the bot's name. */
3
+ export interface BotName {
4
+ /** The bot's name */
5
+ name: string;
6
+ }
7
+ /** This object represents the bot's description. */
8
+ export interface BotDescription {
9
+ /** The bot's description */
10
+ description: string;
11
+ }
12
+ /** This object represents the bot's short description. */
13
+ export interface BotShortDescription {
14
+ /** The bot's short description */
15
+ short_description: string;
16
+ }
17
+ /** This object describes the bot's menu button in a private chat. It should be one of
18
+ - MenuButtonCommands
19
+ - MenuButtonWebApp
20
+ - MenuButtonDefault
21
+
22
+ If a menu button other than MenuButtonDefault is set for a private chat, then it is applied in the chat. Otherwise the default menu button is applied. By default, the menu button opens the list of bot commands. */
23
+ export type MenuButton = MenuButtonCommands | MenuButtonWebApp | MenuButtonDefault;
24
+ /** Represents a menu button, which opens the bot's list of commands. */
25
+ export interface MenuButtonCommands {
26
+ /** Type of the button, must be commands */
27
+ type: "commands";
28
+ }
29
+ /** Represents a menu button, which launches a Web App. */
30
+ export interface MenuButtonWebApp {
31
+ /** Button type, must be web_app */
32
+ type: "web_app";
33
+ /** Text on the button */
34
+ text: string;
35
+ /** Description of the Web App that will be launched when the user presses the button. The Web App will be able to send an arbitrary message on behalf of the user using the method answerWebAppQuery. Alternatively, a t.me link to a Web App of the bot can be specified in the object instead of the Web App's URL, in which case the Web App will be opened as if the user pressed the link. */
36
+ web_app: WebAppInfo;
37
+ }
38
+ /** Describes that no specific value for the menu button was set. */
39
+ export interface MenuButtonDefault {
40
+ /** Type of the button, must be default */
41
+ type: "default";
42
+ }
43
+ /** This object represents the scope to which bot commands are applied. Currently, the following 7 scopes are supported:
44
+ - BotCommandScopeDefault
45
+ - BotCommandScopeAllPrivateChats
46
+ - BotCommandScopeAllGroupChats
47
+ - BotCommandScopeAllChatAdministrators
48
+ - BotCommandScopeChat
49
+ - BotCommandScopeChatAdministrators
50
+ - BotCommandScopeChatMember
51
+
52
+ ## Determining list of commands
53
+
54
+ The following algorithm is used to determine the list of commands for a particular user viewing the bot menu. The first list of commands which is set is returned:
55
+
56
+ ### Commands in the chat with the bot
57
+ - botCommandScopeChat + language_code
58
+ - botCommandScopeChat
59
+ - botCommandScopeAllPrivateChats + language_code
60
+ - botCommandScopeAllPrivateChats
61
+ - botCommandScopeDefault + language_code
62
+ - botCommandScopeDefault
63
+
64
+ ### Commands in group and supergroup chats
65
+ - botCommandScopeChatMember + language_code
66
+ - botCommandScopeChatMember
67
+ - botCommandScopeChatAdministrators + language_code (administrators only)
68
+ - botCommandScopeChatAdministrators (administrators only)
69
+ - botCommandScopeChat + language_code
70
+ - botCommandScopeChat
71
+ - botCommandScopeAllChatAdministrators + language_code (administrators only)
72
+ - botCommandScopeAllChatAdministrators (administrators only)
73
+ - botCommandScopeAllGroupChats + language_code
74
+ - botCommandScopeAllGroupChats
75
+ - botCommandScopeDefault + language_code
76
+ - botCommandScopeDefault */
77
+ export type BotCommandScope = BotCommandScopeDefault | BotCommandScopeAllPrivateChats | BotCommandScopeAllGroupChats | BotCommandScopeAllChatAdministrators | BotCommandScopeChat | BotCommandScopeChatAdministrators | BotCommandScopeChatMember;
78
+ /** Represents the default scope of bot commands. Default commands are used if no commands with a narrower scope are specified for the user. */
79
+ export interface BotCommandScopeDefault {
80
+ /** Scope type, must be default */
81
+ type: "default";
82
+ }
83
+ /** Represents the scope of bot commands, covering all private chats. */
84
+ export interface BotCommandScopeAllPrivateChats {
85
+ /** Scope type, must be all_private_chats */
86
+ type: "all_private_chats";
87
+ }
88
+ /** Represents the scope of bot commands, covering all group and supergroup chats. */
89
+ export interface BotCommandScopeAllGroupChats {
90
+ /** Scope type, must be all_group_chats */
91
+ type: "all_group_chats";
92
+ }
93
+ /** Represents the scope of bot commands, covering all group and supergroup chat administrators. */
94
+ export interface BotCommandScopeAllChatAdministrators {
95
+ /** Scope type, must be all_chat_administrators */
96
+ type: "all_chat_administrators";
97
+ }
98
+ /** Represents the scope of bot commands, covering a specific chat. */
99
+ export interface BotCommandScopeChat {
100
+ /** Scope type, must be chat */
101
+ type: "chat";
102
+ /** Unique identifier for the target chat or username of the target supergroup (in the format `@supergroupusername`). Channel direct messages chats and channel chats aren't supported. */
103
+ chat_id: number | string;
104
+ }
105
+ /** Represents the scope of bot commands, covering all administrators of a specific group or supergroup chat. */
106
+ export interface BotCommandScopeChatAdministrators {
107
+ /** Scope type, must be chat_administrators */
108
+ type: "chat_administrators";
109
+ /** Unique identifier for the target chat or username of the target supergroup (in the format `@supergroupusername`). Channel direct messages chats and channel chats aren't supported. */
110
+ chat_id: number | string;
111
+ }
112
+ /** Represents the scope of bot commands, covering a specific member of a group or supergroup chat. */
113
+ export interface BotCommandScopeChatMember {
114
+ /** Scope type, must be chat_member */
115
+ type: "chat_member";
116
+ /** Unique identifier for the target chat or username of the target supergroup (in the format `@supergroupusername`). Channel direct messages chats and channel chats aren't supported. */
117
+ chat_id: number | string;
118
+ /** Unique identifier of the target user */
119
+ user_id: number;
120
+ }