Skip to main content
Home

Built and signed on GitHub Actions

Powerful Telegram Bot API framework

This package works with Node.js, Deno, BunIt is unknown whether this package works with Cloudflare Workers, Browsers
It is unknown whether this package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
This package works with Bun
It is unknown whether this package works with Browsers
JSR Score
76%
Published
6 months ago (0.1.5)

GramIO

Bot API npm JSR JSR Score

TypeScript/JavaScript Telegram Bot API Framework for create your bots with convenience!

Extensible - Our plugin and hook system is awesome

🛡️ Type-safe - Written in TypeScript with love ❤️

🌐 Multi-runtime - Works on Node.js, Bun and Deno

⚙️ Code-generated - Many parts are code-generated (for example, code-generated and auto-published Telegram Bot API types)

Get started

To create your new bot, you just need to write it to the console:

npm create gramio@latest ./bot

and GramIO customize your project the way you want it!

Example

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.

GramIO in action

Example which uses some interesting features.

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)}`);
    });
Built and signed on
GitHub Actions

New Ticket: Report package

Please provide a reason for reporting this package. We will review your report and take appropriate action.

Please review the JSR usage policy before submitting a report.

Add Package

deno add jsr:@gramio/core

Import symbol

import * as core from "@gramio/core";
or

Import directly with a jsr specifier

import * as core from "jsr:@gramio/core";

Add Package

pnpm i jsr:@gramio/core
or (using pnpm 10.8 or older)
pnpm dlx jsr add @gramio/core

Import symbol

import * as core from "@gramio/core";

Add Package

yarn add jsr:@gramio/core
or (using Yarn 4.8 or older)
yarn dlx jsr add @gramio/core

Import symbol

import * as core from "@gramio/core";

Add Package

vlt install jsr:@gramio/core

Import symbol

import * as core from "@gramio/core";

Add Package

npx jsr add @gramio/core

Import symbol

import * as core from "@gramio/core";

Add Package

bunx jsr add @gramio/core

Import symbol

import * as core from "@gramio/core";