A Telegram broadcast utility package with multiple database backends
Project description
🛰️ pytelecast
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 pytelecast
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
- Reply to any message with:
/broadcast - Bot will show a preview with confirmation buttons
- 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
- Works seamlessly with existing PTB bots
- Automatic database structure creation
- Logs indicate active backend during startup
- All broadcast attempts are logged with timestamps
- Supports both polling and webhook setups
🌐 Links
- GitHub: github.com/manjidevs/pytelecast
- PyPI: pypi.org/project/pytelecast
- Python-Telegram-Bot Docs: docs.python-telegram-bot.org
📄 License
MIT License © 2023 Manji Devs
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pytelecast-0.1.2.tar.gz.
File metadata
- Download URL: pytelecast-0.1.2.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ac6a92c8c4b89bf5ebabaa2063e8bfe931d1cb6217720f374fdcafe22ece888b
|
|
| MD5 |
e6f9836c9fee3d5428c2b2b583f700b9
|
|
| BLAKE2b-256 |
66b72a86b81a71b6b1bed96035e7ebaabc9acb417045dfdabfcb8f4ca6417d16
|
File details
Details for the file pytelecast-0.1.2-py3-none-any.whl.
File metadata
- Download URL: pytelecast-0.1.2-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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
611dba8338d0afdf5126f8168f7da0a1eaebb4fbfbe549b1007189b03b054ef2
|
|
| MD5 |
77e3180d8930222b9453653307dacbdb
|
|
| BLAKE2b-256 |
2b96885614b2fe344115183d61bfddb3bd9793595ad20657e5cf193b83ccf5d9
|