@grammyjs/types 2.12.0 → 3.0.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/README.md +15 -2
- package/api.d.ts +10 -13
- package/inline.d.ts +532 -586
- package/manage.d.ts +375 -423
- package/markup.d.ts +159 -189
- package/message.d.ts +535 -633
- package/methods.d.ts +1531 -0
- package/mod.d.ts +10 -0
- package/package.json +15 -5
- package/passport.d.ts +113 -182
- package/payment.d.ts +77 -85
- package/{menu-button.d.ts → settings.d.ts} +45 -57
- package/update.d.ts +50 -52
- package/.editorconfig +0 -8
- package/deno.jsonc +0 -1
- package/index.d.ts +0 -10
- package/proxied.d.ts +0 -1702
- /package/{index.js → mod.js} +0 -0
|
@@ -1,38 +1,40 @@
|
|
|
1
|
-
import { WebAppInfo } from "./markup";
|
|
2
|
-
|
|
1
|
+
import type { WebAppInfo } from "./markup.js";
|
|
2
|
+
/** This object represents the bot's description. */
|
|
3
|
+
export interface BotDescription {
|
|
4
|
+
/** The bot's description */
|
|
5
|
+
description: string;
|
|
6
|
+
}
|
|
7
|
+
/** This object represents the bot's short description. */
|
|
8
|
+
export interface BotShortDescription {
|
|
9
|
+
/** The bot's short description */
|
|
10
|
+
short_description: string;
|
|
11
|
+
}
|
|
3
12
|
/** This object describes the bot's menu button in a private chat. It should be one of
|
|
4
13
|
- MenuButtonCommands
|
|
5
14
|
- MenuButtonWebApp
|
|
6
15
|
- MenuButtonDefault
|
|
7
16
|
|
|
8
17
|
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. */
|
|
9
|
-
export type MenuButton =
|
|
10
|
-
| MenuButtonCommands
|
|
11
|
-
| MenuButtonWebApp
|
|
12
|
-
| MenuButtonDefault;
|
|
13
|
-
|
|
18
|
+
export type MenuButton = MenuButtonCommands | MenuButtonWebApp | MenuButtonDefault;
|
|
14
19
|
/** Represents a menu button, which opens the bot's list of commands. */
|
|
15
20
|
export interface MenuButtonCommands {
|
|
16
|
-
|
|
17
|
-
|
|
21
|
+
/** Type of the button, must be commands */
|
|
22
|
+
type: "commands";
|
|
18
23
|
}
|
|
19
|
-
|
|
20
24
|
/** Represents a menu button, which launches a Web App. */
|
|
21
25
|
export interface MenuButtonWebApp {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
/** Button type, must be web_app */
|
|
27
|
+
type: "web_app";
|
|
28
|
+
/** Text on the button */
|
|
29
|
+
text: string;
|
|
30
|
+
/** 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. */
|
|
31
|
+
web_app: WebAppInfo;
|
|
28
32
|
}
|
|
29
|
-
|
|
30
33
|
/** Describes that no specific value for the menu button was set. */
|
|
31
34
|
export interface MenuButtonDefault {
|
|
32
|
-
|
|
33
|
-
|
|
35
|
+
/** Type of the button, must be default */
|
|
36
|
+
type: "default";
|
|
34
37
|
}
|
|
35
|
-
|
|
36
38
|
/** This object represents the scope to which bot commands are applied. Currently, the following 7 scopes are supported:
|
|
37
39
|
- BotCommandScopeDefault
|
|
38
40
|
- BotCommandScopeAllPrivateChats
|
|
@@ -67,61 +69,47 @@ The following algorithm is used to determine the list of commands for a particul
|
|
|
67
69
|
- botCommandScopeAllGroupChats
|
|
68
70
|
- botCommandScopeDefault + language_code
|
|
69
71
|
- botCommandScopeDefault */
|
|
70
|
-
export type BotCommandScope =
|
|
71
|
-
| BotCommandScopeDefault
|
|
72
|
-
| BotCommandScopeAllPrivateChats
|
|
73
|
-
| BotCommandScopeAllGroupChats
|
|
74
|
-
| BotCommandScopeAllChatAdministrators
|
|
75
|
-
| BotCommandScopeChat
|
|
76
|
-
| BotCommandScopeChatAdministrators
|
|
77
|
-
| BotCommandScopeChatMember;
|
|
78
|
-
|
|
72
|
+
export type BotCommandScope = BotCommandScopeDefault | BotCommandScopeAllPrivateChats | BotCommandScopeAllGroupChats | BotCommandScopeAllChatAdministrators | BotCommandScopeChat | BotCommandScopeChatAdministrators | BotCommandScopeChatMember;
|
|
79
73
|
/** Represents the default scope of bot commands. Default commands are used if no commands with a narrower scope are specified for the user. */
|
|
80
74
|
export interface BotCommandScopeDefault {
|
|
81
|
-
|
|
82
|
-
|
|
75
|
+
/** Scope type, must be default */
|
|
76
|
+
type: "default";
|
|
83
77
|
}
|
|
84
|
-
|
|
85
78
|
/** Represents the scope of bot commands, covering all private chats. */
|
|
86
79
|
export interface BotCommandScopeAllPrivateChats {
|
|
87
|
-
|
|
88
|
-
|
|
80
|
+
/** Scope type, must be all_private_chats */
|
|
81
|
+
type: "all_private_chats";
|
|
89
82
|
}
|
|
90
|
-
|
|
91
83
|
/** Represents the scope of bot commands, covering all group and supergroup chats. */
|
|
92
84
|
export interface BotCommandScopeAllGroupChats {
|
|
93
|
-
|
|
94
|
-
|
|
85
|
+
/** Scope type, must be all_group_chats */
|
|
86
|
+
type: "all_group_chats";
|
|
95
87
|
}
|
|
96
|
-
|
|
97
88
|
/** Represents the scope of bot commands, covering all group and supergroup chat administrators. */
|
|
98
89
|
export interface BotCommandScopeAllChatAdministrators {
|
|
99
|
-
|
|
100
|
-
|
|
90
|
+
/** Scope type, must be all_chat_administrators */
|
|
91
|
+
type: "all_chat_administrators";
|
|
101
92
|
}
|
|
102
|
-
|
|
103
93
|
/** Represents the scope of bot commands, covering a specific chat. */
|
|
104
94
|
export interface BotCommandScopeChat {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
95
|
+
/** Scope type, must be chat */
|
|
96
|
+
type: "chat";
|
|
97
|
+
/** Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) */
|
|
98
|
+
chat_id: number | string;
|
|
109
99
|
}
|
|
110
|
-
|
|
111
100
|
/** Represents the scope of bot commands, covering all administrators of a specific group or supergroup chat. */
|
|
112
101
|
export interface BotCommandScopeChatAdministrators {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
102
|
+
/** Scope type, must be chat_administrators */
|
|
103
|
+
type: "chat_administrators";
|
|
104
|
+
/** Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) */
|
|
105
|
+
chat_id: number | string;
|
|
117
106
|
}
|
|
118
|
-
|
|
119
107
|
/** Represents the scope of bot commands, covering a specific member of a group or supergroup chat. */
|
|
120
108
|
export interface BotCommandScopeChatMember {
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
109
|
+
/** Scope type, must be chat_member */
|
|
110
|
+
type: "chat_member";
|
|
111
|
+
/** Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) */
|
|
112
|
+
chat_id: number | string;
|
|
113
|
+
/** Unique identifier of the target user */
|
|
114
|
+
user_id: number;
|
|
127
115
|
}
|
package/update.d.ts
CHANGED
|
@@ -1,58 +1,56 @@
|
|
|
1
|
-
import { CallbackQuery } from "./markup";
|
|
2
|
-
import { ChosenInlineResult, InlineQuery } from "./inline";
|
|
3
|
-
import { Chat, ChatJoinRequest, ChatMemberUpdated, User } from "./manage";
|
|
4
|
-
import { Message, Poll, PollAnswer } from "./message";
|
|
5
|
-
import { PreCheckoutQuery, ShippingQuery } from "./payment";
|
|
6
|
-
|
|
1
|
+
import type { CallbackQuery } from "./markup.js";
|
|
2
|
+
import type { ChosenInlineResult, InlineQuery } from "./inline.js";
|
|
3
|
+
import type { Chat, ChatJoinRequest, ChatMemberUpdated, User } from "./manage.js";
|
|
4
|
+
import type { Message, Poll, PollAnswer } from "./message.js";
|
|
5
|
+
import type { PreCheckoutQuery, ShippingQuery } from "./payment.js";
|
|
7
6
|
/** Internal namespace used to make some message types more accurate */
|
|
8
|
-
export namespace Update {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
7
|
+
export declare namespace Update {
|
|
8
|
+
/** Internal type holding properties that message updates in channels share. */
|
|
9
|
+
interface Channel {
|
|
10
|
+
chat: Chat.ChannelChat;
|
|
11
|
+
}
|
|
12
|
+
/** Internal type holding properties that message updates outside of channels share. */
|
|
13
|
+
interface NonChannel {
|
|
14
|
+
chat: Exclude<Chat, Chat.ChannelChat>;
|
|
15
|
+
from: User;
|
|
16
|
+
}
|
|
17
|
+
/** Internal type holding properties that updates about edited messages share. */
|
|
18
|
+
interface Edited {
|
|
19
|
+
/** Date the message was last edited in Unix time */
|
|
20
|
+
edit_date: number;
|
|
21
|
+
}
|
|
23
22
|
}
|
|
24
|
-
|
|
25
23
|
/** This object represents an incoming update.
|
|
26
24
|
At most one of the optional parameters can be present in any given update. */
|
|
27
25
|
export interface Update {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
26
|
+
/** The update's unique identifier. Update identifiers start from a certain positive number and increase sequentially. This ID becomes especially handy if you're using webhooks, since it allows you to ignore repeated updates or to restore the correct update sequence, should they get out of order. If there are no new updates for at least a week, then identifier of the next update will be chosen randomly instead of sequentially. */
|
|
27
|
+
update_id: number;
|
|
28
|
+
/** New incoming message of any kind - text, photo, sticker, etc. */
|
|
29
|
+
message?: Message & Update.NonChannel;
|
|
30
|
+
/** New version of a message that is known to the bot and was edited */
|
|
31
|
+
edited_message?: Message & Update.Edited & Update.NonChannel;
|
|
32
|
+
/** New incoming channel post of any kind - text, photo, sticker, etc. */
|
|
33
|
+
channel_post?: Message & Update.Channel;
|
|
34
|
+
/** New version of a channel post that is known to the bot and was edited */
|
|
35
|
+
edited_channel_post?: Message & Update.Edited & Update.Channel;
|
|
36
|
+
/** New incoming inline query */
|
|
37
|
+
inline_query?: InlineQuery;
|
|
38
|
+
/** The result of an inline query that was chosen by a user and sent to their chat partner. Please see our documentation on the feedback collecting for details on how to enable these updates for your bot. */
|
|
39
|
+
chosen_inline_result?: ChosenInlineResult;
|
|
40
|
+
/** New incoming callback query */
|
|
41
|
+
callback_query?: CallbackQuery;
|
|
42
|
+
/** New incoming shipping query. Only for invoices with flexible price */
|
|
43
|
+
shipping_query?: ShippingQuery;
|
|
44
|
+
/** New incoming pre-checkout query. Contains full information about checkout */
|
|
45
|
+
pre_checkout_query?: PreCheckoutQuery;
|
|
46
|
+
/** New poll state. Bots receive only updates about stopped polls and polls, which are sent by the bot */
|
|
47
|
+
poll?: Poll;
|
|
48
|
+
/** A user changed their answer in a non-anonymous poll. Bots receive new votes only in polls that were sent by the bot itself. */
|
|
49
|
+
poll_answer?: PollAnswer;
|
|
50
|
+
/** The bot's chat member status was updated in a chat. For private chats, this update is received only when the bot is blocked or unblocked by the user. */
|
|
51
|
+
my_chat_member?: ChatMemberUpdated;
|
|
52
|
+
/** A chat member's status was updated in a chat. 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. */
|
|
53
|
+
chat_member?: ChatMemberUpdated;
|
|
54
|
+
/** A request to join the chat has been sent. The bot must have the can_invite_users administrator right in the chat to receive these updates. */
|
|
55
|
+
chat_join_request?: ChatJoinRequest;
|
|
58
56
|
}
|
package/.editorconfig
DELETED
package/deno.jsonc
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{ "fmt": { "options": { "indentWidth": 2, "proseWrap": "preserve" } } }
|
package/index.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export * from "./api";
|
|
2
|
-
export * from "./inline";
|
|
3
|
-
export * from "./manage";
|
|
4
|
-
export * from "./markup";
|
|
5
|
-
export * from "./menu-button";
|
|
6
|
-
export * from "./message";
|
|
7
|
-
export * from "./passport";
|
|
8
|
-
export * from "./payment";
|
|
9
|
-
export * from "./proxied";
|
|
10
|
-
export * from "./update";
|