FileToLink
Thunder - The fastest Telegram File To Link bot, built on the pyrofork platform.
Install / Use
/learn @fyaz05/FileToLinkREADME
📑 Table of Contents
- About The Project
- How It Works
- Features
- Configuration
- Usage and Commands
- Advanced Feature Setup
- Deployment Guide
- Support & Community
- License
- Acknowledgments
About The Project
Thunder is a powerful Telegram bot that transforms Telegram files into high-speed direct links, perfect for both streaming and rapid downloading. Share files via HTTP(S) links without needing to download them from the Telegram client first.
💡 Perfect For
- 🚀 Bypassing Telegram's built-in download speed limits
- ☁️ Unlimited cloud storage with fast streaming and download links
- 🎬 Content creators sharing media files
- 👥 Communities distributing resources
- 🎓 Educational platforms sharing materials
How It Works
User Uploads File → Telegram Bot → Forwards to Channel → Generates Direct Link → Direct Download / Streaming
- Upload → User sends any file to the bot.
- Store → The bot forwards the file to your private storage channel (
BIN_CHANNEL), where it is permanently saved to generate the link. - Generate → A unique, permanent link is created.
- Stream/Download → Anyone with the link can stream or download the file directly in their browser.
- Balance → Multi-client support distributes the load for high availability.
Features
Core Functionality
- ✅ Direct Link Generation - Convert any Telegram file into a direct HTTP(S) link.
- ✅ Permanent Links - Links remain active as long as the file exists in the storage channel.
- ✅ Browser Streaming & Downloading - Stream media directly or download files at high speed without a Telegram client.
- ✅ All File Types - Supports video, audio, documents, images, and any other file format.
- ✅ Batch Processing - Generate links for multiple files at once with a single command.
Performance & Scalability
- ✅ Multi-Client Support - Distributes traffic across multiple Telegram bots to avoid limits and increase throughput.
- ✅ Async Architecture - Built with
aiohttpandasynciofor non-blocking, high-performance operations. - ✅ MongoDB Integration - Ensures persistent and reliable data storage.
Security & Control
- 🔐 Token Authentication - Secure user access with a time-limited token system.
- 🛡️ Admin Controls - Full suite of commands for user and bot management.
- 👤 User Authentication - Require users to join a specific channel before they can use the bot.
- ✅ Channel/Group Support - Fully functional in private chats, groups, and channels.
Customization
- 🌍 Custom Domain - Serve files from your own domain for a professional look.
- 🔗 URL Shortening - Integrate with URL shortener services for clean, shareable links.
- 🎨 Custom Templates - Personalize messages sent by the bot to match your brand.
- 📈 Media Info Display - Shows file size, duration, and format details in the response message.
Configuration
Copy config_sample.env to config.env and fill in your values.
Essential Configuration
| Variable | Description | Example |
| :--- | :--- | :--- |
| API_ID | Telegram API ID | 12345678 |
| API_HASH | Telegram API Hash | abc123def456 |
| BOT_TOKEN | Bot token from @BotFather | 123456:ABCdefGHI |
| BIN_CHANNEL | Storage channel ID | -1001234567890 |
| OWNER_ID | Owner user ID | 12345678 |
| DATABASE_URL | MongoDB connection | mongodb+srv://... |
| FQDN | Domain/IP address | f2l.thunder.com |
| HAS_SSL | HTTPS enabled | True or False |
| PORT | Server port | 8080 |
| NO_PORT | Hide port in URLs | True or False |
Optional Configuration
<details> <summary>Optional Configuration Details</summary>| Variable | Description | Default |
| :--- | :--- | :--- |
| MULTI_TOKEN1 | Additional bot token 1 (use MULTI_TOKEN1, MULTI_TOKEN2, etc.) | (empty) |
| FORCE_CHANNEL_ID | Required channel join | (empty) |
| MAX_BATCH_FILES | Maximum files in batch processing | 50 |
| CHANNEL | Allow processing messages from channels | False |
| BANNED_CHANNELS | Blocked channel IDs | (empty) |
| SLEEP_THRESHOLD | Client switch threshold | 300 |
| WORKERS | Async workers | 8 |
| NAME | Bot name | ThunderF2L |
| BIND_ADDRESS | Bind address | 0.0.0.0 |
| PING_INTERVAL | Ping interval (seconds) | 840 |
| TOKEN_ENABLED | Enable tokens | False |
| SHORTEN_ENABLED | URL shortening for tokens | False |
| SHORTEN_MEDIA_LINKS | URL shortening for media | False |
| TOKEN_TTL_HOURS | Token validity duration in hours | 24 |
| URL_SHORTENER_API_KEY | Shortener API key | (empty) |
| URL_SHORTENER_SITE | Shortener service | (empty) |
| SET_COMMANDS | Auto-set bot commands | True |
| RATE_LIMIT_ENABLED | Enable rate limiting | False |
| MAX_FILES_PER_PERIOD | Files per window | 2 |
| RATE_LIMIT_PERIOD_MINUTES | Time window | 1 |
| MAX_QUEUE_SIZE | Queue size | 100 |
| GLOBAL_RATE_LIMIT | Global limiting | True |
| MAX_GLOBAL_REQUESTS_PER_MINUTE | Global limit | 4 |
Usage and Commands
Basic Usage
- Start → Send
/startto the bot. - Authenticate → Join required channels (if configured).
- Upload → Send any media file.
- Receive → Get a direct streaming and download link.
- Share → Anyone can access the file via the link.
Commands Reference
User Commands
| Command | Description |
| :--- | :--- |
| /start | Start the bot and get a welcome message. Also used for token activation. |
| /link | Generates a link. For batches, reply to the first file of a group and specify the count. Example: /link 5 will process that file and the next four. |
| /dc | Get the data center (DC) of a user or file. Use /dc id, or reply to a file or user. |
| /ping | Check if the bot is online and measure response time. |
| /about | Get information about the bot. |
| /help | Show help and usage instructions. |
Admin Commands
| Command | Description |
| :--- | :--- |
| /status | Check bot status, uptime, and resource usage. |
| /broadcast | Send a message to all users (supports text, media, buttons). |
| /stats | View usage statistics and analytics. |
| /ban | Ban a user or channel (reply to message or use user/channel ID). |
| /unban | Unban a user or channel. |
| /log | Send bot logs. |
| /restart | Restart the bot. |
| /shell | Execute a shell command. |
| /speedtest | Run network speed test and display comprehensive results. |
| /users | Show total number of users. |
| /authorize | Permanently authorize a user to use the bot (bypasses token system). |
| /deauthorize | Remove permanent authorization from a user. |
| /listauth | List all permanently authorized users. |
start - Initialize bot
link - Generate direct link
dc - Get data center info
ping - Check bot status
about - Bot information
help - Show help guide
status - [Admin] System status
stats - [Admin] Usage statistics
broadcast - [Admin] Message all users
ban - [Admin] Ban user
unban - [Admin] Unban user
users - [Admin] User count
authorize - [Admin] Grant access
deauthorize - [Admin] Revoke access
listauth - [Admin] List authorized
log - [Admin] Send bot logs
restart - [Admin] Restart the bot
shell - [Admin] Execute shell command
speedtest - [Admin] Run network speed test
</details>
Advanced Feature Setup
Token System
Enable controlled access with tokens:
- Set
TOKEN_ENABLED=Truein yourconfig.env. - Users receive automatic tokens on first use.
- Admins can grant permanent authorization with
/authorizeto bypass tokens. - Tokens include activation links for secure access.
URL Shortening
Configure URL shortening for cleaner links:
SHORTEN_ENABLED=True
SHORTEN_MEDIA_LINKS=True
URL_SHORTENER
