grammy 1.5.3 → 1.5.4
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 +12 -1
- package/out/composer.js +1 -1
- package/out/convenience/keyboard.d.ts +9 -9
- package/out/convenience/keyboard.js +9 -9
- package/out/filter.js +1 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -12,7 +12,7 @@ _<h2 align="center"> [:mag: Documentation](https://grammy.dev) | [:page_with_cur
|
|
|
12
12
|
|
|
13
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 -->
|
|
@@ -108,6 +108,16 @@ However, given that most bot developers are still using Node.js, all documentati
|
|
|
108
108
|
|
|
109
109
|
You may also be interested in [why we support Deno](https://grammy.dev/resources/faq.html#why-do-you-support-deno).
|
|
110
110
|
|
|
111
|
+
## Browser Support
|
|
112
|
+
|
|
113
|
+
The grammY core package in this repository is avaiable as a JavaScript bundle from the CDN at `get.grammy.dev`.
|
|
114
|
+
Currently, we transpile all stable versions (all releases since v1.0) as well as the current `main` branch to ES3, ES5, ES6, and ESNext.
|
|
115
|
+
|
|
116
|
+
You can download them from the URL `https://get.grammy.dev/[ES version lowercased]@[grammY version including v-prefix].js`.
|
|
117
|
+
For example, the most recent source on `main` in ES6 is available from <https://get.grammy.dev/es6@dev.js>.
|
|
118
|
+
|
|
119
|
+
So far, this is mainly useful for running bots on Cloudflare Workers.
|
|
120
|
+
|
|
111
121
|
## [Contribution Guide »](./CONTRIBUTING.md)
|
|
112
122
|
|
|
113
123
|
## Contributors ✨
|
|
@@ -176,6 +186,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
|
|
|
176
186
|
<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
187
|
<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
188
|
<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>
|
|
189
|
+
<td align="center"><a href="http://glukki.ru"><img src="https://avatars.githubusercontent.com/u/140462?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Vitaliy Meshchaninov</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/issues?q=author%3Aglukki" title="Bug reports">🐛</a> <a href="https://github.com/grammyjs/grammY/commits?author=glukki" title="Code">💻</a></td>
|
|
179
190
|
</tr>
|
|
180
191
|
</table>
|
|
181
192
|
|
package/out/composer.js
CHANGED
|
@@ -299,7 +299,7 @@ class Composer {
|
|
|
299
299
|
const noAtCommands = new Set();
|
|
300
300
|
toArray(command).forEach((cmd) => {
|
|
301
301
|
if (cmd.startsWith("/")) {
|
|
302
|
-
throw new Error(`Do not include '/' when registering command handlers (use '${cmd.substr(
|
|
302
|
+
throw new Error(`Do not include '/' when registering command handlers (use '${cmd.substr(1)}' not '${cmd}')`);
|
|
303
303
|
}
|
|
304
304
|
const set = cmd.indexOf("@") === -1 ? noAtCommands : atCommands;
|
|
305
305
|
set.add(cmd);
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { InlineKeyboardButton, KeyboardButton, LoginUrl } from "../platform.node.js";
|
|
2
2
|
/**
|
|
3
|
-
* Use this class to simplify building a keyboard (something like this:
|
|
3
|
+
* Use this class to simplify building a custom keyboard (something like this:
|
|
4
4
|
* https://core.telegram.org/bots#keyboards).
|
|
5
5
|
*
|
|
6
6
|
* ```ts
|
|
7
|
-
* // Build a keyboard:
|
|
7
|
+
* // Build a custom keyboard:
|
|
8
8
|
* const keyboard = new Keyboard()
|
|
9
9
|
* .text('A').text('B').row()
|
|
10
10
|
* .text('C').text('D')
|
|
11
11
|
*
|
|
12
12
|
* // Now you can either pass it directly:
|
|
13
|
-
* ctx.reply('Here is your keyboard!', {
|
|
13
|
+
* ctx.reply('Here is your custom keyboard!', {
|
|
14
14
|
* reply_markup: keyboard
|
|
15
15
|
* })
|
|
16
16
|
* // Or if you need to specify more options in `reply_markup`:
|
|
17
|
-
* ctx.reply('Here is your keyboard!', {
|
|
17
|
+
* ctx.reply('Here is your custom keyboard!', {
|
|
18
18
|
* reply_markup: {
|
|
19
19
|
* keyboard: keyboard.build(), // note the `build` call
|
|
20
20
|
* one_time_keyboard: true,
|
|
@@ -23,12 +23,12 @@ import { InlineKeyboardButton, KeyboardButton, LoginUrl } from "../platform.node
|
|
|
23
23
|
* ```
|
|
24
24
|
*
|
|
25
25
|
* Be sure to check out the
|
|
26
|
-
* [documentation](https://grammy.dev/plugins/keyboard.html#keyboards) on
|
|
27
|
-
* keyboards in grammY.
|
|
26
|
+
* [documentation](https://grammy.dev/plugins/keyboard.html#custom-keyboards) on
|
|
27
|
+
* custom keyboards in grammY.
|
|
28
28
|
*/
|
|
29
29
|
export declare class Keyboard {
|
|
30
30
|
/**
|
|
31
|
-
* The nested array that holds the keyboard. It will be extended every time
|
|
31
|
+
* The nested array that holds the custom keyboard. It will be extended every time
|
|
32
32
|
* you call one of the provided methods.
|
|
33
33
|
*/
|
|
34
34
|
readonly keyboard: KeyboardButton[][];
|
|
@@ -82,8 +82,8 @@ export declare class Keyboard {
|
|
|
82
82
|
*/
|
|
83
83
|
requestPoll(text: string, type?: "quiz" | "regular"): this;
|
|
84
84
|
/**
|
|
85
|
-
* Return the resulting keyboard that was built. May be called in the
|
|
86
|
-
* necessary so you can specify more options in `reply_markup`.
|
|
85
|
+
* Return the resulting custom keyboard that was built. May be called in the
|
|
86
|
+
* end if necessary so you can specify more options in `reply_markup`.
|
|
87
87
|
*/
|
|
88
88
|
build(): KeyboardButton[][];
|
|
89
89
|
}
|
|
@@ -2,21 +2,21 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.InlineKeyboard = exports.Keyboard = void 0;
|
|
4
4
|
/**
|
|
5
|
-
* Use this class to simplify building a keyboard (something like this:
|
|
5
|
+
* Use this class to simplify building a custom keyboard (something like this:
|
|
6
6
|
* https://core.telegram.org/bots#keyboards).
|
|
7
7
|
*
|
|
8
8
|
* ```ts
|
|
9
|
-
* // Build a keyboard:
|
|
9
|
+
* // Build a custom keyboard:
|
|
10
10
|
* const keyboard = new Keyboard()
|
|
11
11
|
* .text('A').text('B').row()
|
|
12
12
|
* .text('C').text('D')
|
|
13
13
|
*
|
|
14
14
|
* // Now you can either pass it directly:
|
|
15
|
-
* ctx.reply('Here is your keyboard!', {
|
|
15
|
+
* ctx.reply('Here is your custom keyboard!', {
|
|
16
16
|
* reply_markup: keyboard
|
|
17
17
|
* })
|
|
18
18
|
* // Or if you need to specify more options in `reply_markup`:
|
|
19
|
-
* ctx.reply('Here is your keyboard!', {
|
|
19
|
+
* ctx.reply('Here is your custom keyboard!', {
|
|
20
20
|
* reply_markup: {
|
|
21
21
|
* keyboard: keyboard.build(), // note the `build` call
|
|
22
22
|
* one_time_keyboard: true,
|
|
@@ -25,13 +25,13 @@ exports.InlineKeyboard = exports.Keyboard = void 0;
|
|
|
25
25
|
* ```
|
|
26
26
|
*
|
|
27
27
|
* Be sure to check out the
|
|
28
|
-
* [documentation](https://grammy.dev/plugins/keyboard.html#keyboards) on
|
|
29
|
-
* keyboards in grammY.
|
|
28
|
+
* [documentation](https://grammy.dev/plugins/keyboard.html#custom-keyboards) on
|
|
29
|
+
* custom keyboards in grammY.
|
|
30
30
|
*/
|
|
31
31
|
class Keyboard {
|
|
32
32
|
constructor() {
|
|
33
33
|
/**
|
|
34
|
-
* The nested array that holds the keyboard. It will be extended every time
|
|
34
|
+
* The nested array that holds the custom keyboard. It will be extended every time
|
|
35
35
|
* you call one of the provided methods.
|
|
36
36
|
*/
|
|
37
37
|
Object.defineProperty(this, "keyboard", {
|
|
@@ -106,8 +106,8 @@ class Keyboard {
|
|
|
106
106
|
return this.add({ text, request_poll: { type } });
|
|
107
107
|
}
|
|
108
108
|
/**
|
|
109
|
-
* Return the resulting keyboard that was built. May be called in the
|
|
110
|
-
* necessary so you can specify more options in `reply_markup`.
|
|
109
|
+
* Return the resulting custom keyboard that was built. May be called in the
|
|
110
|
+
* end if necessary so you can specify more options in `reply_markup`.
|
|
111
111
|
*/
|
|
112
112
|
build() {
|
|
113
113
|
return this.keyboard;
|
package/out/filter.js
CHANGED
|
@@ -127,9 +127,7 @@ Permitted values are: ${permitted.map((k) => `'${k}'`).join(", ")}.`;
|
|
|
127
127
|
const permitted = Object.keys(l2Obj);
|
|
128
128
|
return `Invalid L3 filter '${l3}' given in '${filter.join(":")}'. ${permitted.length === 0
|
|
129
129
|
? `No further filtering is possible after '${l1}:${l2}'.`
|
|
130
|
-
: `Permitted values are: ${permitted
|
|
131
|
-
.map((k) => `'${k}'`)
|
|
132
|
-
.join(", ")}.`}`;
|
|
130
|
+
: `Permitted values are: ${permitted.map((k) => `'${k}'`).join(", ")}.`}`;
|
|
133
131
|
}
|
|
134
132
|
if (n.length === 0)
|
|
135
133
|
return true;
|