gramio 0.1.2 → 0.1.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 +3 -3
- package/dist/index.cjs +12 -1
- package/dist/index.js +12 -1
- package/package.json +8 -5
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
<div align="center">
|
|
4
4
|
|
|
5
|
-
[](https://core.telegram.org/bots/api)
|
|
6
6
|
[](https://www.npmjs.org/package/gramio)
|
|
7
7
|
[](https://jsr.io/@gramio/core)
|
|
8
8
|
[](https://jsr.io/@gramio/core)
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
|
|
12
12
|
TypeScript/JavaScript Telegram Bot API Framework for create your bots with convenience!
|
|
13
13
|
|
|
14
|
-
✨ **Extensible** - Our plugin and hook system is awesome
|
|
14
|
+
✨ **Extensible** - Our [plugin](https://gramio.dev/plugins/) and [hook](https://gramio.dev/hooks/overview) system is awesome
|
|
15
15
|
|
|
16
16
|
🛡️ **Type-safe** - Written in TypeScript with love ❤️
|
|
17
17
|
|
|
@@ -24,7 +24,7 @@ TypeScript/JavaScript Telegram Bot API Framework for create your bots with conve
|
|
|
24
24
|
To create your new bot, you just need to write it to the console:
|
|
25
25
|
|
|
26
26
|
```bash [npm]
|
|
27
|
-
npm create gramio ./bot
|
|
27
|
+
npm create gramio@latest ./bot
|
|
28
28
|
```
|
|
29
29
|
|
|
30
30
|
and GramIO customize your project the way you want it!
|
package/dist/index.cjs
CHANGED
|
@@ -369,7 +369,9 @@ class Updates {
|
|
|
369
369
|
}
|
|
370
370
|
} catch (error) {
|
|
371
371
|
console.error("Error received when fetching updates", error);
|
|
372
|
-
|
|
372
|
+
if (error instanceof TelegramError && error.payload?.retry_after) {
|
|
373
|
+
await sleep(error.payload.retry_after * 1e3);
|
|
374
|
+
} else await sleep(this.bot.options.api.retryGetUpdatesWait ?? 1e3);
|
|
373
375
|
}
|
|
374
376
|
}
|
|
375
377
|
}
|
|
@@ -821,6 +823,15 @@ class Bot {
|
|
|
821
823
|
for (const handler of plugin._.groups) {
|
|
822
824
|
this.group(handler);
|
|
823
825
|
}
|
|
826
|
+
for (const value of plugin._.onErrors) {
|
|
827
|
+
this.onError(value);
|
|
828
|
+
}
|
|
829
|
+
for (const value of plugin._.onStarts) {
|
|
830
|
+
this.onStart(value);
|
|
831
|
+
}
|
|
832
|
+
for (const value of plugin._.onStops) {
|
|
833
|
+
this.onStop(value);
|
|
834
|
+
}
|
|
824
835
|
this.dependencies.push(plugin._.name);
|
|
825
836
|
return this;
|
|
826
837
|
}
|
package/dist/index.js
CHANGED
|
@@ -371,7 +371,9 @@ class Updates {
|
|
|
371
371
|
}
|
|
372
372
|
} catch (error) {
|
|
373
373
|
console.error("Error received when fetching updates", error);
|
|
374
|
-
|
|
374
|
+
if (error instanceof TelegramError && error.payload?.retry_after) {
|
|
375
|
+
await sleep(error.payload.retry_after * 1e3);
|
|
376
|
+
} else await sleep(this.bot.options.api.retryGetUpdatesWait ?? 1e3);
|
|
375
377
|
}
|
|
376
378
|
}
|
|
377
379
|
}
|
|
@@ -823,6 +825,15 @@ class Bot {
|
|
|
823
825
|
for (const handler of plugin._.groups) {
|
|
824
826
|
this.group(handler);
|
|
825
827
|
}
|
|
828
|
+
for (const value of plugin._.onErrors) {
|
|
829
|
+
this.onError(value);
|
|
830
|
+
}
|
|
831
|
+
for (const value of plugin._.onStarts) {
|
|
832
|
+
this.onStart(value);
|
|
833
|
+
}
|
|
834
|
+
for (const value of plugin._.onStops) {
|
|
835
|
+
this.onStop(value);
|
|
836
|
+
}
|
|
826
837
|
this.dependencies.push(plugin._.name);
|
|
827
838
|
return this;
|
|
828
839
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gramio",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.4",
|
|
5
5
|
"description": "Powerful, extensible and really type-safe Telegram Bot API framework",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
7
7
|
"module": "dist/index.js",
|
|
@@ -41,21 +41,24 @@
|
|
|
41
41
|
"license": "MIT",
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@biomejs/biome": "1.9.4",
|
|
44
|
-
"@types/bun": "^1.1.
|
|
44
|
+
"@types/bun": "^1.1.14",
|
|
45
45
|
"@types/debug": "^4.1.12",
|
|
46
46
|
"pkgroll": "^2.5.1",
|
|
47
|
-
"typescript": "^5.
|
|
47
|
+
"typescript": "^5.7.2"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
50
|
"@gramio/callback-data": "^0.0.3",
|
|
51
51
|
"@gramio/contexts": "^0.0.23",
|
|
52
52
|
"@gramio/files": "^0.1.0",
|
|
53
|
-
"@gramio/format": "^0.1.
|
|
53
|
+
"@gramio/format": "^0.1.5",
|
|
54
54
|
"@gramio/keyboards": "^1.0.0",
|
|
55
|
-
"@gramio/types": "^
|
|
55
|
+
"@gramio/types": "^8.0.6",
|
|
56
56
|
"debug": "^4.3.7",
|
|
57
57
|
"inspectable": "^3.0.2",
|
|
58
58
|
"middleware-io": "^2.8.1"
|
|
59
59
|
},
|
|
60
|
+
"overrides": {
|
|
61
|
+
"@gramio/types": "^8.0.6"
|
|
62
|
+
},
|
|
60
63
|
"files": ["dist"]
|
|
61
64
|
}
|