@grammyjs/types 3.1.2 → 3.1.3
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/manage.d.ts +12 -13
- package/markup.d.ts +9 -10
- package/message.d.ts +54 -56
- package/package.json +1 -1
package/manage.d.ts
CHANGED
|
@@ -11,15 +11,15 @@ export interface WebhookInfo {
|
|
|
11
11
|
/** Currently used webhook IP address */
|
|
12
12
|
ip_address?: string;
|
|
13
13
|
/** Unix time for the most recent error that happened when trying to deliver an update via webhook */
|
|
14
|
-
last_error_date
|
|
14
|
+
last_error_date?: number;
|
|
15
15
|
/** Error message in human-readable format for the most recent error that happened when trying to deliver an update via webhook */
|
|
16
|
-
last_error_message
|
|
16
|
+
last_error_message?: string;
|
|
17
17
|
/** Unix time of the most recent error that happened when trying to synchronize available updates with Telegram datacenters */
|
|
18
18
|
last_synchronization_error_date?: number;
|
|
19
19
|
/** The maximum allowed number of simultaneous HTTPS connections to the webhook for update delivery */
|
|
20
|
-
max_connections
|
|
20
|
+
max_connections?: number;
|
|
21
21
|
/** A list of update types the bot is subscribed to. Defaults to all update types except chat_member */
|
|
22
|
-
allowed_updates
|
|
22
|
+
allowed_updates?: Array<Exclude<keyof Update, "update_id">>;
|
|
23
23
|
}
|
|
24
24
|
/** This object represents a Telegram user or bot. */
|
|
25
25
|
export interface User {
|
|
@@ -70,7 +70,7 @@ export declare namespace Chat {
|
|
|
70
70
|
title: string;
|
|
71
71
|
}
|
|
72
72
|
/** Internal type representing private chats. */
|
|
73
|
-
|
|
73
|
+
interface PrivateChat extends AbstractChat, UserNameChat {
|
|
74
74
|
type: "private";
|
|
75
75
|
/** First name of the other party in a private chat */
|
|
76
76
|
first_name: string;
|
|
@@ -78,17 +78,17 @@ export declare namespace Chat {
|
|
|
78
78
|
last_name?: string;
|
|
79
79
|
}
|
|
80
80
|
/** Internal type representing group chats. */
|
|
81
|
-
|
|
81
|
+
interface GroupChat extends AbstractChat, TitleChat {
|
|
82
82
|
type: "group";
|
|
83
83
|
}
|
|
84
84
|
/** Internal type representing super group chats. */
|
|
85
|
-
|
|
85
|
+
interface SupergroupChat extends AbstractChat, UserNameChat, TitleChat {
|
|
86
86
|
type: "supergroup";
|
|
87
87
|
/** True, if the supergroup chat is a forum (has topics enabled) */
|
|
88
88
|
is_forum?: true;
|
|
89
89
|
}
|
|
90
90
|
/** Internal type representing channel chats. */
|
|
91
|
-
|
|
91
|
+
interface ChannelChat extends AbstractChat, UserNameChat, TitleChat {
|
|
92
92
|
type: "channel";
|
|
93
93
|
}
|
|
94
94
|
/** Internal type holding properties that those chats returned from `getChat` share. */
|
|
@@ -127,7 +127,7 @@ export declare namespace Chat {
|
|
|
127
127
|
linked_chat_id?: number;
|
|
128
128
|
}
|
|
129
129
|
/** Internal type representing private chats returned from `getChat`. */
|
|
130
|
-
|
|
130
|
+
interface PrivateGetChat extends PrivateChat, NonGroupGetChat, GetChat {
|
|
131
131
|
/** Custom emoji identifier of emoji status of the other party in a private chat. Returned only in getChat. */
|
|
132
132
|
emoji_status_custom_emoji_id?: string;
|
|
133
133
|
/** Bio of the other party in a private chat. Returned only in getChat. */
|
|
@@ -138,10 +138,10 @@ export declare namespace Chat {
|
|
|
138
138
|
has_restricted_voice_and_video_messages?: true;
|
|
139
139
|
}
|
|
140
140
|
/** Internal type representing group chats returned from `getChat`. */
|
|
141
|
-
|
|
141
|
+
interface GroupGetChat extends GroupChat, MultiUserGetChat {
|
|
142
142
|
}
|
|
143
143
|
/** Internal type representing supergroup chats returned from `getChat`. */
|
|
144
|
-
|
|
144
|
+
interface SupergroupGetChat extends SupergroupChat, NonGroupGetChat, MultiUserGetChat, LargeGetChat {
|
|
145
145
|
/** True, if users need to join the supergroup before they can send messages. Returned only in getChat. */
|
|
146
146
|
join_to_send_messages?: true;
|
|
147
147
|
/** True, if all users directly joining the supergroup need to be approved by supergroup administrators. Returned only in getChat. */
|
|
@@ -156,9 +156,8 @@ export declare namespace Chat {
|
|
|
156
156
|
location?: ChatLocation;
|
|
157
157
|
}
|
|
158
158
|
/** Internal type representing channel chats returned from `getChat`. */
|
|
159
|
-
|
|
159
|
+
interface ChannelGetChat extends ChannelChat, NonGroupGetChat, LargeGetChat {
|
|
160
160
|
}
|
|
161
|
-
export {};
|
|
162
161
|
}
|
|
163
162
|
/** This object represents a chat. */
|
|
164
163
|
export type Chat = Chat.PrivateChat | Chat.GroupChat | Chat.SupergroupChat | Chat.ChannelChat;
|
package/markup.d.ts
CHANGED
|
@@ -10,51 +10,50 @@ export declare namespace InlineKeyboardButton {
|
|
|
10
10
|
/** Label text on the button */
|
|
11
11
|
text: string;
|
|
12
12
|
}
|
|
13
|
-
|
|
13
|
+
interface UrlButton extends AbstractInlineKeyboardButton {
|
|
14
14
|
/** HTTP or tg:// URL to be opened when the button is pressed. Links tg://user?id=<user_id> can be used to mention a user by their ID without using a username, if this is allowed by their privacy settings. */
|
|
15
15
|
url: string;
|
|
16
16
|
}
|
|
17
|
-
|
|
17
|
+
interface CallbackButton extends AbstractInlineKeyboardButton {
|
|
18
18
|
/** Data to be sent in a callback query to the bot when button is pressed, 1-64 bytes */
|
|
19
19
|
callback_data: string;
|
|
20
20
|
}
|
|
21
|
-
|
|
21
|
+
interface WebAppButton extends AbstractInlineKeyboardButton {
|
|
22
22
|
/** 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. Available only in private chats between a user and the bot. */
|
|
23
23
|
web_app: WebAppInfo;
|
|
24
24
|
}
|
|
25
|
-
|
|
25
|
+
interface LoginButton extends AbstractInlineKeyboardButton {
|
|
26
26
|
/** An HTTPS URL used to automatically authorize the user. Can be used as a replacement for the Telegram Login Widget. */
|
|
27
27
|
login_url: LoginUrl;
|
|
28
28
|
}
|
|
29
|
-
|
|
29
|
+
interface SwitchInlineButton extends AbstractInlineKeyboardButton {
|
|
30
30
|
/** If set, pressing the button will prompt the user to select one of their chats, open that chat and insert the bot's username and the specified inline query in the input field. Can be empty, in which case just the bot's username will be inserted.
|
|
31
31
|
|
|
32
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. */
|
|
33
33
|
switch_inline_query: string;
|
|
34
34
|
}
|
|
35
|
-
|
|
35
|
+
interface SwitchInlineCurrentChatButton extends AbstractInlineKeyboardButton {
|
|
36
36
|
/** 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.
|
|
37
37
|
|
|
38
38
|
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. */
|
|
39
39
|
switch_inline_query_current_chat: string;
|
|
40
40
|
}
|
|
41
|
-
|
|
41
|
+
interface SwitchInlineChosenChatButton extends AbstractInlineKeyboardButton {
|
|
42
42
|
/** 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 */
|
|
43
43
|
switch_inline_query_chosen_chat: SwitchInlineQueryChosenChat;
|
|
44
44
|
}
|
|
45
|
-
|
|
45
|
+
interface GameButton extends AbstractInlineKeyboardButton {
|
|
46
46
|
/** Description of the game that will be launched when the user presses the button.
|
|
47
47
|
|
|
48
48
|
NOTE: This type of button must always be the first button in the first row. */
|
|
49
49
|
callback_game: CallbackGame;
|
|
50
50
|
}
|
|
51
|
-
|
|
51
|
+
interface PayButton extends AbstractInlineKeyboardButton {
|
|
52
52
|
/** Specify True, to send a Pay button.
|
|
53
53
|
|
|
54
54
|
NOTE: This type of button must always be the first button in the first row and can only be used in invoice messages. */
|
|
55
55
|
pay: boolean;
|
|
56
56
|
}
|
|
57
|
-
export {};
|
|
58
57
|
}
|
|
59
58
|
/** This object represents one button of an inline keyboard. You must use exactly one of the optional fields. */
|
|
60
59
|
export type InlineKeyboardButton = InlineKeyboardButton.CallbackButton | InlineKeyboardButton.GameButton | InlineKeyboardButton.LoginButton | InlineKeyboardButton.PayButton | InlineKeyboardButton.SwitchInlineButton | InlineKeyboardButton.SwitchInlineCurrentChatButton | InlineKeyboardButton.SwitchInlineChosenChatButton | InlineKeyboardButton.UrlButton | InlineKeyboardButton.WebAppButton;
|
package/message.d.ts
CHANGED
|
@@ -20,7 +20,7 @@ export declare namespace Message {
|
|
|
20
20
|
/** True, if the message is sent to a forum topic */
|
|
21
21
|
is_topic_message?: boolean;
|
|
22
22
|
}
|
|
23
|
-
|
|
23
|
+
interface CommonMessage extends ServiceMessage {
|
|
24
24
|
/** For forwarded messages, sender of the original message */
|
|
25
25
|
forward_from?: User;
|
|
26
26
|
/** For messages forwarded from channels or from anonymous administrators, information about the original sender chat */
|
|
@@ -48,65 +48,64 @@ export declare namespace Message {
|
|
|
48
48
|
/** Inline keyboard attached to the message. login_url buttons are represented as ordinary url buttons. */
|
|
49
49
|
reply_markup?: InlineKeyboardMarkup;
|
|
50
50
|
}
|
|
51
|
-
|
|
51
|
+
interface CaptionableMessage extends CommonMessage {
|
|
52
52
|
/** Caption for the animation, audio, document, photo, video or voice */
|
|
53
53
|
caption?: string;
|
|
54
54
|
/** For messages with a caption, special entities like usernames, URLs, bot commands, etc. that appear in the caption */
|
|
55
55
|
caption_entities?: MessageEntity[];
|
|
56
56
|
}
|
|
57
|
-
|
|
57
|
+
interface MediaMessage extends CaptionableMessage {
|
|
58
58
|
/** The unique identifier of a media message group this message belongs to */
|
|
59
59
|
media_group_id?: string;
|
|
60
60
|
/** True, if the message media is covered by a spoiler animation */
|
|
61
61
|
has_media_spoiler?: true;
|
|
62
62
|
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
export {};
|
|
63
|
+
type TextMessage = CommonMessage & MsgWith<"text">;
|
|
64
|
+
type AudioMessage = CaptionableMessage & MsgWith<"audio">;
|
|
65
|
+
type DocumentMessage = CaptionableMessage & MsgWith<"document">;
|
|
66
|
+
type AnimationMessage = DocumentMessage & MsgWith<"animation">;
|
|
67
|
+
type PhotoMessage = MediaMessage & MsgWith<"photo">;
|
|
68
|
+
type StickerMessage = CommonMessage & MsgWith<"sticker">;
|
|
69
|
+
type VideoMessage = MediaMessage & MsgWith<"video">;
|
|
70
|
+
type VideoNoteMessage = CommonMessage & MsgWith<"video_note">;
|
|
71
|
+
type VoiceMessage = CaptionableMessage & MsgWith<"voice">;
|
|
72
|
+
type ContactMessage = CommonMessage & MsgWith<"contact">;
|
|
73
|
+
type DiceMessage = CommonMessage & MsgWith<"dice">;
|
|
74
|
+
type GameMessage = CommonMessage & MsgWith<"game">;
|
|
75
|
+
type PollMessage = CommonMessage & MsgWith<"poll">;
|
|
76
|
+
type LocationMessage = CommonMessage & MsgWith<"location">;
|
|
77
|
+
type VenueMessage = LocationMessage & MsgWith<"venue">;
|
|
78
|
+
type NewChatMembersMessage = ServiceMessage & MsgWith<"new_chat_members">;
|
|
79
|
+
type LeftChatMemberMessage = ServiceMessage & MsgWith<"left_chat_member">;
|
|
80
|
+
type NewChatTitleMessage = ServiceMessage & MsgWith<"new_chat_title">;
|
|
81
|
+
type NewChatPhotoMessage = ServiceMessage & MsgWith<"new_chat_photo">;
|
|
82
|
+
type DeleteChatPhotoMessage = ServiceMessage & MsgWith<"delete_chat_photo">;
|
|
83
|
+
type GroupChatCreatedMessage = ServiceMessage & MsgWith<"group_chat_created">;
|
|
84
|
+
type SupergroupChatCreated = ServiceMessage & MsgWith<"supergroup_chat_created">;
|
|
85
|
+
type ChannelChatCreatedMessage = ServiceMessage & MsgWith<"channel_chat_created">;
|
|
86
|
+
type MessageAutoDeleteTimerChangedMessage = ServiceMessage & MsgWith<"message_auto_delete_timer_changed">;
|
|
87
|
+
type MigrateToChatIdMessage = ServiceMessage & MsgWith<"migrate_to_chat_id">;
|
|
88
|
+
type MigrateFromChatIdMessage = ServiceMessage & MsgWith<"migrate_from_chat_id">;
|
|
89
|
+
type PinnedMessageMessage = ServiceMessage & MsgWith<"pinned_message">;
|
|
90
|
+
type InvoiceMessage = ServiceMessage & MsgWith<"invoice">;
|
|
91
|
+
type SuccessfulPaymentMessage = ServiceMessage & MsgWith<"successful_payment">;
|
|
92
|
+
type UserSharedMessage = ServiceMessage & MsgWith<"user_shared">;
|
|
93
|
+
type ChatSharedMessage = ServiceMessage & MsgWith<"chat_shared">;
|
|
94
|
+
type ConnectedWebsiteMessage = ServiceMessage & MsgWith<"connected_website">;
|
|
95
|
+
type WriteAccessAllowedMessage = ServiceMessage & MsgWith<"write_access_allowed">;
|
|
96
|
+
type PassportDataMessage = ServiceMessage & MsgWith<"passport_data">;
|
|
97
|
+
type ProximityAlertTriggeredMessage = ServiceMessage & MsgWith<"proximity_alert_triggered">;
|
|
98
|
+
type ForumTopicCreatedMessage = ServiceMessage & MsgWith<"forum_topic_created">;
|
|
99
|
+
type ForumTopicEditedMessage = ServiceMessage & MsgWith<"forum_topic_edited">;
|
|
100
|
+
type ForumTopicClosedMessage = ServiceMessage & MsgWith<"forum_topic_closed">;
|
|
101
|
+
type ForumTopicReopenedMessage = ServiceMessage & MsgWith<"forum_topic_reopened">;
|
|
102
|
+
type GeneralForumTopicHiddenMessage = ServiceMessage & MsgWith<"general_forum_topic_hidden">;
|
|
103
|
+
type GeneralForumTopicUnhiddenMessage = ServiceMessage & MsgWith<"general_forum_topic_unhidden">;
|
|
104
|
+
type VideoChatScheduledMessage = ServiceMessage & MsgWith<"video_chat_scheduled">;
|
|
105
|
+
type VideoChatStartedMessage = ServiceMessage & MsgWith<"video_chat_started">;
|
|
106
|
+
type VideoChatEndedMessage = ServiceMessage & MsgWith<"video_chat_ended">;
|
|
107
|
+
type VideoChatParticipantsInvitedMessage = ServiceMessage & MsgWith<"video_chat_participants_invited">;
|
|
108
|
+
type WebAppDataMessage = ServiceMessage & MsgWith<"web_app_data">;
|
|
110
109
|
}
|
|
111
110
|
type ReplyMessage = Message & {
|
|
112
111
|
reply_to_message: undefined;
|
|
@@ -322,30 +321,29 @@ export declare namespace MessageEntity {
|
|
|
322
321
|
/** Length of the entity in UTF-16 code units */
|
|
323
322
|
length: number;
|
|
324
323
|
}
|
|
325
|
-
|
|
324
|
+
interface CommonMessageEntity extends AbstractMessageEntity {
|
|
326
325
|
type: "mention" | "hashtag" | "cashtag" | "bot_command" | "url" | "email" | "phone_number" | "bold" | "italic" | "underline" | "strikethrough" | "spoiler" | "code";
|
|
327
326
|
}
|
|
328
|
-
|
|
327
|
+
interface PreMessageEntity extends AbstractMessageEntity {
|
|
329
328
|
type: "pre";
|
|
330
329
|
/** For “pre” only, the programming language of the entity text */
|
|
331
330
|
language?: string;
|
|
332
331
|
}
|
|
333
|
-
|
|
332
|
+
interface TextLinkMessageEntity extends AbstractMessageEntity {
|
|
334
333
|
type: "text_link";
|
|
335
334
|
/** For “text_link” only, URL that will be opened after user taps on the text */
|
|
336
335
|
url: string;
|
|
337
336
|
}
|
|
338
|
-
|
|
337
|
+
interface TextMentionMessageEntity extends AbstractMessageEntity {
|
|
339
338
|
type: "text_mention";
|
|
340
339
|
/** For “text_mention” only, the mentioned user */
|
|
341
340
|
user: User;
|
|
342
341
|
}
|
|
343
|
-
|
|
342
|
+
interface CustomEmojiMessageEntity extends AbstractMessageEntity {
|
|
344
343
|
type: "custom_emoji";
|
|
345
344
|
/** For “custom_emoji” only, unique identifier of the custom emoji. Use getCustomEmojiStickers to get full information about the sticker */
|
|
346
345
|
custom_emoji_id: string;
|
|
347
346
|
}
|
|
348
|
-
export {};
|
|
349
347
|
}
|
|
350
348
|
/** This object represents one special entity in a text message. For example, hashtags, usernames, URLs, etc. */
|
|
351
349
|
export type MessageEntity = MessageEntity.CommonMessageEntity | MessageEntity.CustomEmojiMessageEntity | MessageEntity.PreMessageEntity | MessageEntity.TextLinkMessageEntity | MessageEntity.TextMentionMessageEntity;
|