Skip to content

A Discord music bot, supports YouTube, Spotify, SoundCloud, Deezer streams and web dashboard.

License

Notifications You must be signed in to change notification settings

hmes98318/Music-Disc

Repository files navigation

music_disc

Music Disc

GitHub package.json version GitHub

A discord music bot, supports YouTube, Spotify, SoundCloud, Deezer streams and web dashboard.
Developed based on discord.js v14, LavaShark, Lavalink.

Features

  • Stable
  • Use Lavalink
  • Web dashboard
  • Local node
  • Docker images

If you need the version of discord-player, please refer to this branch.

If you encounter any issues or would like to contribute to the community, please join our Discord server.

Deploying with node.js

Clone the latest version of the repository

git clone -b v2.1.3 https://github.com/hmes98318/Music-Disc.git

or click here to download

Install the dependencies

install all the dependencies from package.json

npm install

Add Lavalink node

Edit the nodelist.json file to add a Lavalink node.

Please refer to this documentation for detailed information.

[
    {
        "id": "Node 1",
        "hostname": "localhost",
        "port": 2333,
        "password": "youshallnotpass"
    }
]

Configure environment

Refer to .env.example and edit the .env fileEdit the file.

# Discord Bot Token
BOT_TOKEN = "your_token"

# Admin of the bot (User ID)
# OAUTH2 mode requires setting BOT_ADMIN, BOT_CLIENT_SECRET value
BOT_ADMIN = ""              
BOT_CLIENT_SECRET = ""

# Bot settings
BOT_NAME = "Music Disc"
BOT_PREFIX = "+"
BOT_STATUS = "online"
BOT_PLAYING = "+help | music"
BOT_EMBEDS_COLOR = "#FFFFFF"


# Volume settings
DEFAULT_VOLUME = 50
MAX_VOLUME = 100

# Auto leave channel settings
AUTO_LEAVE = true
AUTO_LEAVE_COOLDOWN = 5000

# Show voice channel updates
DISPLAY_VOICE_STATE = true


# Web dashboard settings
ENABLE_SITE = true
SITE_PORT = 33333
SITE_LOGIN_TYPE = "USER"   # "USER" | "OAUTH2"

# USER mode settings
SITE_USERNAME = "admin"
SITE_PASSWORD = "000"

# OAUTH2 mode settings
SITE_OAUTH2_LINK = ""   # Your OAuth2 authentication link
SITE_OAUTH2_REDIRECT_URI = "http://localhost:33333/login"   # Redirect link after OAuth2 authentication is complete


# Local Lavalink node
ENABLE_LOCAL_NODE = false
LOCAL_NODE_AUTO_RESTART = true
# LOCAL_NODE_DOWNLOAD_LINK = ""

Running the script

npm run start

Deploying with Docker

image link : https://hub.docker.com/r/hmes98318/music-disc

If you don't have any available nodes, you need to first start the server container using Docker Compose in the server directory.

Start with Docker Compose

Please put your token into the BOT_TOKEN variable.

version: '3.8'
services:
  music-disc:
    image: hmes98318/music-disc:latest
    container_name: music-disc
    restart: always
    environment:
      TZ: "Asia/Taipei"
      BOT_TOKEN: "your_token"

      # OAUTH2 mode requires setting BOT_ADMIN, BOT_CLIENT_SECRET value
      BOT_ADMIN: ""
      BOT_CLIENT_SECRET: ""

      BOT_NAME: "Music Disc"
      BOT_PREFIX: "+"
      BOT_PLAYING: "+help | music"
      BOT_EMBEDS_COLOR: "#FFFFFF"
      DEFAULT_VOLUME: 50
      MAX_VOLUME: 100
      AUTO_LEAVE: "true"
      AUTO_LEAVE_COOLDOWN: 5000
      DISPLAY_VOICE_STATE: "true"

      # Web dashboard settings
      ENABLE_SITE: true
      SITE_PORT: 33333
      SITE_LOGIN_TYPE: "USER"   # "OAUTH2" | "USER"
      # USER mode settings
      SITE_USERNAME: "admin"
      SITE_PASSWORD: "password"
      # OAUTH2 mode settings
      SITE_OAUTH2_LINK: ""      # Your OAuth2 authentication link
      SITE_OAUTH2_REDIRECT_URI: "http://localhost:33333/login"   # Redirect link after OAuth2 authentication is complete

      # Local Lavalink node
      ENABLE_LOCAL_NODE: false
      LOCAL_NODE_AUTO_RESTART: true
    volumes:
      - ./server:/bot/server    # localnode configuration file
      - ./nodelist.json:/bot/nodelist.json
      - ./blacklist.json:/bot/blacklist.json
    ports:
      - 33333:33333

Start the container

docker compose up -d

Start with Docker

Use the following command to start the container:
Please put your token into the BOT_TOKEN variable.

docker run -d \
  --name music-disc \
  --restart always \
  -e TZ="Asia/Taipei" \
  -e BOT_TOKEN="your_token" \
  -e BOT_ADMIN="" \
  -e BOT_CLIENT_SECRET="" \
  -e BOT_NAME="Music Disc" \
  -e BOT_PREFIX="+" \
  -e BOT_PLAYING="+help | music" \
  -e BOT_EMBEDS_COLOR="#FFFFFF" \
  -e DEFAULT_VOLUME=50 \
  -e MAX_VOLUME=100 \
  -e AUTO_LEAVE="true" \
  -e AUTO_LEAVE_COOLDOWN=5000 \
  -e DISPLAY_VOICE_STATE="true" \
  -e ENABLE_SITE=true \
  -e SITE_PORT=33333 \
  -e SITE_LOGIN_TYPE="USER" \
  -e SITE_USERNAME="admin" \
  -e SITE_PASSWORD="password" \
  -e SITE_OAUTH2_LINK="" \
  -e SITE_OAUTH2_REDIRECT_URI="http://localhost:33333/login" \
  -e ENABLE_LOCAL_NODE=false \
  -e LOCAL_NODE_AUTO_RESTART=true \
  -v $(pwd)/server:/bot/server \
  -v $(pwd)/nodelist.json:/bot/nodelist.json \
  -v $(pwd)/blacklist.json:/bot/blacklist.json \
  -p 33333:33333 \
  hmes98318/music-disc:latest