Skip to content

GouthamSER/TG-FileStreamBot

Repository files navigation

Telegram File Stream Bot

Cover Image

A Telegram bot to generate direct download links for your Telegram files.
Report a Bug | Request Feature


Table of Contents
  1. About this Bot
  2. How to Deploy
  3. Configuration
  4. How to Use
  5. Contact
  6. Credits

About This Bot

Telegram Logo

Send any Telegram file to this bot and get an instant direct download link — no waiting for the full file to download first.

  • ✅ Direct download links with original filename
  • ✅ File size displayed in reply
  • ✅ Links expire in 24 hours
  • ✅ Multi-client support to avoid flood limits
  • ✅ Supports documents, videos, audio, photos, stickers, and more

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

To stop: CTRL+C

Run 24/7 on VPS using 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 .env changes:

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 variables in 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. Set Procfileweb: python3 -m WebStreamer
  4. Set .python-version3.10
  5. Deploy

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 and 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 for link generation
HAS_SSL False Set True to generate https:// links
NO_PORT True Set True to hide port from generated links (use when port is 80/443)
KEEP_ALIVE False Ping self every PING_INTERVAL seconds — useful 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

Multi-Client Support

Multi-client distributes 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 needed. No upper limit tested.

⚠️ Important: Add all multi-client bots to BIN_CHANNEL as admins.


How to Use

⚠️ Add all bots (including multi-client ones) to BIN_CHANNEL as admins before starting.

Command Description
/start Check if bot is running

Simply forward or send any media file to the bot. It will instantly reply with:

  • 📄 File name
  • 📦 File size
  • 🔗 Direct download link
  • Buttons: Shortened link + Download link

Links are valid as long as the bot is running and BIN_CHANNEL is intact.


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 — you can 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

Languages