ysdragon / StreamBot

A self bot to stream videos to Discord.
Other
76 stars 16 forks source link
discord discord-bot discord-js discordjs discordvideo nodejs selfbot selfbot-for-discord streambot streaming video youtube-api

StreamBot

This is a Discord selfbot that allows streaming videos, and streams from YouTube and direct links to a Discord voice channel.

🧐Features

Requirements

node.js (version 16.9.0 or later)
ffmpeg (must be added to path or installed to working directory)

🛠️ Installation Steps:

This project is hosted on github.

  1. You can clone this project directly using this command:
git clone https://github.com/ysdragon/StreamBot
  1. Use bun to install all the dependencies:

    bun install 
  2. Build the artifacts from source:

    bun run build
  3. Rename .env.example to .env

Usage

Start the built artifacts:

bun run start

Start with Docker Compose

If you want to use Docker Compose, follow these steps:

  1. Create a new folder.
  2. Run the following command to download the docker-compose.yml file:
    wget https://raw.githubusercontent.com/ysdragon/StreamBot/main/docker-compose.yml
  3. Edit the docker-compose.yml file and update the necessary information (e.g., TOKEN, PREFIX, GUILD_ID, etc.).
  4. Run the following command to start the Docker Compose setup:
    docker compose up -d

🛠️ Commands

play <video name> - Play a video from the local folder.
playlink <url> - Play a (YouTube video/live stream, direct link).
ytplay <query> - Play a YouTube video from a title query.
ytsearch <query> - Search for a YouTube video using a title query.
stop - Stop the current playback.
pause - Pause the current playback.
resume - Resume playback.
list - List available videos.
refresh - Refresh the video list.
status - Get current playback status.
preview <video name> - Generate and obtain preview thumbnails of a specific video.
help - Show help message.

🛠️ Configuration

Configuration is done via .env:

# Selfbot options
TOKEN = "" # Your Discord self-bot token
PREFIX = "$" # The prefix used to trigger your self-bot commands
GUILD_ID = "" # The ID of the Discord server your self-bot will be running on
COMMAND_CHANNEL_ID = "" # The ID of the Discord channel where your self-bot will respond to commands
VIDEO_CHANNEL_ID = "" # The ID of the Discord voice/video channel where your self-bot will stream videos
VIDEOS_FOLDER = "./videos" # The local path where you store video files
PREVIEW_CACHE = "./tmp/preview-cache" # The local path where your self-bot will cache video preview thumbnails
VIDEO_CACHE = "./tmp/video-cache" # The local path where your self-bot will cache youtube videos

# Stream options
STREAM_WIDTH = "1280" # The width of the video stream in pixels
STREAM_HEIGHT = "720" # The height of the video stream in pixels
STREAM_FPS = "30" # The frames per second (FPS) of the video stream
STREAM_BITRATE_KBPS = "1000" # The bitrate of the video stream in kilobits per second (Kbps)
STREAM_MAX_BITRATE_KBPS = "2500" # The maximum bitrate of the video stream in kilobits per second (Kbps)
STREAM_HARDWARE_ACCELERATION = "false" # Whether to use hardware acceleration for video decoding, set to "true" to enable, "false" to disable
STREAM_VIDEO_CODEC = "H264" # The video codec to use for the stream, can be "H264" or "H265" or "VP8"

# Videos server options
SERVER_ENABLED = "false" # Whether to enable the built-in video server
SERVER_USERNAME = "admin" # The username for the video server's admin interface
SERVER_PASSWORD = "admin" # The password for the video server's admin interface
SERVER_PORT = "8080" # The port number the video server will listen on

Get Token ?

Check the Get token wiki

Server

An optional basic HTTP server can be enabled to manage the video library:

Protected by HTTP basic auth.

Todo

Contributing

Public contributions are welcome!
You can create a new issue for bugs, or feel free to open a pull request for any and all your changes or work-in-progress features.

Legal

This bot may violate Discord's Terms of Service. Use at your own risk.

إبراء الذمة

أتبرأ من أي استخدام غير أخلاقي لهذا المشروع أمام الله.

License

This project is licensed under the MIT License. See the LICENSE file for details.