Skip to content

YamlEngineer/TelePlate

Repository files navigation

🤖 Teleplate

Bot starter template based on grammY bot framework.

Features

  • Scalable structure
  • Config loading and validation
  • Internationalization, language changing
  • Graceful shutdown
  • Logger (powered by pino)
  • Ultrafast and multi-runtime server (powered by 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.

  2. 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 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:

    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 to false 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)

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