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 +1 -1
- package/README.md +6 -2
- package/out/bot.d.ts +12 -1
- package/out/bot.js +17 -6
- package/package.json +1 -1
package/LICENSE
CHANGED
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
|
-
[](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 -->
|
|
@@ -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
|
|
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
|
|
174
|
+
* method is called automatically, you usually don't have to call it
|
|
175
|
+
* manually.
|
|
163
176
|
*/
|
|
164
177
|
async init() {
|
|
165
|
-
if (this.
|
|
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
|
-
|
|
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;
|