Telegram Ads Automation Bot Source Code
PROMPT
Overview
• A Telegram ads automation bot plus a Telegram WebApp control panel for multi-account outreach, group management, subscriptions, payments, and proxy operations
Key Features (bullets)
• Pyrogram-based bot with a FastAPI Telegram WebApp dashboard
• Multi-account management: session string import, .session import (Pyrogram/Telethon), phone login with OTP/2FA, start/stop and profile edits
• Group management: link import, bulk sync of joined groups, removal, and category management (with default category)
• Broadcast engine: copy/forward modes, interval scheduling, saved post library, and category targeting with resumable jobs
• Subscription & trial limits: accounts/groups/messages/categories with auto-expire cleanup
• Payments: TRON/USDT invoices with unique amounts and TX-hash confirmation
• Referral program: referral link, earnings tracking, withdrawal requests, admin-configurable percent
• Proxy system: per-user proxy vault plus global pool with SOCKS/HTTP/HTTPS validation and rotation
• Multi-language UI: EN/ZH/AR/RU/KO
• Admin tools: plan editor, user subscriptions/balances, logs, link export, trial reset, updates and restarts
Workflows (step-by-step)
User Flow
1) /start to choose language and open the main menu or WebApp
2) Import accounts via /add or WebApp (session string/.session/phone OTP), optionally with proxies
3) Add groups via /link or WebApp, and run group sync when needed
4) Build saved posts and categories in the WebApp
5) Launch broadcasts with method + category scope and monitor live progress
6) Top up balance and purchase/upgrade a plan or activate the free trial
Admin Flow (if needed)
1) Use the admin panel to manage plans, admins, subscriptions, and balances
2) Review logs, export links, reset trials, or clean data
3) Configure channel lists and start discussion auto-reply broadcasts
4) Run /update and /restart when maintenance is required
Benefits (bullets)
• Launch a monetized Telegram ads automation service quickly
• Scalable multi-account delivery with proxy support and resumable jobs
• Built-in billing and referral flows reduce custom build time
• Unified bot + WebApp operations simplify training and handoff
• Health checks and logging reduce operational risk
Deployment & Maintenance (only confirmed in repo)
• Start with python -m hybrid, .env supported (python-dotenv)
• MongoDB (Motor) for users, sessions, chats, jobs, payments, and referrals
• Optional WebApp via WEBAPP_ENABLED/WEBAPP_URL/WEBAPP_HOST/WEBAPP_PORT
• Proxy configuration via PROXY_ENDPOINT or proxies.txt, plus user proxy vault
• Dockerfile and start.sh included for setup and launch
Deliverables
• Full bot + WebApp source code
• Database layer, subscriptions/payments/referrals modules
• Web templates and static assets
• Deployment files (requirements, Dockerfile, start.sh)