grammy 1.7.1 → 1.7.2

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 CHANGED
@@ -12,7 +12,7 @@ _<h2 align="center"> [:mag: Documentation](https://grammy.dev) | [:page_with_cur
12
12
 
13
13
  [![Bot API](https://img.shields.io/badge/Bot%20API-5.7-blue?logo=telegram&style=flat-square)](https://core.telegram.org/bots/api)
14
14
  [![npm](https://img.shields.io/npm/v/grammy?logo=npm&style=flat-square)](https://www.npmjs.org/package/grammy) <!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
15
- [![All Contributors](https://img.shields.io/badge/all_contributors-50-orange.svg?style=flat-square)](#contributors-)
15
+ [![All Contributors](https://img.shields.io/badge/all_contributors-52-orange.svg?style=flat-square)](#contributors-)
16
16
  <!-- ALL-CONTRIBUTORS-BADGE:END -->
17
17
 
18
18
  <!-- deno-fmt-ignore-end -->
@@ -193,6 +193,8 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
193
193
  </tr>
194
194
  <tr>
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
+ <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
+ <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>
196
198
  </tr>
197
199
  </table>
198
200
 
package/out/bot.d.ts CHANGED
@@ -35,13 +35,14 @@ export interface PollingOptions {
35
35
  */
36
36
  drop_pending_updates?: boolean;
37
37
  /**
38
- * Synchronous callback that is useful for logging. It will be executed once
39
- * the setup of the bot has completed, and immediately before the first
40
- * updates are being fetched. The bot information `bot.botInfo` will be
41
- * available when the function is run. For convenience, the callback
42
- * function receives the value of `bot.botInfo` as an argument.
38
+ * A callback function that is useful for logging (or setting up middleware
39
+ * if you did not do this before). It will be executed after the setup of
40
+ * the bot has completed, and immediately before the first updates are being
41
+ * fetched. The bot information `bot.botInfo` will be available when the
42
+ * function is run. For convenience, the callback function receives the
43
+ * value of `bot.botInfo` as an argument.
43
44
  */
44
- onStart?: (botInfo: UserFromGetMe) => void;
45
+ onStart?: (botInfo: UserFromGetMe) => void | Promise<void>;
45
46
  }
46
47
  export { BotError };
47
48
  /**
@@ -50,7 +51,7 @@ export { BotError };
50
51
  */
51
52
  export declare type ErrorHandler<C extends Context = Context> = (error: BotError<C>) => unknown;
52
53
  /**
53
- * Options to pass the bot when creating it.
54
+ * Options to pass to the bot when creating it.
54
55
  */
55
56
  export interface BotConfig<C extends Context> {
56
57
  /**
package/out/bot.js CHANGED
@@ -233,6 +233,8 @@ a known bot info object.");
233
233
  await withRetries(() => this.api.deleteWebhook({
234
234
  drop_pending_updates: options === null || options === void 0 ? void 0 : options.drop_pending_updates,
235
235
  }));
236
+ // All async ops of setup complete, run callback
237
+ await ((_a = options === null || options === void 0 ? void 0 : options.onStart) === null || _a === void 0 ? void 0 : _a.call(options, this.botInfo));
236
238
  // Prevent common misuse that causes memory leak
237
239
  this.use = () => {
238
240
  throw new Error(`It looks like you are registering more listeners \
@@ -249,7 +251,6 @@ you can circumvent this protection against memory leaks.`);
249
251
  };
250
252
  // Start polling
251
253
  debug("Starting simple long polling");
252
- (_a = options === null || options === void 0 ? void 0 : options.onStart) === null || _a === void 0 ? void 0 : _a.call(options, this.botInfo);
253
254
  await this.loop(options);
254
255
  debug("Middleware is done running");
255
256
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "grammy",
3
3
  "description": "The Telegram Bot Framework.",
4
- "version": "1.7.1",
4
+ "version": "1.7.2",
5
5
  "author": "KnorpelSenf",
6
6
  "license": "MIT",
7
7
  "engines": {
@@ -25,15 +25,15 @@
25
25
  "dependencies": {
26
26
  "@grammyjs/types": "^2.6.0",
27
27
  "abort-controller": "^3.0.0",
28
- "debug": "^4.3.3",
29
- "node-fetch": "^2.6.5"
28
+ "debug": "^4.3.4",
29
+ "node-fetch": "^2.6.7"
30
30
  },
31
31
  "devDependencies": {
32
32
  "@types/debug": "^4.1.7",
33
- "@types/node": "^12.20.36",
34
- "@types/node-fetch": "^2.5.12",
33
+ "@types/node": "^12.20.47",
34
+ "@types/node-fetch": "^2.6.1",
35
35
  "all-contributors-cli": "^6.20.0",
36
- "deno2node": "^1.1.0"
36
+ "deno2node": "^1.3.0"
37
37
  },
38
38
  "files": [
39
39
  "out/"