grammy 1.39.2 → 1.40.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 +3 -1
- package/out/context.d.ts +12 -4
- package/out/context.js +12 -2
- package/out/convenience/keyboard.d.ts +184 -68
- package/out/convenience/keyboard.js +286 -66
- package/out/convenience/webhook.js +42 -1
- package/out/core/api.d.ts +30 -3
- package/out/core/api.js +34 -1
- package/out/core/client.js +2 -1
- package/out/core/payload.js +18 -15
- package/out/filter.d.ts +16 -0
- package/out/filter.js +2 -0
- package/out/types.node.d.ts +1 -0
- package/out/types.node.js +3 -0
- package/out/web.mjs +243 -52
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
<!-- deno-fmt-ignore-start -->
|
|
12
12
|
|
|
13
|
-
[](https://core.telegram.org/bots/api)
|
|
14
14
|
[](https://deno.land/x/grammy)
|
|
15
15
|
[](https://www.npmjs.org/package/grammy)
|
|
16
16
|
[](#contributors-)
|
|
@@ -332,6 +332,8 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
|
|
|
332
332
|
<td align="center" valign="top" width="11.11%"><a href="https://github.com/OfficialCodinary"><img src="https://avatars.githubusercontent.com/u/133005277?v=4?s=100" width="100px;" alt="Codinary"/><br /><sub><b>Codinary</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/pulls?q=is%3Apr+reviewed-by%3AOfficialCodinary" title="Reviewed Pull Requests">👀</a></td>
|
|
333
333
|
<td align="center" valign="top" width="11.11%"><a href="https://github.com/dotvhs"><img src="https://avatars.githubusercontent.com/u/681416?v=4?s=100" width="100px;" alt=".vhs"/><br /><sub><b>.vhs</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/issues?q=author%3Adotvhs" title="Bug reports">🐛</a> <a href="https://github.com/grammyjs/grammY/pulls?q=is%3Apr+reviewed-by%3Adotvhs" title="Reviewed Pull Requests">👀</a></td>
|
|
334
334
|
<td align="center" valign="top" width="11.11%"><a href="https://agou.im/"><img src="https://avatars.githubusercontent.com/u/55237525?v=4?s=100" width="100px;" alt="agoudbg"/><br /><sub><b>agoudbg</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/issues?q=author%3Aagoudbg" title="Bug reports">🐛</a> <a href="https://github.com/grammyjs/grammY/commits?author=agoudbg" title="Code">💻</a></td>
|
|
335
|
+
<td align="center" valign="top" width="11.11%"><a href="https://github.com/arunr-inji"><img src="https://avatars.githubusercontent.com/u/5071242?v=4?s=100" width="100px;" alt="ArunR"/><br /><sub><b>ArunR</b></sub></a><br /><a href="#ideas-arunr-inji" title="Ideas, Planning, & Feedback">🤔</a> <a href="https://github.com/grammyjs/grammY/commits?author=arunr-inji" title="Code">💻</a> <a href="https://github.com/grammyjs/grammY/commits?author=arunr-inji" title="Tests">⚠️</a></td>
|
|
336
|
+
<td align="center" valign="top" width="11.11%"><a href="https://github.com/crwnd"><img src="https://avatars.githubusercontent.com/u/97118277?v=4?s=100" width="100px;" alt="A"/><br /><sub><b>A</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/issues?q=author%3Acrwnd" title="Bug reports">🐛</a> <a href="https://github.com/grammyjs/grammY/pulls?q=is%3Apr+reviewed-by%3Acrwnd" title="Reviewed Pull Requests">👀</a></td>
|
|
335
337
|
</tr>
|
|
336
338
|
</tbody>
|
|
337
339
|
</table>
|
package/out/context.d.ts
CHANGED
|
@@ -745,13 +745,21 @@ export declare class Context implements RenamedUpdate {
|
|
|
745
745
|
/**
|
|
746
746
|
* Context-aware alias for `api.getUserProfilePhotos`. Use this method to get a list of profile pictures for a user. Returns a UserProfilePhotos object.
|
|
747
747
|
*
|
|
748
|
-
* @param user_id Unique identifier of the target user
|
|
749
748
|
* @param other Optional remaining parameters, confer the official reference below
|
|
750
749
|
* @param signal Optional `AbortSignal` to cancel the request
|
|
751
750
|
*
|
|
752
751
|
* **Official reference:** https://core.telegram.org/bots/api#getuserprofilephotos
|
|
753
752
|
*/
|
|
754
753
|
getUserProfilePhotos(other?: Other<"getUserProfilePhotos", "user_id">, signal?: AbortSignal): Promise<import("@grammyjs/types/manage.js").UserProfilePhotos>;
|
|
754
|
+
/**
|
|
755
|
+
* Context-aware alias for `api.getUserProfileAudios`. Use this method to get a list of profile audios for a user. Returns a UserProfileAudios object.
|
|
756
|
+
*
|
|
757
|
+
* @param other Optional remaining parameters, confer the official reference below
|
|
758
|
+
* @param signal Optional `AbortSignal` to cancel the request
|
|
759
|
+
*
|
|
760
|
+
* **Official reference:** https://core.telegram.org/bots/api#getuserprofileaudios
|
|
761
|
+
*/
|
|
762
|
+
getUserProfileAudios(other?: Other<"getUserProfileAudios", "user_id">, signal?: AbortSignal): Promise<import("@grammyjs/types/manage.js").UserProfileAudios>;
|
|
755
763
|
/**
|
|
756
764
|
* Context-aware alias for `api.serUserEmojiStatus`. Changes the emoji status for a given user that previously allowed the bot to manage their emoji status via the Mini App method requestEmojiStatusAccess. Returns True on success.
|
|
757
765
|
*
|
|
@@ -1152,7 +1160,7 @@ export declare class Context implements RenamedUpdate {
|
|
|
1152
1160
|
*/
|
|
1153
1161
|
deleteChatStickerSet(signal?: AbortSignal): Promise<true>;
|
|
1154
1162
|
/**
|
|
1155
|
-
* Context-aware alias for `api.createForumTopic`. Use this method to create a topic in a forum supergroup chat.
|
|
1163
|
+
* Context-aware alias for `api.createForumTopic`. Use this method to create a topic in a forum supergroup chat or a private chat with a user. In the case of a supergroup chat the bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator right. Returns information about the created topic as a ForumTopic object.
|
|
1156
1164
|
*
|
|
1157
1165
|
* @param name Topic name, 1-128 characters
|
|
1158
1166
|
* @param other Optional remaining parameters, confer the official reference below
|
|
@@ -1565,7 +1573,7 @@ export declare class Context implements RenamedUpdate {
|
|
|
1565
1573
|
*
|
|
1566
1574
|
* **Official reference:** https://core.telegram.org/bots/api#sendgift
|
|
1567
1575
|
*/
|
|
1568
|
-
replyWithGift(gift_id: string, other?: Other<"sendGift", "user_id" | "chat_id" | "gift_id">, signal?: AbortSignal): Promise<
|
|
1576
|
+
replyWithGift(gift_id: string, other?: Other<"sendGift", "user_id" | "chat_id" | "gift_id">, signal?: AbortSignal): Promise<true>;
|
|
1569
1577
|
/**
|
|
1570
1578
|
* Context-aware alias for `api.giftPremiumSubscription`. Gifts a Telegram Premium subscription to the given user. Returns True on success.
|
|
1571
1579
|
*
|
|
@@ -1586,7 +1594,7 @@ export declare class Context implements RenamedUpdate {
|
|
|
1586
1594
|
*
|
|
1587
1595
|
* **Official reference:** https://core.telegram.org/bots/api#sendgift
|
|
1588
1596
|
*/
|
|
1589
|
-
replyWithGiftToChannel(gift_id: string, other?: Other<"sendGift", "user_id" | "chat_id" | "gift_id">, signal?: AbortSignal): Promise<
|
|
1597
|
+
replyWithGiftToChannel(gift_id: string, other?: Other<"sendGift", "user_id" | "chat_id" | "gift_id">, signal?: AbortSignal): Promise<true>;
|
|
1590
1598
|
/**
|
|
1591
1599
|
* Context-aware alias for `api.answerInlineQuery`. Use this method to send answers to an inline query. On success, True is returned.
|
|
1592
1600
|
* No more than 50 results per query are allowed.
|
package/out/context.js
CHANGED
|
@@ -1165,7 +1165,6 @@ class Context {
|
|
|
1165
1165
|
/**
|
|
1166
1166
|
* Context-aware alias for `api.getUserProfilePhotos`. Use this method to get a list of profile pictures for a user. Returns a UserProfilePhotos object.
|
|
1167
1167
|
*
|
|
1168
|
-
* @param user_id Unique identifier of the target user
|
|
1169
1168
|
* @param other Optional remaining parameters, confer the official reference below
|
|
1170
1169
|
* @param signal Optional `AbortSignal` to cancel the request
|
|
1171
1170
|
*
|
|
@@ -1174,6 +1173,17 @@ class Context {
|
|
|
1174
1173
|
getUserProfilePhotos(other, signal) {
|
|
1175
1174
|
return this.api.getUserProfilePhotos(orThrow(this.from, "getUserProfilePhotos").id, other, signal);
|
|
1176
1175
|
}
|
|
1176
|
+
/**
|
|
1177
|
+
* Context-aware alias for `api.getUserProfileAudios`. Use this method to get a list of profile audios for a user. Returns a UserProfileAudios object.
|
|
1178
|
+
*
|
|
1179
|
+
* @param other Optional remaining parameters, confer the official reference below
|
|
1180
|
+
* @param signal Optional `AbortSignal` to cancel the request
|
|
1181
|
+
*
|
|
1182
|
+
* **Official reference:** https://core.telegram.org/bots/api#getuserprofileaudios
|
|
1183
|
+
*/
|
|
1184
|
+
getUserProfileAudios(other, signal) {
|
|
1185
|
+
return this.api.getUserProfileAudios(orThrow(this.from, "getUserProfileAudios").id, other, signal);
|
|
1186
|
+
}
|
|
1177
1187
|
/**
|
|
1178
1188
|
* Context-aware alias for `api.serUserEmojiStatus`. Changes the emoji status for a given user that previously allowed the bot to manage their emoji status via the Mini App method requestEmojiStatusAccess. Returns True on success.
|
|
1179
1189
|
*
|
|
@@ -1671,7 +1681,7 @@ class Context {
|
|
|
1671
1681
|
return this.api.deleteChatStickerSet(orThrow(this.chatId, "deleteChatStickerSet"), signal);
|
|
1672
1682
|
}
|
|
1673
1683
|
/**
|
|
1674
|
-
* Context-aware alias for `api.createForumTopic`. Use this method to create a topic in a forum supergroup chat.
|
|
1684
|
+
* Context-aware alias for `api.createForumTopic`. Use this method to create a topic in a forum supergroup chat or a private chat with a user. In the case of a supergroup chat the bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator right. Returns information about the created topic as a ForumTopic object.
|
|
1675
1685
|
*
|
|
1676
1686
|
* @param name Topic name, 1-128 characters
|
|
1677
1687
|
* @param other Optional remaining parameters, confer the official reference below
|
|
@@ -98,127 +98,186 @@ export declare class Keyboard {
|
|
|
98
98
|
* Adds a new text button. This button will simply send the given text as a
|
|
99
99
|
* text message back to your bot if a user clicks on it.
|
|
100
100
|
*
|
|
101
|
-
* @param text The text to display
|
|
101
|
+
* @param text The text to display, and optional styling information
|
|
102
|
+
* @param options Optional styling information
|
|
102
103
|
*/
|
|
103
|
-
text(text: string): this;
|
|
104
|
+
text(text: string, options?: KeyboardButton.CommonButton["style"] | Omit<KeyboardButton.CommonButton, "text">): this;
|
|
104
105
|
/**
|
|
105
106
|
* Creates a new text button. This button will simply send the given text as
|
|
106
107
|
* a text message back to your bot if a user clicks on it.
|
|
107
108
|
*
|
|
108
|
-
* @param text The text to display
|
|
109
|
+
* @param text The text to display, and optional styling information
|
|
110
|
+
* @param options Optional styling information
|
|
109
111
|
*/
|
|
110
|
-
static text(text: string): KeyboardButton.CommonButton;
|
|
112
|
+
static text(text: string, options?: KeyboardButton.CommonButton["style"] | Omit<KeyboardButton.CommonButton, "text">): KeyboardButton.CommonButton;
|
|
111
113
|
/**
|
|
112
114
|
* Adds a new request users button. When the user presses the button, a list
|
|
113
115
|
* of suitable users will be opened. Tapping on any number of users will
|
|
114
116
|
* send their identifiers to the bot in a “users_shared” service message.
|
|
115
117
|
* Available in private chats only.
|
|
116
118
|
*
|
|
117
|
-
* @param text The text to display
|
|
119
|
+
* @param text The text to display, and optional styling information
|
|
118
120
|
* @param requestId A signed 32-bit identifier of the request
|
|
119
121
|
* @param options Options object for further requirements
|
|
120
122
|
*/
|
|
121
|
-
requestUsers(text: string, requestId: number, options?: Omit<KeyboardButtonRequestUsers, "request_id">): this;
|
|
123
|
+
requestUsers(text: string | KeyboardButton.CommonButton, requestId: number, options?: Omit<KeyboardButtonRequestUsers, "request_id">): this;
|
|
122
124
|
/**
|
|
123
125
|
* Creates a new request users button. When the user presses the button, a
|
|
124
126
|
* list of suitable users will be opened. Tapping on any number of users
|
|
125
127
|
* will send their identifiers to the bot in a “users_shared” service
|
|
126
128
|
* message. Available in private chats only.
|
|
127
129
|
*
|
|
128
|
-
* @param text The text to display
|
|
130
|
+
* @param text The text to display, and optional styling information
|
|
129
131
|
* @param requestId A signed 32-bit identifier of the request
|
|
130
132
|
* @param options Options object for further requirements
|
|
131
133
|
*/
|
|
132
|
-
static requestUsers(text: string, requestId: number, options?: Omit<KeyboardButtonRequestUsers, "request_id">): KeyboardButton.RequestUsersButton;
|
|
134
|
+
static requestUsers(text: string | KeyboardButton.CommonButton, requestId: number, options?: Omit<KeyboardButtonRequestUsers, "request_id">): KeyboardButton.RequestUsersButton;
|
|
133
135
|
/**
|
|
134
136
|
* Adds a new request chat button. When the user presses the button, a list
|
|
135
137
|
* of suitable users will be opened. Tapping on a chat will send its
|
|
136
138
|
* identifier to the bot in a “chat_shared” service message. Available in
|
|
137
139
|
* private chats only.
|
|
138
140
|
*
|
|
139
|
-
* @param text The text to display
|
|
141
|
+
* @param text The text to display, and optional styling information
|
|
140
142
|
* @param requestId A signed 32-bit identifier of the request
|
|
141
143
|
* @param options Options object for further requirements
|
|
142
144
|
*/
|
|
143
|
-
requestChat(text: string, requestId: number, options?: Omit<KeyboardButtonRequestChat, "request_id">): this;
|
|
145
|
+
requestChat(text: string | KeyboardButton.CommonButton, requestId: number, options?: Omit<KeyboardButtonRequestChat, "request_id">): this;
|
|
144
146
|
/**
|
|
145
147
|
* Creates a new request chat button. When the user presses the button, a
|
|
146
148
|
* list of suitable users will be opened. Tapping on a chat will send its
|
|
147
149
|
* identifier to the bot in a “chat_shared” service message. Available in
|
|
148
150
|
* private chats only.
|
|
149
151
|
*
|
|
150
|
-
* @param text The text to display
|
|
152
|
+
* @param text The text to display, and optional styling information
|
|
151
153
|
* @param requestId A signed 32-bit identifier of the request
|
|
152
154
|
* @param options Options object for further requirements
|
|
153
155
|
*/
|
|
154
|
-
static requestChat(text: string, requestId: number, options?: Omit<KeyboardButtonRequestChat, "request_id">): KeyboardButton.RequestChatButton;
|
|
156
|
+
static requestChat(text: string | KeyboardButton.CommonButton, requestId: number, options?: Omit<KeyboardButtonRequestChat, "request_id">): KeyboardButton.RequestChatButton;
|
|
155
157
|
/**
|
|
156
158
|
* Adds a new contact request button. The user's phone number will be sent
|
|
157
159
|
* as a contact when the button is pressed. Available in private chats only.
|
|
158
160
|
*
|
|
159
|
-
* @param text The text to display
|
|
161
|
+
* @param text The text to display, and optional styling information
|
|
160
162
|
*/
|
|
161
|
-
requestContact(text: string): this;
|
|
163
|
+
requestContact(text: string | KeyboardButton.CommonButton): this;
|
|
162
164
|
/**
|
|
163
165
|
* Creates a new contact request button. The user's phone number will be
|
|
164
166
|
* sent as a contact when the button is pressed. Available in private chats
|
|
165
167
|
* only.
|
|
166
168
|
*
|
|
167
|
-
* @param text The text to display
|
|
169
|
+
* @param text The text to display, and optional styling information
|
|
168
170
|
*/
|
|
169
|
-
static requestContact(text: string): KeyboardButton.RequestContactButton;
|
|
171
|
+
static requestContact(text: string | KeyboardButton.CommonButton): KeyboardButton.RequestContactButton;
|
|
170
172
|
/**
|
|
171
173
|
* Adds a new location request button. The user's current location will be
|
|
172
174
|
* sent when the button is pressed. Available in private chats only.
|
|
173
175
|
*
|
|
174
|
-
* @param text The text to display
|
|
176
|
+
* @param text The text to display, and optional styling information
|
|
175
177
|
*/
|
|
176
|
-
requestLocation(text: string): this;
|
|
178
|
+
requestLocation(text: string | KeyboardButton.CommonButton): this;
|
|
177
179
|
/**
|
|
178
180
|
* Creates a new location request button. The user's current location will
|
|
179
181
|
* be sent when the button is pressed. Available in private chats only.
|
|
180
182
|
*
|
|
181
|
-
* @param text The text to display
|
|
183
|
+
* @param text The text to display, and optional styling information
|
|
182
184
|
*/
|
|
183
|
-
static requestLocation(text: string): KeyboardButton.RequestLocationButton;
|
|
185
|
+
static requestLocation(text: string | KeyboardButton.CommonButton): KeyboardButton.RequestLocationButton;
|
|
184
186
|
/**
|
|
185
187
|
* Adds a new poll request button. The user will be asked to create a poll
|
|
186
188
|
* and send it to the bot when the button is pressed. Available in private
|
|
187
189
|
* chats only.
|
|
188
190
|
*
|
|
189
|
-
* @param text The text to display
|
|
191
|
+
* @param text The text to display, and optional styling information
|
|
190
192
|
* @param type The type of permitted polls to create, omit if the user may
|
|
191
193
|
* send a poll of any type
|
|
192
194
|
*/
|
|
193
|
-
requestPoll(text: string, type?: KeyboardButtonPollType["type"]): this;
|
|
195
|
+
requestPoll(text: string | KeyboardButton.CommonButton, type?: KeyboardButtonPollType["type"]): this;
|
|
194
196
|
/**
|
|
195
197
|
* Creates a new poll request button. The user will be asked to create a
|
|
196
198
|
* poll and send it to the bot when the button is pressed. Available in
|
|
197
199
|
* private chats only.
|
|
198
200
|
*
|
|
199
|
-
* @param text The text to display
|
|
201
|
+
* @param text The text to display, and optional styling information
|
|
200
202
|
* @param type The type of permitted polls to create, omit if the user may
|
|
201
203
|
* send a poll of any type
|
|
202
204
|
*/
|
|
203
|
-
static requestPoll(text: string, type?: KeyboardButtonPollType["type"]): KeyboardButton.RequestPollButton;
|
|
205
|
+
static requestPoll(text: string | KeyboardButton.CommonButton, type?: KeyboardButtonPollType["type"]): KeyboardButton.RequestPollButton;
|
|
204
206
|
/**
|
|
205
207
|
* Adds a new web app button. The Web App that will be launched when the
|
|
206
208
|
* user presses the button. The Web App will be able to send a
|
|
207
209
|
* “web_app_data” service message. Available in private chats only.
|
|
208
210
|
*
|
|
209
|
-
* @param text The text to display
|
|
211
|
+
* @param text The text to display, and optional styling information
|
|
210
212
|
* @param url An HTTPS URL of a Web App to be opened with additional data
|
|
211
213
|
*/
|
|
212
|
-
webApp(text: string, url: string): this;
|
|
214
|
+
webApp(text: string | KeyboardButton.CommonButton, url: string): this;
|
|
213
215
|
/**
|
|
214
216
|
* Creates a new web app button. The Web App that will be launched when the
|
|
215
217
|
* user presses the button. The Web App will be able to send a
|
|
216
218
|
* “web_app_data” service message. Available in private chats only.
|
|
217
219
|
*
|
|
218
|
-
* @param text The text to display
|
|
220
|
+
* @param text The text to display, and optional styling information
|
|
219
221
|
* @param url An HTTPS URL of a Web App to be opened with additional data
|
|
220
222
|
*/
|
|
221
|
-
static webApp(text: string, url: string): KeyboardButton.WebAppButton;
|
|
223
|
+
static webApp(text: string | KeyboardButton.CommonButton, url: string): KeyboardButton.WebAppButton;
|
|
224
|
+
/**
|
|
225
|
+
* Adds a style to the last added button of the keyboard.
|
|
226
|
+
*
|
|
227
|
+
* ```ts
|
|
228
|
+
* const keyboard = new Keyboard()
|
|
229
|
+
* .text('blue button')
|
|
230
|
+
* .style('primary')
|
|
231
|
+
* ```
|
|
232
|
+
*
|
|
233
|
+
* @param style Style of the button
|
|
234
|
+
*/
|
|
235
|
+
style(style: KeyboardButton.CommonButton["style"]): this;
|
|
236
|
+
/**
|
|
237
|
+
* Adds a danger style to the last added button of the keyboard. Alias for
|
|
238
|
+
* `.style('danger')`.
|
|
239
|
+
*
|
|
240
|
+
* ```ts
|
|
241
|
+
* const keyboard = new Keyboard()
|
|
242
|
+
* .text('red button')
|
|
243
|
+
* .danger()
|
|
244
|
+
* ```
|
|
245
|
+
*/
|
|
246
|
+
danger(): this;
|
|
247
|
+
/**
|
|
248
|
+
* Adds a success style to the last added button of the keyboard. Alias for
|
|
249
|
+
* `.style('success')`.
|
|
250
|
+
*
|
|
251
|
+
* ```ts
|
|
252
|
+
* const keyboard = new Keyboard()
|
|
253
|
+
* .text('green button')
|
|
254
|
+
* .success()
|
|
255
|
+
* ```
|
|
256
|
+
*/
|
|
257
|
+
success(): this;
|
|
258
|
+
/**
|
|
259
|
+
* Adds a primary style to the last added button of the keyboard. Alias for
|
|
260
|
+
* `.style('primary')`.
|
|
261
|
+
*
|
|
262
|
+
* ```ts
|
|
263
|
+
* const keyboard = new Keyboard()
|
|
264
|
+
* .text('blue button')
|
|
265
|
+
* .primary()
|
|
266
|
+
* ```
|
|
267
|
+
*/
|
|
268
|
+
primary(): this;
|
|
269
|
+
/**
|
|
270
|
+
* Adds a custom emoji icon to the last added button of the keyboard.
|
|
271
|
+
*
|
|
272
|
+
* ```ts
|
|
273
|
+
* const keyboard = new Keyboard()
|
|
274
|
+
* .text('button with icon')
|
|
275
|
+
* .icon(myCustomEmojiIconIdentifier)
|
|
276
|
+
* ```
|
|
277
|
+
*
|
|
278
|
+
* @param icon Unique identifier of the custom emoji shown before the text of the button
|
|
279
|
+
*/
|
|
280
|
+
icon(icon: KeyboardButton.CommonButton["icon_custom_emoji_id"]): this;
|
|
222
281
|
/**
|
|
223
282
|
* Make the current keyboard persistent. See
|
|
224
283
|
* https://grammy.dev/plugins/keyboard#persistent-keyboards for more
|
|
@@ -438,18 +497,18 @@ export declare class InlineKeyboard {
|
|
|
438
497
|
* Adds a new URL button. Telegram clients will open the provided URL when
|
|
439
498
|
* the button is pressed.
|
|
440
499
|
*
|
|
441
|
-
* @param text The text to display
|
|
500
|
+
* @param text The text to display, and optional styling information
|
|
442
501
|
* @param url 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.
|
|
443
502
|
*/
|
|
444
|
-
url(text: string, url: string): this;
|
|
503
|
+
url(text: string | InlineKeyboardButton.AbstractInlineKeyboardButton, url: string): this;
|
|
445
504
|
/**
|
|
446
505
|
* Creates a new URL button. Telegram clients will open the provided URL
|
|
447
506
|
* when the button is pressed.
|
|
448
507
|
*
|
|
449
|
-
* @param text The text to display
|
|
508
|
+
* @param text The text to display, and optional styling information
|
|
450
509
|
* @param url 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.
|
|
451
510
|
*/
|
|
452
|
-
static url(text: string, url: string): InlineKeyboardButton.UrlButton;
|
|
511
|
+
static url(text: string | InlineKeyboardButton.AbstractInlineKeyboardButton, url: string): InlineKeyboardButton.UrlButton;
|
|
453
512
|
/**
|
|
454
513
|
* Adds a new callback query button. The button contains a text and a custom
|
|
455
514
|
* payload. This payload will be sent back to your bot when the button is
|
|
@@ -465,10 +524,10 @@ export declare class InlineKeyboard {
|
|
|
465
524
|
* bot.on('callback_query:data', ctx => { ... })
|
|
466
525
|
* ```
|
|
467
526
|
*
|
|
468
|
-
* @param text The text to display
|
|
527
|
+
* @param text The text to display, and optional styling information
|
|
469
528
|
* @param data The callback data to send back to your bot (default = text)
|
|
470
529
|
*/
|
|
471
|
-
text(text: string, data?: string): this;
|
|
530
|
+
text(text: string | InlineKeyboardButton.AbstractInlineKeyboardButton, data?: string): this;
|
|
472
531
|
/**
|
|
473
532
|
* Creates a new callback query button. The button contains a text and a
|
|
474
533
|
* custom payload. This payload will be sent back to your bot when the
|
|
@@ -484,42 +543,42 @@ export declare class InlineKeyboard {
|
|
|
484
543
|
* bot.on('callback_query:data', ctx => { ... })
|
|
485
544
|
* ```
|
|
486
545
|
*
|
|
487
|
-
* @param text The text to display
|
|
546
|
+
* @param text The text to display, and optional styling information
|
|
488
547
|
* @param data The callback data to send back to your bot (default = text)
|
|
489
548
|
*/
|
|
490
|
-
static text(text: string, data?: string): InlineKeyboardButton.CallbackButton;
|
|
549
|
+
static text(text: string | InlineKeyboardButton.AbstractInlineKeyboardButton, data?: string): InlineKeyboardButton.CallbackButton;
|
|
491
550
|
/**
|
|
492
551
|
* Adds a new web app button, confer https://core.telegram.org/bots/webapps
|
|
493
552
|
*
|
|
494
|
-
* @param text The text to display
|
|
553
|
+
* @param text The text to display, and optional styling information
|
|
495
554
|
* @param url An HTTPS URL of a Web App to be opened with additional data
|
|
496
555
|
*/
|
|
497
|
-
webApp(text: string, url: string | WebAppInfo): this;
|
|
556
|
+
webApp(text: string | InlineKeyboardButton.AbstractInlineKeyboardButton, url: string | WebAppInfo): this;
|
|
498
557
|
/**
|
|
499
558
|
* Creates a new web app button, confer https://core.telegram.org/bots/webapps
|
|
500
559
|
*
|
|
501
|
-
* @param text The text to display
|
|
560
|
+
* @param text The text to display, and optional styling information
|
|
502
561
|
* @param url An HTTPS URL of a Web App to be opened with additional data
|
|
503
562
|
*/
|
|
504
|
-
static webApp(text: string, url: string | WebAppInfo): InlineKeyboardButton.WebAppButton;
|
|
563
|
+
static webApp(text: string | InlineKeyboardButton.AbstractInlineKeyboardButton, url: string | WebAppInfo): InlineKeyboardButton.WebAppButton;
|
|
505
564
|
/**
|
|
506
565
|
* Adds a new login button. This can be used as a replacement for the
|
|
507
566
|
* Telegram Login Widget. You must specify an HTTPS URL used to
|
|
508
567
|
* automatically authorize the user.
|
|
509
568
|
*
|
|
510
|
-
* @param text The text to display
|
|
569
|
+
* @param text The text to display, and optional styling information
|
|
511
570
|
* @param loginUrl The login URL as string or `LoginUrl` object
|
|
512
571
|
*/
|
|
513
|
-
login(text: string, loginUrl: string | LoginUrl): this;
|
|
572
|
+
login(text: string | InlineKeyboardButton.AbstractInlineKeyboardButton, loginUrl: string | LoginUrl): this;
|
|
514
573
|
/**
|
|
515
574
|
* Creates a new login button. This can be used as a replacement for the
|
|
516
575
|
* Telegram Login Widget. You must specify an HTTPS URL used to
|
|
517
576
|
* automatically authorize the user.
|
|
518
577
|
*
|
|
519
|
-
* @param text The text to display
|
|
578
|
+
* @param text The text to display, and optional styling information
|
|
520
579
|
* @param loginUrl The login URL as string or `LoginUrl` object
|
|
521
580
|
*/
|
|
522
|
-
static login(text: string, loginUrl: string | LoginUrl): InlineKeyboardButton.LoginButton;
|
|
581
|
+
static login(text: string | InlineKeyboardButton.AbstractInlineKeyboardButton, loginUrl: string | LoginUrl): InlineKeyboardButton.LoginButton;
|
|
523
582
|
/**
|
|
524
583
|
* Adds a new inline query button. Telegram clients will let the user pick a
|
|
525
584
|
* chat when this button is pressed. This will start an inline query. The
|
|
@@ -532,10 +591,10 @@ export declare class InlineKeyboard {
|
|
|
532
591
|
* bot.on('inline_query', ctx => { ... })
|
|
533
592
|
* ```
|
|
534
593
|
*
|
|
535
|
-
* @param text The text to display
|
|
594
|
+
* @param text The text to display, and optional styling information
|
|
536
595
|
* @param query The (optional) inline query string to prefill
|
|
537
596
|
*/
|
|
538
|
-
switchInline(text: string, query?: string): this;
|
|
597
|
+
switchInline(text: string | InlineKeyboardButton.AbstractInlineKeyboardButton, query?: string): this;
|
|
539
598
|
/**
|
|
540
599
|
* Creates a new inline query button. Telegram clients will let the user pick a
|
|
541
600
|
* chat when this button is pressed. This will start an inline query. The
|
|
@@ -548,10 +607,10 @@ export declare class InlineKeyboard {
|
|
|
548
607
|
* bot.on('inline_query', ctx => { ... })
|
|
549
608
|
* ```
|
|
550
609
|
*
|
|
551
|
-
* @param text The text to display
|
|
610
|
+
* @param text The text to display, and optional styling information
|
|
552
611
|
* @param query The (optional) inline query string to prefill
|
|
553
612
|
*/
|
|
554
|
-
static switchInline(text: string, query?: string): InlineKeyboardButton.SwitchInlineButton;
|
|
613
|
+
static switchInline(text: string | InlineKeyboardButton.AbstractInlineKeyboardButton, query?: string): InlineKeyboardButton.SwitchInlineButton;
|
|
555
614
|
/**
|
|
556
615
|
* Adds a new inline query button that acts on the current chat. The
|
|
557
616
|
* selected chat will be prefilled with the name of your bot. You may
|
|
@@ -564,10 +623,10 @@ export declare class InlineKeyboard {
|
|
|
564
623
|
* bot.on('inline_query', ctx => { ... })
|
|
565
624
|
* ```
|
|
566
625
|
*
|
|
567
|
-
* @param text The text to display
|
|
626
|
+
* @param text The text to display, and optional styling information
|
|
568
627
|
* @param query The (optional) inline query string to prefill
|
|
569
628
|
*/
|
|
570
|
-
switchInlineCurrent(text: string, query?: string): this;
|
|
629
|
+
switchInlineCurrent(text: string | InlineKeyboardButton.AbstractInlineKeyboardButton, query?: string): this;
|
|
571
630
|
/**
|
|
572
631
|
* Creates a new inline query button that acts on the current chat. The
|
|
573
632
|
* selected chat will be prefilled with the name of your bot. You may
|
|
@@ -580,10 +639,10 @@ export declare class InlineKeyboard {
|
|
|
580
639
|
* bot.on('inline_query', ctx => { ... })
|
|
581
640
|
* ```
|
|
582
641
|
*
|
|
583
|
-
* @param text The text to display
|
|
642
|
+
* @param text The text to display, and optional styling information
|
|
584
643
|
* @param query The (optional) inline query string to prefill
|
|
585
644
|
*/
|
|
586
|
-
static switchInlineCurrent(text: string, query?: string): InlineKeyboardButton.SwitchInlineCurrentChatButton;
|
|
645
|
+
static switchInlineCurrent(text: string | InlineKeyboardButton.AbstractInlineKeyboardButton, query?: string): InlineKeyboardButton.SwitchInlineCurrentChatButton;
|
|
587
646
|
/**
|
|
588
647
|
* Adds a new inline query button. Telegram clients will let the user pick a
|
|
589
648
|
* chat when this button is pressed. This will start an inline query. The
|
|
@@ -596,10 +655,10 @@ export declare class InlineKeyboard {
|
|
|
596
655
|
* bot.on('inline_query', ctx => { ... })
|
|
597
656
|
* ```
|
|
598
657
|
*
|
|
599
|
-
* @param text The text to display
|
|
658
|
+
* @param text The text to display, and optional styling information
|
|
600
659
|
* @param query The query object describing which chats can be picked
|
|
601
660
|
*/
|
|
602
|
-
switchInlineChosen(text: string, query?: SwitchInlineQueryChosenChat): this;
|
|
661
|
+
switchInlineChosen(text: string | InlineKeyboardButton.AbstractInlineKeyboardButton, query?: SwitchInlineQueryChosenChat): this;
|
|
603
662
|
/**
|
|
604
663
|
* Creates a new inline query button. Telegram clients will let the user pick a
|
|
605
664
|
* chat when this button is pressed. This will start an inline query. The
|
|
@@ -612,44 +671,44 @@ export declare class InlineKeyboard {
|
|
|
612
671
|
* bot.on('inline_query', ctx => { ... })
|
|
613
672
|
* ```
|
|
614
673
|
*
|
|
615
|
-
* @param text The text to display
|
|
674
|
+
* @param text The text to display, and optional styling information
|
|
616
675
|
* @param query The query object describing which chats can be picked
|
|
617
676
|
*/
|
|
618
|
-
static switchInlineChosen(text: string, query?: SwitchInlineQueryChosenChat): InlineKeyboardButton.SwitchInlineChosenChatButton;
|
|
677
|
+
static switchInlineChosen(text: string | InlineKeyboardButton.AbstractInlineKeyboardButton, query?: SwitchInlineQueryChosenChat): InlineKeyboardButton.SwitchInlineChosenChatButton;
|
|
619
678
|
/**
|
|
620
679
|
* Adds a new copy text button. When clicked, the specified text will be
|
|
621
680
|
* copied to the clipboard.
|
|
622
681
|
*
|
|
623
|
-
* @param text The text to display
|
|
682
|
+
* @param text The text to display, and optional styling information
|
|
624
683
|
* @param copyText The text to be copied to the clipboard
|
|
625
684
|
*/
|
|
626
|
-
copyText(text: string, copyText: string | CopyTextButton): this;
|
|
685
|
+
copyText(text: string | InlineKeyboardButton.AbstractInlineKeyboardButton, copyText: string | CopyTextButton): this;
|
|
627
686
|
/**
|
|
628
687
|
* Creates a new copy text button. When clicked, the specified text will be
|
|
629
688
|
* copied to the clipboard.
|
|
630
689
|
*
|
|
631
|
-
* @param text The text to display
|
|
690
|
+
* @param text The text to display, and optional styling information
|
|
632
691
|
* @param copyText The text to be copied to the clipboard
|
|
633
692
|
*/
|
|
634
|
-
static copyText(text: string, copyText: string | CopyTextButton): InlineKeyboardButton.CopyTextButtonButton;
|
|
693
|
+
static copyText(text: string | InlineKeyboardButton.AbstractInlineKeyboardButton, copyText: string | CopyTextButton): InlineKeyboardButton.CopyTextButtonButton;
|
|
635
694
|
/**
|
|
636
695
|
* Adds a new game query button, confer
|
|
637
696
|
* https://core.telegram.org/bots/api#games
|
|
638
697
|
*
|
|
639
698
|
* This type of button must always be the first button in the first row.
|
|
640
699
|
*
|
|
641
|
-
* @param text The text to display
|
|
700
|
+
* @param text The text to display, and optional styling information
|
|
642
701
|
*/
|
|
643
|
-
game(text: string): this;
|
|
702
|
+
game(text: string | InlineKeyboardButton.AbstractInlineKeyboardButton): this;
|
|
644
703
|
/**
|
|
645
704
|
* Creates a new game query button, confer
|
|
646
705
|
* https://core.telegram.org/bots/api#games
|
|
647
706
|
*
|
|
648
707
|
* This type of button must always be the first button in the first row.
|
|
649
708
|
*
|
|
650
|
-
* @param text The text to display
|
|
709
|
+
* @param text The text to display, and optional styling information
|
|
651
710
|
*/
|
|
652
|
-
static game(text: string): InlineKeyboardButton.GameButton;
|
|
711
|
+
static game(text: string | InlineKeyboardButton.AbstractInlineKeyboardButton): InlineKeyboardButton.GameButton;
|
|
653
712
|
/**
|
|
654
713
|
* Adds a new payment button, confer
|
|
655
714
|
* https://core.telegram.org/bots/api#payments
|
|
@@ -657,9 +716,9 @@ export declare class InlineKeyboard {
|
|
|
657
716
|
* This type of button must always be the first button in the first row and
|
|
658
717
|
* can only be used in invoice messages.
|
|
659
718
|
*
|
|
660
|
-
* @param text The text to display. Substrings “⭐” and “XTR” in the buttons's text will be replaced with a Telegram Star icon.
|
|
719
|
+
* @param text The text to display, and optional styling information. Substrings “⭐” and “XTR” in the buttons's text will be replaced with a Telegram Star icon.
|
|
661
720
|
*/
|
|
662
|
-
pay(text: string): this;
|
|
721
|
+
pay(text: string | InlineKeyboardButton.AbstractInlineKeyboardButton): this;
|
|
663
722
|
/**
|
|
664
723
|
* Create a new payment button, confer
|
|
665
724
|
* https://core.telegram.org/bots/api#payments
|
|
@@ -667,9 +726,66 @@ export declare class InlineKeyboard {
|
|
|
667
726
|
* This type of button must always be the first button in the first row and
|
|
668
727
|
* can only be used in invoice messages.
|
|
669
728
|
*
|
|
670
|
-
* @param text The text to display. Substrings “⭐” and “XTR” in the buttons's text will be replaced with a Telegram Star icon.
|
|
729
|
+
* @param text The text to display, and optional styling information. Substrings “⭐” and “XTR” in the buttons's text will be replaced with a Telegram Star icon.
|
|
730
|
+
*/
|
|
731
|
+
static pay(text: string | InlineKeyboardButton.AbstractInlineKeyboardButton): InlineKeyboardButton.PayButton;
|
|
732
|
+
/**
|
|
733
|
+
* Adds a style to the last added button of the inline keyboard.
|
|
734
|
+
*
|
|
735
|
+
* ```ts
|
|
736
|
+
* const keyboard = new InlineKeyboard()
|
|
737
|
+
* .text('blue button')
|
|
738
|
+
* .style('primary')
|
|
739
|
+
* ```
|
|
740
|
+
*
|
|
741
|
+
* @param style Style of the button
|
|
742
|
+
*/
|
|
743
|
+
style(style: InlineKeyboardButton.AbstractInlineKeyboardButton["style"]): this;
|
|
744
|
+
/**
|
|
745
|
+
* Adds a danger style to the last added button of the inline keyboard.
|
|
746
|
+
* Alias for `.style('danger')`.
|
|
747
|
+
*
|
|
748
|
+
* ```ts
|
|
749
|
+
* const keyboard = new InlineKeyboard()
|
|
750
|
+
* .text('red button')
|
|
751
|
+
* .danger()
|
|
752
|
+
* ```
|
|
753
|
+
*/
|
|
754
|
+
danger(): this;
|
|
755
|
+
/**
|
|
756
|
+
* Adds a success style to the last added button of the inline keyboard.
|
|
757
|
+
* Alias for `.style('success')`.
|
|
758
|
+
*
|
|
759
|
+
* ```ts
|
|
760
|
+
* const keyboard = new InlineKeyboard()
|
|
761
|
+
* .text('green button')
|
|
762
|
+
* .success()
|
|
763
|
+
* ```
|
|
764
|
+
*/
|
|
765
|
+
success(): this;
|
|
766
|
+
/**
|
|
767
|
+
* Adds a primary style to the last added button of the inline keyboard.
|
|
768
|
+
* Alias for `.style('primary')`.
|
|
769
|
+
*
|
|
770
|
+
* ```ts
|
|
771
|
+
* const keyboard = new InlineKeyboard()
|
|
772
|
+
* .text('blue button')
|
|
773
|
+
* .primary()
|
|
774
|
+
* ```
|
|
775
|
+
*/
|
|
776
|
+
primary(): this;
|
|
777
|
+
/**
|
|
778
|
+
* Adds a custom emoji icon to the last added button of the inline keyboard.
|
|
779
|
+
*
|
|
780
|
+
* ```ts
|
|
781
|
+
* const keyboard = new InlineKeyboard()
|
|
782
|
+
* .text('button with icon')
|
|
783
|
+
* .icon(myCustomEmojiIconIdentifier)
|
|
784
|
+
* ```
|
|
785
|
+
*
|
|
786
|
+
* @param icon Unique identifier of the custom emoji shown before the text of the button
|
|
671
787
|
*/
|
|
672
|
-
|
|
788
|
+
icon(icon: InlineKeyboardButton.AbstractInlineKeyboardButton["icon_custom_emoji_id"]): this;
|
|
673
789
|
/**
|
|
674
790
|
* Creates a new inline keyboard that contains the transposed grid of
|
|
675
791
|
* buttons of this inline keyboard. This means that the resulting inline
|