Skip to content

Commit 9fd90bb

Browse files
committed
Refactor/Rewrite the bot (#79)
Refactor/Rewrite the bot
2 parents 4c4f9bf + 8ee36e8 commit 9fd90bb

49 files changed

Lines changed: 4885 additions & 2050 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 69 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,31 @@
11
<div align="center">
22

3-
# StreamBot
4-
5-
[![Ceasefire Now](https://badge.techforpalestine.org/default)](https://techforpalestine.org/learn-more)
3+
<img src="assets/logo.svg" alt="StreamBot Logo" width="400" height="120"/>
64

7-
A powerful Discord selfbot for streaming videos and live content to Discord voice channels.
5+
# StreamBot
86

97
![GitHub release](https://img.shields.io/github/v/release/ysdragon/StreamBot)
108
[![CodeFactor](https://www.codefactor.io/repository/github/ysdragon/streambot/badge)](https://www.codefactor.io/repository/github/ysdragon/streambot)
119

10+
[![Ceasefire Now](https://badge.techforpalestine.org/default)](https://techforpalestine.org/learn-more)
11+
1212
</div>
1313

1414
## ✨ Features
1515

16-
- 📁 Stream videos from a local folder
17-
- 🎬 Stream and search YouTube videos by title
18-
- 🔗 Stream YouTube videos/live streams by link
19-
- 🌐 Stream from arbitrary links (video files, live streams, Twitch, etc.)
20-
- ⚡ Playback controls: play, stop
21-
- 📋 Video library management
16+
- 📁 **Local Video Streaming**: Stream videos from your local videos folder
17+
- 🎬 **YouTube Integration**: Stream YouTube videos
18+
- 🔗 **YouTube Live Streams**: Direct streaming support for YouTube live content
19+
- 🌐 **Twitch Support**: Stream Twitch live streams and video-on-demand (VODs)
20+
- 🔗 **Direct URL Streaming**: Stream from arbitrary video file URLs and live streams
21+
- 🎵 **Queue System**: Queue multiple videos with auto-play and skip functionality
22+
- 🌐 **Web Management Interface**: Full-featured web dashboard for video library management
23+
- 📤 **Video Upload**: Upload videos through the web interface
2224

2325
## 📋 Requirements
24-
- [Bun](https://bun.sh/) `v1.1.39+`
26+
- [Bun](https://bun.sh/) `v1.1.39+` (recommended) or [Node.js](https://nodejs.org/) `v16+`
2527
- [FFmpeg](https://www.ffmpeg.org/) _(in PATH or working directory)_
28+
- [yt-dlp](https://github.com/yt-dlp/yt-dlp) _(automatically downloaded/updated by the bot)_
2629

2730
## 🚀 Installation
2831

@@ -44,17 +47,31 @@ bun install
4447

4548
## 🎮 Usage
4649

47-
Start with Bun:
50+
### Starting the Bot
51+
52+
**With Bun (recommended):**
4853
```bash
4954
bun run start
5055
```
5156

52-
Start with Node.js:
57+
**With Node.js:**
5358
```bash
5459
bun run build
5560
bun run start:node
5661
```
5762

63+
> **Note:** All videos are played through a queue system. Use the `play` command to add videos to the queue, and they will be played sequentially with automatic advancement to the next video.
64+
65+
### Video Sources
66+
67+
StreamBot supports multiple video sources:
68+
69+
- **Local Videos**: Store videos in your `VIDEOS_DIR` folder and use `play <filename>`
70+
- **Smart Play**: Use `play <input>` for automatic detection and streaming (local file, URL, YouTube video, or Twitch stream)
71+
- **YouTube Search**: Use `ytsearch <query>` to search YouTube and display results (use `play` with search results to stream)
72+
- **Live Streams**: Full support for YouTube Live streams and Twitch live content
73+
- **Video Queue**: All playback goes through a queue system - videos are added to queue and played sequentially
74+
5875
## 🐳 Docker Setup
5976

6077
### Standard Setup
@@ -81,7 +98,9 @@ docker compose up -d
8198
wget https://raw.githubusercontent.com/ysdragon/StreamBot/main/docker-compose-warp.yml
8299
```
83100

84-
2. Configure `docker-compose-warp.yml` and add your WARP license key
101+
2. Configure `docker-compose-warp.yml`:
102+
- Add your WARP license key
103+
- Update TOKEN, etc
85104

86105
3. Launch with WARP:
87106
```bash
@@ -93,22 +112,22 @@ docker compose -f docker-compose-warp.yml up -d
93112

94113
## 🎯 Commands
95114

96-
| Command | Description |
97-
|---------|-------------|
98-
| `play <video>` | Play local video |
99-
| `playlink <url>` | Stream from URL/YouTube/Twitch |
100-
| `ytplay <query>` | Play YouTube video |
101-
| `ytsearch <query>` | Search YouTube |
102-
| `stop` | Stop playback |
103-
| `list` | Show video library |
104-
| `refresh` | Update video list |
105-
| `status` | Show playback status |
106-
| `preview <video>` | Generate thumbnails |
107-
| `help` | Show help |
115+
| Command | Description | Aliases |
116+
|---------|-------------|---------|
117+
| `play <input>` | Smart play: local video, URL, or YouTube search | |
118+
| `ytsearch <query>` | Search YouTube and display results | |
119+
| `stop` | Stop current playback | |
120+
| `skip` | Skip to next video in queue | `next` |
121+
| `queue` | Display current video queue | |
122+
| `list` | Show local video library | |
123+
| `status` | Show playback status | |
124+
| `preview <video>` | Generate video thumbnails | |
125+
| `ping` | Check bot latency | |
126+
| `help` | Show available commands | |
108127

109128
## Configuration
110129

111-
Configuration is done via `.env`:
130+
Configuration is done via `.env` file:
112131

113132
```bash
114133
# Selfbot options
@@ -123,46 +142,45 @@ VIDEOS_DIR = "./videos" # The local path where you store video files
123142
PREVIEW_CACHE_DIR = "./tmp/preview-cache" # The local path where your self-bot will cache video preview thumbnails
124143

125144
# Stream options
126-
STREAM_RESPECT_VIDEO_PARAMS = "false" # This option is used to respect video parameters such as width, height, fps, bitrate, and max bitrate.
145+
STREAM_RESPECT_VIDEO_PARAMS = "false" # Respect original video parameters (width, height, fps, bitrate)
127146
STREAM_WIDTH = "1280" # The width of the video stream in pixels
128147
STREAM_HEIGHT = "720" # The height of the video stream in pixels
129148
STREAM_FPS = "30" # The frames per second (FPS) of the video stream
130-
STREAM_BITRATE_KBPS = "2000" # The bitrate of the video stream in kilobits per second (Kbps)
149+
STREAM_BITRATE_KBPS = "1000" # The bitrate of the video stream in kilobits per second (Kbps)
131150
STREAM_MAX_BITRATE_KBPS = "2500" # The maximum bitrate of the video stream in kilobits per second (Kbps)
132-
STREAM_HARDWARE_ACCELERATION = "false" # Whether to use hardware acceleration for video decoding, set to "true" to enable, "false" to disable
133-
STREAM_VIDEO_CODEC = "H264" # The video codec to use for the stream, can be "H264" or "H265" or "VP8"
134-
135-
# STREAM_H26X_PRESET: Determines the encoding preset for H26x video streams.
136-
# If the STREAM_H26X_PRESET environment variable is set, it parses the value
137-
# using the parsePreset function. If not set, it defaults to 'ultrafast' for
138-
# optimal encoding speed. This preset is only applicable when the codec is
139-
# H26x; otherwise, it should be disabled or ignored.
140-
# Available presets: "ultrafast", "superfast", "veryfast", "faster",
141-
# "fast", "medium", "slow", "slower", "veryslow".
151+
STREAM_HARDWARE_ACCELERATION = "false" # Enable hardware acceleration for video decoding
152+
STREAM_VIDEO_CODEC = "H264" # Video codec: VP8, H264, H265, VP9, or AV1
153+
154+
# H.26x encoding preset for optimal quality/speed balance
155+
# Available presets: ultrafast, superfast, veryfast, faster, fast, medium, slow, slower, veryslow
142156
STREAM_H26X_PRESET = "ultrafast"
143157

144158
# Videos server options
145-
SERVER_ENABLED = "false" # Whether to enable the built-in video server
146-
SERVER_USERNAME = "admin" # The username for the video server's admin interface
147-
SERVER_PASSWORD = "admin" # The password for the video server's admin interface
148-
SERVER_PORT = "8080" # The port number the video server will listen on
159+
SERVER_ENABLED = "false" # Enable the built-in web server for video management
160+
SERVER_USERNAME = "admin" # Username for the web interface
161+
SERVER_PASSWORD = "admin" # Password for the web interface (bcrypt hash is supported)
162+
SERVER_PORT = "8080" # Port number for the web server
149163
```
150164

151165
## Get Token ?
152166
Check the [Get token wiki](https://github.com/ysdragon/StreamBot/wiki/Get-Discord-user-token)
153167

154-
## Server
168+
## 🌐 Web Interface
155169

156-
An optional basic HTTP server can be enabled to manage the video library:
170+
When enabled by setting `SERVER_ENABLED=true` in your `.env` file, StreamBot provides a user-friendly web-based management interface for seamless video library control.
157171

158-
- List videos
159-
- Upload videos
160-
- Delete videos
161-
- Generate video preview thumbnails
172+
**Features:**
173+
- 📋 **Video Library Management**: Browse, search, and organize your video collection
174+
- 📤 **Video Upload**: Upload new videos directly through the web interface
175+
- 🖼️ **Thumbnail Generation**: Automatic preview generation for all videos in the library
162176

163-
## Todo
177+
**Access:** Available at `http://localhost:SERVER_PORT` when enabled
164178

165-
- [x] Adding ytsearch and ytplay commands
179+
**Setup:**
180+
1. Set `SERVER_ENABLED=true` in your `.env` file
181+
2. Configure `SERVER_USERNAME`, `SERVER_PASSWORD`, and `SERVER_PORT`
182+
3. Restart the bot to apply changes
183+
4. Access the web interface in your browser at the configured port
166184

167185
## 🤝 Contributing
168186
Contributions are welcome! Feel free to:

assets/logo.svg

Lines changed: 6 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)