ββββββββββββββ βββββββββββββββββββββββββ βββββββ βββββββ ββββββββ
ββββββββββββββ ββββββββββββββββββββββββββββββββββββββββββββββββββ
ββββββ ββββββ ββββββ ββββββββ βββ βββ βββββββββββββββββ
ββββββ ββββββ ββββββ ββββββββ βββ βββ βββββββββββββββββ
βββ ββββββββββ ββββββββββββββββ βββ ββββββββββββ βββββββββββ
βββ ββββββββββ ββββββββββββββββ βββ βββββββ βββ βββββββββββ
π Share files. Lock content. Earn money. β All inside Telegram. FileStore is a lightning-fast π₯ bot with built-in Force-Subscribe π‘οΈ, Ad-Shortener monetization π°, Premium tiers π, auto-deletion β³, and a full admin panel π β zero coding needed after deploy.
FileStore is a production-ready, fully async Telegram Bot built for high-traffic file distribution. Unlike generic file bots, it ships with:
- π₯ uvloop for a blazing-fast event loop
- π‘οΈ Semaphore-guarded request handling β no server crashes under load
- π° Monetization-first design β force users through ad-shorteners or pay for premium
Built with Pyrogram v2, MongoDB, aiohttp, and love for reliability.
π‘οΈ Force Subscribe System
- Normal F-Sub: Requires users to join specified channels before accessing files
- Request F-Sub (R-Sub): Requires users to send a join request (great for private/approval channels)
- Add or remove channels live from within Telegram via the
/fsubcommand panel - Supports multiple channels simultaneously with per-channel join buttons
π Ad-Shortener Monetization
Two powerful modes:
| Mode | How It Works |
|---|---|
| 24H Pass | User watches one ad β unlocked for 24 hours |
| Per Link | Every file request requires an ad click |
Premium users bypass ads entirely. Set via /shortner panel.
β‘ High Performance Architecture
uvloop+tgcryptoβ 2β4Γ faster than standard asyncioGLOBAL_SEMAPHORE(100)β caps concurrent/startexecutions- Per-user
asyncio.Lockβ eliminates race conditions flood_safe()β automatic FloodWait retry with exponential backoff- Auto-delete & broadcast run as background tasks β main coroutine returns instantly
π Admin Panel & Controls
Everything controlled from within Telegram β no SSH, no config files:
- Add/Remove Admins
- Configure Shortener API, Website and Bypass count
- Toggle Content Protection, Caption Hiding, Auto-Delete timer
- Manage Premium users
- Pull server logs with
/log - Hot-restart bot with
/restart
π¦ Batch File Delivery
- Encode any range of DB channel messages into a single shareable Base64 link
- Supports 1 file or 100+ files in a single link
- Semaphore-controlled copy loop prevents API spam
FileStore/
β
βββ π bot.py β Pyrogram Client + startup logic
βββ π config.py β ENV loading with MongoDB fallback
βββ π main.py β Entry point
βββ π helper_func.py β Base64, Shortzy, flood-safe helpers
βββ π users.py β User management
βββ π update.py β Auto-update from upstream
β
βββ π plugins/
β βββ start.py β /start, file delivery, rate limiting
β βββ new.py β All commands + global callback router
β βββ link_generator.py β Batch link generation
β βββ channel_post.py β Channel post handler
β βββ cbb.py
β
βββ π command/
β βββ admin.py β Shortener & admin panel logic
β βββ fsub.py β F-Sub / R-Sub management
β βββ work.py β Subscription verification engine
β βββ call.py β Settings callbacks
β βββ call2.py β Auto-delete callbacks
β βββ pre.py β Premium tier management
β βββ restart.py β Process restart handler
β βββ setting.py β /file settings
β
βββ π database/
β βββ database.py β MongoDB abstraction (get/set variable)
β
βββ π basic/
βββ loop.py β Background API-switch loop
| Variable | Description |
|---|---|
TG_BOT_TOKEN |
Bot token from @BotFather |
APP_ID |
API ID from my.telegram.org |
API_HASH |
API Hash from my.telegram.org |
owner |
Your Telegram User ID (master admin) |
CHANNEL_ID |
DB Channel ID (e.g. -1001234567890) |
DATABASE_URL |
MongoDB connection URI |
| Variable | Default | Description |
|---|---|---|
PORT |
8080 |
Web server port |
TG_BOT_WORKERS |
500 |
Worker thread count |
START_MSG |
Built-in | Custom HTML welcome message ({mention}, {first}, {id}) |
ββ USER COMMANDS βββββββββββββββββββββββββββββββββββββββββββββ
β /start Start the bot or open a shared file link β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
ββ ADMIN COMMANDS ββββββββββββββββββββββββββββββββββββββββββββ
β /admin Master admin management panel β
β /shortner Configure Ad-Shortener settings β
β /fsub Manage Force-Subscribe channels β
β /file File delivery settings β
β /auto_del Auto-delete timer configuration β
β /add_prem Grant a user Premium access β
β /rem_prem Revoke Premium access β
β /list_prem List all Premium users β
β /users Total user count β
β /broadcast Broadcast message to all users β
β /log Fetch server log file directly in chat β
β /restart Hot-restart the bot process β
β /code Extract HTML caption from a message β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
ββ OWNER ONLY ββββββββββββββββββββββββββββββββββββββββββββββββ
β /config Set any DB variable manually β
β /get Read any DB variable value β
β /reset Reset R-Sub tracking data β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# Clone the repository
git clone https://github.com/Itzmepromgitman/FileStore
cd FileStore
# Install requirements
pip3 install -r requirements.txt
# Set ENV variables (or edit config.py)
export TG_BOT_TOKEN="your_bot_token"
export APP_ID="your_app_id"
export API_HASH="your_api_hash"
export owner="your_telegram_id"
export CHANNEL_ID="your_channel_id"
export DATABASE_URL="your_mongodb_uri"
# Start the bot
python3 bot.pydocker build -t FileStore .
docker run --env-file .env FileStoreBefore going public or deploying, ensure:
- All ENV variables are set via environment β no hardcoded tokens in code
- Bot is Admin in DB Channel with Send Messages permission
- Bot is Admin in F-Sub channels with Invite Users via Link permission
- MongoDB URI is private and not committed to version control
-
.gitignoreincludes.env,*.session, andbot.txt
pyrogram
pyromod
tgcrypto
motor
uvloop
aiohttp
shortzy
pip3 install -r requirements.txt| Contributor | Role |
|---|---|
| Pyrogram | Core Telegram MTProto framework |
| pyromod | Conversational client.listen() support |
| shortzy | URL shortener API adapter |
| CodeXBotz | Original inspiration |
Distributed under the GNU General Public License v3.0.
See LICENSE for full details.
If this project helped you, please drop a β β it means a lot!
Made with π₯ + Python + too much caffeine