https://github.com/yamlengineer/teleplate
Telegram Bot Template with Grammy & Hono
https://github.com/yamlengineer/teleplate
bot-template grammy grammyjs hono honojs telegram telegram-bot-template
Last synced: about 1 month ago
JSON representation
Telegram Bot Template with Grammy & Hono
- Host: GitHub
- URL: https://github.com/yamlengineer/teleplate
- Owner: YamlEngineer
- Created: 2023-09-03T19:43:43.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-11-28T14:24:14.000Z (6 months ago)
- Last Synced: 2024-11-28T15:30:57.816Z (6 months ago)
- Topics: bot-template, grammy, grammyjs, hono, honojs, telegram, telegram-bot-template
- Language: TypeScript
- Homepage:
- Size: 14.6 KB
- Stars: 9
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
🤖 Teleplate
Bot starter template based on [grammY](https://grammy.dev/) bot framework.
## Features
- Scalable structure
- Config loading and validation
- Internationalization, language changing
- Graceful shutdown
- Logger (powered by [pino](https://github.com/pinojs/pino))
- Ultrafast and multi-runtime server (powered by [hono](https://github.com/honojs/hono))## Usage
Follow these steps to set up and run your bot using this template:
1. **Create a New Repository**
Start by creating a new repository using this template. You can do this by clicking [here](https://github.com/yamlengineer/teleplate/generate).
2. **Environment Variables Setup**
Create an environment variables file by copying the provided example file:
```bash
cp .env.example .env
```
Open the newly created `.env` file and set the `BOT_TOKEN` environment variable.3. **Launching the Bot**
You can run your bot in both development and production modes.
**Development Mode:**
Install the required dependencies:
```bash
bun install
```
Start the bot in watch mode (auto-reload when code changes):
```bash
bun run dev
```**Production Mode:**
Install only production dependencies:
```bash
bun install --only=prod
```Set `DEBUG` environment variable to `false` in your `.env` file.
Start the bot in production mode:
```bash
bun run start:force # skip type checking and start
# or
bun start # with type checking (requires development dependencies)
```### List of Available Commands
- `bun run dev` — Start the bot in development mode.
### Directory Structure
```
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
```