Skip to content

Commit

Permalink
feat: update to support Telegram Bot API 7.11
Browse files Browse the repository at this point in the history
  • Loading branch information
kravetsone committed Nov 2, 2024
1 parent a47f73e commit 51342b8
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 7 deletions.
28 changes: 26 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<div align="center">

[![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)
[![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)
[![npm](https://img.shields.io/npm/v/gramio?logo=npm&style=flat&labelColor=000&color=3b82f6)](https://www.npmjs.org/package/gramio)
[![JSR](https://jsr.io/badges/@gramio/core)](https://jsr.io/@gramio/core)
[![JSR Score](https://jsr.io/badges/@gramio/core/score)](https://jsr.io/@gramio/core)
Expand All @@ -19,7 +19,6 @@ TypeScript/JavaScript Telegram Bot API Framework for create your bots with conve

⚙️ **Code-generated** - Many parts are code-generated (for example, [code-generated and auto-published Telegram Bot API types](https://github.com/gramiojs/types))


## [Get started](https://gramio.dev/get-started)

To create your new bot, you just need to write it to the console:
Expand All @@ -43,3 +42,28 @@ bot.start();
```

For more, please see [documentation](https://gramio.dev).

### GramIO in action

Example which uses some interesting features.

```ts
import { Bot, format, bold, code } from "gramio";
import { findOrRegisterUser } from "./utils";

const bot = new Bot(process.env.BOT_TOKEN as string)
.derive("message", async () => {
const user = await findOrRegisterUser();

return {
user,
};
})
.on("message", (context) => {
context.user; // typed

return context.send(format`
Hi, ${bold(context.user.name)}!
You balance: ${code(context.user.balance)}`);
});
```
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "gramio",
"type": "module",
"version": "0.1.1",
"version": "0.1.2",
"description": "Powerful, extensible and really type-safe Telegram Bot API framework",
"main": "dist/index.cjs",
"module": "dist/index.js",
Expand Down Expand Up @@ -43,16 +43,16 @@
"@biomejs/biome": "1.9.4",
"@types/bun": "^1.1.12",
"@types/debug": "^4.1.12",
"pkgroll": "^2.5.0",
"pkgroll": "^2.5.1",
"typescript": "^5.6.3"
},
"dependencies": {
"@gramio/callback-data": "^0.0.3",
"@gramio/contexts": "^0.0.23",
"@gramio/files": "^0.1.0",
"@gramio/format": "^0.1.4",
"@gramio/keyboards": "^0.3.3",
"@gramio/types": "^7.10.2",
"@gramio/keyboards": "^1.0.0",
"@gramio/types": "^7.11.0",
"debug": "^4.3.7",
"inspectable": "^3.0.2",
"middleware-io": "^2.8.1"
Expand Down
2 changes: 1 addition & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export interface BotOptions {
/** Bot token */
token: string;
/** When the bot begins to listen for updates, `GramIO` retrieves information about the bot to verify if the **bot token is valid**
* and to utilize some bot metadata. For instance, this metadata can be used to strip bot mentions in commands.
* and to utilize some bot metadata. For example, this metadata will be used to strip bot mentions in commands.
*
* If you set it up, `GramIO` will not send a `getMe` request on startup.
*
Expand Down

0 comments on commit 51342b8

Please sign in to comment.