Skip to content
/ FileToLink Public template

The fastest Telegram File To Link bot, built on the Hydrogram platform.

License

Notifications You must be signed in to change notification settings

fyaz05/FileToLink

Repository files navigation

🚀 File To Link Bot 🌍

Telegram Logo

Telegram Advanced File to Link Bot
Convert files to links for seamless streaming and downloading with advanced features using Hydrogram.

🐞 Report a Bug | 🌟 Request a Feature


📋 Table of Contents
  1. About This Bot
  2. How to Make Your Own
  3. Setting Up Things
  4. How to Use the Bot
  5. FAQ
  6. Contributing
  7. Credits

🤖 About This Bot

⚙️ Features

  • Streamlined Code: Improved efficiency by removing unnecessary features.
  • High Speed: Utilizes Hydrogram for faster operations.
  • Easy Deployment: Configured for straightforward deployment.
  • Enhanced Functionality: Improved user interface and added features:
    • 😄 User-Friendly Interface
    • 🔗 Instant Stream Links
    • 👥 Group Support
    • 📂 File Retrieval
    • 📢 Channel Updates
    • 📑 Log Channel
    • 🚨 Admin Broadcasts

💻 Bot Commands

View All Commands (Click to expand)
start - Start the bot
link - Generate a stream link
help - Bot usage details
about - Get bot info
dc - Check data center
ping - Check bot latency
stats - (Admin) Bot usage statistics
status - (Admin) Bot operational status
broadcast - (Admin) Send a message to all users
users - (Admin) View total users

🚀 How to Make Your Own

Deploy on Heroku

Press the button below to deploy on Heroku:

Deploy To Heroku

Then, refer to the variables tab for more info on setting up environmental variables.

Host It on VPS or Locally

git clone https://github.com/fyaz05/FileToLink
cd FileToLink
pip3 install -r requirements.txt
python3 -m Thunder

To stop the bot:

Ctrl + C

If you want to run the bot 24/7 on VPS:

sudo apt install tmux -y
tmux
python3 -m Thunder

Now you can close the VPS, and the bot will keep running.

⚙️ Setting Up Things

If you're on Heroku, just add these to the Environmental Variables. If you're hosting locally, create a .env file in the root directory and add all the variables there. Example .env file:

API_ID=
API_HASH=
BOT_TOKEN=
BIN_CHANNEL=
DATABASE_URL=
FQDN=
HAS_SSL=
OWNER_ID=
OWNER_USERNAME=
PORT=
#Remove hash for using multiple tokens and max token up to 49
#MULTI_TOKEN1=
#MULTI_TOKEN2=
#MULTI_TOKEN3=

🔐 Mandatory Vars

  • API_ID: Get it from my.telegram.org.
  • API_HASH: Get it from my.telegram.org.
  • BOT_TOKEN: Get the bot token from @BotFather.
  • BIN_CHANNEL: Create a new channel (private/public), post something in your channel, forward that post to @missrose_bot, and reply with /id. Copy the forwarded channel ID here.
  • OWNER_ID: Your Telegram User ID. Send /id to @missrose_bot to get it.
  • DATABASE_URL: MongoDB URI for saving user IDs for broadcasting.

🔧 Optional Vars

UPDATES_CHANNEL: Public channel username that users must join to use the bot. Ensure bot is an admin there.

BANNED_CHANNELS: IDs of channels where the bot won't work. Separate multiple IDs with a Space.

SLEEP_THRESHOLD: Time (in seconds) for bot to handle flood wait exceptions automatically. Defaults to 60 seconds.

WORKERS: Max number of concurrent workers for updates. Defaults to 3.

PORT: The port for your web app's deployment. Defaults to 8080.

MY_PASS: Bot PASSWORD.

WEB_SERVER_BIND_ADDRESS: Your server's bind address. Defaults to 0.0.0.0.

NO_PORT: Set your PORT to 80 (http) or 443 (https) if you want the port hidden. Ignore if using Heroku.

FQDN: A Fully Qualified Domain Name, if present. Defaults to WEB_SERVER_BIND_ADDRESS.

📟 How to Use the Bot

⚠️ Before using the bot, add all relevant bots (multi-client ones too) to the BIN_CHANNEL as admins.

  • /start: Check if the bot is active.
  • To get an instant stream link, forward any media to the bot.
  • To use in a group, add the bot as admin and reply to a file with /link.

❓ FAQ

  • How long do the links remain valid?

    Links remain valid as long as your bot is running and you haven't deleted the log channel.

🤝 Contributing

Feel free to contribute to this project if you have any ideas or improvements in mind!

🏅 Credits

  • Me
  • Adarsh Goel