Installation Guide¶
This guide will walk you through installing StreamBot on your system. Choose the method that best suits your needs.
Prerequisites¶
Before installing StreamBot, ensure you have:
- Python 3.11 or higher (Download Python)
- MongoDB 4.4+ (local or cloud instance)
- Git for cloning the repository
- Telegram Bot Token from @BotFather
- Telegram API credentials from my.telegram.org
Method 1: Standard Installation¶
1. Clone the Repository¶
git clone https://github.com/AnikethJana/Telegram-Download-Link-Generator.git
cd Telegram-Download-Link-Generator
2. Create Virtual Environment¶
3. Install Dependencies¶
4. Environment Configuration¶
# Copy the example environment file
cp .env.example .env
# Edit the configuration file
nano .env # or use your preferred editor
Method 2: Docker Installation¶
1. Using Docker Compose (Recommended)¶
# Clone repository
git clone https://github.com/AnikethJana/Telegram-Download-Link-Generator.git
cd Telegram-Download-Link-Generator
# Copy environment file
cp .env.example .env
# Edit .env with your configuration
# Start with Docker Compose
docker-compose up -d
2. Using Docker Only¶
# Build the image
docker build -t streambot .
# Run the container
docker run -d \
--name streambot \
--env-file .env \
-p 8080:8080 \
streambot
Post-Installation Setup¶
1. Telegram Bot Setup¶
- Create a Bot:
- Message @BotFather on Telegram
- Send
/newbot
and follow the instructions -
Save the bot token
-
Create Log Channel:
- Create a private Telegram channel
- Add your bot as an admin with "Post Messages" permission
-
Get the channel ID using @username_to_id_bot
-
Get API Credentials:
- Visit my.telegram.org
- Log in with your phone number
- Go to "API Development Tools"
- Create a new application to get API ID and Hash
2. MongoDB Setup¶
- Create account at MongoDB Atlas
- Create a new cluster
- Get connection string
- Whitelist your IP address
3. Configuration¶
Edit your .env
file with the following required variables:
# Telegram Configuration
API_ID=your_api_id_here
API_HASH=your_api_hash_here
BOT_TOKEN=your_bot_token_here
LOG_CHANNEL=-1001234567890
# Database Configuration
DATABASE_URL=mongodb://localhost:27017
DATABASE_NAME=StreamBotDB
# Server Configuration
BASE_URL=http://localhost:8080
PORT=8080
BIND_ADDRESS=127.0.0.1
# Video Frontend (defaults to Cricster)
VIDEO_FRONTEND_URL=https://cricster.pages.dev
# Admin Configuration
ADMINS=your_telegram_user_id
Verification¶
1. Test the Installation¶
You should see output like:
INFO - StreamBot starting up...
INFO - Primary bot client operational as @YourBotName
INFO - Web server started on http://127.0.0.1:8080
2. Test Bot Functionality¶
- Send
/start
to your bot on Telegram - Send a file to test link generation
- For videos, test both download and streaming functionality
- Visit
http://localhost:8080/api/info
to check API status
3. Test Video Streaming¶
- Send a video file to your bot
- Click the "🎬 Play Video" button (if VIDEO_FRONTEND_URL is configured)
- Test video seeking and playback functionality
Troubleshooting¶
Common Issues¶
Bot token invalid:
- Verify your bot token in the.env
file
- Ensure there are no extra spaces or characters
Database connection failed:
- Check if MongoDB is running:sudo systemctl status mongodb
- Verify DATABASE_URL in your .env
file
Port already in use:
- Change the PORT in your.env
file
- Or stop the process using port 8080
Permission denied for log channel:
- Ensure the bot is added as admin to your log channel - Verify the LOG_CHANNEL ID is correct (should be negative for channels)Video streaming not working:
- Check your VIDEO_FRONTEND_URL configuration - Ensure the frontend URL is accessible - Set tofalse
to disable video frontend
Getting Help¶
If you encounter issues:
- Check the troubleshooting section
- Review logs for error messages
- Join our community discussions
- Report bugs on GitHub Issues
- Contact developer on Telegram
Next Steps¶
Once installation is complete:
- Configure your bot with additional settings
- Follow the Quick Start guide for basic usage
- Review the User Guide for detailed features
- Explore Video Streaming capabilities