@telegram.ts/types 1.0.1 → 1.3.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.
@@ -1,19 +1,8 @@
1
- import type {
2
- Chat,
3
- File,
4
- User
5
- } from "./manage.js";
6
- import type {
7
- InlineKeyboardMarkup
8
- } from "./markup.js";
9
- import type {
10
- PassportData
11
- } from "./passport.js";
12
- import type {
13
- Invoice,
14
- SuccessfulPayment
15
- } from "./payment.js";
16
- type MsgWith < P extends keyof Message > = Record < P, NonNullable < Message[P]>>;
1
+ import type { Chat, File, User } from "./manageTypes.js";
2
+ import type { InlineKeyboardMarkup } from "./markupTypes.js";
3
+ import type { PassportData } from "./passportTypes.js";
4
+ import type { Invoice, SuccessfulPayment } from "./invoiceTypes.js";
5
+ type MsgWith<P extends keyof Message> = Record<P, NonNullable<Message[P]>>;
17
6
  export declare namespace Message {
18
7
  interface ServiceMessage {
19
8
  /** Unique message identifier inside this chat */
@@ -71,52 +60,75 @@ export declare namespace Message {
71
60
  /** True, if the message media is covered by a spoiler animation */
72
61
  has_media_spoiler?: true;
73
62
  }
74
- export type TextMessage = CommonMessage & MsgWith < "text" >;
75
- export type AudioMessage = CaptionableMessage & MsgWith < "audio" >;
76
- export type DocumentMessage = CaptionableMessage & MsgWith < "document" >;
77
- export type AnimationMessage = DocumentMessage & MsgWith < "animation" >;
78
- export type PhotoMessage = MediaMessage & MsgWith < "photo" >;
79
- export type StickerMessage = CommonMessage & MsgWith < "sticker" >;
80
- export type VideoMessage = MediaMessage & MsgWith < "video" >;
81
- export type VideoNoteMessage = CommonMessage & MsgWith < "video_note" >;
82
- export type VoiceMessage = CaptionableMessage & MsgWith < "voice" >;
83
- export type ContactMessage = CommonMessage & MsgWith < "contact" >;
84
- export type DiceMessage = CommonMessage & MsgWith < "dice" >;
85
- export type GameMessage = CommonMessage & MsgWith < "game" >;
86
- export type PollMessage = CommonMessage & MsgWith < "poll" >;
87
- export type LocationMessage = CommonMessage & MsgWith < "location" >;
88
- export type VenueMessage = LocationMessage & MsgWith < "venue" >;
89
- export type NewChatMembersMessage = ServiceMessage & MsgWith < "new_chat_members" >;
90
- export type LeftChatMemberMessage = ServiceMessage & MsgWith < "left_chat_member" >;
91
- export type NewChatTitleMessage = ServiceMessage & MsgWith < "new_chat_title" >;
92
- export type NewChatPhotoMessage = ServiceMessage & MsgWith < "new_chat_photo" >;
93
- export type DeleteChatPhotoMessage = ServiceMessage & MsgWith < "delete_chat_photo" >;
94
- export type GroupChatCreatedMessage = ServiceMessage & MsgWith < "group_chat_created" >;
95
- export type SupergroupChatCreated = ServiceMessage & MsgWith < "supergroup_chat_created" >;
96
- export type ChannelChatCreatedMessage = ServiceMessage & MsgWith < "channel_chat_created" >;
97
- export type MessageAutoDeleteTimerChangedMessage = ServiceMessage & MsgWith < "message_auto_delete_timer_changed" >;
98
- export type MigrateToChatIdMessage = ServiceMessage & MsgWith < "migrate_to_chat_id" >;
99
- export type MigrateFromChatIdMessage = ServiceMessage & MsgWith < "migrate_from_chat_id" >;
100
- export type PinnedMessageMessage = ServiceMessage & MsgWith < "pinned_message" >;
101
- export type InvoiceMessage = ServiceMessage & MsgWith < "invoice" >;
102
- export type SuccessfulPaymentMessage = ServiceMessage & MsgWith < "successful_payment" >;
103
- export type UserSharedMessage = ServiceMessage & MsgWith < "user_shared" >;
104
- export type ChatSharedMessage = ServiceMessage & MsgWith < "chat_shared" >;
105
- export type ConnectedWebsiteMessage = ServiceMessage & MsgWith < "connected_website" >;
106
- export type WriteAccessAllowedMessage = ServiceMessage & MsgWith < "write_access_allowed" >;
107
- export type PassportDataMessage = ServiceMessage & MsgWith < "passport_data" >;
108
- export type ProximityAlertTriggeredMessage = ServiceMessage & MsgWith < "proximity_alert_triggered" >;
109
- export type ForumTopicCreatedMessage = ServiceMessage & MsgWith < "forum_topic_created" >;
110
- export type ForumTopicEditedMessage = ServiceMessage & MsgWith < "forum_topic_edited" >;
111
- export type ForumTopicClosedMessage = ServiceMessage & MsgWith < "forum_topic_closed" >;
112
- export type ForumTopicReopenedMessage = ServiceMessage & MsgWith < "forum_topic_reopened" >;
113
- export type GeneralForumTopicHiddenMessage = ServiceMessage & MsgWith < "general_forum_topic_hidden" >;
114
- export type GeneralForumTopicUnhiddenMessage = ServiceMessage & MsgWith < "general_forum_topic_unhidden" >;
115
- export type VideoChatScheduledMessage = ServiceMessage & MsgWith < "video_chat_scheduled" >;
116
- export type VideoChatStartedMessage = ServiceMessage & MsgWith < "video_chat_started" >;
117
- export type VideoChatEndedMessage = ServiceMessage & MsgWith < "video_chat_ended" >;
118
- export type VideoChatParticipantsInvitedMessage = ServiceMessage & MsgWith < "video_chat_participants_invited" >;
119
- export type WebAppDataMessage = ServiceMessage & MsgWith < "web_app_data" >;
63
+ export type TextMessage = CommonMessage & MsgWith<"text">;
64
+ export type AudioMessage = CaptionableMessage & MsgWith<"audio">;
65
+ export type DocumentMessage = CaptionableMessage & MsgWith<"document">;
66
+ export type AnimationMessage = DocumentMessage & MsgWith<"animation">;
67
+ export type PhotoMessage = MediaMessage & MsgWith<"photo">;
68
+ export type StickerMessage = CommonMessage & MsgWith<"sticker">;
69
+ export type VideoMessage = MediaMessage & MsgWith<"video">;
70
+ export type VideoNoteMessage = CommonMessage & MsgWith<"video_note">;
71
+ export type VoiceMessage = CaptionableMessage & MsgWith<"voice">;
72
+ export type ContactMessage = CommonMessage & MsgWith<"contact">;
73
+ export type DiceMessage = CommonMessage & MsgWith<"dice">;
74
+ export type GameMessage = CommonMessage & MsgWith<"game">;
75
+ export type PollMessage = CommonMessage & MsgWith<"poll">;
76
+ export type LocationMessage = CommonMessage & MsgWith<"location">;
77
+ export type VenueMessage = LocationMessage & MsgWith<"venue">;
78
+ export type NewChatMembersMessage = ServiceMessage &
79
+ MsgWith<"new_chat_members">;
80
+ export type LeftChatMemberMessage = ServiceMessage &
81
+ MsgWith<"left_chat_member">;
82
+ export type NewChatTitleMessage = ServiceMessage & MsgWith<"new_chat_title">;
83
+ export type NewChatPhotoMessage = ServiceMessage & MsgWith<"new_chat_photo">;
84
+ export type DeleteChatPhotoMessage = ServiceMessage &
85
+ MsgWith<"delete_chat_photo">;
86
+ export type GroupChatCreatedMessage = ServiceMessage &
87
+ MsgWith<"group_chat_created">;
88
+ export type SupergroupChatCreated = ServiceMessage &
89
+ MsgWith<"supergroup_chat_created">;
90
+ export type ChannelChatCreatedMessage = ServiceMessage &
91
+ MsgWith<"channel_chat_created">;
92
+ export type MessageAutoDeleteTimerChangedMessage = ServiceMessage &
93
+ MsgWith<"message_auto_delete_timer_changed">;
94
+ export type MigrateToChatIdMessage = ServiceMessage &
95
+ MsgWith<"migrate_to_chat_id">;
96
+ export type MigrateFromChatIdMessage = ServiceMessage &
97
+ MsgWith<"migrate_from_chat_id">;
98
+ export type PinnedMessageMessage = ServiceMessage & MsgWith<"pinned_message">;
99
+ export type InvoiceMessage = ServiceMessage & MsgWith<"invoice">;
100
+ export type SuccessfulPaymentMessage = ServiceMessage &
101
+ MsgWith<"successful_payment">;
102
+ export type UserSharedMessage = ServiceMessage & MsgWith<"user_shared">;
103
+ export type ChatSharedMessage = ServiceMessage & MsgWith<"chat_shared">;
104
+ export type ConnectedWebsiteMessage = ServiceMessage &
105
+ MsgWith<"connected_website">;
106
+ export type WriteAccessAllowedMessage = ServiceMessage &
107
+ MsgWith<"write_access_allowed">;
108
+ export type PassportDataMessage = ServiceMessage & MsgWith<"passport_data">;
109
+ export type ProximityAlertTriggeredMessage = ServiceMessage &
110
+ MsgWith<"proximity_alert_triggered">;
111
+ export type ForumTopicCreatedMessage = ServiceMessage &
112
+ MsgWith<"forum_topic_created">;
113
+ export type ForumTopicEditedMessage = ServiceMessage &
114
+ MsgWith<"forum_topic_edited">;
115
+ export type ForumTopicClosedMessage = ServiceMessage &
116
+ MsgWith<"forum_topic_closed">;
117
+ export type ForumTopicReopenedMessage = ServiceMessage &
118
+ MsgWith<"forum_topic_reopened">;
119
+ export type GeneralForumTopicHiddenMessage = ServiceMessage &
120
+ MsgWith<"general_forum_topic_hidden">;
121
+ export type GeneralForumTopicUnhiddenMessage = ServiceMessage &
122
+ MsgWith<"general_forum_topic_unhidden">;
123
+ export type VideoChatScheduledMessage = ServiceMessage &
124
+ MsgWith<"video_chat_scheduled">;
125
+ export type VideoChatStartedMessage = ServiceMessage &
126
+ MsgWith<"video_chat_started">;
127
+ export type VideoChatEndedMessage = ServiceMessage &
128
+ MsgWith<"video_chat_ended">;
129
+ export type VideoChatParticipantsInvitedMessage = ServiceMessage &
130
+ MsgWith<"video_chat_participants_invited">;
131
+ export type WebAppDataMessage = ServiceMessage & MsgWith<"web_app_data">;
120
132
  export {};
121
133
  }
122
134
  type ReplyMessage = Message & {
@@ -256,12 +268,12 @@ __underline__
256
268
  [inline mention of a user](tg://user?id=123456789)
257
269
  ![👍](tg://emoji?id=5368324170671202286)
258
270
  `inline fixed-width code`
259
- `​`​`
271
+ ```
260
272
  pre-formatted fixed-width code block
261
- `​`​`
262
- `​`​`python
273
+ ```
274
+ ```python
263
275
  pre-formatted fixed-width code block written in the Python programming language
264
- `​`​`
276
+ ```
265
277
  ```
266
278
  Please note:
267
279
 
@@ -334,7 +346,20 @@ export declare namespace MessageEntity {
334
346
  length: number;
335
347
  }
336
348
  export interface CommonMessageEntity extends AbstractMessageEntity {
337
- type: "mention" | "hashtag" | "cashtag" | "bot_command" | "url" | "email" | "phone_number" | "bold" | "italic" | "underline" | "strikethrough" | "spoiler" | "code";
349
+ type:
350
+ | "mention"
351
+ | "hashtag"
352
+ | "cashtag"
353
+ | "bot_command"
354
+ | "url"
355
+ | "email"
356
+ | "phone_number"
357
+ | "bold"
358
+ | "italic"
359
+ | "underline"
360
+ | "strikethrough"
361
+ | "spoiler"
362
+ | "code";
338
363
  }
339
364
  export interface PreMessageEntity extends AbstractMessageEntity {
340
365
  type: "pre";
@@ -359,7 +384,12 @@ export declare namespace MessageEntity {
359
384
  export {};
360
385
  }
361
386
  /** This object represents one special entity in a text message. For example, hashtags, usernames, URLs, etc. */
362
- export type MessageEntity = MessageEntity.CommonMessageEntity | MessageEntity.CustomEmojiMessageEntity | MessageEntity.PreMessageEntity | MessageEntity.TextLinkMessageEntity | MessageEntity.TextMentionMessageEntity;
387
+ export type MessageEntity =
388
+ | MessageEntity.CommonMessageEntity
389
+ | MessageEntity.CustomEmojiMessageEntity
390
+ | MessageEntity.PreMessageEntity
391
+ | MessageEntity.TextLinkMessageEntity
392
+ | MessageEntity.TextMentionMessageEntity;
363
393
  /** This object represents one size of a photo or a file / sticker thumbnail. */
364
394
  export interface PhotoSize {
365
395
  /** Identifier for this file, which can be used to download or reuse the file */
@@ -740,4 +770,4 @@ export interface GameHighScore {
740
770
  /** Score */
741
771
  score: number;
742
772
  }
743
- export {};
773
+ export {};
@@ -0,0 +1,257 @@
1
+ /** Describes the user's Telegram Passport data shared with the bot. */
2
+ export interface PassportData {
3
+ /** Array containing information about documents and other Telegram Passport elements shared with the bot. */
4
+ data: EncryptedPassportElement[];
5
+ /** Encrypted credentials required to decrypt the data. */
6
+ credentials: EncryptedCredentials;
7
+ }
8
+
9
+ /** This object represents a file uploaded to Telegram Passport. Currently, all Telegram Passport files are in JPEG format when decrypted and do not exceed 10MB. */
10
+ export interface PassportFile {
11
+ /** Identifier for this file, which can be used to download or reuse the file. */
12
+ file_id: string;
13
+ /** Unique identifier for this file, which remains the same over time and for different bots. This identifier cannot be used to download or reuse the file. */
14
+ file_unique_id: string;
15
+ /** File size in bytes. */
16
+ file_size: number;
17
+ /** Unix time when the file was uploaded. */
18
+ file_date: number;
19
+ }
20
+
21
+ /** Describes documents or other Telegram Passport elements shared with the bot by the user. */
22
+ export interface EncryptedPassportElement {
23
+ /** Element type. Possible values are "personal_details", "passport", "driver_license", "identity_card", "internal_passport", "address", "utility_bill", "bank_statement", "rental_agreement", "passport_registration", "temporary_registration", "phone_number", and "email". */
24
+ type:
25
+ | "personal_details"
26
+ | "passport"
27
+ | "driver_license"
28
+ | "identity_card"
29
+ | "internal_passport"
30
+ | "address"
31
+ | "utility_bill"
32
+ | "bank_statement"
33
+ | "rental_agreement"
34
+ | "passport_registration"
35
+ | "temporary_registration"
36
+ | "phone_number"
37
+ | "email";
38
+ /** Base64-encoded encrypted Telegram Passport element data provided by the user. This data is available for types "personal_details", "passport", "driver_license", "identity_card", "internal_passport", and "address". It can be decrypted and verified using the accompanying EncryptedCredentials. */
39
+ data?: string;
40
+ /** User's verified phone number, available only for type "phone_number". */
41
+ phone_number?: string;
42
+ /** User's verified email address, available only for type "email". */
43
+ email?: string;
44
+ /** Array of encrypted files with documents provided by the user. This array is available for types "utility_bill", "bank_statement", "rental_agreement", "passport_registration", and "temporary_registration". The files can be decrypted and verified using the accompanying EncryptedCredentials. */
45
+ files?: PassportFile[];
46
+ /** Encrypted file with the front side of the document, provided by the user. This file is available for types "passport", "driver_license", "identity_card", and "internal_passport". It can be decrypted and verified using the accompanying EncryptedCredentials. */
47
+ front_side?: PassportFile;
48
+ /** Encrypted file with the reverse side of the document, provided by the user. This file is available for types "driver_license" and "identity_card". It can be decrypted and verified using the accompanying EncryptedCredentials. */
49
+ reverse_side?: PassportFile;
50
+ /** Encrypted file with the selfie of the user holding a document, provided by the user. This file is available for types "passport", "driver_license", "identity_card", and "internal_passport". It can be decrypted and verified using the accompanying EncryptedCredentials. */
51
+ selfie?: PassportFile;
52
+ /** Array of encrypted files with translated versions of documents provided by the user. This array is available for types "passport", "driver_license", "identity_card", "internal_passport", "utility_bill", "bank_statement", "rental_agreement", "passport_registration", and "temporary_registration". The
53
+
54
+ files can be decrypted and verified using the accompanying EncryptedCredentials. */
55
+ translation?: PassportFile[];
56
+ /** Base64-encoded element hash for use in PassportElementErrorUnspecified. */
57
+ hash: string;
58
+ }
59
+
60
+ /** Describes data required for decrypting and authenticating EncryptedPassportElement. See the Telegram Passport Documentation for a complete description of the data decryption and authentication processes. */
61
+ export interface EncryptedCredentials {
62
+ /** Base64-encoded encrypted JSON-serialized data with the user's payload, data hashes, and secrets required for EncryptedPassportElement decryption and authentication. */
63
+ data: string;
64
+ /** Base64-encoded data hash for data authentication. */
65
+ hash: string;
66
+ /** Base64-encoded secret encrypted with the bot's public RSA key, required for data decryption. */
67
+ secret: string;
68
+ }
69
+
70
+ /** This object represents an error in the Telegram Passport element that was submitted and should be resolved by the user. It can be one of the following:
71
+ - PassportElementErrorDataField
72
+ - PassportElementErrorFrontSide
73
+ - PassportElementErrorReverseSide
74
+ - PassportElementErrorSelfie
75
+ - PassportElementErrorFile
76
+ - PassportElementErrorFiles
77
+ - PassportElementErrorTranslationFile
78
+ - PassportElementErrorTranslationFiles
79
+ - PassportElementErrorUnspecified
80
+ */
81
+ export type PassportElementError =
82
+ | PassportElementErrorDataField
83
+ | PassportElementErrorFrontSide
84
+ | PassportElementErrorReverseSide
85
+ | PassportElementErrorSelfie
86
+ | PassportElementErrorFile
87
+ | PassportElementErrorFiles
88
+ | PassportElementErrorTranslationFile
89
+ | PassportElementErrorTranslationFiles
90
+ | PassportElementErrorUnspecified;
91
+
92
+ /** Represents an issue in one of the data fields provided by the user. The error is considered resolved when the field's value changes. */
93
+ export interface PassportElementErrorDataField {
94
+ /** Error source, must be "data". */
95
+ source: "data";
96
+ /** The section of the user's Telegram Passport that has the error. Possible values are "personal_details", "passport", "driver_license", "identity_card", "internal_passport", and "address". */
97
+ type:
98
+ | "personal_details"
99
+ | "passport"
100
+ | "driver_license"
101
+ | "identity_card"
102
+ | "internal_passport"
103
+ | "address";
104
+ /** Name of the data field that has the error. */
105
+ field_name: string;
106
+ /** Base64-encoded data hash. */
107
+ data_hash: string;
108
+ /** Error message. */
109
+ message: string;
110
+ }
111
+
112
+ /** 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. */
113
+ export interface PassportElementErrorFrontSide {
114
+ /** Error source, must be "front_side". */
115
+ source: "front_side";
116
+ /** The section of the user's Telegram Passport that has the issue. Possible values are "passport", "driver_license", "identity_card", and "internal_passport". */
117
+ type: "passport" | "driver_license" | "identity_card" | "internal_passport";
118
+ /** Base64-encoded hash of the file with the front side of the document. */
119
+ file_hash: string;
120
+ /** Error message. */
121
+ message: string;
122
+ }
123
+
124
+ /** Represents an issue with the reverse side of a document. The error is considered resolved when the file with the reverse side of the document changes. */
125
+ export interface PassportElementErrorReverseSide {
126
+ /** Error source, must be "reverse_side". */
127
+ source: "reverse_side";
128
+ /** The section of the user's Telegram Passport that has the issue. Possible values are "driver_license" and "identity_card". */
129
+ type: "driver_license" | "identity_card";
130
+ /** Base64-encoded hash of the file with the reverse side
131
+
132
+ of the document. */
133
+ file_hash: string;
134
+ /** Error message. */
135
+ message: string;
136
+ }
137
+
138
+ /** Represents an issue with the selfie with a document. The error is considered resolved when the file with the selfie changes. */
139
+ export interface PassportElementErrorSelfie {
140
+ /** Error source, must be "selfie". */
141
+ source: "selfie";
142
+ /** The section of the user's Telegram Passport that has the issue. Possible values are "passport", "driver_license", "identity_card", and "internal_passport". */
143
+ type: "passport" | "driver_license" | "identity_card" | "internal_passport";
144
+ /** Base64-encoded hash of the file with the selfie. */
145
+ file_hash: string;
146
+ /** Error message. */
147
+ message: string;
148
+ }
149
+
150
+ /** Represents an issue with a document scan. The error is considered resolved when the file with the document scan changes. */
151
+ export interface PassportElementErrorFile {
152
+ /** Error source, must be "file". */
153
+ source: "file";
154
+ /** The section of the user's Telegram Passport that has the issue. Possible values are "utility_bill", "bank_statement", "rental_agreement", "passport_registration", and "temporary_registration". */
155
+ type:
156
+ | "utility_bill"
157
+ | "bank_statement"
158
+ | "rental_agreement"
159
+ | "passport_registration"
160
+ | "temporary_registration";
161
+ /** Base64-encoded file hash. */
162
+ file_hash: string;
163
+ /** Error message. */
164
+ message: string;
165
+ }
166
+
167
+ /** Represents an issue with a list of scans. The error is considered resolved when the list of files containing the scans changes. */
168
+ export interface PassportElementErrorFiles {
169
+ /** Error source, must be "files". */
170
+ source: "files";
171
+ /** The section of the user's Telegram Passport that has the issue. Possible values are "utility_bill", "bank_statement", "rental_agreement", "passport_registration", and "temporary_registration". */
172
+ type:
173
+ | "utility_bill"
174
+ | "bank_statement"
175
+ | "rental_agreement"
176
+ | "passport_registration"
177
+ | "temporary_registration";
178
+ /** List of base64-encoded file hashes. */
179
+ file_hashes: string[];
180
+ /** Error message. */
181
+ message: string;
182
+ }
183
+
184
+ /** Represents an issue with one of the files that constitute the translation of a document. The error is considered resolved when the file changes. */
185
+ export interface PassportElementErrorTranslationFile {
186
+ /** Error source, must be "translation_file". */
187
+ source: "translation_file";
188
+ /** Type of element of the user's Telegram Passport that has the issue. Possible values are "passport", "driver_license", "identity_card", "internal_passport", "utility_bill", "bank_statement", "rental_agreement", "passport_registration", and "temporary_registration". */
189
+ type:
190
+ | "passport"
191
+ | "driver_license"
192
+ | "identity_card"
193
+ | "internal_passport"
194
+ | "utility_bill"
195
+ | "bank_statement"
196
+ | "rental_agreement"
197
+ | "passport_registration"
198
+ | "temporary_registration";
199
+ /** Base64-encoded file hash. */
200
+ file_hash: string;
201
+ /** Error message. */
202
+ message: string;
203
+ }
204
+
205
+ /** Represents an issue with the translated version of a document. The error is considered resolved when a file with the document translation changes. */
206
+ export interface PassportElementErrorTranslationFiles {
207
+ /** Error source, must be "translation_files". */
208
+ source: "translation_files";
209
+ /** Type of element of the user's Telegram Passport that has the issue. Possible values are "passport", "driver_license", "identity_card", "internal_passport", "utility_bill", "bank_statement", "rental_agreement", "passport_registration", and "temporary_registration". */
210
+ type:
211
+ | "passport"
212
+ | "driver_license"
213
+ | "identity_card"
214
+ | "internal_passport"
215
+ | "utility_bill"
216
+ | "bank_statement"
217
+ | "rental_agreement"
218
+ | "passport_registration"
219
+ | "temporary_registration";
220
+ /** List of base64-encoded file hashes. */
221
+ file_hashes: string[];
222
+ /** Error message. */
223
+ message: string;
224
+ }
225
+
226
+ /** Represents an issue in an unspecified element of the Telegram Passport. The error is considered resolved when new data is added. */
227
+ export interface PassportElementErrorUnspecified {
228
+ /** Error source, must be "unspecified". */
229
+ source: "unspecified";
230
+ /** Type of element of the user's Telegram Passport that has the issue. Possible values are "personal_details", "passport", "driver_license", "identity_card", "internal_passport", "address", "utility_bill", "bank_statement", "rental_agreement", "passport_registration", "temporary_registration", "phone_number", and "email". */
231
+ type:
232
+ | "personal_details"
233
+ | "passport"
234
+ | "driver_license"
235
+ | "identity_card"
236
+ | "internal_passport"
237
+ | "address"
238
+ | "utility_bill"
239
+ | "bank_statement"
240
+ | "rental_agreement"
241
+ | "passport_registration"
242
+ | "temporary_registration"
243
+ | "phone_number"
244
+ | "email";
245
+ /** Base64-encoded element hash. */
246
+ element_hash: string;
247
+ /** Error message. */
248
+ message: string;
249
+ }
250
+
251
+ /** This object represents a user's Telegram Passport data. */
252
+ export interface Passport {
253
+ /** Array with information about documents and other Telegram Passport elements that are shared with the bot. */
254
+ data: EncryptedPassportElement[];
255
+ /** Encrypted credentials required to decrypt and authenticate the data. */
256
+ credentials: EncryptedCredentials;
257
+ }
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Represents the response from the API, which can be either a success or an error.
3
+ * If 'ok' is true, the request was successful, and the result of the query can be found in the 'result' field.
4
+ * In case of an unsuccessful request, 'ok' is false, and the error is explained in the 'description' field.
5
+ * An optional 'error_code' field of type number may be returned, but its contents are subject to change in the future.
6
+ * Some errors may also have an additional 'parameters' field of type ResponseParameters,
7
+ * which can provide information to automatically handle the error.
8
+ */
9
+ export type ApiResponse<T> = ApiError | ApiSuccess<T>;
10
+
11
+ /**
12
+ * Represents an API error response.
13
+ */
14
+ export interface ApiError {
15
+ ok: false;
16
+ error_code: number;
17
+ description: string;
18
+ parameters?: ResponseParameters;
19
+ }
20
+
21
+ /**
22
+ * Represents a successful API response.
23
+ * 'ok' is true, and the result of the query can be found in the 'result' field.
24
+ */
25
+ export interface ApiSuccess<T> {
26
+ ok: true;
27
+ result: T;
28
+ }
29
+
30
+ /**
31
+ * Describes additional parameters provided in an API error response.
32
+ */
33
+ export interface ResponseParameters {
34
+ /**
35
+ * The group has been migrated to a supergroup with the specified identifier.
36
+ * This number may have more than 32 significant bits, and some programming languages may have difficulty/silent defects in interpreting it.
37
+ * However, it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type is safe for storing this identifier.
38
+ */
39
+ migrate_to_chat_id?: number;
40
+ /**
41
+ * In case of exceeding flood control, the number of seconds left to wait before the request can be repeated.
42
+ */
43
+ retry_after?: number;
44
+ }
45
+
46
+ /**
47
+ * All methods in the Bot API are case-insensitive.
48
+ * All queries must be made using UTF-8.
49
+ */
@@ -0,0 +1,128 @@
1
+ import type { ChosenInlineResult, InlineQuery } from "./inlineTypes.js";
2
+ import type {
3
+ Chat,
4
+ ChatJoinRequest,
5
+ ChatMemberUpdated,
6
+ User,
7
+ } from "./manageTypes.js";
8
+ import type { CallbackQuery } from "./markupTypes.js";
9
+ import type { Message, Poll, PollAnswer } from "./messageTypes.js";
10
+ import type { PreCheckoutQuery, ShippingQuery } from "./invoiceTypes.js";
11
+
12
+ /**
13
+ * Namespace used internally to define more accurate message update types.
14
+ */
15
+ export declare namespace Update {
16
+ /**
17
+ * Internal type holding properties that message updates in channels share.
18
+ */
19
+ interface Channel {
20
+ chat: Chat.ChannelChat;
21
+ }
22
+
23
+ /**
24
+ * Internal type holding properties that message updates outside of channels share.
25
+ */
26
+ interface NonChannel {
27
+ chat: Exclude<Chat, Chat.ChannelChat>;
28
+ from: User;
29
+ }
30
+
31
+ /**
32
+ * Internal type holding properties that updates about edited messages share.
33
+ */
34
+ interface Edited {
35
+ /**
36
+ * Date the message was last edited in Unix time.
37
+ */
38
+ edit_date: number;
39
+ }
40
+ }
41
+
42
+ /**
43
+ * This object represents an incoming update.
44
+ * At most one of the optional parameters can be present in any given update.
45
+ */
46
+ export interface Update {
47
+ /**
48
+ * The update's unique identifier. Update identifiers start from a certain positive number and increase sequentially.
49
+ * This ID becomes especially handy if you're using webhooks, as it allows you to ignore repeated updates or restore the correct update sequence if they get out of order.
50
+ * If there are no new updates for at least a week, the identifier of the next update will be chosen randomly instead of sequentially.
51
+ */
52
+ update_id: number;
53
+
54
+ /**
55
+ * New incoming message of any kind - text, photo, sticker, etc.
56
+ */
57
+ message?: Message & Update.NonChannel;
58
+
59
+ /**
60
+ * New version of a message known to the bot that has been edited.
61
+ */
62
+ edited_message?: Message & Update.Edited & Update.NonChannel;
63
+
64
+ /**
65
+ * New incoming channel post of any kind - text, photo, sticker, etc.
66
+ */
67
+ channel_post?: Message & Update.Channel;
68
+
69
+ /**
70
+ * New version of a channel post known to the bot that has been edited.
71
+ */
72
+ edited_channel_post?: Message & Update.Edited & Update.Channel;
73
+
74
+ /**
75
+ * New incoming inline query.
76
+ */
77
+ inline_query?: InlineQuery;
78
+
79
+ /**
80
+ * The result of an inline query that was chosen by a user and sent to their chat partner.
81
+ * Please refer to our documentation on collecting feedback for details on how to enable these updates for your bot.
82
+ */
83
+ chosen_inline_result?: ChosenInlineResult;
84
+
85
+ /**
86
+ * New incoming callback query.
87
+ */
88
+ callback_query?: CallbackQuery;
89
+
90
+ /**
91
+ * New incoming shipping query. Only for invoices with flexible price.
92
+ */
93
+ shipping_query?: ShippingQuery;
94
+
95
+ /**
96
+ * New incoming pre-checkout query. Contains full information about checkout.
97
+ */
98
+ pre_checkout_query?: PreCheckoutQuery;
99
+
100
+ /**
101
+ * New poll state. Bots receive updates only about stopped polls and polls sent by the bot.
102
+ */
103
+ poll?: Poll;
104
+
105
+ /**
106
+ * A user changed their answer in a non-anonymous poll.
107
+ * Bots receive new votes only in polls that were sent by the bot itself.
108
+ */
109
+ poll_answer?: PollAnswer;
110
+
111
+ /**
112
+ * The bot's chat member status was updated in a chat.
113
+ * For private chats, this update is received only when the bot is blocked or unblocked by the user.
114
+ */
115
+ my_chat_member?: ChatMemberUpdated;
116
+
117
+ /**
118
+ * A chat member's status was updated in a chat.
119
+ * The bot must be an administrator in the chat and must explicitly specify "chat_member" in the list of allowed_updates to receive these updates.
120
+ */
121
+ chat_member?: ChatMemberUpdated;
122
+
123
+ /**
124
+ * A request to join the chat has been sent.
125
+ * The bot must have the can_invite_users administrator right in the chat to receive these updates.
126
+ */
127
+ chat_join_request?: ChatJoinRequest;
128
+ }