Skip to main content

Telegram Bot Template with Aiogram

This repository provides a template for building Telegram bots using the Aiogram framework in Python. It is designed to help you quickly start your bot development with a clean and modular structure.

Features

  • Asynchronous Telegram Bot API with Aiogram
  • Modular code organization
  • Database integration utilities
  • Easy to extend with custom handlers and commands

Installation

You can install this template generator directly from PyPI:

pip install ziyodev-tg-bot

Once installed, you can generate a new bot project anywhere with a single command:

ziyodev-tg-bot init my-new-bot

This creates a new folder my-new-bot containing all the template structure. Then, simply:

cd my-new-bot
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
pip install -r requirements.txt
# Configure BOT_TOKEN and SECRET_KEY in src/.env
cd src
python manage.py migrate
python manage.py createsuperuser
python manage.py runbot

Option 2: Clone from GitHub

  1. Clone the repository:

    git clone https://github.com/Ziyodullodev/telegram-bot-shablon-aiogram.git
    cd telegram-bot-shablon-aiogram
    
  2. Create venv and run:

    python -m venv venv
    source venv/bin/activate
    pip install -r requirements.txt
    cp src/.env.example src/.env
    # Configure BOT_TOKEN and SECRET_KEY in src/.env
    cd src
    python manage.py migrate
    python manage.py createsuperuser
    python manage.py runbot
    

Configuration

Set your Telegram Bot Token in the environment or configuration file as needed.

Running the Bot

Run the bot with:

cd src
python manage.py runbot

Project Structure

  • src/ - Django Backend & Bot Application
    • config/ - Django core configurations (settings.py, urls.py)
    • users/ - Custom User model, migrations, and django admin settings
    • bot/ - Aiogram Telegram Bot application
      • management/commands/runbot.py - Bot runner command
      • handlers/ - Bot handlers and keyboards
      • locales/ - Local JSON translation files synced dynamically via signals

Contributing

Contributions are welcome! Feel free to fork and submit pull requests.

License

MIT License


Happy bot building! 🚀

Metadata

Release files for ziyodev-tg-bot 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ziyodev-tg-bot 0.3.0
File Size Uploaded Provenance Actions
ziyodev_tg_bot-0.3.0.tar.gz 22.5 kB Without provenance Details for ziyodev_tg_bot-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ziyodev-tg-bot 0.3.0
File Interpreter ABI Platform Actions
ziyodev_tg_bot-0.3.0-py3-none-any.whl Python 3 none any Details for ziyodev_tg_bot-0.3.0-py3-none-any.whl

Total release size: 53.8 kB

Release files / ziyodev_tg_bot-0.3.0.tar.gz

Download URL ziyodev_tg_bot-0.3.0.tar.gz
Size 22.5 kB
Tags Source
SHA-256 checksum
How to use checksums
bae3fcd9e6cd72729e8d3a87f8614466c7e70e70ab5a3732dda991e7c3d1b228
BLAKE2b-256 checksum
How to use checksums
ff4e244ebd2daf131938e1ce5d8c863a849f28a361f6ec7d47bcc23e3f750394
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release files / ziyodev_tg_bot-0.3.0-py3-none-any.whl

Download URL ziyodev_tg_bot-0.3.0-py3-none-any.whl
Size 31.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
96015f6c1f2e2894fbbceb6efdef3b1e5e7826cf4a91b2f5fd85a0c44d6170f3
BLAKE2b-256 checksum
How to use checksums
8dddbf0308fa65bf1e32d2b9c3df7666a2a1e8a7b303d63ec4f401c7792f9b36
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Security for ziyodev-tg-bot 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page