Skip to content

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:

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

python -m venv venv
venv\Scripts\activate
python3 -m venv venv
source venv/bin/activate

3. Install Dependencies

pip install -r requirements.txt

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

# 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

  1. Create a Bot:
  2. Message @BotFather on Telegram
  3. Send /newbot and follow the instructions
  4. Save the bot token

  5. Create Log Channel:

  6. Create a private Telegram channel
  7. Add your bot as an admin with "Post Messages" permission
  8. Get the channel ID using @username_to_id_bot

  9. Get API Credentials:

  10. Visit my.telegram.org
  11. Log in with your phone number
  12. Go to "API Development Tools"
  13. Create a new application to get API ID and Hash

2. MongoDB Setup

# Install MongoDB (Ubuntu/Debian)
sudo apt update
sudo apt install mongodb

# Start MongoDB service
sudo systemctl start mongodb
sudo systemctl enable mongodb
  1. Create account at MongoDB Atlas
  2. Create a new cluster
  3. Get connection string
  4. 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

# Start StreamBot
python -m StreamBot

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

  1. Send /start to your bot on Telegram
  2. Send a file to test link generation
  3. For videos, test both download and streaming functionality
  4. Visit http://localhost:8080/api/info to check API status

3. Test Video Streaming

  1. Send a video file to your bot
  2. Click the "🎬 Play Video" button (if VIDEO_FRONTEND_URL is configured)
  3. Test video seeking and playback functionality

Troubleshooting

Common Issues

Bot token invalid:

ERROR - Bot token is invalid
- Verify your bot token in the .env file - Ensure there are no extra spaces or characters

Database connection failed:

ERROR - Failed to connect to MongoDB
- Check if MongoDB is running: sudo systemctl status mongodb - Verify DATABASE_URL in your .env file

Port already in use:

ERROR - Port 8080 is already in use
- Change the PORT in your .env file - Or stop the process using port 8080

Permission denied for log channel:

ERROR - Bot doesn't have permission to post in 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:

ERROR - Video frontend not accessible
- Check your VIDEO_FRONTEND_URL configuration - Ensure the frontend URL is accessible - Set to false to disable video frontend

Getting Help

If you encounter issues:

  1. Check the troubleshooting section
  2. Review logs for error messages
  3. Join our community discussions
  4. Report bugs on GitHub Issues
  5. Contact developer on Telegram

Next Steps

Once installation is complete:

  1. Configure your bot with additional settings
  2. Follow the Quick Start guide for basic usage
  3. Review the User Guide for detailed features
  4. Explore Video Streaming capabilities