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.5.tar.gz (27.1 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.5-py3-none-any.whl (37.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: create_tg_bot-0.1.5.tar.gz
  • Upload date:
  • Size: 27.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.19

File hashes

Hashes for create_tg_bot-0.1.5.tar.gz
Algorithm Hash digest
SHA256 262181b0b5114004f2d7b02596cab50ec4a2bfc102589c5db1a6b643bb667fb6
MD5 b0298d72a106157ba8b4b5471a1d22fd
BLAKE2b-256 ad012d72e9ca3b33cb5cfbb6ce52a4216d3fcc7238a8f0db2c91ad9e0cac07a8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: create_tg_bot-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 37.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.19

File hashes

Hashes for create_tg_bot-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 f953ba406c2b86e54c02d95800e089663e43ad723b26b5d12c7d945f4c2876e9
MD5 2d6b6b520cd7a5fec363007c9ec9c420
BLAKE2b-256 89842f387e6b43b5377f67959d05acc5e5141e98676239c85522e411a9adc135

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