grammy 1.6.1 β†’ 1.6.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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2021 KnorpelSenf
3
+ Copyright (c) 2022 KnorpelSenf
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -10,9 +10,9 @@ _<h2 align="center"> [:mag: Documentation](https://grammy.dev) | [:page_with_cur
10
10
 
11
11
  <!-- deno-fmt-ignore-start -->
12
12
 
13
- [![Bot API](https://img.shields.io/badge/Bot%20API-5.5-blue?logo=telegram&style=flat-square)](https://core.telegram.org/bots/api)
13
+ [![Bot API](https://img.shields.io/badge/Bot%20API-5.6-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-48-orange.svg?style=flat-square)](#contributors-)
15
+ [![All Contributors](https://img.shields.io/badge/all_contributors-50-orange.svg?style=flat-square)](#contributors-)
16
16
  <!-- ALL-CONTRIBUTORS-BADGE:END -->
17
17
 
18
18
  <!-- deno-fmt-ignore-end -->
@@ -189,6 +189,10 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
189
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>
190
190
  <td align="center"><a href="https://github.com/dilyanpalauzov"><img src="https://avatars.githubusercontent.com/u/4992947?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Дилян ΠŸΠ°Π»Π°ΡƒΠ·ΠΎΠ²</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/issues?q=author%3Adilyanpalauzov" title="Bug reports">πŸ›</a> <a href="https://github.com/grammyjs/grammY/commits?author=dilyanpalauzov" title="Code">πŸ’»</a></td>
191
191
  <td align="center"><a href="https://github.com/lmx-Hexagram"><img src="https://avatars.githubusercontent.com/u/52130356?v=4?s=100" width="100px;" alt=""/><br /><sub><b>lmx-Hexagram</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/commits?author=lmx-Hexagram" title="Documentation">πŸ“–</a></td>
192
+ <td align="center"><a href="https://github.com/IlyaSemenov"><img src="https://avatars.githubusercontent.com/u/128121?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Ilya Semenov</b></sub></a><br /><a href="#ideas-IlyaSemenov" title="Ideas, Planning, & Feedback">πŸ€”</a> <a href="https://github.com/grammyjs/grammY/pulls?q=is%3Apr+reviewed-by%3AIlyaSemenov" title="Reviewed Pull Requests">πŸ‘€</a></td>
193
+ </tr>
194
+ <tr>
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>
192
196
  </tr>
193
197
  </table>
194
198
 
package/out/bot.d.ts CHANGED
@@ -153,9 +153,20 @@ export declare class Bot<C extends Context = Context, A extends Api = Api> exten
153
153
  */
154
154
  set botInfo(botInfo: UserFromGetMe);
155
155
  get botInfo(): UserFromGetMe;
156
+ /**
157
+ * Checks if the bot has been initialized. A bot is initialized if the bot
158
+ * information is set. The bot information can either be set automatically
159
+ * by calling `bot.init`, or manually through the bot constructor. Note that
160
+ * usually, initialization is done automatically and you do not have to care
161
+ * about this method.
162
+ *
163
+ * @returns true if the bot is initialized, and false otherwise
164
+ */
165
+ isInited(): boolean;
156
166
  /**
157
167
  * Initializes the bot, i.e. fetches information about the bot itself. This
158
- * method is called automatically, you don't have to call it manually.
168
+ * method is called automatically, you usually don't have to call it
169
+ * manually.
159
170
  */
160
171
  init(): Promise<void>;
161
172
  /**
package/out/bot.js CHANGED
@@ -157,12 +157,25 @@ class Bot extends composer_js_1.Composer {
157
157
  }
158
158
  return this.me;
159
159
  }
160
+ /**
161
+ * Checks if the bot has been initialized. A bot is initialized if the bot
162
+ * information is set. The bot information can either be set automatically
163
+ * by calling `bot.init`, or manually through the bot constructor. Note that
164
+ * usually, initialization is done automatically and you do not have to care
165
+ * about this method.
166
+ *
167
+ * @returns true if the bot is initialized, and false otherwise
168
+ */
169
+ isInited() {
170
+ return this.me !== undefined;
171
+ }
160
172
  /**
161
173
  * Initializes the bot, i.e. fetches information about the bot itself. This
162
- * method is called automatically, you don't have to call it manually.
174
+ * method is called automatically, you usually don't have to call it
175
+ * manually.
163
176
  */
164
177
  async init() {
165
- if (this.me === undefined) {
178
+ if (!this.isInited()) {
166
179
  debug("Initializing bot");
167
180
  const me = await this.api.getMe();
168
181
  if (this.me === undefined)
@@ -170,9 +183,6 @@ class Bot extends composer_js_1.Composer {
170
183
  else
171
184
  debug("Bot info was set manually by now, will not overwrite");
172
185
  }
173
- else {
174
- debug("Bot already initialized!");
175
- }
176
186
  debug(`I am ${this.me.username}!`);
177
187
  }
178
188
  /**
@@ -248,7 +258,8 @@ a known bot info object.");
248
258
  async start(options) {
249
259
  var _a, _b;
250
260
  // Perform setup
251
- await withRetries(() => this.init());
261
+ if (!this.isInited())
262
+ await withRetries(() => this.init());
252
263
  if (this.pollingRunning) {
253
264
  debug("Simple long polling already running!");
254
265
  return;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "grammy",
3
3
  "description": "The Telegram Bot Framework.",
4
- "version": "1.6.1",
4
+ "version": "1.6.2",
5
5
  "author": "KnorpelSenf",
6
6
  "license": "MIT",
7
7
  "engines": {