A powerful Discord self-bot for streaming videos from multiple sources with a web management interface
- โจ Features
- ๐ Requirements
- ๐ Installation
- ๐ฎ Usage
- ๐ณ Docker Setup
- ๐ฏ Commands
- โ๏ธ Configuration
- ๐ Web Interface
- ๐ค Contributing
โ ๏ธ Legal- ๐ License
- ๐ Local Video Streaming: Stream videos from your local videos folder
- ๐ฌ YouTube Integration: Stream YouTube videos with smart search functionality
- ๐ YouTube Live Streams: Direct streaming support for YouTube live content
- ๐ Twitch Support: Stream Twitch live streams and video-on-demand (VODs)
- ๐ Direct URL Streaming: Stream from any URL supported by yt-dlp (thousands of video sites including Vimeo, Dailymotion, Facebook, Instagram, news sites, and more)
- ๐ต Queue System: Queue multiple videos with auto-play and skip functionality
- ๐ Web Management Interface: Full-featured web dashboard for video library management
- ๐ค Video Upload: Upload videos through the web interface or download from remote URLs
- ๐ผ๏ธ Video Previews: Generate and view thumbnail previews for all videos
- โ๏ธ Runtime Configuration: Adjust streaming parameters and bot settings during runtime
- GPU with hardware acceleration (optional, for improved streaming performance)
- High-speed internet (for remote video streaming and downloads)
- Sufficient disk space (for video storage and cache)
This project is hosted on GitHub.
- Bun
v1.1.39+(recommended) or Node.jsv21+ - FFmpeg (automatically installed by the bot if missing)
- yt-dlp (automatically downloaded and updated by the bot)
- Clone the repository:
git clone https://github.com/ysdragon/StreamBot
cd StreamBot- Install dependencies:
bun install-
Configure environment:
- Copy
.env.exampleto.env - Update the configuration values in
.env(see Configuration section below)
- Copy
-
Setup complete!
- The bot will automatically download and update yt-dlp on first run
- Required directories for videos and cache will be created automatically
With Bun (recommended):
bun run startWith Node.js:
bun run build
bun run start:nodeWith web interface:
bun run server # Start only the web interfaceQueue System: All videos are played through an intelligent queue system that automatically advances to the next video when the current one ends.
Smart Detection: The play command automatically detects the type of input:
- Local files (in your
VIDEOS_DIR) - YouTube videos (by URL or search)
- Twitch streams (live or VOD)
- Any URL supported by yt-dlp
YouTube Search: Use ytsearch to find videos, then play with the search results to stream them.
Local Library: Use list to browse your local video collection with file information.
StreamBot supports multiple video sources:
- Local Videos: Store videos in your
VIDEOS_DIRfolder and useplay <filename> - Smart Play: Use
play <input>for automatic detection and streaming (local file, YouTube video, Twitch stream, or any URL supported by yt-dlp) - YouTube Search: Use
ytsearch <query>to search YouTube and display results (useplaywith search results to stream) - Live Streams: Full support for YouTube Live streams and Twitch live content
- Video Queue: All playback goes through a queue system - videos are added to queue and played sequentially
StreamBot provides ready-to-use Docker configurations for easy deployment.
- Create project directory:
mkdir streambot && cd streambot- Download Docker Compose configuration:
wget https://raw.githubusercontent.com/ysdragon/StreamBot/main/docker-compose.yml-
Configure environment:
- Edit
docker-compose.ymlto set your environment variables - Ensure video storage directories are properly mounted
- Edit
-
Launch StreamBot:
docker compose up -dFor enhanced network capabilities with Cloudflare WARP:
- Download WARP configuration:
wget https://raw.githubusercontent.com/ysdragon/StreamBot/main/docker-compose-warp.yml-
Configure WARP settings:
- Add your WARP license key to
docker-compose-warp.yml - Update Discord token and other required environment variables
- Add your WARP license key to
-
Launch with WARP:
docker compose -f docker-compose-warp.yml up -d
โ ๏ธ Note: The web interface will not work when using WARP configuration.
| Command | Description | Aliases |
|---|---|---|
play <video_name|url|search_query> |
Play local video, URL, or search YouTube videos | |
ytsearch <query> |
Search for videos on YouTube | |
stop |
Stop current video playback and clear queue | leave, s |
skip |
Skip the currently playing video | next |
queue |
Display the current video queue | |
list |
Show available local videos |
| Command | Description | Aliases |
|---|---|---|
status |
Show current streaming status | |
preview <video_name> |
Generate preview thumbnails for a video | |
ping |
Check bot latency | |
help |
Show available commands |
| Command | Description | Aliases |
|---|---|---|
config [parameter] [value] |
View or adjust bot configuration parameters (Admin only) | cfg, set |
StreamBot is configured through environment variables in a .env file. Copy .env.example to .env and modify the values as needed.
# Required: Your Discord self-bot token (see wiki for setup instructions)
TOKEN = "YOUR_BOT_TOKEN_HERE"
# Command prefix for bot commands
PREFIX = "$"
# Discord server where the bot will operate
GUILD_ID = "YOUR_SERVER_ID"
# Channel where bot will respond to commands
COMMAND_CHANNEL_ID = "COMMAND_CHANNEL_ID"
# Voice/video channel where bot will stream
VIDEO_CHANNEL_ID = "VIDEO_CHANNEL_ID"
# Admin user IDs (comma-separated or JSON array)
ADMIN_IDS = ["YOUR_USER_ID_HERE"]# Directory where video files are stored
VIDEOS_DIR = "./videos"
# Directory for caching video preview thumbnails
PREVIEW_CACHE_DIR = "./tmp/preview-cache"# Path to browser cookies for accessing private/premium content
# Supports: YouTube Premium, age-restricted content, private videos
YTDLP_COOKIES_PATH = ""# Video Quality Settings
STREAM_RESPECT_VIDEO_PARAMS = "false" # Use original video parameters if true
STREAM_WIDTH = "1280" # Output resolution width
STREAM_HEIGHT = "720" # Output resolution height
STREAM_FPS = "30" # Target frame rate
# Bitrate Settings (affects quality and bandwidth usage)
STREAM_BITRATE_KBPS = "2000" # Target bitrate (higher = better quality)
STREAM_MAX_BITRATE_KBPS = "2500" # Maximum allowed bitrate
# Performance & Encoding
STREAM_HARDWARE_ACCELERATION = "false" # Use GPU acceleration if available
STREAM_VIDEO_CODEC = "H264" # Codec: H264, H265, VP8, VP9, AV1
# H.264/H.265 Encoding Preset (quality vs speed tradeoff)
# Options: ultrafast, superfast, veryfast, faster, fast, medium, slow, slower, veryslow
STREAM_H26X_PRESET = "ultrafast"# Enable/disable the web management interface
SERVER_ENABLED = "false"
# Web interface authentication
SERVER_USERNAME = "admin"
SERVER_PASSWORD = "admin" # Plain text, bcrypt, or argon2 hash
# Web server port
SERVER_PORT = "8080"To access private, or premium content (like YouTube Premium videos), you can provide a cookies file to yt-dlp:
-
Export cookies from your browser using a browser extension like:
- Get cookies.txt LOCALLY (Chromium based browsers)
- cookies.txt (Firefox based browsers)
-
Save the cookies file (usually named
cookies.txt) to a location accessible by the bot -
Configure the path in one of two ways:
- Set
YTDLP_COOKIES_PATHin your.envfile:YTDLP_COOKIES_PATH = "./cookies.txt" - Or use the config command while the bot is running:
$config ytdlpCookiesPath ./cookies.txt
- Set
-
Restart the bot if you updated the
.envfile
The cookies will be automatically used for all yt-dlp operations, allowing access to restricted content.
Check the Get token wiki
When enabled by setting SERVER_ENABLED=true in your .env file, StreamBot provides a comprehensive web-based management interface for seamless video library control.
- ๐ Video Library Management: Browse your video collection with file sizes and detailed information
- ๐ค Local File Upload: Upload videos directly through the web interface with progress tracking
- ๐ Remote URL Download: Download videos from remote URLs directly to your library with progress tracking
- ๐ผ๏ธ Video Previews: Generate and view 5 thumbnail screenshots from different parts of each video
- ๐๏ธ File Management: Delete videos from your library through the web interface
- ๐ Video Metadata: View detailed information about video files (duration, resolution, codec, etc.)
-
Enable the web server:
SERVER_ENABLED=true
-
Configure authentication:
SERVER_USERNAME=your_username SERVER_PASSWORD=your_password # Plain text, bcrypt hash, or argon2 hash SERVER_PORT=8080 -
Restart the bot to apply changes
-
Access the interface at
http://localhost:SERVER_PORT
- Dashboard: Overview of all videos in your library with file sizes
- Upload: Choose local files or provide remote URLs for download
- Preview: Click on any video to generate and view thumbnail previews
- Delete: Remove unwanted videos from your library
Contributions are welcome! Feel free to:
- ๐ Report bugs via issues
- ๐ง Submit pull requests
- ๐ก Suggest new features
This bot may violate Discord's ToS. Use at your own risk.
I disavow before Allah any unethical use of this project.
ุฅุจุฑุงุก ุงูุฐู ุฉ: ุฃุชุจุฑุฃ ู ู ุฃู ุงุณุชุฎุฏุงู ุบูุฑ ุฃุฎูุงูู ููุฐุง ุงูู ุดุฑูุน ุฃู ุงู ุงููู.
Licensed under MIT License. See LICENSE for details.