Skip to content

GouthamSER/TG-FileStreamBot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

60 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

⚑ Telegram File Stream Bot

Cover Image

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
  1. About This Bot
  2. How to Deploy
  3. Configuration
  4. How to Use
  5. Admin Commands
  6. Contact
  7. Credits
  8. License

πŸš€ About This Bot

Telegram Logo

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

πŸ“¦ How to Deploy

Run Locally / VPS

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 WebStreamer

Stop with CTRL+C.

Run 24/7 on a VPS with tmux:

sudo apt install tmux -y
tmux
python3 -m WebStreamer

Detach with CTRL+B then D. Bot keeps running after you close SSH.

Deploy using Docker

git clone https://github.com/GouthamSER/TG-FileStreamBot
cd TG-FileStreamBot
docker build . -t fsb

Create your .env file, then run:

docker run -d --restart unless-stopped --name fsb \
  -v /PATH/TO/.env:/app/.env \
  -p 8080:8080 \
  fsb

PORT in .env must match the exposed port. Example: PORT=9000 β†’ -p 9000:9000

Restart after changing .env:

docker restart fsb

Deploy using docker-compose

sudo apt install docker-compose -y
git clone https://github.com/GouthamSER/TG-FileStreamBot
cd TG-FileStreamBot

Edit the variables inside docker-compose.yml, then:

sudo docker compose up -d

Deploy on Koyeb / Heroku

  1. Fork this repo
  2. Set all env vars in the platform dashboard
  3. Procfile β†’ web: python3 -m WebStreamer
  4. .python-version β†’ 3.10
  5. Deploy πŸš€

⚠️ Koyeb (Dockerfile deploy): container EXPOSEs 8080. In Koyeb's service settings, set Port β†’ 8080 (and protocol HTTP) to match, or set PORT=8080 env var if you change the exposed port. Health checks hit /.


βš™οΈ Configuration

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

Mandatory Vars

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

Optional Vars

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

MongoDB / User Tracking (optional)

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.

Force-Subscribe (optional)

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_CHANNEL to check membership.

Multi-Client Support

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_3

Add as many as you need β€” no upper limit tested.

⚠️ Important: Add every multi-client bot to BIN_CHANNEL as an admin.


πŸ“² How to Use

⚠️ Add all bots (including multi-client ones) to BIN_CHANNEL as 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.


πŸ›  Admin Commands

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

πŸ“¬ Contact

Developed and maintained by GouthamSER

GitHub Telegram


πŸ™Œ Credits


πŸ“„ License

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.

About

File To Link Converts Easy To Download tg things via FDM or 1DM App

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors