**Sender Bot** is an advanced, event-driven Telegram syndication and filtering engine written in Python with the **Telethon** MTProto framework. It autonomously monitors source channels, cleanses content, strips promotional material, and re-broadcasts messages to target channels in real time.
To overcome Telegram's rigorous anti-spam policies and FloodWait limits, Sender Bot introduces an innovative **Bot Pool Architecture**. High-frequency text broadcasts are dynamically distributed across an array of bot tokens with intelligent rate-limit tracking, while a dedicated userbot session handles large media, video streams, and document payloads up to 2GB.
Furthermore, it integrates an automated **VPN Configuration Extraction & Rewriter Engine** compatible with VLESS, VMess, Trojan, and Shadowsocks URI schemas. It extracts configurations, validates parameters, and rewrites the remark metadata with your target channel brand. All operational settings can be reconfigured on the fly through an **Interactive Telegram Inline Admin Panel** backed by **Dynamic Hot-Reload** without restarting the daemon.
The Problem
Managing large-scale Telegram media channels and curated content hubs presents numerous challenges:
• Manual Tedium: Monitoring multiple source feeds and reposting round the clock is error-prone and time-consuming.
• Foreign Watermarks & Ads: Source messages routinely include competitor usernames, sponsor banners, tracking links, and promo hashtags that compromise branding.
• Aggressive Rate Limits (FloodWait): Frequent broadcasting via a single bot or user account triggers severe Telegram rate penalties and account bans.
• Large Media Constraints: Telegram Bot API enforces strict 50MB file thresholds, requiring user MTProto sessions for heavy media handling.
• Maintenance Downtime: Modifying channel routes or keyword blacklists should not require SSH terminal logins, manual config editing, or service restarts.
The Solution
Sender Bot resolves these obstacles through an enterprise-grade automated pipeline:
• Distributed Bot Pool: Balances message throughput across a swarm of Bot API tokens, completely mitigating FloodWait penalties.
• Hybrid Forwarding Engine: Automatically dispatches rich media and documents via the userbot session while offloading text posts to the Bot Pool.
• Granular Regex Sanitizer: Cleanses messages by removing competitor handles, invitation links, hashtags, and blacklisted words, paired with file extension whitelists/blacklists.
• VPN Configuration Extraction Engine: Parses VLESS, VMess, Trojan, and Shadowsocks protocols, validates schemas, and overwrites the config remark with target channel branding.
• Persistent Queue & Resiliency: Persists in-flight queues to disk and leverages exponential backoff retries to guarantee zero message loss during network interruptions.
• Time-Window Scheduling: Enforces customizable active hours per channel (e.g. 08:00 to 23:00) alongside randomized delays to emulate authentic human posting.
• Telegram In-Chat Admin Panel: Complete remote administration through interactive inline keyboards with hot-reload capabilities for zero-downtime reconfiguration.
System Flow & Architecture
Constructed on asynchronous event-driven principles (Python AsyncIO & Telethon) divided into modular subsystems:
- Message Monitor: Telethon-based listener that subscribes to incoming channel events and message streams.
- Filtering Engine: Multi-stage pipeline evaluating content type, keyword blacklists, regex link cleaning, and file extension policies.
- VPN Extraction & Remark Modifier: Specialized parser inspecting URI schemes and dynamically rewriting remarks for brand consistency.
- Queue Manager & Scheduler: Per-destination persistent queues backed by disk storage with configurable active time windows and randomized pacing.
- Hybrid Dispatcher: Routes text payloads to the Bot Pool Manager while streaming large documents via the MTProto user session.
- Remote Admin Bot & Hot-Reload: Independent inline keyboard UI providing immediate configuration updates without stopping background workers.
01
๐ก
Source Monitoring
Subscribes to events and captures new posts, media, and files across multiple source channels in real time.
02
๐งน
Content Cleansing
Automatically scrubs competitor links, usernames, hashtags, blacklisted keywords, and filters file extensions.
03
๐
VPN Extraction & Branding
Extracts and validates VLESS, VMess, Trojan, and Shadowsocks configs, injecting your custom remark brand.
04
๐พ
Persistent Queue & Scheduling
Retains queues safely on disk, checks active operational hours, and regulates per-mapping intervals.
05
๐
Hybrid Bot Pool Dispatch
Distributes text streams across a multi-bot pool to avoid rate limits while self-bot dispatches heavy media.
Technical Challenges & Solutions
Mitigating Aggressive FloodWait and API Rate Limiting
Challenge
High-frequency syndication from a single account or bot rapidly triggers Telegram FloodWait penalties, freezing channels during high-volume periods.
Solution
Built a distributed Bot Pool architecture with round-robin load distribution and cooldown tracking, coupled with randomized posting delays that mirror natural user activity.
Impact: Zero FloodWait outages achieved across thousands of daily dispatches without token suspensions.
Zero-Downtime Configuration Updates via Hot-Reload
Challenge
Adding new channel mappings or updating spam keyword blacklists previously required process restarts, causing missed real-time events.
Solution
Engineered a non-blocking configuration manager that monitors YAML/JSON changes and refreshes runtime memory seamlessly, synchronized with an interactive Telegram inline admin bot.
Impact: Continuous 24/7 uptime with immediate configuration deployment directly from an administrator's mobile device.
Robust VPN URI Parsing and Metadata Normalization
Challenge
VPN configurations from source channels frequently arrived surrounded by messy emojis, broken characters, and competitor tracking tags.
Solution
Developed a dedicated protocol parser for VLESS, VMess, Trojan, and Shadowsocks formats that validates connection attributes and safely replaces the URI remark with the channel's custom brand identity.
Impact: 100% automated delivery of clean, validated, and branded proxy configurations directly to subscribers.
Results & Metrics
• Fully automated 24/7 syndication of hundreds of messages across multiple channels.
• Complete elimination of FloodWait rate restrictions through Bot Pool load balancing.
• Zero-trace content cleansing removing 100% of unwanted competitor links and ads.
• Zero message loss guaranteed by disk-backed persistent queueing and exponential retries.
• Full operational control via Telegram mobile chat with instantaneous hot-reload.