How codexbotz/file-sharing-bot works
Project type and purpose
• This is a Python-based Telegram Bot (“File-sharing-Bot”) that lets users upload posts/documents, stores them in a private Telegram channel, and returns special shareable links.
• It is essentially a backend service (no separate “frontend” UI) that interfaces with Telegram’s Bot API, a MongoDB database, and a Telegram channel used as file storage.
File structure
• Top-level files:
• Dockerfile, Procfile, app.json – deployment descriptors (Heroku, Docker, etc.)
• bot.py, main.py – bootstrap and run logic for the Pyrogram client
• config.py – environment-variable based configuration loader
• helper_func.py – shared utilities
• database/database.py – MongoDB connection and data-access layer
• plugins/ – individual command handlers and business-logic modules (cbb.py, channel_post.py, link_generator.py, route.py, start.py, useless.py)
• requirements.txt – pinned Python dependencies (Pyrogram, motor or pymongo, etc.)
README for additional insights
• Uses Pyrogram to handle updates and file operations
• Stores metadata (file IDs, captions, link tokens) in MongoDB via DATABASE_URL
• Posts/reads files from a “Database Channel” on Telegram
• Supports configurable features (force-sub, auto-delete, protect content) via environment variables
• Deployable on Heroku, Railway, Koyeb, or any VPS
• Blue rectangles for internal components (Application Core, Plugins)
Detailed capture of architectural elements
• How environment variables feed into config.py and influence feature toggles (force-sub, auto-delete)
• “Database Channel” as a special storage unit outside MongoDB but managed via the same Bot API
• If desired, annotate high-level sequence: e.g., on /genlink flow, highlight steps from HTTP update to final file share link