grammy 1.4.3 β 1.5.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/README.md +15 -9
- package/out/bot.js +5 -2
- package/out/context.d.ts +22 -4
- package/out/context.js +28 -6
- package/out/convenience/keyboard.d.ts +2 -2
- package/out/convenience/keyboard.js +2 -2
- package/out/convenience/session.d.ts +14 -3
- package/out/convenience/session.js +13 -0
- package/out/core/api.d.ts +21 -1
- package/out/core/api.js +43 -109
- package/out/filter.d.ts +7 -3
- package/out/filter.js +2 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -4,15 +4,15 @@
|
|
|
4
4
|
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
_<h2 align="center"> [:mag: Documentation](https://grammy.dev) | [:page_with_curl: API Reference](https://doc.deno.land/https
|
|
7
|
+
_<h2 align="center"> [:mag: Documentation](https://grammy.dev) | [:page_with_curl: API Reference](https://doc.deno.land/https://deno.land/x/grammy/mod.ts) | [:busts_in_silhouette: Group Chat](https://telegram.me/grammyjs) | [:new: News](https://telegram.me/grammyjs_news)</h2>_
|
|
8
8
|
|
|
9
9
|
<div align="center">
|
|
10
10
|
|
|
11
11
|
<!-- deno-fmt-ignore-start -->
|
|
12
12
|
|
|
13
|
-
[](https://core.telegram.org/bots/api)
|
|
14
14
|
[](https://www.npmjs.org/package/grammy) <!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
|
|
15
|
-
[](#contributors-)
|
|
16
16
|
<!-- ALL-CONTRIBUTORS-BADGE:END -->
|
|
17
17
|
|
|
18
18
|
<!-- deno-fmt-ignore-end -->
|
|
@@ -25,7 +25,7 @@ You want grammY because it is easy to use. It is very powerful and always up to
|
|
|
25
25
|
|
|
26
26
|
Are you ready? π€π
|
|
27
27
|
|
|
28
|
-
Bots are written in [TypeScript](https://www.typescriptlang.org/) (or JavaScript) and run on [Node.js](https://nodejs.org/).
|
|
28
|
+
Bots are written in [TypeScript](https://www.typescriptlang.org/) (or JavaScript) and run on [Node.js](https://nodejs.org/) or [Deno](#deno-support).
|
|
29
29
|
|
|
30
30
|
## Quickstart
|
|
31
31
|
|
|
@@ -66,7 +66,7 @@ Congrats! You just wrote a Telegram bot :)
|
|
|
66
66
|
|
|
67
67
|
## Going Further
|
|
68
68
|
|
|
69
|
-
grammY has an excellent [documentation](https://grammy.dev), and an [API Reference](https://doc.deno.land/https
|
|
69
|
+
grammY has an excellent [documentation](https://grammy.dev), and an [API Reference](https://doc.deno.land/https://deno.land/x/grammy/mod.ts). It even integrates with your code editor, e.g. [VSCode](https://code.visualstudio.com/). You can hover over any element of grammY to get a detailed description of what that thing does or means.
|
|
70
70
|
|
|
71
71
|
If you are still stuck, just join the [Telegram chat](https://t.me/grammyjs) and ask for help. People are nice there and we appreciate your question, no matter what it is :)
|
|
72
72
|
|
|
@@ -78,7 +78,7 @@ Here are some more resources to support you:
|
|
|
78
78
|
|
|
79
79
|
βmain project website and documentation.
|
|
80
80
|
|
|
81
|
-
### [grammY API Reference](https://doc.deno.land/https
|
|
81
|
+
### [grammY API Reference](https://doc.deno.land/https://deno.land/x/grammy/mod.ts)
|
|
82
82
|
|
|
83
83
|
βreference of everything that grammY exports.
|
|
84
84
|
|
|
@@ -90,6 +90,8 @@ Here are some more resources to support you:
|
|
|
90
90
|
|
|
91
91
|
βTelegram chat where you can ask any question about grammY or bots in general. We are also open for feedback, ideas, and contributions!
|
|
92
92
|
|
|
93
|
+
The Russian commnity chat can be found [here](https://t.me/grammyjs_ru).
|
|
94
|
+
|
|
93
95
|
### [grammY News Channel](https://t.me/grammyjs_news)
|
|
94
96
|
|
|
95
97
|
βTelegram channel where updates to grammY and the ecosystem are posted.
|
|
@@ -100,9 +102,11 @@ Here are some more resources to support you:
|
|
|
100
102
|
|
|
101
103
|
## Deno Support
|
|
102
104
|
|
|
103
|
-
All grammY packages published by [@grammyjs](https://github.com/grammyjs) run natively on Deno. We are compiling every codebase to still run on Node.
|
|
105
|
+
All grammY packages published by [@grammyjs](https://github.com/grammyjs) run natively on [Deno](https://deno.land). We are compiling every codebase to still run on Node.js.
|
|
106
|
+
|
|
107
|
+
However, given that most bot developers are still using Node.js, all documentation is written Node.js-first. We may migrate it if Deno overtakes Node.js. If you are already on Deno today, import grammY from [`https://deno.land/x/grammy/mod.ts`](https://deno.land/x/grammy).
|
|
104
108
|
|
|
105
|
-
|
|
109
|
+
You may also be interested in [why we support Deno](https://grammy.dev/resources/faq.html#why-do-you-support-deno).
|
|
106
110
|
|
|
107
111
|
## [Contribution Guide Β»](./CONTRIBUTING.md)
|
|
108
112
|
|
|
@@ -163,13 +167,15 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
|
|
|
163
167
|
<td align="center"><a href="https://github.com/taotie111"><img src="https://avatars.githubusercontent.com/u/44166322?v=4?s=100" width="100px;" alt=""/><br /><sub><b>taotie111</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/commits?author=taotie111" title="Documentation">π</a> <a href="#translation-taotie111" title="Translation">π</a></td>
|
|
164
168
|
<td align="center"><a href="https://www.linkedin.com/in/merlin-brandes-42328717a/"><img src="https://avatars.githubusercontent.com/u/14237330?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Merlin</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/commits?author=FatalMerlin" title="Documentation">π</a></td>
|
|
165
169
|
<td align="center"><a href="https://darve.sh"><img src="https://avatars.githubusercontent.com/u/22394081?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Darvesh</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/issues?q=author%3Adarvesh" title="Bug reports">π</a> <a href="https://github.com/grammyjs/grammY/commits?author=darvesh" title="Code">π»</a></td>
|
|
166
|
-
<td align="center"><a href="http://telegram.me/dcdunkan"><img src="https://avatars.githubusercontent.com/u/70066170?v=4?s=100" width="100px;" alt=""/><br /><sub><b>dcdunkan</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/issues?q=author%3Adcdunkan" title="Bug reports">π</a> <a href="https://github.com/grammyjs/grammY/commits?author=dcdunkan" title="Code">π»</a></td>
|
|
170
|
+
<td align="center"><a href="http://telegram.me/dcdunkan"><img src="https://avatars.githubusercontent.com/u/70066170?v=4?s=100" width="100px;" alt=""/><br /><sub><b>dcdunkan</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/issues?q=author%3Adcdunkan" title="Bug reports">π</a> <a href="https://github.com/grammyjs/grammY/commits?author=dcdunkan" title="Code">π»</a> <a href="#plugin-dcdunkan" title="Plugin/utility libraries">π</a> <a href="https://github.com/grammyjs/grammY/pulls?q=is%3Apr+reviewed-by%3Adcdunkan" title="Reviewed Pull Requests">π</a></td>
|
|
167
171
|
<td align="center"><a href="https://xuann.wang/"><img src="https://avatars.githubusercontent.com/u/44045911?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Kid</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/commits?author=kidonng" title="Documentation">π</a> <a href="#translation-kidonng" title="Translation">π</a></td>
|
|
168
172
|
<td align="center"><a href="http://slava.fomin.io/"><img src="https://avatars.githubusercontent.com/u/1702725?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Slava Fomin II</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/issues?q=author%3Aslavafomin" title="Bug reports">π</a> <a href="https://github.com/grammyjs/grammY/commits?author=slavafomin" title="Documentation">π</a></td>
|
|
169
173
|
<td align="center"><a href="https://kikobeats.com/"><img src="https://avatars.githubusercontent.com/u/2096101?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Kiko Beats</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/commits?author=Kikobeats" title="Documentation">π</a></td>
|
|
170
174
|
</tr>
|
|
171
175
|
<tr>
|
|
172
176
|
<td align="center"><a href="http://///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////kraftwerk28.pp.ua"><img src="https://avatars.githubusercontent.com/u/31807671?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Vsevolod</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/commits?author=kraftwerk28" title="Code">π»</a> <a href="#ideas-kraftwerk28" title="Ideas, Planning, & Feedback">π€</a> <a href="https://github.com/grammyjs/grammY/pulls?q=is%3Apr+reviewed-by%3Akraftwerk28" title="Reviewed Pull Requests">π</a></td>
|
|
177
|
+
<td align="center"><a href="https://github.com/habemuscode"><img src="https://avatars.githubusercontent.com/u/34692207?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Habemuscode</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/pulls?q=is%3Apr+reviewed-by%3Ahabemuscode" title="Reviewed Pull Requests">π</a></td>
|
|
178
|
+
<td align="center"><a href="https://borodutch.com/"><img src="https://avatars.githubusercontent.com/u/3192028?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Nikita Kolmogorov</b></sub></a><br /><a href="#plugin-backmeupplz" title="Plugin/utility libraries">π</a></td>
|
|
173
179
|
</tr>
|
|
174
180
|
</table>
|
|
175
181
|
|
package/out/bot.js
CHANGED
|
@@ -301,7 +301,7 @@ you can circumvent this protection against memory leaks.`);
|
|
|
301
301
|
}
|
|
302
302
|
else
|
|
303
303
|
debugErr(error);
|
|
304
|
-
debugErr("Call to
|
|
304
|
+
debugErr("Call to getUpdates failed, retrying in 3 seconds ...");
|
|
305
305
|
await new Promise((r) => setTimeout(r, 3000));
|
|
306
306
|
};
|
|
307
307
|
while (this.pollingRunning) {
|
|
@@ -313,7 +313,10 @@ you can circumvent this protection against memory leaks.`);
|
|
|
313
313
|
updates = await this.api.getUpdates({ offset, limit, timeout, allowed_updates }, this.pollingAbortController.signal);
|
|
314
314
|
}
|
|
315
315
|
catch (error) {
|
|
316
|
-
|
|
316
|
+
if (this.pollingRunning)
|
|
317
|
+
await handleErr(error);
|
|
318
|
+
else
|
|
319
|
+
debug("Pending getUpdates request cancelled");
|
|
317
320
|
}
|
|
318
321
|
} while (updates === undefined && this.pollingRunning);
|
|
319
322
|
if (updates === undefined)
|
package/out/context.d.ts
CHANGED
|
@@ -62,7 +62,7 @@ export declare class Context implements RenamedUpdate {
|
|
|
62
62
|
* Used by some middleware to store information about how a certain string
|
|
63
63
|
* or regular expression was matched.
|
|
64
64
|
*/
|
|
65
|
-
match?: string | RegExpMatchArray
|
|
65
|
+
match?: string | RegExpMatchArray;
|
|
66
66
|
constructor(
|
|
67
67
|
/**
|
|
68
68
|
* The update object that is contained in the context.
|
|
@@ -113,7 +113,7 @@ export declare class Context implements RenamedUpdate {
|
|
|
113
113
|
get msg(): Message | undefined;
|
|
114
114
|
/**
|
|
115
115
|
* Get chat object from whereever possible. Alias for `(this.msg ??
|
|
116
|
-
* this.myChatMember ?? this.chatMember)?.chat`
|
|
116
|
+
* this.myChatMember ?? this.chatMember ?? this.chatJoinRequest)?.chat`
|
|
117
117
|
*/
|
|
118
118
|
get chat(): Chat | undefined;
|
|
119
119
|
/**
|
|
@@ -125,7 +125,7 @@ export declare class Context implements RenamedUpdate {
|
|
|
125
125
|
* Get message author from whereever possible. Alias for
|
|
126
126
|
* `(ctx.callbackQuery?? ctx.inlineQuery ?? ctx.shippingQuery ??
|
|
127
127
|
* ctx.preCheckoutQuery ?? ctx.chosenInlineResult ?? ctx.msg ??
|
|
128
|
-
* this.myChatMember ?? this.chatMember)?.from`
|
|
128
|
+
* this.myChatMember ?? this.chatMember ?? this.chatJoinRequest)?.from`
|
|
129
129
|
*/
|
|
130
130
|
get from(): User | undefined;
|
|
131
131
|
/**
|
|
@@ -447,6 +447,24 @@ export declare class Context implements RenamedUpdate {
|
|
|
447
447
|
* **Official reference:** https://core.telegram.org/bots/api#setchatadministratorcustomtitle
|
|
448
448
|
*/
|
|
449
449
|
setChatAdministratorCustomTitle(user_id: number, custom_title: string, signal?: AbortSignal): Promise<true>;
|
|
450
|
+
/**
|
|
451
|
+
* Context-aware alias for `api.banChatSenderChat`. Use this method to ban a channel chat in a supergroup or a channel. Until the chat is unbanned, the owner of the banned chat won't be able to send messages on behalf of any of their channels. The bot must be an administrator in the supergroup or channel for this to work and must have the appropriate administrator rights. Returns True on success.
|
|
452
|
+
*
|
|
453
|
+
* @param sender_chat_id Unique identifier of the target sender chat
|
|
454
|
+
* @param signal Optional `AbortSignal` to cancel the request
|
|
455
|
+
*
|
|
456
|
+
* **Official reference:** https://core.telegram.org/bots/api#banchatsenderchat
|
|
457
|
+
*/
|
|
458
|
+
banChatSenderChat(sender_chat_id: number, signal?: AbortSignal): Promise<true>;
|
|
459
|
+
/**
|
|
460
|
+
* Context-aware alias for `api.unbanChatSenderChat`. Use this method to unban a previously banned channel chat in a supergroup or channel. The bot must be an administrator for this to work and must have the appropriate administrator rights. Returns True on success.
|
|
461
|
+
*
|
|
462
|
+
* @param sender_chat_id Unique identifier of the target sender chat
|
|
463
|
+
* @param signal Optional `AbortSignal` to cancel the request
|
|
464
|
+
*
|
|
465
|
+
* **Official reference:** https://core.telegram.org/bots/api#unbanchatsenderchat
|
|
466
|
+
*/
|
|
467
|
+
unbanChatSenderChat(sender_chat_id: number, signal?: AbortSignal): Promise<true>;
|
|
450
468
|
/**
|
|
451
469
|
* Context-aware alias for `api.setChatPermissions`. Use this method to set default chat permissions for all members. The bot must be an administrator in the group or a supergroup for this to work and must have the can_restrict_members administrator rights. Returns True on success.
|
|
452
470
|
*
|
|
@@ -753,7 +771,7 @@ export declare class Context implements RenamedUpdate {
|
|
|
753
771
|
*
|
|
754
772
|
* **Official reference:** https://core.telegram.org/bots/api#sendinvoice
|
|
755
773
|
*/
|
|
756
|
-
replyWithInvoice(title: string, description: string, payload: string, provider_token: string, currency: string, prices: readonly LabeledPrice[], other?: Other<"sendInvoice", "title" | "description" | "payload" | "provider_token" | "
|
|
774
|
+
replyWithInvoice(title: string, description: string, payload: string, provider_token: string, currency: string, prices: readonly LabeledPrice[], other?: Other<"sendInvoice", "title" | "description" | "payload" | "provider_token" | "currency" | "prices">, signal?: AbortSignal): Promise<Message.InvoiceMessage>;
|
|
757
775
|
/**
|
|
758
776
|
* Context-aware alias for `api.answerShippingQuery`. If you sent an invoice requesting a shipping address and the parameter is_flexible was specified, the Bot API will send an Update with a shipping_query field to the bot. Use this method to reply to shipping queries. On success, True is returned.
|
|
759
777
|
*
|
package/out/context.js
CHANGED
|
@@ -152,12 +152,12 @@ class Context {
|
|
|
152
152
|
}
|
|
153
153
|
/**
|
|
154
154
|
* Get chat object from whereever possible. Alias for `(this.msg ??
|
|
155
|
-
* this.myChatMember ?? this.chatMember)?.chat`
|
|
155
|
+
* this.myChatMember ?? this.chatMember ?? this.chatJoinRequest)?.chat`
|
|
156
156
|
*/
|
|
157
157
|
get chat() {
|
|
158
|
-
var _a, _b, _c;
|
|
158
|
+
var _a, _b, _c, _d;
|
|
159
159
|
// Keep in sync with types in `filter.ts`.
|
|
160
|
-
return (_c = (
|
|
160
|
+
return (_d = ((_c = (_b = (_a = this.msg) !== null && _a !== void 0 ? _a : this.myChatMember) !== null && _b !== void 0 ? _b : this.chatMember) !== null && _c !== void 0 ? _c : this.chatJoinRequest)) === null || _d === void 0 ? void 0 : _d.chat;
|
|
161
161
|
}
|
|
162
162
|
/**
|
|
163
163
|
* Get sender chat object from wherever possible. Alias for
|
|
@@ -171,12 +171,12 @@ class Context {
|
|
|
171
171
|
* Get message author from whereever possible. Alias for
|
|
172
172
|
* `(ctx.callbackQuery?? ctx.inlineQuery ?? ctx.shippingQuery ??
|
|
173
173
|
* ctx.preCheckoutQuery ?? ctx.chosenInlineResult ?? ctx.msg ??
|
|
174
|
-
* this.myChatMember ?? this.chatMember)?.from`
|
|
174
|
+
* this.myChatMember ?? this.chatMember ?? this.chatJoinRequest)?.from`
|
|
175
175
|
*/
|
|
176
176
|
get from() {
|
|
177
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
177
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
178
178
|
// Keep in sync with types in `filter.ts`.
|
|
179
|
-
return (_h = (
|
|
179
|
+
return (_j = ((_h = (_g = (_f = (_e = (_d = (_c = (_b = (_a = this.callbackQuery) !== null && _a !== void 0 ? _a : this.inlineQuery) !== null && _b !== void 0 ? _b : this.shippingQuery) !== null && _c !== void 0 ? _c : this.preCheckoutQuery) !== null && _d !== void 0 ? _d : this.chosenInlineResult) !== null && _e !== void 0 ? _e : this.msg) !== null && _f !== void 0 ? _f : this.myChatMember) !== null && _g !== void 0 ? _g : this.chatMember) !== null && _h !== void 0 ? _h : this.chatJoinRequest)) === null || _j === void 0 ? void 0 : _j.from;
|
|
180
180
|
}
|
|
181
181
|
/**
|
|
182
182
|
* Get inline message ID from whereever possible. Alias for
|
|
@@ -576,6 +576,28 @@ class Context {
|
|
|
576
576
|
setChatAdministratorCustomTitle(user_id, custom_title, signal) {
|
|
577
577
|
return this.api.setChatAdministratorCustomTitle(orThrow(this.chat, "setChatAdministratorCustomTitle").id, user_id, custom_title, signal);
|
|
578
578
|
}
|
|
579
|
+
/**
|
|
580
|
+
* Context-aware alias for `api.banChatSenderChat`. Use this method to ban a channel chat in a supergroup or a channel. Until the chat is unbanned, the owner of the banned chat won't be able to send messages on behalf of any of their channels. The bot must be an administrator in the supergroup or channel for this to work and must have the appropriate administrator rights. Returns True on success.
|
|
581
|
+
*
|
|
582
|
+
* @param sender_chat_id Unique identifier of the target sender chat
|
|
583
|
+
* @param signal Optional `AbortSignal` to cancel the request
|
|
584
|
+
*
|
|
585
|
+
* **Official reference:** https://core.telegram.org/bots/api#banchatsenderchat
|
|
586
|
+
*/
|
|
587
|
+
banChatSenderChat(sender_chat_id, signal) {
|
|
588
|
+
return this.api.banChatSenderChat(orThrow(this.chat, "banChatSenderChat").id, sender_chat_id, signal);
|
|
589
|
+
}
|
|
590
|
+
/**
|
|
591
|
+
* Context-aware alias for `api.unbanChatSenderChat`. Use this method to unban a previously banned channel chat in a supergroup or channel. The bot must be an administrator for this to work and must have the appropriate administrator rights. Returns True on success.
|
|
592
|
+
*
|
|
593
|
+
* @param sender_chat_id Unique identifier of the target sender chat
|
|
594
|
+
* @param signal Optional `AbortSignal` to cancel the request
|
|
595
|
+
*
|
|
596
|
+
* **Official reference:** https://core.telegram.org/bots/api#unbanchatsenderchat
|
|
597
|
+
*/
|
|
598
|
+
unbanChatSenderChat(sender_chat_id, signal) {
|
|
599
|
+
return this.api.unbanChatSenderChat(orThrow(this.chat, "unbanChatSenderChat").id, sender_chat_id, signal);
|
|
600
|
+
}
|
|
579
601
|
/**
|
|
580
602
|
* Context-aware alias for `api.setChatPermissions`. Use this method to set default chat permissions for all members. The bot must be an administrator in the group or a supergroup for this to work and must have the can_restrict_members administrator rights. Returns True on success.
|
|
581
603
|
*
|
|
@@ -138,7 +138,7 @@ export declare class InlineKeyboard {
|
|
|
138
138
|
* the button is pressed.
|
|
139
139
|
*
|
|
140
140
|
* @param text The text to display
|
|
141
|
-
* @param url HTTP or tg:// url to be opened when button is pressed
|
|
141
|
+
* @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.
|
|
142
142
|
*/
|
|
143
143
|
url(text: string, url: string): this;
|
|
144
144
|
/**
|
|
@@ -211,7 +211,7 @@ export declare class InlineKeyboard {
|
|
|
211
211
|
/**
|
|
212
212
|
* Adds a new payment button, confer https://core.telegram.org/bots/api#payments
|
|
213
213
|
*
|
|
214
|
-
* This type of button must always be the first button in the first row.
|
|
214
|
+
* This type of button must always be the first button in the first row and can only be used in invoice messages.
|
|
215
215
|
*
|
|
216
216
|
* @param text The text to display
|
|
217
217
|
*/
|
|
@@ -179,7 +179,7 @@ class InlineKeyboard {
|
|
|
179
179
|
* the button is pressed.
|
|
180
180
|
*
|
|
181
181
|
* @param text The text to display
|
|
182
|
-
* @param url HTTP or tg:// url to be opened when button is pressed
|
|
182
|
+
* @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.
|
|
183
183
|
*/
|
|
184
184
|
url(text, url) {
|
|
185
185
|
return this.add({ text, url });
|
|
@@ -269,7 +269,7 @@ class InlineKeyboard {
|
|
|
269
269
|
/**
|
|
270
270
|
* Adds a new payment button, confer https://core.telegram.org/bots/api#payments
|
|
271
271
|
*
|
|
272
|
-
* This type of button must always be the first button in the first row.
|
|
272
|
+
* This type of button must always be the first button in the first row and can only be used in invoice messages.
|
|
273
273
|
*
|
|
274
274
|
* @param text The text to display
|
|
275
275
|
*/
|
|
@@ -8,7 +8,7 @@ declare type MaybePromise<T> = Promise<T> | T;
|
|
|
8
8
|
* Session middleware will load the session data of a specific chat from your
|
|
9
9
|
* storage solution, and make it available to you on the context object. Check
|
|
10
10
|
* out the
|
|
11
|
-
* [documentation](https://doc.deno.land/https
|
|
11
|
+
* [documentation](https://doc.deno.land/https://deno.land/x/grammy/mod.ts/~/session)
|
|
12
12
|
* on session middleware to know more, and read the section about sessions on
|
|
13
13
|
* the [website](https://grammy.dev/plugins/session.html).
|
|
14
14
|
*/
|
|
@@ -37,7 +37,7 @@ export interface SessionFlavor<S> {
|
|
|
37
37
|
* object. Once you access `ctx.session`, the storage will be queried and the
|
|
38
38
|
* session data becomes available. If you access `ctx.session` again for the
|
|
39
39
|
* same context object, the cached value will be used. Check out the
|
|
40
|
-
* [documentation](https://doc.deno.land/https
|
|
40
|
+
* [documentation](https://doc.deno.land/https://deno.land/x/grammy/mod.ts/~/lazySession)
|
|
41
41
|
* on lazy session middleware to know more, and read the section about lazy
|
|
42
42
|
* sessions on the
|
|
43
43
|
* [website](https://grammy.dev/plugins/session.html#lazy-sessions).
|
|
@@ -218,7 +218,13 @@ export declare function lazySession<S, C extends Context>(options?: SessionOptio
|
|
|
218
218
|
*/
|
|
219
219
|
export declare class MemorySessionStorage<S> implements StorageAdapter<S> {
|
|
220
220
|
private readonly timeToLive;
|
|
221
|
-
|
|
221
|
+
/**
|
|
222
|
+
* Internally used `Map` instance that stores the session data
|
|
223
|
+
*/
|
|
224
|
+
protected readonly storage: Map<string, {
|
|
225
|
+
session: S;
|
|
226
|
+
expires?: number | undefined;
|
|
227
|
+
}>;
|
|
222
228
|
/**
|
|
223
229
|
* Constructs a new memory session storage with the given time to live. Note
|
|
224
230
|
* that this storage adapter will not store your data permanently.
|
|
@@ -227,6 +233,11 @@ export declare class MemorySessionStorage<S> implements StorageAdapter<S> {
|
|
|
227
233
|
*/
|
|
228
234
|
constructor(timeToLive?: number);
|
|
229
235
|
read(key: string): S | undefined;
|
|
236
|
+
/**
|
|
237
|
+
* Reads the values for all keys of the session storage, and returns them as
|
|
238
|
+
* an array.
|
|
239
|
+
*/
|
|
240
|
+
readAll(): S[];
|
|
230
241
|
write(key: string, value: S): void;
|
|
231
242
|
private addExpiryDate;
|
|
232
243
|
delete(key: string): void;
|
|
@@ -218,6 +218,9 @@ class MemorySessionStorage {
|
|
|
218
218
|
writable: true,
|
|
219
219
|
value: timeToLive
|
|
220
220
|
});
|
|
221
|
+
/**
|
|
222
|
+
* Internally used `Map` instance that stores the session data
|
|
223
|
+
*/
|
|
221
224
|
Object.defineProperty(this, "storage", {
|
|
222
225
|
enumerable: true,
|
|
223
226
|
configurable: true,
|
|
@@ -235,6 +238,16 @@ class MemorySessionStorage {
|
|
|
235
238
|
}
|
|
236
239
|
return value.session;
|
|
237
240
|
}
|
|
241
|
+
/**
|
|
242
|
+
* Reads the values for all keys of the session storage, and returns them as
|
|
243
|
+
* an array.
|
|
244
|
+
*/
|
|
245
|
+
readAll() {
|
|
246
|
+
return Array
|
|
247
|
+
.from(this.storage.keys())
|
|
248
|
+
.map((key) => this.read(key))
|
|
249
|
+
.filter((value) => value !== undefined);
|
|
250
|
+
}
|
|
238
251
|
write(key, value) {
|
|
239
252
|
this.storage.set(key, this.addExpiryDate(value));
|
|
240
253
|
}
|
package/out/core/api.d.ts
CHANGED
|
@@ -459,6 +459,26 @@ export declare class Api<R extends RawApi = RawApi> {
|
|
|
459
459
|
* **Official reference:** https://core.telegram.org/bots/api#setchatadministratorcustomtitle
|
|
460
460
|
*/
|
|
461
461
|
setChatAdministratorCustomTitle(chat_id: number | string, user_id: number, custom_title: string, signal?: AbortSignal): Promise<true>;
|
|
462
|
+
/**
|
|
463
|
+
* Use this method to ban a channel chat in a supergroup or a channel. Until the chat is unbanned, the owner of the banned chat won't be able to send messages on behalf of any of their channels. The bot must be an administrator in the supergroup or channel for this to work and must have the appropriate administrator rights. Returns True on success.
|
|
464
|
+
*
|
|
465
|
+
* @param chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername)
|
|
466
|
+
* @param sender_chat_id Unique identifier of the target sender chat
|
|
467
|
+
* @param signal Optional `AbortSignal` to cancel the request
|
|
468
|
+
*
|
|
469
|
+
* **Official reference:** https://core.telegram.org/bots/api#banchatsenderchat
|
|
470
|
+
*/
|
|
471
|
+
banChatSenderChat(chat_id: number | string, sender_chat_id: number, signal?: AbortSignal): Promise<true>;
|
|
472
|
+
/**
|
|
473
|
+
* Use this method to unban a previously banned channel chat in a supergroup or channel. The bot must be an administrator for this to work and must have the appropriate administrator rights. Returns True on success.
|
|
474
|
+
*
|
|
475
|
+
* @param chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername)
|
|
476
|
+
* @param sender_chat_id Unique identifier of the target sender chat
|
|
477
|
+
* @param signal Optional `AbortSignal` to cancel the request
|
|
478
|
+
*
|
|
479
|
+
* **Official reference:** https://core.telegram.org/bots/api#unbanchatsenderchat
|
|
480
|
+
*/
|
|
481
|
+
unbanChatSenderChat(chat_id: number | string, sender_chat_id: number, signal?: AbortSignal): Promise<true>;
|
|
462
482
|
/**
|
|
463
483
|
* Use this method to set default chat permissions for all members. The bot must be an administrator in the group or a supergroup for this to work and must have the can_restrict_members administrator rights. Returns True on success.
|
|
464
484
|
*
|
|
@@ -938,7 +958,7 @@ export declare class Api<R extends RawApi = RawApi> {
|
|
|
938
958
|
*
|
|
939
959
|
* **Official reference:** https://core.telegram.org/bots/api#sendinvoice
|
|
940
960
|
*/
|
|
941
|
-
sendInvoice(chat_id: number | string, title: string, description: string, payload: string, provider_token: string, currency: string, prices: readonly LabeledPrice[], other?: Other<R, "sendInvoice", "title" | "description" | "payload" | "provider_token" | "
|
|
961
|
+
sendInvoice(chat_id: number | string, title: string, description: string, payload: string, provider_token: string, currency: string, prices: readonly LabeledPrice[], other?: Other<R, "sendInvoice", "title" | "description" | "payload" | "provider_token" | "currency" | "prices">, signal?: AbortSignal): Promise<import("@grammyjs/types/message").Message.InvoiceMessage>;
|
|
942
962
|
/**
|
|
943
963
|
* If you sent an invoice requesting a shipping address and the parameter is_flexible was specified, the Bot API will send an Update with a shipping_query field to the bot. Use this method to reply to shipping queries. On success, True is returned.
|
|
944
964
|
*
|
package/out/core/api.js
CHANGED
|
@@ -166,12 +166,7 @@ class Api {
|
|
|
166
166
|
* **Official reference:** https://core.telegram.org/bots/api#forwardmessage
|
|
167
167
|
*/
|
|
168
168
|
forwardMessage(chat_id, from_chat_id, message_id, other, signal) {
|
|
169
|
-
return this.raw.forwardMessage({
|
|
170
|
-
chat_id,
|
|
171
|
-
from_chat_id,
|
|
172
|
-
message_id,
|
|
173
|
-
...other,
|
|
174
|
-
}, signal);
|
|
169
|
+
return this.raw.forwardMessage({ chat_id, from_chat_id, message_id, ...other }, signal);
|
|
175
170
|
}
|
|
176
171
|
/**
|
|
177
172
|
* Use this method to copy messages of any kind. Service messages and invoice messages can't be copied. The method is analogous to the method forwardMessage, but the copied message doesn't have a link to the original message. Returns the MessageId of the sent message on success.
|
|
@@ -185,12 +180,7 @@ class Api {
|
|
|
185
180
|
* **Official reference:** https://core.telegram.org/bots/api#copymessage
|
|
186
181
|
*/
|
|
187
182
|
copyMessage(chat_id, from_chat_id, message_id, other, signal) {
|
|
188
|
-
return this.raw.copyMessage({
|
|
189
|
-
chat_id,
|
|
190
|
-
from_chat_id,
|
|
191
|
-
message_id,
|
|
192
|
-
...other,
|
|
193
|
-
}, signal);
|
|
183
|
+
return this.raw.copyMessage({ chat_id, from_chat_id, message_id, ...other }, signal);
|
|
194
184
|
}
|
|
195
185
|
/**
|
|
196
186
|
* Use this method to send photos. On success, the sent Message is returned.
|
|
@@ -326,13 +316,7 @@ class Api {
|
|
|
326
316
|
* **Official reference:** https://core.telegram.org/bots/api#editmessagelivelocation
|
|
327
317
|
*/
|
|
328
318
|
editMessageLiveLocation(chat_id, message_id, latitude, longitude, other, signal) {
|
|
329
|
-
return this.raw.editMessageLiveLocation({
|
|
330
|
-
chat_id,
|
|
331
|
-
message_id,
|
|
332
|
-
latitude,
|
|
333
|
-
longitude,
|
|
334
|
-
...other,
|
|
335
|
-
}, signal);
|
|
319
|
+
return this.raw.editMessageLiveLocation({ chat_id, message_id, latitude, longitude, ...other }, signal);
|
|
336
320
|
}
|
|
337
321
|
/**
|
|
338
322
|
* Use this method to edit live location inline messages. A location can be edited until its live_period expires or editing is explicitly disabled by a call to stopMessageLiveLocation. On success, if the edited message is not an inline message, the edited Message is returned, otherwise True is returned.
|
|
@@ -346,12 +330,7 @@ class Api {
|
|
|
346
330
|
* **Official reference:** https://core.telegram.org/bots/api#editmessagelivelocation
|
|
347
331
|
*/
|
|
348
332
|
editMessageLiveLocationInline(inline_message_id, latitude, longitude, other, signal) {
|
|
349
|
-
return this.raw.editMessageLiveLocation({
|
|
350
|
-
inline_message_id,
|
|
351
|
-
latitude,
|
|
352
|
-
longitude,
|
|
353
|
-
...other,
|
|
354
|
-
}, signal);
|
|
333
|
+
return this.raw.editMessageLiveLocation({ inline_message_id, latitude, longitude, ...other }, signal);
|
|
355
334
|
}
|
|
356
335
|
/**
|
|
357
336
|
* Use this method to stop updating a live location message before live_period expires. On success, if the message is not an inline message, the edited Message is returned, otherwise True is returned.
|
|
@@ -364,11 +343,7 @@ class Api {
|
|
|
364
343
|
* **Official reference:** https://core.telegram.org/bots/api#stopmessagelivelocation
|
|
365
344
|
*/
|
|
366
345
|
stopMessageLiveLocation(chat_id, message_id, other, signal) {
|
|
367
|
-
return this.raw.stopMessageLiveLocation({
|
|
368
|
-
chat_id,
|
|
369
|
-
message_id,
|
|
370
|
-
...other,
|
|
371
|
-
}, signal);
|
|
346
|
+
return this.raw.stopMessageLiveLocation({ chat_id, message_id, ...other }, signal);
|
|
372
347
|
}
|
|
373
348
|
/**
|
|
374
349
|
* Use this method to stop updating a live location message before live_period expires. On success, if the message is not an inline message, the edited Message is returned, otherwise True is returned.
|
|
@@ -396,14 +371,7 @@ class Api {
|
|
|
396
371
|
* **Official reference:** https://core.telegram.org/bots/api#sendvenue
|
|
397
372
|
*/
|
|
398
373
|
sendVenue(chat_id, latitude, longitude, title, address, other, signal) {
|
|
399
|
-
return this.raw.sendVenue({
|
|
400
|
-
chat_id,
|
|
401
|
-
latitude,
|
|
402
|
-
longitude,
|
|
403
|
-
title,
|
|
404
|
-
address,
|
|
405
|
-
...other,
|
|
406
|
-
}, signal);
|
|
374
|
+
return this.raw.sendVenue({ chat_id, latitude, longitude, title, address, ...other }, signal);
|
|
407
375
|
}
|
|
408
376
|
/**
|
|
409
377
|
* Use this method to send phone contacts. On success, the sent Message is returned.
|
|
@@ -417,12 +385,7 @@ class Api {
|
|
|
417
385
|
* **Official reference:** https://core.telegram.org/bots/api#sendcontact
|
|
418
386
|
*/
|
|
419
387
|
sendContact(chat_id, phone_number, first_name, other, signal) {
|
|
420
|
-
return this.raw.sendContact({
|
|
421
|
-
chat_id,
|
|
422
|
-
phone_number,
|
|
423
|
-
first_name,
|
|
424
|
-
...other,
|
|
425
|
-
}, signal);
|
|
388
|
+
return this.raw.sendContact({ chat_id, phone_number, first_name, ...other }, signal);
|
|
426
389
|
}
|
|
427
390
|
/**
|
|
428
391
|
* Use this method to send a native poll. On success, the sent Message is returned.
|
|
@@ -534,12 +497,7 @@ class Api {
|
|
|
534
497
|
* **Official reference:** https://core.telegram.org/bots/api#restrictchatmember
|
|
535
498
|
*/
|
|
536
499
|
restrictChatMember(chat_id, user_id, permissions, other, signal) {
|
|
537
|
-
return this.raw.restrictChatMember({
|
|
538
|
-
chat_id,
|
|
539
|
-
user_id,
|
|
540
|
-
permissions,
|
|
541
|
-
...other,
|
|
542
|
-
}, signal);
|
|
500
|
+
return this.raw.restrictChatMember({ chat_id, user_id, permissions, ...other }, signal);
|
|
543
501
|
}
|
|
544
502
|
/**
|
|
545
503
|
* Use this method to promote or demote a user in a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Pass False for all boolean parameters to demote a user. Returns True on success.
|
|
@@ -565,11 +523,31 @@ class Api {
|
|
|
565
523
|
* **Official reference:** https://core.telegram.org/bots/api#setchatadministratorcustomtitle
|
|
566
524
|
*/
|
|
567
525
|
setChatAdministratorCustomTitle(chat_id, user_id, custom_title, signal) {
|
|
568
|
-
return this.raw.setChatAdministratorCustomTitle({
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
526
|
+
return this.raw.setChatAdministratorCustomTitle({ chat_id, user_id, custom_title }, signal);
|
|
527
|
+
}
|
|
528
|
+
/**
|
|
529
|
+
* Use this method to ban a channel chat in a supergroup or a channel. Until the chat is unbanned, the owner of the banned chat won't be able to send messages on behalf of any of their channels. The bot must be an administrator in the supergroup or channel for this to work and must have the appropriate administrator rights. Returns True on success.
|
|
530
|
+
*
|
|
531
|
+
* @param chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername)
|
|
532
|
+
* @param sender_chat_id Unique identifier of the target sender chat
|
|
533
|
+
* @param signal Optional `AbortSignal` to cancel the request
|
|
534
|
+
*
|
|
535
|
+
* **Official reference:** https://core.telegram.org/bots/api#banchatsenderchat
|
|
536
|
+
*/
|
|
537
|
+
banChatSenderChat(chat_id, sender_chat_id, signal) {
|
|
538
|
+
return this.raw.banChatSenderChat({ chat_id, sender_chat_id }, signal);
|
|
539
|
+
}
|
|
540
|
+
/**
|
|
541
|
+
* Use this method to unban a previously banned channel chat in a supergroup or channel. The bot must be an administrator for this to work and must have the appropriate administrator rights. Returns True on success.
|
|
542
|
+
*
|
|
543
|
+
* @param chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername)
|
|
544
|
+
* @param sender_chat_id Unique identifier of the target sender chat
|
|
545
|
+
* @param signal Optional `AbortSignal` to cancel the request
|
|
546
|
+
*
|
|
547
|
+
* **Official reference:** https://core.telegram.org/bots/api#unbanchatsenderchat
|
|
548
|
+
*/
|
|
549
|
+
unbanChatSenderChat(chat_id, sender_chat_id, signal) {
|
|
550
|
+
return this.raw.unbanChatSenderChat({ chat_id, sender_chat_id }, signal);
|
|
573
551
|
}
|
|
574
552
|
/**
|
|
575
553
|
* Use this method to set default chat permissions for all members. The bot must be an administrator in the group or a supergroup for this to work and must have the can_restrict_members administrator rights. Returns True on success.
|
|
@@ -811,10 +789,7 @@ class Api {
|
|
|
811
789
|
* **Official reference:** https://core.telegram.org/bots/api#setchatstickerset
|
|
812
790
|
*/
|
|
813
791
|
setChatStickerSet(chat_id, sticker_set_name, signal) {
|
|
814
|
-
return this.raw.setChatStickerSet({
|
|
815
|
-
chat_id,
|
|
816
|
-
sticker_set_name,
|
|
817
|
-
}, signal);
|
|
792
|
+
return this.raw.setChatStickerSet({ chat_id, sticker_set_name }, signal);
|
|
818
793
|
}
|
|
819
794
|
/**
|
|
820
795
|
* Use this method to delete a group sticker set from a supergroup. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Use the field can_set_sticker_set ly returned in getChat requests to check if the bot can use this method. Returns True on success.
|
|
@@ -938,12 +913,7 @@ class Api {
|
|
|
938
913
|
* **Official reference:** https://core.telegram.org/bots/api#editmessagemedia
|
|
939
914
|
*/
|
|
940
915
|
editMessageMedia(chat_id, message_id, media, other, signal) {
|
|
941
|
-
return this.raw.editMessageMedia({
|
|
942
|
-
chat_id,
|
|
943
|
-
message_id,
|
|
944
|
-
media,
|
|
945
|
-
...other,
|
|
946
|
-
}, signal);
|
|
916
|
+
return this.raw.editMessageMedia({ chat_id, message_id, media, ...other }, signal);
|
|
947
917
|
}
|
|
948
918
|
/**
|
|
949
919
|
* Use this method to edit animation, audio, document, photo, or video messages. If a message is part of a message album, then it can be edited only to an audio for audio albums, only to a document for document albums and to a photo or a video otherwise. When an inline message is edited, a new file can't be uploaded; use a previously uploaded file via its file_id or specify a URL. On success, if the edited message is not an inline message, the edited Message is returned, otherwise True is returned.
|
|
@@ -969,11 +939,7 @@ class Api {
|
|
|
969
939
|
* **Official reference:** https://core.telegram.org/bots/api#editmessagereplymarkup
|
|
970
940
|
*/
|
|
971
941
|
editMessageReplyMarkup(chat_id, message_id, other, signal) {
|
|
972
|
-
return this.raw.editMessageReplyMarkup({
|
|
973
|
-
chat_id,
|
|
974
|
-
message_id,
|
|
975
|
-
...other,
|
|
976
|
-
}, signal);
|
|
942
|
+
return this.raw.editMessageReplyMarkup({ chat_id, message_id, ...other }, signal);
|
|
977
943
|
}
|
|
978
944
|
/**
|
|
979
945
|
* Use this method to edit only the reply markup of inline messages. On success, if the edited message is not an inline message, the edited Message is returned, otherwise True is returned.
|
|
@@ -1069,13 +1035,7 @@ class Api {
|
|
|
1069
1035
|
* **Official reference:** https://core.telegram.org/bots/api#createnewstickerset
|
|
1070
1036
|
*/
|
|
1071
1037
|
createNewStickerSet(user_id, name, title, emojis, other, signal) {
|
|
1072
|
-
return this.raw.createNewStickerSet({
|
|
1073
|
-
user_id,
|
|
1074
|
-
name,
|
|
1075
|
-
title,
|
|
1076
|
-
emojis,
|
|
1077
|
-
...other,
|
|
1078
|
-
}, signal);
|
|
1038
|
+
return this.raw.createNewStickerSet({ user_id, name, title, emojis, ...other }, signal);
|
|
1079
1039
|
}
|
|
1080
1040
|
/**
|
|
1081
1041
|
* Use this method to add a new sticker to a set created by the bot. You must use exactly one of the fields png_sticker or tgs_sticker. Animated stickers can be added to animated sticker sets and only to them. Animated sticker sets can have up to 50 stickers. Static sticker sets can have up to 120 stickers. Returns True on success.
|
|
@@ -1141,11 +1101,7 @@ class Api {
|
|
|
1141
1101
|
* **Official reference:** https://core.telegram.org/bots/api#answerinlinequery
|
|
1142
1102
|
*/
|
|
1143
1103
|
answerInlineQuery(inline_query_id, results, other, signal) {
|
|
1144
|
-
return this.raw.answerInlineQuery({
|
|
1145
|
-
inline_query_id,
|
|
1146
|
-
results,
|
|
1147
|
-
...other,
|
|
1148
|
-
}, signal);
|
|
1104
|
+
return this.raw.answerInlineQuery({ inline_query_id, results, ...other }, signal);
|
|
1149
1105
|
}
|
|
1150
1106
|
/**
|
|
1151
1107
|
* Use this method to send invoices. On success, the sent Message is returned.
|
|
@@ -1198,11 +1154,7 @@ class Api {
|
|
|
1198
1154
|
* **Official reference:** https://core.telegram.org/bots/api#answerprecheckoutquery
|
|
1199
1155
|
*/
|
|
1200
1156
|
answerPreCheckoutQuery(pre_checkout_query_id, ok, other, signal) {
|
|
1201
|
-
return this.raw.answerPreCheckoutQuery({
|
|
1202
|
-
pre_checkout_query_id,
|
|
1203
|
-
ok,
|
|
1204
|
-
...other,
|
|
1205
|
-
}, signal);
|
|
1157
|
+
return this.raw.answerPreCheckoutQuery({ pre_checkout_query_id, ok, ...other }, signal);
|
|
1206
1158
|
}
|
|
1207
1159
|
/**
|
|
1208
1160
|
* Informs a user that some of the Telegram Passport elements they provided contains errors. The user will not be able to re-submit their Passport to you until the errors are fixed (the contents of the field for which you returned the error must change). Returns True on success.
|
|
@@ -1244,13 +1196,7 @@ class Api {
|
|
|
1244
1196
|
* **Official reference:** https://core.telegram.org/bots/api#setgamescore
|
|
1245
1197
|
*/
|
|
1246
1198
|
setGameScore(chat_id, message_id, user_id, score, other, signal) {
|
|
1247
|
-
return this.raw.setGameScore({
|
|
1248
|
-
chat_id,
|
|
1249
|
-
message_id,
|
|
1250
|
-
user_id,
|
|
1251
|
-
score,
|
|
1252
|
-
...other,
|
|
1253
|
-
}, signal);
|
|
1199
|
+
return this.raw.setGameScore({ chat_id, message_id, user_id, score, ...other }, signal);
|
|
1254
1200
|
}
|
|
1255
1201
|
/**
|
|
1256
1202
|
* Use this method to set the score of the specified user in a game message. On success, if the message is not an inline message, the Message is returned, otherwise True is returned. Returns an error, if the new score is not greater than the user's current score in the chat and force is False.
|
|
@@ -1264,12 +1210,7 @@ class Api {
|
|
|
1264
1210
|
* **Official reference:** https://core.telegram.org/bots/api#setgamescore
|
|
1265
1211
|
*/
|
|
1266
1212
|
setGameScoreInline(inline_message_id, user_id, score, other, signal) {
|
|
1267
|
-
return this.raw.setGameScore({
|
|
1268
|
-
inline_message_id,
|
|
1269
|
-
user_id,
|
|
1270
|
-
score,
|
|
1271
|
-
...other,
|
|
1272
|
-
}, signal);
|
|
1213
|
+
return this.raw.setGameScore({ inline_message_id, user_id, score, ...other }, signal);
|
|
1273
1214
|
}
|
|
1274
1215
|
/**
|
|
1275
1216
|
* Use this method to get data for high score tables. Will return the score of the specified user and several of their neighbors in a game. On success, returns an Array of GameHighScore objects.
|
|
@@ -1284,11 +1225,7 @@ class Api {
|
|
|
1284
1225
|
* **Official reference:** https://core.telegram.org/bots/api#getgamehighscores
|
|
1285
1226
|
*/
|
|
1286
1227
|
getGameHighScores(chat_id, message_id, user_id, signal) {
|
|
1287
|
-
return this.raw.getGameHighScores({
|
|
1288
|
-
chat_id,
|
|
1289
|
-
message_id,
|
|
1290
|
-
user_id,
|
|
1291
|
-
}, signal);
|
|
1228
|
+
return this.raw.getGameHighScores({ chat_id, message_id, user_id }, signal);
|
|
1292
1229
|
}
|
|
1293
1230
|
/**
|
|
1294
1231
|
* Use this method to get data for high score tables. Will return the score of the specified user and several of their neighbors in an inline game. On success, returns an Array of GameHighScore objects.
|
|
@@ -1302,10 +1239,7 @@ class Api {
|
|
|
1302
1239
|
* **Official reference:** https://core.telegram.org/bots/api#getgamehighscores
|
|
1303
1240
|
*/
|
|
1304
1241
|
getGameHighScoresInline(inline_message_id, user_id, signal) {
|
|
1305
|
-
return this.raw.getGameHighScores({
|
|
1306
|
-
inline_message_id,
|
|
1307
|
-
user_id,
|
|
1308
|
-
}, signal);
|
|
1242
|
+
return this.raw.getGameHighScores({ inline_message_id, user_id }, signal);
|
|
1309
1243
|
}
|
|
1310
1244
|
}
|
|
1311
1245
|
exports.Api = Api;
|
package/out/filter.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ declare type FilterFunction<C extends Context, D extends C> = (ctx: C) => ctx is
|
|
|
17
17
|
* ```
|
|
18
18
|
*
|
|
19
19
|
* Check out the
|
|
20
|
-
* [documentation](https://doc.deno.land/https
|
|
20
|
+
* [documentation](https://doc.deno.land/https://deno.land/x/grammy/mod.ts/~/Composer)
|
|
21
21
|
* of `bot.on` for examples. In addition, the
|
|
22
22
|
* [website](https://grammy.dev/guide/filter-queries.html) contains more
|
|
23
23
|
* information about how filter queries work in grammY.
|
|
@@ -61,6 +61,7 @@ declare const UPDATE_KEYS: {
|
|
|
61
61
|
readonly voice_chat_ended: {};
|
|
62
62
|
readonly voice_chat_participants_invited: {};
|
|
63
63
|
readonly forward_date: {};
|
|
64
|
+
readonly is_automatic_forward: {};
|
|
64
65
|
readonly text: {};
|
|
65
66
|
readonly animation: {};
|
|
66
67
|
readonly audio: {};
|
|
@@ -140,6 +141,7 @@ declare const UPDATE_KEYS: {
|
|
|
140
141
|
readonly voice_chat_ended: {};
|
|
141
142
|
readonly voice_chat_participants_invited: {};
|
|
142
143
|
readonly forward_date: {};
|
|
144
|
+
readonly is_automatic_forward: {};
|
|
143
145
|
readonly text: {};
|
|
144
146
|
readonly animation: {};
|
|
145
147
|
readonly audio: {};
|
|
@@ -205,6 +207,7 @@ declare const UPDATE_KEYS: {
|
|
|
205
207
|
readonly voice_chat_ended: {};
|
|
206
208
|
readonly voice_chat_participants_invited: {};
|
|
207
209
|
readonly forward_date: {};
|
|
210
|
+
readonly is_automatic_forward: {};
|
|
208
211
|
readonly text: {};
|
|
209
212
|
readonly animation: {};
|
|
210
213
|
readonly audio: {};
|
|
@@ -270,6 +273,7 @@ declare const UPDATE_KEYS: {
|
|
|
270
273
|
readonly voice_chat_ended: {};
|
|
271
274
|
readonly voice_chat_participants_invited: {};
|
|
272
275
|
readonly forward_date: {};
|
|
276
|
+
readonly is_automatic_forward: {};
|
|
273
277
|
readonly text: {};
|
|
274
278
|
readonly animation: {};
|
|
275
279
|
readonly audio: {};
|
|
@@ -398,8 +402,8 @@ declare type PerformQuery<C extends Context, U extends SomeObject> = U extends u
|
|
|
398
402
|
declare type FilteredContext<C extends Context, U extends Update> = C & Record<"update", U> & AliasProps<Omit<U, "update_id">> & Shortcuts<U>;
|
|
399
403
|
interface Shortcuts<U extends Update> {
|
|
400
404
|
msg: [U["callback_query"]] extends [SomeObject] ? U["callback_query"]["message"] : [U["message"]] extends [SomeObject] ? U["message"] : [U["edited_message"]] extends [SomeObject] ? U["edited_message"] : [U["channel_post"]] extends [SomeObject] ? U["channel_post"] : [U["edited_channel_post"]] extends [SomeObject] ? U["edited_channel_post"] : undefined;
|
|
401
|
-
chat: [U["callback_query"]] extends [SomeObject] ? NonNullable<U["callback_query"]["message"]>["chat"] | undefined : [Shortcuts<U>["msg"]] extends [SomeObject] ? Shortcuts<U>["msg"]["chat"] : [U["my_chat_member"]] extends [SomeObject] ? U["my_chat_member"]["chat"] : [U["chat_member"]] extends [SomeObject] ? U["chat_member"]["chat"] : undefined;
|
|
402
|
-
from: [U["callback_query"]] extends [SomeObject] ? U["callback_query"]["from"] : [U["inline_query"]] extends [SomeObject] ? U["inline_query"]["from"] : [U["shipping_query"]] extends [SomeObject] ? U["shipping_query"]["from"] : [U["pre_checkout_query"]] extends [SomeObject] ? U["pre_checkout_query"]["from"] : [U["chosen_inline_result"]] extends [SomeObject] ? U["chosen_inline_result"]["from"] : [U["message"]] extends [SomeObject] ? NonNullable<U["message"]["from"]> : [U["edited_message"]] extends [SomeObject] ? NonNullable<U["edited_message"]["from"]> : [U["my_chat_member"]] extends [SomeObject] ? U["my_chat_member"]["from"] : [U["chat_member"]] extends [SomeObject] ? U["chat_member"]["from"] : undefined;
|
|
405
|
+
chat: [U["callback_query"]] extends [SomeObject] ? NonNullable<U["callback_query"]["message"]>["chat"] | undefined : [Shortcuts<U>["msg"]] extends [SomeObject] ? Shortcuts<U>["msg"]["chat"] : [U["my_chat_member"]] extends [SomeObject] ? U["my_chat_member"]["chat"] : [U["chat_member"]] extends [SomeObject] ? U["chat_member"]["chat"] : [U["chat_join_request"]] extends [SomeObject] ? U["chat_join_request"]["chat"] : undefined;
|
|
406
|
+
from: [U["callback_query"]] extends [SomeObject] ? U["callback_query"]["from"] : [U["inline_query"]] extends [SomeObject] ? U["inline_query"]["from"] : [U["shipping_query"]] extends [SomeObject] ? U["shipping_query"]["from"] : [U["pre_checkout_query"]] extends [SomeObject] ? U["pre_checkout_query"]["from"] : [U["chosen_inline_result"]] extends [SomeObject] ? U["chosen_inline_result"]["from"] : [U["message"]] extends [SomeObject] ? NonNullable<U["message"]["from"]> : [U["edited_message"]] extends [SomeObject] ? NonNullable<U["edited_message"]["from"]> : [U["my_chat_member"]] extends [SomeObject] ? U["my_chat_member"]["from"] : [U["chat_member"]] extends [SomeObject] ? U["chat_member"]["from"] : [U["chat_join_request"]] extends [SomeObject] ? U["chat_join_request"]["from"] : undefined;
|
|
403
407
|
}
|
|
404
408
|
declare const L1_SHORTCUTS: {
|
|
405
409
|
readonly "": readonly ["message", "channel_post"];
|
package/out/filter.js
CHANGED
|
@@ -18,7 +18,7 @@ exports.matchFilter = void 0;
|
|
|
18
18
|
* ```
|
|
19
19
|
*
|
|
20
20
|
* Check out the
|
|
21
|
-
* [documentation](https://doc.deno.land/https
|
|
21
|
+
* [documentation](https://doc.deno.land/https://deno.land/x/grammy/mod.ts/~/Composer)
|
|
22
22
|
* of `bot.on` for examples. In addition, the
|
|
23
23
|
* [website](https://grammy.dev/guide/filter-queries.html) contains more
|
|
24
24
|
* information about how filter queries work in grammY.
|
|
@@ -249,6 +249,7 @@ const COMMON_MESSAGE_KEYS = {
|
|
|
249
249
|
voice_chat_ended: {},
|
|
250
250
|
voice_chat_participants_invited: {},
|
|
251
251
|
forward_date: {},
|
|
252
|
+
is_automatic_forward: {},
|
|
252
253
|
};
|
|
253
254
|
const MESSAGE_KEYS = {
|
|
254
255
|
...COMMON_MESSAGE_KEYS,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "grammy",
|
|
3
3
|
"description": "The Telegram Bot Framework.",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.5.3",
|
|
5
5
|
"author": "KnorpelSenf",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"engines": {
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"contribs": "all-contributors"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@grammyjs/types": "^2.
|
|
26
|
+
"@grammyjs/types": "^2.4.5",
|
|
27
27
|
"abort-controller": "^3.0.0",
|
|
28
28
|
"debug": "^4.3.3",
|
|
29
29
|
"node-fetch": "^2.6.5"
|