Skip to content

2rage/telegram_bot_boilerplate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Telegram Bot Boilerplate

A flexible boilerplate for building Telegram bots using modern tools and best practices. This project is designed to simplify the setup, development, and scaling of Telegram bots, with support for both development and production environments


Features

  • Python 3.12+: Built with the latest Python features
  • Telegram Bot API: Powered by python-telegram-bot
  • Auto-Reload: Supports auto-reloading during development using watchfiles
  • Environment Configuration: Easy setup with .env file
  • Docker Support: Ready for containerized deployments
  • Makefile: Simplified commands for common tasks
  • Clean Structure: Modular and scalable architecture for adding features

Prerequisites

Ensure you have the following installed:


Installation

  1. Clone the repository:

Replace YOUR_APP_NAME with your desired project name

git clone https://github.com/2rage/telegram_bot_boilerplate.git
mv telegram_bot_boilerplate YOUR_APP_NAME
cd YOUR_APP_NAME
  1. Removing Git History:
rm -rf .git
git init
  1. Set up environment variables:
  • Create a .env file by copying the example:

    cp .env.example .env && rm .env.example
  • Edit the .env file and add your configuration

  1. Install dependencies:
poetry install
  1. Run the bot
make bot-dev

Project Structure

├── Dockerfile                 # Docker image setup
├── Makefile                   # Simplified automation commands
├── README.md                  # Project documentation
├── app/                       # Main application folder
│   ├── exceptions/            # Custom exception classes
│   │   └── base.py            # Base application exception
│   ├── handlers/              # Command and message handlers
│   │   ├── base.py            # Basic command handlers (e.g., /start)
│   │   └── errors.py          # Error handling logic
│   ├── main.py                # Entry point for the bot
│   └── settings.py            # Configuration and environment variables
├── docker_compose/            # Docker Compose configuration
│   └── bot.yaml               # Configuration for running the bot container
├── poetry.lock                # Poetry lock file
└── pyproject.toml             # Poetry configuration

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published