Get Started
Create a new bot with GramIO in minutes. You should already have Node.js, Bun or Deno installed.
Obtain your bot token
First, create a bot and get a token. You can do this using the @BotFather bot.
Send him the /newbot command and follow the instructions until you receive a token like 110201543:AAHdqTcvCH1vGWJxfSeofSAs0K5PALDsaw.
Create your bot project
There are two ways to create a bot project:
Automatically
The easiest way is to use create-gramio.
bash
npm create gramio bot-examplebash
yarn create gramio bot-examplebash
pnpm create gramio bot-examplebash
bunx create-gramio bot-exampleAnd then:
bash
cd bot-example
npm run devbash
cd bot-example
yarn devbash
cd bot-example
pnpm devbash
cd bot-example
bun devSupported environment
- ORM/Query builders
- Linters
- ESLint with some plugins
- Plugins
- Others
- Husky (Git hooks)
- Telegram apps
- Elysia (by create-elysiajs)
The environment can work
togetherWhen you select ESLint and Drizzle, you get eslint-plugin-drizzle
Manually
To manually create a new bot with GramIO, install the package:
bash
npm install gramiobash
yarn add gramiobash
pnpm add gramiobash
bun install gramioSetup TypeScript:
bash
npm install typescript -D
npx tsc --initbash
yarn add typescript -D
yarn dlx tsc --initbash
pnpm add typescript -D
pnpm exec tsc --initbash
bun install typescript -D
bunx tsc --initcreate src folder with index.ts file and write something like:
ts
import { Bot } from "gramio";
const bot = new Bot("") // put you token here
.command("start", (context) => context.send("Hi!"))
.onStart(console.log);
bot.start();ts
import { Bot } from "jsr:@gramio/core";
const bot = new Bot("") // put you token here
.command("start", (context) => context.send("Hi!"))
.onStart(console.log);
bot.start();and run the bot with:
bash
npx tsx ./src/index.tsbash
bun ./src/index.tsbash
deno run --allow-net --allow-env ./src/index.tsDone! 🎉
Now you can interact with your Telegram bot.