How dreamxbotz/auto_filter_bot works
1. What this repo is
- This is a Telegram bot system centered on media/file search, indexing, moderation, and premium access management.
- The README features confirm a bot that supports file filtering, post links, batch links, streaming/download modes, verification, broadcast, and premium memberships.
2. Runtime entry points and deployment shape
- The main execution entry appears to be bot.py, with Script.py likely used as an alternate launcher or bootstrap wrapper.
- Deployment is designed for container/Heroku-style hosting: Dockerfile, docker-compose.yml, Procfile, app.json, and heroku.yml all indicate the bot can run as a long-lived service with optional web process support.
3. Telegram client layer
- dreamxbotz/Bot/clients.py and dreamxbotz/Bot/__init__.py likely define the Telegram client(s), shared session objects, and startup wiring.
- The bot is organized around message/update handlers rather than a monolith, which is important for the architecture: Telegram events enter the client layer and are dispatched to plugins.
4. Plugin-based feature architecture
- The plugins/ directory is the core functional boundary.
- Each plugin covers a feature slice: commands.py, misc.py, broadcast.py, banned.py, pmfilter.py, join_req.py, post_handler.py, route.py, extract.py, files_delete.py, index.py, channel.py, Premium.py, and more.
- This suggests a modular event-driven bot where handlers are loaded by feature, not by a centralized service class.
5. Primary user-facing flows
- The bot’s main flow is: user sends a query or command → plugin handles it → data is fetched from storage → formatted response is sent back in Telegram.
- Features such as link, batch, top, start, settings, stats, info, and id indicate a mix of content discovery, account/status commands, and administrative controls.
6. File indexing and delivery path
- The repository strongly suggests a file catalog / searchable index model.
- database/ia_filterdb.py, plugins/index.py, plugins/extract.py, plugins/post_handler.py, and dreamxbotz/util/custom_dl.py point to a pipeline where incoming media/posts are indexed, searchable later, and then delivered as links or forwarded files.
- README items like “file indexing above 2GB,” “auto file send,” “file protection,” “single filter button,” and “bot PM file send mode” reinforce that content delivery is a core subsystem.
7. Moderation, access control, and chat management
- Several plugins implement operational controls: banned.py, channel.py, join_req.py, pmfilter.py, leave, disable, enable, and files_delete.py.
- This indicates the bot manages who can use it, which groups are allowed, and what content is available, with support for group join requests, forward restrictions, chat bans, and group-specific settings.
- The README’s “3 verification system” and “verified user counter” imply a dedicated access-verification path.
8. Premium, referral, and monetization-like flows
- plugins/Premium.py, plugins/Dreamxfutures/Redeem.py, and database/refer.py indicate a premium entitlement subsystem with redeem codes or referral-based access.
- Commands such as plan, myplan, add_premium, remove_premium, and premium_users show that subscription state is part of the bot’s persistent model.
9. Persistence layer
- The database/ package is the storage boundary: users_chats_db.py, ia_filterdb.py, refer.py, and config_db.py.
- This layer stores user/chat records, filter/index entries, referral data, and configuration/settings.
- The repository does not expose the DB engine directly in the tree, so the important architectural point is that handlers do not own persistence logic; they call into database modules.
10. Web-serving and template layer
- dreamxbotz/server/, dreamxbotz/template/dl.html, and dreamxbotz/template/req.html indicate a small HTTP-facing layer alongside Telegram.
- dreamxbotz/util/render_template.py, custom_dl.py, and file_properties.py suggest this layer renders download/request pages and formats file metadata for users.
- This is likely used for shareable links, request pages, and streaming/download presentation, not as a general website.
11. Utility and content-enrichment helpers
- dreamxbotz/util/ contains support code for configuration parsing, keepalive, file-size formatting, time formatting, and human-readable output.
- plugins/Dreamxfutures/Imdbposter.py, telegraph.py, font.py, and fotnt_string.py add content enrichment and presentation, such as poster metadata and stylized text.
- plugins/monkey_patch.py and utils.py indicate cross-cutting runtime adjustments and shared helpers.
12. Operational and hosting concerns
- dreamxbotz/util/keepalive.py, plugins/Dreamxfutures/check_alive.py, and the deployment files show that the app is designed to stay awake in managed hosting environments.
- Logging is explicitly configured via logging.conf, which is relevant because the bot’s behavior depends on many handler paths and background checks.
13. External boundaries
- The primary external dependency is Telegram, which is both the UI and event source.
- Secondary external integrations appear to include media metadata sources and link/rendering services such as IMDb/Telegraph-style content generation, plus whatever backend datastore is configured in database/config_db.py.
14. How to diagram it
- A clear architecture diagram should show:
- Telegram users/groups/channels feeding into the Telegram client layer
- client updates routed into feature plugins
- plugins reading/writing through the database modules
- some flows passing through the HTTP/template layer for shareable download/request pages
- supporting utility modules for formatting, keepalive, and deployment
- The main architectural boundary is between event handlers (plugins) and shared persistence/serving infrastructure.
Main entry points: plugins/__init__.py Plugins init · database Database · clients.py Clients · Bot/__init__.py Bot init
Components 20
Runtime
Entry points and deployment wrappers
- Telegram users · End users, groups, and channels interacting with the bot
- bot.py · Primary bot startup script
bot.py - Script.py · Alternate bootstrap or launch wrapper
Script.py - Deploy files · Container, Procfile, and platform deployment configuration
Dockerfile
Bot core
Telegram client bootstrap and event dispatch
Features
Plugin-based bot capabilities
- Plugins init · Plugin package initialization
plugins/__init__.py - Commands · Core command responses and bot actions
plugins/commands.py - Misc · Utility and auxiliary message handling
plugins/misc.py - Indexing · Indexes incoming files and searchable content
plugins/index.py - Extract · Extracts and prepares media or file responses
plugins/extract.py - PM filter · Private-message filtering and gated file access
plugins/pmfilter.py - Broadcast · Broadcasts messages to users or chats
plugins/broadcast.py - Premium · Premium plans and membership management
plugins/Premium.py - Channel · Channel and subscription-related controls
plugins/channel.py - Join req · Join request and verification handling
plugins/join_req.py
Data & serving
Persistence, web pages, and shared helpers
- Database · Shared storage boundary for users, filters, referrals, and config
database - Web layer · Request/download pages and lightweight HTTP surface
dreamxbotz/server - Templates · Download and request page templates
dreamxbotz/template - Utilities · Formatting, file helpers, keepalive, and template rendering
dreamxbotz/util
Connections 24
- Telegram users → Clients: messages · User, group, and channel updates arrive at the Telegram client
- bot.py → Bot init: starts · Primary entrypoint initializes the bot package
- Script.py → Bot init: bootstraps · Alternate launcher also enters the bot package
- Bot init → Clients: creates · Initialization wires shared clients and runtime state
- Clients → Plugins init: loads · Client runtime registers plugin handlers
- Plugins init → Commands: dispatches · Core command handlers are loaded as plugins
- Plugins init → Misc: dispatches · Auxiliary handlers are loaded as plugins
- Plugins init → Indexing: dispatches · Indexing pipeline is loaded as a plugin
- Plugins init → Extract: dispatches · File extraction and delivery handlers are loaded
- Plugins init → PM filter: dispatches · Access-gated PM filtering is loaded
- Plugins init → Broadcast: dispatches · Administrative broadcast features are loaded
- Plugins init → Premium: dispatches · Premium entitlement handlers are loaded
- Plugins init → Channel: dispatches · Channel and subscription controls are loaded
- Plugins init → Join req: dispatches · Join-request and verification handling is loaded
- Indexing → Database: reads/writes · Search index and file catalog are persisted
- Extract → Database: reads · Delivery flows resolve stored file metadata
- PM filter → Database: reads/writes · Access checks and user state are stored
- Premium → Database: reads/writes · Plan and premium membership state is persisted
- Broadcast → Database: reads · Broadcast targets and user records are retrieved
- Web layer → Templates: renders · HTTP surface serves request and download pages
- Utilities → Web layer: supports · Template rendering and file helpers back the web surface
- Utilities → Clients: supports · Shared helpers support runtime formatting and keepalive
- Deploy files → bot.py: runs · Deployment artifacts launch the bot service
- Deploy files → Web layer: enables · Deployment can expose the HTTP serving layer