@telegram.ts/types 1.3.0 → 1.3.2
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/README.md +4 -1
- package/package.json +2 -2
- package/src/apiMethodsTypes.d.ts +143 -58
- package/src/botCommandTypes.d.ts +89 -90
- package/src/index.d.ts +1 -1
- package/src/index.js +5 -2
- package/src/inlineTypes.d.ts +32 -19
- package/src/invoiceTypes.d.ts +39 -43
- package/src/manageTypes.d.ts +45 -39
- package/src/markupTypes.d.ts +26 -12
- package/src/messageTypes.d.ts +95 -65
- package/src/passportTypes.d.ts +77 -17
- package/src/telegramTypes.d.ts +25 -25
- package/src/updateTypes.d.ts +57 -70
package/src/markupTypes.d.ts
CHANGED
|
@@ -1,10 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
User
|
|
4
|
-
} from "./manageTypes.js";
|
|
5
|
-
import type {
|
|
6
|
-
Message
|
|
7
|
-
} from "./messageTypes.js";
|
|
1
|
+
import type { ChatAdministratorRights, User } from "./manageTypes.js";
|
|
2
|
+
import type { Message } from "./messageTypes.js";
|
|
8
3
|
/** This object represents an inline keyboard that appears right next to the message it belongs to. */
|
|
9
4
|
export interface InlineKeyboardMarkup {
|
|
10
5
|
/** Array of button rows, each represented by an Array of InlineKeyboardButton objects */
|
|
@@ -37,13 +32,15 @@ export declare namespace InlineKeyboardButton {
|
|
|
37
32
|
Note: This offers an easy way for users to start using your bot in inline mode when they are currently in a private chat with it. Especially useful when combined with switch_pm... actions – in this case the user will be automatically returned to the chat they switched from, skipping the chat selection screen. */
|
|
38
33
|
switch_inline_query: string;
|
|
39
34
|
}
|
|
40
|
-
export interface SwitchInlineCurrentChatButton
|
|
35
|
+
export interface SwitchInlineCurrentChatButton
|
|
36
|
+
extends AbstractInlineKeyboardButton {
|
|
41
37
|
/** If set, pressing the button will insert the bot's username and the specified inline query in the current chat's input field. Can be empty, in which case only the bot's username will be inserted.
|
|
42
38
|
|
|
43
39
|
This offers a quick way for the user to open your bot in inline mode in the same chat – good for selecting something from multiple options. */
|
|
44
40
|
switch_inline_query_current_chat: string;
|
|
45
41
|
}
|
|
46
|
-
export interface SwitchInlineChosenChatButton
|
|
42
|
+
export interface SwitchInlineChosenChatButton
|
|
43
|
+
extends AbstractInlineKeyboardButton {
|
|
47
44
|
/** If set, pressing the button will prompt the user to select one of their chats of the specified type, open that chat and insert the bot's username and the specified inline query in the input field */
|
|
48
45
|
switch_inline_query_chosen_chat: SwitchInlineQueryChosenChat;
|
|
49
46
|
}
|
|
@@ -62,7 +59,16 @@ export declare namespace InlineKeyboardButton {
|
|
|
62
59
|
export {};
|
|
63
60
|
}
|
|
64
61
|
/** This object represents one button of an inline keyboard. You must use exactly one of the optional fields. */
|
|
65
|
-
export type InlineKeyboardButton =
|
|
62
|
+
export type InlineKeyboardButton =
|
|
63
|
+
| InlineKeyboardButton.CallbackButton
|
|
64
|
+
| InlineKeyboardButton.GameButton
|
|
65
|
+
| InlineKeyboardButton.LoginButton
|
|
66
|
+
| InlineKeyboardButton.PayButton
|
|
67
|
+
| InlineKeyboardButton.SwitchInlineButton
|
|
68
|
+
| InlineKeyboardButton.SwitchInlineCurrentChatButton
|
|
69
|
+
| InlineKeyboardButton.SwitchInlineChosenChatButton
|
|
70
|
+
| InlineKeyboardButton.UrlButton
|
|
71
|
+
| InlineKeyboardButton.WebAppButton;
|
|
66
72
|
/** This object represents a parameter of the inline keyboard button used to automatically authorize a user. Serves as a great replacement for the Telegram Login Widget when the user is coming from Telegram. All the user needs to do is tap/click a button and confirm that they want to log in.
|
|
67
73
|
Telegram apps support these buttons as of version 5.7. */
|
|
68
74
|
export interface LoginUrl {
|
|
@@ -159,7 +165,15 @@ export declare namespace KeyboardButton {
|
|
|
159
165
|
}
|
|
160
166
|
}
|
|
161
167
|
/** This object represents one button of the reply keyboard. For simple text buttons, String can be used instead of this object to specify the button text. The optional fields web_app, request_user, request_chat, request_contact, request_location, and request_poll are mutually exclusive. */
|
|
162
|
-
export type KeyboardButton =
|
|
168
|
+
export type KeyboardButton =
|
|
169
|
+
| KeyboardButton.CommonButton
|
|
170
|
+
| KeyboardButton.RequestUserButton
|
|
171
|
+
| KeyboardButton.RequestChatButton
|
|
172
|
+
| KeyboardButton.RequestContactButton
|
|
173
|
+
| KeyboardButton.RequestLocationButton
|
|
174
|
+
| KeyboardButton.RequestPollButton
|
|
175
|
+
| KeyboardButton.WebAppButton
|
|
176
|
+
| string;
|
|
163
177
|
/** This object represents type of a poll, which is allowed to be created and sent when the corresponding button is pressed. */
|
|
164
178
|
export interface KeyboardButtonPollType {
|
|
165
179
|
/** If quiz is passed, the user will be allowed to create only polls in the quiz mode. If regular is passed, only regular polls will be allowed. Otherwise, the user will be allowed to create a poll of any type. */
|
|
@@ -223,4 +237,4 @@ export interface KeyboardButtonRequestChat {
|
|
|
223
237
|
bot_administrator_rights?: ChatAdministratorRights;
|
|
224
238
|
/** Pass True to request a chat with the bot as a member. Otherwise, no additional restrictions are applied. */
|
|
225
239
|
bot_is_member?: boolean;
|
|
226
|
-
}
|
|
240
|
+
}
|
package/src/messageTypes.d.ts
CHANGED
|
@@ -1,19 +1,8 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import type {
|
|
7
|
-
InlineKeyboardMarkup
|
|
8
|
-
} from "./markupTypes.js";
|
|
9
|
-
import type {
|
|
10
|
-
PassportData
|
|
11
|
-
} from "./passportTypes.js";
|
|
12
|
-
import type {
|
|
13
|
-
Invoice,
|
|
14
|
-
SuccessfulPayment
|
|
15
|
-
} from "./invoiceTypes.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
|
|
75
|
-
export type AudioMessage = CaptionableMessage & MsgWith
|
|
76
|
-
export type DocumentMessage = CaptionableMessage & MsgWith
|
|
77
|
-
export type AnimationMessage = DocumentMessage & MsgWith
|
|
78
|
-
export type PhotoMessage = MediaMessage & MsgWith
|
|
79
|
-
export type StickerMessage = CommonMessage & MsgWith
|
|
80
|
-
export type VideoMessage = MediaMessage & MsgWith
|
|
81
|
-
export type VideoNoteMessage = CommonMessage & MsgWith
|
|
82
|
-
export type VoiceMessage = CaptionableMessage & MsgWith
|
|
83
|
-
export type ContactMessage = CommonMessage & MsgWith
|
|
84
|
-
export type DiceMessage = CommonMessage & MsgWith
|
|
85
|
-
export type GameMessage = CommonMessage & MsgWith
|
|
86
|
-
export type PollMessage = CommonMessage & MsgWith
|
|
87
|
-
export type LocationMessage = CommonMessage & MsgWith
|
|
88
|
-
export type VenueMessage = LocationMessage & MsgWith
|
|
89
|
-
export type NewChatMembersMessage = ServiceMessage &
|
|
90
|
-
|
|
91
|
-
export type
|
|
92
|
-
|
|
93
|
-
export type
|
|
94
|
-
export type
|
|
95
|
-
export type
|
|
96
|
-
|
|
97
|
-
export type
|
|
98
|
-
|
|
99
|
-
export type
|
|
100
|
-
|
|
101
|
-
export type
|
|
102
|
-
|
|
103
|
-
export type
|
|
104
|
-
|
|
105
|
-
export type
|
|
106
|
-
|
|
107
|
-
export type
|
|
108
|
-
|
|
109
|
-
export type
|
|
110
|
-
export type
|
|
111
|
-
export type
|
|
112
|
-
|
|
113
|
-
export type
|
|
114
|
-
export type
|
|
115
|
-
export type
|
|
116
|
-
|
|
117
|
-
export type
|
|
118
|
-
|
|
119
|
-
export type
|
|
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 & {
|
|
@@ -334,7 +346,20 @@ export declare namespace MessageEntity {
|
|
|
334
346
|
length: number;
|
|
335
347
|
}
|
|
336
348
|
export interface CommonMessageEntity extends AbstractMessageEntity {
|
|
337
|
-
type:
|
|
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 =
|
|
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 {};
|
package/src/passportTypes.d.ts
CHANGED
|
@@ -21,7 +21,20 @@ export interface PassportFile {
|
|
|
21
21
|
/** Describes documents or other Telegram Passport elements shared with the bot by the user. */
|
|
22
22
|
export interface EncryptedPassportElement {
|
|
23
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:
|
|
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";
|
|
25
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. */
|
|
26
39
|
data?: string;
|
|
27
40
|
/** User's verified phone number, available only for type "phone_number". */
|
|
@@ -66,22 +79,28 @@ export interface EncryptedCredentials {
|
|
|
66
79
|
- PassportElementErrorUnspecified
|
|
67
80
|
*/
|
|
68
81
|
export type PassportElementError =
|
|
69
|
-
| PassportElementErrorDataField
|
|
70
|
-
| PassportElementErrorFrontSide
|
|
71
|
-
| PassportElementErrorReverseSide
|
|
72
|
-
| PassportElementErrorSelfie
|
|
73
|
-
| PassportElementErrorFile
|
|
74
|
-
| PassportElementErrorFiles
|
|
75
|
-
| PassportElementErrorTranslationFile
|
|
76
|
-
| PassportElementErrorTranslationFiles
|
|
77
|
-
| PassportElementErrorUnspecified;
|
|
82
|
+
| PassportElementErrorDataField
|
|
83
|
+
| PassportElementErrorFrontSide
|
|
84
|
+
| PassportElementErrorReverseSide
|
|
85
|
+
| PassportElementErrorSelfie
|
|
86
|
+
| PassportElementErrorFile
|
|
87
|
+
| PassportElementErrorFiles
|
|
88
|
+
| PassportElementErrorTranslationFile
|
|
89
|
+
| PassportElementErrorTranslationFiles
|
|
90
|
+
| PassportElementErrorUnspecified;
|
|
78
91
|
|
|
79
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. */
|
|
80
93
|
export interface PassportElementErrorDataField {
|
|
81
94
|
/** Error source, must be "data". */
|
|
82
95
|
source: "data";
|
|
83
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". */
|
|
84
|
-
type:
|
|
97
|
+
type:
|
|
98
|
+
| "personal_details"
|
|
99
|
+
| "passport"
|
|
100
|
+
| "driver_license"
|
|
101
|
+
| "identity_card"
|
|
102
|
+
| "internal_passport"
|
|
103
|
+
| "address";
|
|
85
104
|
/** Name of the data field that has the error. */
|
|
86
105
|
field_name: string;
|
|
87
106
|
/** Base64-encoded data hash. */
|
|
@@ -133,7 +152,12 @@ export interface PassportElementErrorFile {
|
|
|
133
152
|
/** Error source, must be "file". */
|
|
134
153
|
source: "file";
|
|
135
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". */
|
|
136
|
-
type:
|
|
155
|
+
type:
|
|
156
|
+
| "utility_bill"
|
|
157
|
+
| "bank_statement"
|
|
158
|
+
| "rental_agreement"
|
|
159
|
+
| "passport_registration"
|
|
160
|
+
| "temporary_registration";
|
|
137
161
|
/** Base64-encoded file hash. */
|
|
138
162
|
file_hash: string;
|
|
139
163
|
/** Error message. */
|
|
@@ -145,7 +169,12 @@ export interface PassportElementErrorFiles {
|
|
|
145
169
|
/** Error source, must be "files". */
|
|
146
170
|
source: "files";
|
|
147
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". */
|
|
148
|
-
type:
|
|
172
|
+
type:
|
|
173
|
+
| "utility_bill"
|
|
174
|
+
| "bank_statement"
|
|
175
|
+
| "rental_agreement"
|
|
176
|
+
| "passport_registration"
|
|
177
|
+
| "temporary_registration";
|
|
149
178
|
/** List of base64-encoded file hashes. */
|
|
150
179
|
file_hashes: string[];
|
|
151
180
|
/** Error message. */
|
|
@@ -157,7 +186,16 @@ export interface PassportElementErrorTranslationFile {
|
|
|
157
186
|
/** Error source, must be "translation_file". */
|
|
158
187
|
source: "translation_file";
|
|
159
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". */
|
|
160
|
-
type:
|
|
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";
|
|
161
199
|
/** Base64-encoded file hash. */
|
|
162
200
|
file_hash: string;
|
|
163
201
|
/** Error message. */
|
|
@@ -169,7 +207,16 @@ export interface PassportElementErrorTranslationFiles {
|
|
|
169
207
|
/** Error source, must be "translation_files". */
|
|
170
208
|
source: "translation_files";
|
|
171
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". */
|
|
172
|
-
type:
|
|
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";
|
|
173
220
|
/** List of base64-encoded file hashes. */
|
|
174
221
|
file_hashes: string[];
|
|
175
222
|
/** Error message. */
|
|
@@ -181,7 +228,20 @@ export interface PassportElementErrorUnspecified {
|
|
|
181
228
|
/** Error source, must be "unspecified". */
|
|
182
229
|
source: "unspecified";
|
|
183
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". */
|
|
184
|
-
type:
|
|
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";
|
|
185
245
|
/** Base64-encoded element hash. */
|
|
186
246
|
element_hash: string;
|
|
187
247
|
/** Error message. */
|
|
@@ -194,4 +254,4 @@ export interface Passport {
|
|
|
194
254
|
data: EncryptedPassportElement[];
|
|
195
255
|
/** Encrypted credentials required to decrypt and authenticate the data. */
|
|
196
256
|
credentials: EncryptedCredentials;
|
|
197
|
-
}
|
|
257
|
+
}
|
package/src/telegramTypes.d.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
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
|
|
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
10
|
|
|
11
11
|
/**
|
|
12
|
-
* Represents an API error response.
|
|
13
|
-
*/
|
|
12
|
+
* Represents an API error response.
|
|
13
|
+
*/
|
|
14
14
|
export interface ApiError {
|
|
15
15
|
ok: false;
|
|
16
16
|
error_code: number;
|
|
@@ -19,31 +19,31 @@ export interface ApiError {
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
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
|
|
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
26
|
ok: true;
|
|
27
27
|
result: T;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
/**
|
|
31
|
-
* Describes additional parameters provided in an API error response.
|
|
32
|
-
*/
|
|
31
|
+
* Describes additional parameters provided in an API error response.
|
|
32
|
+
*/
|
|
33
33
|
export interface ResponseParameters {
|
|
34
34
|
/**
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
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
39
|
migrate_to_chat_id?: number;
|
|
40
40
|
/**
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
* In case of exceeding flood control, the number of seconds left to wait before the request can be repeated.
|
|
42
|
+
*/
|
|
43
43
|
retry_after?: number;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
/**
|
|
47
|
-
* All methods in the Bot API are case-insensitive.
|
|
48
|
-
* All queries must be made using UTF-8.
|
|
49
|
-
*/
|
|
47
|
+
* All methods in the Bot API are case-insensitive.
|
|
48
|
+
* All queries must be made using UTF-8.
|
|
49
|
+
*/
|