create-telebot
v1.0.4
Published
A CLI tool to create Telegram bot projects with Bun and Telegraf
Maintainers
Readme
create-telebot
A CLI tool to quickly create Telegram bot projects with Bun and Telegraf.
Quick Start
Create a new Telegram bot project with one command:
npx create-telebot my-bot
# or
bunx create-telebot my-botThen:
cd my-bot
cp .env.example .env
# Add your bot token to .env
bun run devGlobal Installation
Install globally for repeated use:
npm install -g create-telebot
# or
bun install -g create-telebot
# Then use anywhere:
create-telebot my-new-botWhat's Included
The generated project includes:
- Telegraf - Modern Telegram Bot API framework
- TypeScript - Full TypeScript support
- Bun - Fast JavaScript runtime
- Hot reload - Development with auto-restart
- Environment config - Secure token management
- Basic commands -
/startand/helphandlers - Message echo - Example text message handling
- Graceful shutdown - Proper bot lifecycle management
Project Structure
my-bot/
├── index.ts # Main bot file
├── package.json # Dependencies and scripts
├── tsconfig.json # TypeScript configuration
├── .env.example # Environment template
├── .gitignore # Git ignore rules
└── README.md # Project documentationDevelopment
After creating a project:
- Get your bot token from @BotFather
- Copy
.env.exampleto.envand add your token - Run
bun run devfor development with hot reload - Run
bun run startfor production
Adding Webhook Support
To add webhook support to your project, run the following command:
bun run add:webhookThis will install the necessary dependencies and create a server.ts file with a basic webhook setup.
You can also choose between fastify (default) and hono as the server framework:
bun run add:webhook --framework honoRequirements
- Bun installed on your system
