Bot starter template based on grammY bot framework.
- Scalable structure
- Config loading and validation
- Internationalization, language changing
- Graceful shutdown
- Logger (powered by pino)
- Ultrafast and multi-runtime server (powered by hono)
Follow these steps to set up and run your bot using this template:
-
Create a New Repository
Start by creating a new repository using this template. You can do this by clicking here.
-
Environment Variables Setup
Create an environment variables file by copying the provided example file:
cp .env.example .env
Open the newly created
.env
file and set theBOT_TOKEN
environment variable. -
Launching the Bot
You can run your bot in both development and production modes.
Development Mode:
Install the required dependencies:
bun install
Start the bot in watch mode (auto-reload when code changes):
bun run dev
Production Mode:
Install only production dependencies:
bun install --only=prod
Set
DEBUG
environment variable tofalse
in your.env
file.Start the bot in production mode:
bun run start:force # skip type checking and start # or bun start # with type checking (requires development dependencies)
bun run dev
— Start the bot in development mode.
project-root/
├── locales # Localization files
└── src # Codes
├── common # Common Files like Custom Context
├── helpers # Helper functions
├── middlewares # Bot middlewares
├── modules # bot Modules
│ ├── example # Module Name
│ │ ├── example.module.ts # Get updates
│ │ └── example.service.ts # Answer updates
│ ├── somthing # other modules
├── bootstrap.ts # bot entry point
└── index.ts # Application entry point