TelePilot MiniApp Overview
Relevant source files
The following files were used as context for generating this wiki page:
TelePilot is a management system for Telegram channels and groups that integrates a central control panel with automated bot services. It provides tools for content summarization, member management, smart broadcasting, and automated moderation to help administrators manage multiple Telegram entities from a single dashboard.
The system consists of a Python-based Telegram bot backend and a dashboard interface. The bot handles real-time message processing, extractive summarization, and command execution, while the dashboard provides a management interface for configuration, analytics, and bulk operations.
Sources: README.md:1-12, README.md:120-130, bot.py:1-5
Core System Architecture
The architecture relies on a long-polling mechanism to interact with the Telegram Bot API. The backend maintains an in-memory message buffer for active chats to support on-demand summarization.
Data Flow and Update Loop
The bot executes a continuous loop that fetches updates from Telegram, processes individual messages, and stores them in a thread-safe deque structure.
The system uses urllib3 for connection pooling and python-dotenv for managing environment-specific configurations.
Sources: bot.py:32-48, bot.py:107-120, requirements.txt:1-4
Functional Components
1. Message Summarization Engine
The summarizer implements an extractive logic. It cleans text, splits it into sentences based on punctuation, and returns the first N sentences as defined by the SUMMARY_SENTENCES configuration.
| Feature | Description |
|---|---|
| Inline Summary | Summarizes text provided directly after the /summary command. |
| Contextual Summary | Summarizes the history of the current chat from stored messages. |
| Sentence Limit | Defaults to 5 sentences per summary. |
Sources: bot.py:59-74, README.md:15-18
2. Management and Moderation
The system includes a suite of tools for group and channel administration, including automated filters and member tracking.
- Member Management: Includes advanced search, CSV exports, and growth tracking.
- Moderation Suite: Filters prohibited words and implements CAPTCHA verification for new members.
- Smart Broadcasting: Supports audience segmentation (VIP, New, Active) and media-rich broadcasts.
Sources: README.md:133-157, README.md:168-174
3. Automated Messaging
Administrators can configure automated workflows for various engagement scenarios:
- Welcome/Goodbye: Automated responses for member joins or leaves.
- Scheduled Posts: Message scheduling with retry logic and engagement tracking.
- Custom Bot Commands: Creation of dynamic responses using placeholders like
{name}or{channel}.
Sources: README.md:158-167
Technical Configuration
The bot's behavior is governed by environment variables that control logging, message retention, and API timeouts.
| Variable | Default | Description |
|---|---|---|
TELEGRAM_BOT_TOKEN | None | Authentication token from @BotFather. |
MAX_STORED_MESSAGES | 100 | Number of recent messages retained per chat in memory. |
SUMMARY_SENTENCES | 5 | Sentence limit for the extractive summarizer. |
POLL_TIMEOUT | 30 | Timeout in seconds for the long-polling request. |
LOG_LEVEL | INFO | Verbosity of the Python logger. |
Sources: bot.py:18-28, README.md:43-51
Deployment Workflows
The system supports multiple deployment strategies, ranging from local execution to containerized environments.
Supported Environments
- Local/VPS: Uses
systemdfor service management andpipfor dependency resolution. - Docker: Encapsulates the environment in a container for consistent deployment.
- PaaS: Supports platforms like Render or Railway using the provided
Procfilefor worker processes.
Sources: README.md:31-41, README.md:53-65, Procfile:1
Security and Reliability
The system implements several safeguards to ensure stable operation:
- Graceful Shutdown: Handles
SIGINTandSIGTERMsignals to stop the polling loop cleanly. - Error Handling: Catches polling exceptions and implements a 5-second retry delay to maintain uptime.
- Input Sanitization: Cleans whitespace and truncates messages to the 4096-character Telegram limit before sending.
Sources: bot.py:32-34, bot.py:51-57, bot.py:115-119
The TelePilot MiniApp serves as a comprehensive tool for Telegram administrators, combining local extractive summarization with extensive group management features. It enables efficient oversight of unlimited channels through a single, dashboard-driven interface.