Skip to main content

A Telegram broadcast utility package with multiple database backends

Project description

🛰️ py-telecast

A lightweight and plug-and-play broadcast module for Python Telegram Bots using python-telegram-bot v20+. Developed by Manji Devs, this module supports:

  • JSON (default)
  • SQLite
  • MongoDB

Simple. Powerful. Flexible.

✨ Features

  • 📣 Broadcast any message (text, media, buttons, hyperlinks)
  • 📥 Supports reply-to-message for broadcasting
  • 👤 User database with JSON / SQLite / MongoDB backends
  • 🧠 Smart message formatting (Markdown & buttons preserved)
  • 🛡️ Sudo-only broadcasting
  • 📊 Stats report after broadcast

🔧 Installation

pip install py-telecast

Requirements: Python 3.10+ and python-telegram-bot>=20.6

🚀 Quick Start

1. Basic Setup (main.py)

from telegram.ext import Application
from pytelecast import init_broadcast

app = Application.builder().token("YOUR_BOT_TOKEN").build()

init_broadcast(
    app,
    sudo_users=[123456789],  # required
    db_type="json",          # json (default) | sqlite | mongo
    db_url=None              # optional for mongo: "mongodb+srv://..."
)

app.run_polling()

2. Broadcasting

  1. Reply to any message with:
    /broadcast
    
  2. Bot will show a preview with confirmation buttons
  3. After confirmation, sends to all users with stats:
    ✅ Broadcast completed.
    ◇ Total Users: 10
    ◇ Successful: 9
    ◇ Blocked Users: 1
    ◇ Deleted Accounts: 0
    ◇ Unsuccessful: 0
    

🛠️ Supported DB Backends

Type Configuration
JSON Default (no config needed)
SQLite db_type="sqlite"
MongoDB db_type="mongo", db_url="mongodb+srv://..."

📁 Requirements

Core Dependencies:

  • python-telegram-bot>=20.6

Optional (for MongoDB):

  • pymongo>=4.6.3

🧩 Integration Tips

  1. Works seamlessly with existing PTB bots
  2. Automatic database structure creation
  3. Logs indicate active backend during startup
  4. All broadcast attempts are logged with timestamps
  5. Supports both polling and webhook setups

🌐 Links

📄 License

MIT License © 2023 Manji Devs

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

pytelecast-0.1.1.tar.gz (5.7 kB view details)

Uploaded Source

Built Distribution

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

pytelecast-0.1.1-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

Details for the file pytelecast-0.1.1.tar.gz.

File metadata

  • Download URL: pytelecast-0.1.1.tar.gz
  • Upload date:
  • Size: 5.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for pytelecast-0.1.1.tar.gz
Algorithm Hash digest
SHA256 8ca567fe64e8259ed0bf9387e181e3ab97d50dd7e464264fa13b3c6e9c8de124
MD5 01948a5aef9d5f65310e2d8521e0b39d
BLAKE2b-256 98d1673af4f68696816b9c284c7f1d87ae2fb2c01e5080555dad1e185fb36db4

See more details on using hashes here.

File details

Details for the file pytelecast-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: pytelecast-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 7.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for pytelecast-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 bae889d7fd815bd666ad0e131ec54a315a22d41e0444f15e6fc9ab30ceff6368
MD5 3d4a60084e95664c60657f0c5213a612
BLAKE2b-256 e668efc2c4548a580caeeaf5a1d4eeae77e3bcf4289ed0bc1b19b8c8f0402010

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