Turn any Telegram file into an instant direct download / streaming link.
No waiting for the full file to download first β just send it, get the link.
π Report a Bug Β· β¨ Request a Feature
π Table of Contents
Send any file to this bot and get an instant direct download / streaming link in return.
| β | Direct download links with original filename |
| β | File size shown in the reply |
| β | Multi-client support to dodge flood limits |
| β | Supports documents, videos, audio, photos, stickers & more |
| β | Optional MongoDB user tracking |
| β | Optional Force-Subscribe (FSub) gating |
| β | Built-in /stats and /broadcast for the bot owner |
git clone https://github.com/GouthamSER/TG-FileStreamBot
cd TG-FileStreamBot
python3 -m venv ./venv
. ./venv/bin/activate
pip3 install -r requirements.txt
python3 -m WebStreamerStop with CTRL+C.
Run 24/7 on a VPS with tmux:
sudo apt install tmux -y tmux python3 -m WebStreamerDetach with CTRL+B then D. Bot keeps running after you close SSH.
git clone https://github.com/GouthamSER/TG-FileStreamBot
cd TG-FileStreamBot
docker build . -t fsbCreate your .env file, then run:
docker run -d --restart unless-stopped --name fsb \
-v /PATH/TO/.env:/app/.env \
-p 8080:8080 \
fsb
PORTin.envmust match the exposed port. Example:PORT=9000β-p 9000:9000
Restart after changing .env:
docker restart fsbsudo apt install docker-compose -y
git clone https://github.com/GouthamSER/TG-FileStreamBot
cd TG-FileStreamBotEdit the variables inside docker-compose.yml, then:
sudo docker compose up -d- Fork this repo
- Set all env vars in the platform dashboard
Procfileβweb: python3 -m WebStreamer.python-versionβ3.10- Deploy π
β οΈ Koyeb (Dockerfile deploy): containerEXPOSEs8080. In Koyeb's service settings, set Port β 8080 (and protocol HTTP) to match, or setPORT=8080env var if you change the exposed port. Health checks hit/.
Create a .env file in the root directory (for local/VPS):
API_ID=452525
API_HASH=esx576f8738x883f3sfzx83
BOT_TOKEN=55838383:yourbottokenhere
BIN_CHANNEL=-1001234567890
PORT=8080
FQDN=yourdomain.com
HAS_SSL=True| Variable | Description |
|---|---|
API_ID |
Telegram API ID from my.telegram.org |
API_HASH |
Telegram API Hash from my.telegram.org |
BOT_TOKEN |
Bot token from @BotFather |
BIN_CHANNEL |
Channel ID where the bot forwards & stores files. Create a channel, forward any message to @missrose_bot and reply /id to get the ID |
| Variable | Default | Description |
|---|---|---|
ALLOWED_USERS |
(empty) | Comma-separated Telegram user IDs/usernames allowed to use the bot. Leave empty for public access |
HASH_LENGTH |
6 |
Length of the hash in generated URLs. Must be between 6 and 63 |
SLEEP_THRESHOLD |
60 |
Seconds to sleep on flood wait before retrying |
WORKERS |
6 |
Max concurrent workers for handling updates |
PORT |
8080 |
Port the web server listens on |
WEB_SERVER_BIND_ADDRESS |
0.0.0.0 |
Server bind address |
FQDN |
(bind address) | Your domain name, used for link generation |
HAS_SSL |
True |
Set True to generate https:// links |
NO_PORT |
True |
Set True to hide the port from generated links (use when port is 80/443) |
KEEP_ALIVE |
False |
Ping self every PING_INTERVAL seconds β handy for PaaS free tiers |
PING_INTERVAL |
1200 |
Ping interval in seconds (default 20 min) |
USE_SESSION_FILE |
False |
Use session files instead of in-memory SQLite |
DEBUG |
False |
Enable debug logging |
Set DATABASE_URI to enable storing user IDs β required for /stats and /broadcast.
| Variable | Default | Description |
|---|---|---|
DATABASE_URI |
(empty) | MongoDB connection string. Leave empty to disable DB features entirely |
DATABASE_NAME |
FileStreamBot |
Database name |
USERS_COLLECTION |
fsb_users |
Collection used to store user IDs |
OWNER_ID |
0 |
Your Telegram user ID β required to use /stats and /broadcast |
Only the user ID is stored β no message content, no file data, no byte tracking.
Require users to join a channel before they can use the bot.
| Variable | Default | Description |
|---|---|---|
FSUB_CHANNEL |
(empty) | Channel username (@mychannel) or ID (-100xxxxxxxxxx) users must join. Leave empty to disable |
The bot must be an admin in
FSUB_CHANNELto check membership.
Multi-client spreads Telegram API requests across multiple bots to avoid flood limits and handle more concurrent streams.
To enable, add extra bot tokens as env vars:
MULTI_TOKEN1=token_of_bot_1
MULTI_TOKEN2=token_of_bot_2
MULTI_TOKEN3=token_of_bot_3Add as many as you need β no upper limit tested.
β οΈ Important: Add every multi-client bot toBIN_CHANNELas an admin.
β οΈ Add all bots (including multi-client ones) toBIN_CHANNELas admins before starting.
| Command | Description |
|---|---|
/start |
Check if the bot is running (also runs the FSub check if enabled) |
Simply forward or send any media file to the bot. It instantly replies with:
- π File name
- π¦ File size
- π Direct download link
- Buttons: Shortened link + Download link
Links stay valid as long as the bot is running and BIN_CHANNEL is intact.
These require OWNER_ID and DATABASE_URI to be set, and only work for the owner in a private chat.
| Command | Description |
|---|---|
/stats |
Shows total tracked users |
/broadcast |
Reply to any message with this command to send it to every tracked user |
Developed and maintained by GouthamSER
- GouthamSER β Owner, Developer & Re-Edit
- EverythingSuckz β Original author of TG-FileStreamBot
- eyaadh β Original streaming core from Megatron Bot
- BlackStone β Multi-client support
- Dan TΓ¨s β Pyrogram library
Copyright (C) 2026 GouthamSER under the GNU Affero General Public License v3.0.
This is free software β use, study, share and improve it under the terms of the AGPL-3.0 license.
