https://github.com/gramiojs/gramio
Powerful, extensible and really type-safe Telegram Bot API framework
https://github.com/gramiojs/gramio
bun framework nodejs telegram telegram-api telegram-bot telegram-bot-api telegram-framework typescript
Last synced: 5 days ago
JSON representation
Powerful, extensible and really type-safe Telegram Bot API framework
- Host: GitHub
- URL: https://github.com/gramiojs/gramio
- Owner: gramiojs
- License: mit
- Created: 2023-11-02T16:42:36.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-03-18T13:06:04.000Z (27 days ago)
- Last Synced: 2025-04-02T16:01:52.234Z (12 days ago)
- Topics: bun, framework, nodejs, telegram, telegram-api, telegram-bot, telegram-bot-api, telegram-framework, typescript
- Language: TypeScript
- Homepage: https://gramio.dev/
- Size: 342 KB
- Stars: 102
- Watchers: 4
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome - gramiojs/gramio - Powerful, extensible and really type-safe Telegram Bot API framework (TypeScript)
- awesome-telegram - GramIO - safe Telegram Bot API framework (Bots / Bot Libs)
README
# GramIO
[](https://core.telegram.org/bots/api)
[](https://www.npmjs.org/package/gramio)
[](https://www.npmjs.org/package/gramio)
[](https://jsr.io/@gramio/core)
[](https://jsr.io/@gramio/core)TypeScript/JavaScript Telegram Bot API Framework for create your bots with convenience!
✨ **Extensible** - Our [plugin](https://gramio.dev/plugins/) and [hook](https://gramio.dev/hooks/overview) system is awesome
🛡️ **Type-safe** - Written in TypeScript with love ❤️
🌐 **Multi-runtime** - Works on [Node.js](https://nodejs.org/), [Bun](https://bun.sh/) and [Deno](https://deno.com/)
⚙️ **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:
```bash [npm]
npm create gramio@latest ./bot
```and GramIO customize your project the way you want it!
### Example
```typescript
import { Bot } from "gramio";const bot = new Bot(process.env.TOKEN as string)
.command("start", (context) => context.send("Hello!"))
.onStart(({ info }) => console.log(`✨ Bot ${info.username} was started!`));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; // typedreturn context.send(format`
Hi, ${bold(context.user.name)}!
You balance: ${code(context.user.balance)}`);
});
```