gramio 0.1.0 → 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 CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  <div align="center">
4
4
 
5
- [![Bot API](https://img.shields.io/badge/Bot%20API-7.10-blue?logo=telegram&style=flat&labelColor=000&color=3b82f6)](https://core.telegram.org/bots/api)
5
+ [![Bot API](https://img.shields.io/badge/Bot%20API-7.11-blue?logo=telegram&style=flat&labelColor=000&color=3b82f6)](https://core.telegram.org/bots/api)
6
6
  [![npm](https://img.shields.io/npm/v/gramio?logo=npm&style=flat&labelColor=000&color=3b82f6)](https://www.npmjs.org/package/gramio)
7
7
  [![JSR](https://jsr.io/badges/@gramio/core)](https://jsr.io/@gramio/core)
8
8
  [![JSR Score](https://jsr.io/badges/@gramio/core/score)](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.cjs CHANGED
@@ -1155,9 +1155,11 @@ function webhookHandler(bot, framework, secretToken) {
1155
1155
  Symbol.metadata ??= Symbol("Symbol.metadata");
1156
1156
 
1157
1157
  exports.Bot = Bot;
1158
+ exports.Composer = Composer;
1158
1159
  exports.ErrorKind = ErrorKind;
1159
1160
  exports.Plugin = Plugin;
1160
1161
  exports.TelegramError = TelegramError;
1162
+ exports.Updates = Updates;
1161
1163
  exports.webhookHandler = webhookHandler;
1162
1164
  Object.keys(callbackData).forEach(function (k) {
1163
1165
  if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
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 instance, this metadata can be used to strip bot mentions in commands.
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
  *
@@ -1009,4 +1009,4 @@ declare function webhookHandler<Framework extends keyof typeof frameworks>(bot:
1009
1009
  response: () => any;
1010
1010
  } ? (...args: Parameters<(typeof frameworks)[Framework]>) => ReturnType<ReturnType<(typeof frameworks)[Framework]>["response"]> : (...args: Parameters<(typeof frameworks)[Framework]>) => void;
1011
1011
 
1012
- export { type AnyBot, type AnyPlugin, Bot, type BotOptions, type DeriveDefinitions, type ErrorDefinitions, ErrorKind, type FilterDefinitions, type Handler, Hooks, type MaybePromise, type MaybeSuppressedParams, Plugin, type Suppress, type SuppressedAPIMethodParams, type SuppressedAPIMethodReturn, type SuppressedAPIMethods, TelegramError, type WebhookHandlers, webhookHandler };
1012
+ export { type AnyBot, type AnyPlugin, Bot, type BotOptions, Composer, type DeriveDefinitions, type ErrorDefinitions, ErrorKind, type FilterDefinitions, type Handler, Hooks, type MaybePromise, type MaybeSuppressedParams, Plugin, type Suppress, type SuppressedAPIMethodParams, type SuppressedAPIMethodReturn, type SuppressedAPIMethods, TelegramError, Updates, type WebhookHandlers, webhookHandler };
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 instance, this metadata can be used to strip bot mentions in commands.
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
  *
@@ -1009,4 +1009,4 @@ declare function webhookHandler<Framework extends keyof typeof frameworks>(bot:
1009
1009
  response: () => any;
1010
1010
  } ? (...args: Parameters<(typeof frameworks)[Framework]>) => ReturnType<ReturnType<(typeof frameworks)[Framework]>["response"]> : (...args: Parameters<(typeof frameworks)[Framework]>) => void;
1011
1011
 
1012
- export { type AnyBot, type AnyPlugin, Bot, type BotOptions, type DeriveDefinitions, type ErrorDefinitions, ErrorKind, type FilterDefinitions, type Handler, Hooks, type MaybePromise, type MaybeSuppressedParams, Plugin, type Suppress, type SuppressedAPIMethodParams, type SuppressedAPIMethodReturn, type SuppressedAPIMethods, TelegramError, type WebhookHandlers, webhookHandler };
1012
+ export { type AnyBot, type AnyPlugin, Bot, type BotOptions, Composer, type DeriveDefinitions, type ErrorDefinitions, ErrorKind, type FilterDefinitions, type Handler, Hooks, type MaybePromise, type MaybeSuppressedParams, Plugin, type Suppress, type SuppressedAPIMethodParams, type SuppressedAPIMethodReturn, type SuppressedAPIMethods, TelegramError, Updates, type WebhookHandlers, webhookHandler };
package/dist/index.js CHANGED
@@ -1156,4 +1156,4 @@ function webhookHandler(bot, framework, secretToken) {
1156
1156
 
1157
1157
  Symbol.metadata ??= Symbol("Symbol.metadata");
1158
1158
 
1159
- export { Bot, ErrorKind, Plugin, TelegramError, webhookHandler };
1159
+ export { Bot, Composer, ErrorKind, Plugin, TelegramError, Updates, webhookHandler };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "gramio",
3
3
  "type": "module",
4
- "version": "0.1.0",
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.0",
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.3.3",
55
- "@gramio/types": "^7.10.2",
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"