Skip to main content

A modular, CLI-first Python boilerplate for building Telegram bots. Fast setup, clean architecture, and open-source ready.

Project description

create-tg-bot

PyPI version License: MIT CI/CD

๐Ÿ“– This README is also available in ๐Ÿ‡ท๐Ÿ‡บ Russian

create-tg-bot is a Python CLI tool and boilerplate generator for creating Telegram bots using a modular and extensible architecture. It scaffolds the basic project structure, including handlers, keyboards, models, and services, and includes a manage.py interface for generating new components.


๐Ÿ”ง Features

  • Modular project layout
  • Jinja2 templating for generating project files
  • Built-in generator for models, keyboards, and command handlers
  • manage.py CLI powered by Click
  • Templates for CRUD, keyboards, and message formatting
  • Support for future integration of async ORM, logging, i18n

๐Ÿ“ฆ Installation

pip install create-tg-bot

๐Ÿš€ Quick Start

  1. Install the package:
pip install create-tg-bot
  1. Generate a new bot project:
create-tg-bot my_bot
cd my_bot
  1. Use CLI to generate components:
python manage.py gen-model user
python manage.py gen-keyboard main
python manage.py gen-command start

๐Ÿ“ Project Structure

project/
โ”œโ”€โ”€ .env                      # Environment variables for local development
โ”œโ”€โ”€ alembic.ini               # Alembic configuration file for DB migrations
โ”œโ”€โ”€ config.py                 # Global configuration settings (token, DB URL, etc.)
โ”œโ”€โ”€ main.py                   # Entry point to start the bot
โ”œโ”€โ”€ models/                   # SQLAlchemy models for database schema
โ”œโ”€โ”€ services/                 # Business logic and service layer
โ”œโ”€โ”€ crud/                     # Functions for Create, Read, Update, Delete operations
โ”œโ”€โ”€ migrations/               # Alembic migration scripts for database versioning
โ”œโ”€โ”€ templates/                # Jinja2 templates for code generation
โ”œโ”€โ”€ requirements.txt          # Python dependencies
โ”œโ”€โ”€ commands/                 # Message handlers for bot commands (e.g. /start, /help)
โ”œโ”€โ”€ keyboards/                # Inline and reply keyboard definitions
โ”œโ”€โ”€ button_handlers/          # Callback query handlers for inline buttons
โ”œโ”€โ”€ texts/                    # Static texts and formatting functions
โ”œโ”€โ”€ utils/                    # General-purpose helper functions
โ”œโ”€โ”€ manage.py                 # CLI entry point to generate code via Click commands
โ””โ”€โ”€ .github/workflows/        # CI/CD pipeline definitions (e.g., GitHub Actions)


๐Ÿงช Development Notes

  • Uses setuptools_scm for automatic versioning
  • Templates live in create_tg_bot/templates
  • CLI interface powered by Click

๐Ÿ“„ License

This project is licensed under the MIT License.


๐Ÿ‘ค Author

Emil Astanov

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

create_tg_bot-0.1.4.tar.gz (25.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

create_tg_bot-0.1.4-py3-none-any.whl (35.5 kB view details)

Uploaded Python 3

File details

Details for the file create_tg_bot-0.1.4.tar.gz.

File metadata

  • Download URL: create_tg_bot-0.1.4.tar.gz
  • Upload date:
  • Size: 25.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.17

File hashes

Hashes for create_tg_bot-0.1.4.tar.gz
Algorithm Hash digest
SHA256 bd5ce391cc7a2f7f0ac10545d637518bbffd3f1ce69e242ae4a399108e347925
MD5 6902ee6684b3916904b4523bc5c0b6ef
BLAKE2b-256 f5c6934c280016115c394765a47192818e8d3a4f0246dcfc84c88ab39b64d517

See more details on using hashes here.

File details

Details for the file create_tg_bot-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: create_tg_bot-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 35.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.17

File hashes

Hashes for create_tg_bot-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 c0fb469051a46da39253e3237e39f0443405503f2073a4cd35d43998a2d05684
MD5 76d9ddc071732593cf8a9a41972ae527
BLAKE2b-256 521c044f25cd16c338ac34eb2fb69ce7721f648593f2b4fd5b80bea8a08cb44a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page