gramio 0.1.1 → 0.1.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 +26 -2
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/package.json +4 -4
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)
|
|
@@ -19,7 +19,6 @@ TypeScript/JavaScript Telegram Bot API Framework for create your bots with conve
|
|
|
19
19
|
|
|
20
20
|
⚙️ **Code-generated** - Many parts are code-generated (for example, [code-generated and auto-published Telegram Bot API types](https://github.com/gramiojs/types))
|
|
21
21
|
|
|
22
|
-
|
|
23
22
|
## [Get started](https://gramio.dev/get-started)
|
|
24
23
|
|
|
25
24
|
To create your new bot, you just need to write it to the console:
|
|
@@ -43,3 +42,28 @@ bot.start();
|
|
|
43
42
|
```
|
|
44
43
|
|
|
45
44
|
For more, please see [documentation](https://gramio.dev).
|
|
45
|
+
|
|
46
|
+
### GramIO in action
|
|
47
|
+
|
|
48
|
+
Example which uses some interesting features.
|
|
49
|
+
|
|
50
|
+
```ts
|
|
51
|
+
import { Bot, format, bold, code } from "gramio";
|
|
52
|
+
import { findOrRegisterUser } from "./utils";
|
|
53
|
+
|
|
54
|
+
const bot = new Bot(process.env.BOT_TOKEN as string)
|
|
55
|
+
.derive("message", async () => {
|
|
56
|
+
const user = await findOrRegisterUser();
|
|
57
|
+
|
|
58
|
+
return {
|
|
59
|
+
user,
|
|
60
|
+
};
|
|
61
|
+
})
|
|
62
|
+
.on("message", (context) => {
|
|
63
|
+
context.user; // typed
|
|
64
|
+
|
|
65
|
+
return context.send(format`
|
|
66
|
+
Hi, ${bold(context.user.name)}!
|
|
67
|
+
You balance: ${code(context.user.balance)}`);
|
|
68
|
+
});
|
|
69
|
+
```
|
package/dist/index.d.cts
CHANGED
|
@@ -277,7 +277,7 @@ interface BotOptions {
|
|
|
277
277
|
/** Bot token */
|
|
278
278
|
token: string;
|
|
279
279
|
/** When the bot begins to listen for updates, `GramIO` retrieves information about the bot to verify if the **bot token is valid**
|
|
280
|
-
* and to utilize some bot metadata. For
|
|
280
|
+
* and to utilize some bot metadata. For example, this metadata will be used to strip bot mentions in commands.
|
|
281
281
|
*
|
|
282
282
|
* If you set it up, `GramIO` will not send a `getMe` request on startup.
|
|
283
283
|
*
|
package/dist/index.d.ts
CHANGED
|
@@ -277,7 +277,7 @@ interface BotOptions {
|
|
|
277
277
|
/** Bot token */
|
|
278
278
|
token: string;
|
|
279
279
|
/** When the bot begins to listen for updates, `GramIO` retrieves information about the bot to verify if the **bot token is valid**
|
|
280
|
-
* and to utilize some bot metadata. For
|
|
280
|
+
* and to utilize some bot metadata. For example, this metadata will be used to strip bot mentions in commands.
|
|
281
281
|
*
|
|
282
282
|
* If you set it up, `GramIO` will not send a `getMe` request on startup.
|
|
283
283
|
*
|
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.2",
|
|
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",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"@biomejs/biome": "1.9.4",
|
|
44
44
|
"@types/bun": "^1.1.12",
|
|
45
45
|
"@types/debug": "^4.1.12",
|
|
46
|
-
"pkgroll": "^2.5.
|
|
46
|
+
"pkgroll": "^2.5.1",
|
|
47
47
|
"typescript": "^5.6.3"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
@@ -51,8 +51,8 @@
|
|
|
51
51
|
"@gramio/contexts": "^0.0.23",
|
|
52
52
|
"@gramio/files": "^0.1.0",
|
|
53
53
|
"@gramio/format": "^0.1.4",
|
|
54
|
-
"@gramio/keyboards": "^0.
|
|
55
|
-
"@gramio/types": "^7.
|
|
54
|
+
"@gramio/keyboards": "^1.0.0",
|
|
55
|
+
"@gramio/types": "^7.11.0",
|
|
56
56
|
"debug": "^4.3.7",
|
|
57
57
|
"inspectable": "^3.0.2",
|
|
58
58
|
"middleware-io": "^2.8.1"
|