Scaffold a new GramIO Telegram bot project with proper structure, TypeScript config, environment setup, and initial handlers.
Install
npx skillscat add gramiojs/documentation/skills-gramio-new-bot Install via the SkillsCat registry.
SKILL.md
Create New GramIO Bot
You are scaffolding a new GramIO Telegram bot project.
Arguments
The user may provide:
[project-name]— directory name for the project (default: current directory)- Optional flags or preferences (e.g., runtime, plugins to include)
Steps
Check if
create-gramiois available:- The recommended way is
npm create gramio [project-name](or bun/pnpm/yarn equivalent). - If the user wants a custom setup instead, proceed with manual scaffolding below.
- The recommended way is
If using
create-gramio(recommended):npm create gramio [project-name]Then help the user configure the generated project.
If manual scaffolding, create the project structure:
[project-name]/ src/ index.ts # Main bot entry point .env # BOT_TOKEN=your_token_here .env.example # BOT_TOKEN= (template) .gitignore # node_modules, .env, dist package.json tsconfig.jsonsrc/index.ts— basic bot setup:import { Bot } from "gramio"; const bot = new Bot(process.env.BOT_TOKEN as string) .command("start", (context) => context.send("Hello! I'm powered by GramIO.") ) .onStart(({ info }) => { console.log(`Bot @${info.username} started!`); }) .onError(({ context, kind, error }) => { console.error(`[${kind}]`, error); }); bot.start();package.json— include gramio and dev scripts:{ "name": "[project-name]", "type": "module", "scripts": { "dev": "bun --watch src/index.ts", "start": "bun src/index.ts" }, "dependencies": { "gramio": "latest" } }Install dependencies:
cd [project-name] && bun installAdd recommended plugins if the user wants them:
@gramio/sessionfor user data@gramio/autoloadfor file-based handler loading@gramio/auto-retryfor resilient API calls
Remind the user to:
- Set
BOT_TOKENin.env - Run
bun run devto start developing
- Set