grammy 1.7.2 → 1.7.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 +4 -2
- package/out/bot.d.ts +1 -0
- package/out/bot.js +14 -6
- 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 -->
|
|
@@ -111,7 +111,7 @@ You may also be interested in [why we support Deno](https://grammy.dev/resources
|
|
|
111
111
|
## Browser Support
|
|
112
112
|
|
|
113
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
|
|
114
|
+
Currently, we transpile all stable versions (all releases since v1.0) as well as the current `main` branch to ES6 and ESNext.
|
|
115
115
|
|
|
116
116
|
You can download them from the URL `https://get.grammy.dev/[ES version lowercased]@[grammY version including v-prefix].js`.
|
|
117
117
|
For example, the most recent source on `main` in ES6 is available from <https://get.grammy.dev/es6@dev.js>.
|
|
@@ -195,6 +195,8 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
|
|
|
195
195
|
<td align="center"><a href="https://github.com/abdollahzadehAli"><img src="https://avatars.githubusercontent.com/u/96317431?v=4?s=100" width="100px;" alt=""/><br /><sub><b>abdollahzadehAli</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/commits?author=abdollahzadehAli" title="Documentation">📖</a> <a href="#example-abdollahzadehAli" title="Examples">💡</a></td>
|
|
196
196
|
<td align="center"><a href="https://github.com/MrSaeedNasiri"><img src="https://avatars.githubusercontent.com/u/17780289?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Saeed Nasiri</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/commits?author=MrSaeedNasiri" title="Documentation">📖</a></td>
|
|
197
197
|
<td align="center"><a href="https://github.com/Scrip7"><img src="https://avatars.githubusercontent.com/u/37535505?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Hesoyam</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/commits?author=Scrip7" title="Documentation">📖</a></td>
|
|
198
|
+
<td align="center"><a href="http://yrz.am"><img src="https://avatars.githubusercontent.com/u/96742416?v=4?s=100" width="100px;" alt=""/><br /><sub><b>yrzam</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/issues?q=author%3Ayrzam" title="Bug reports">🐛</a></td>
|
|
199
|
+
<td align="center"><a href="https://github.com/drmikecrowe"><img src="https://avatars.githubusercontent.com/u/90312?v=4?s=100" width="100px;" alt=""/><br /><sub><b>drmikecrowe</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/pulls?q=is%3Apr+reviewed-by%3Adrmikecrowe" title="Reviewed Pull Requests">👀</a></td>
|
|
198
200
|
</tr>
|
|
199
201
|
</table>
|
|
200
202
|
|
package/out/bot.d.ts
CHANGED
package/out/bot.js
CHANGED
|
@@ -115,9 +115,17 @@ class Bot extends composer_js_1.Composer {
|
|
|
115
115
|
* manually.
|
|
116
116
|
*/
|
|
117
117
|
async init() {
|
|
118
|
+
var _a;
|
|
118
119
|
if (!this.isInited()) {
|
|
119
120
|
debug("Initializing bot");
|
|
120
|
-
|
|
121
|
+
(_a = this.mePromise) !== null && _a !== void 0 ? _a : (this.mePromise = withRetries(() => this.api.getMe()));
|
|
122
|
+
let me;
|
|
123
|
+
try {
|
|
124
|
+
me = await this.mePromise;
|
|
125
|
+
}
|
|
126
|
+
finally {
|
|
127
|
+
this.mePromise = undefined;
|
|
128
|
+
}
|
|
121
129
|
if (this.me === undefined)
|
|
122
130
|
this.me = me;
|
|
123
131
|
else
|
|
@@ -225,7 +233,7 @@ a known bot info object.");
|
|
|
225
233
|
var _a;
|
|
226
234
|
// Perform setup
|
|
227
235
|
if (!this.isInited())
|
|
228
|
-
await
|
|
236
|
+
await this.init();
|
|
229
237
|
if (this.pollingRunning) {
|
|
230
238
|
debug("Simple long polling already running!");
|
|
231
239
|
return;
|
|
@@ -386,11 +394,10 @@ exports.Bot = Bot;
|
|
|
386
394
|
* @param task Async task to perform
|
|
387
395
|
*/
|
|
388
396
|
async function withRetries(task) {
|
|
389
|
-
let
|
|
390
|
-
while (!
|
|
397
|
+
let result = { ok: false };
|
|
398
|
+
while (!result.ok) {
|
|
391
399
|
try {
|
|
392
|
-
await task();
|
|
393
|
-
success = true;
|
|
400
|
+
result = { ok: true, value: await task() };
|
|
394
401
|
}
|
|
395
402
|
catch (error) {
|
|
396
403
|
debugErr(error);
|
|
@@ -409,6 +416,7 @@ async function withRetries(task) {
|
|
|
409
416
|
throw error;
|
|
410
417
|
}
|
|
411
418
|
}
|
|
419
|
+
return result.value;
|
|
412
420
|
}
|
|
413
421
|
/**
|
|
414
422
|
* Returns a new promise that resolves after the specified number of seconds.
|