Skip to content

Installation on a Linux server

Darren edited this page Oct 18, 2021 · 9 revisions

Prerequisites

Create a Discord Application

  • go to the Discord Developer portal
  • create a new application + bot
  • create a bot invitelink using it's client id here
  • save the bot token for later

get a Spotify Client ID + Secret

  • login here and create an application

Install nodejs + npm

follow those instructions

Installation

Configuration

  • run git clone https://github.com/SudhanPlayz/Discord-MusicBot.git
  • go into the folder with cd Discord-MusicBot
  • edit the botconfig.js with the tokens from earlier

lavalink

use

host: "lava.link",
port: 80,
pass: "youshallnotpass"

or host your own

Final steps

  • run npm install
  • start the bot with node index.js

Dashboard setup.

You can do this in 2 ways, with a custom domain or with your vps/server ip.

Dashboard with custom domain

With Nginx

Create a new file in /etc/nginx/sites-available

you can use whatever your favorite text editor, but I'll be using vim cause I'm used to it

Do vi /etc/nginx/sites-available/musicbot.conf Then enter this example config

server
{
    listen 80;
    listen [::]:80;
    listen 443 ssl http2;
    listen [::]:443 ssl http2;
    server_name example.com;
    index index.html index.htm default.htm default.html;
    
    #SSL-START SSL related configuration, Remove this if you don't have ssl
    #error_page 404/404.html;
    ssl_certificate    /www/server/panel/vhost/cert/discordmusicbot/fullchain.pem;
    ssl_certificate_key    /www/server/panel/vhost/cert/discordmusicbot/privkey.pem;
    ssl_protocols TLSv1.1 TLSv1.2 TLSv1.3;
    ssl_ciphers EECDH+CHACHA20:EECDH+CHACHA20-draft:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;
    ssl_prefer_server_ciphers on;
    ssl_session_cache shared:SSL:10m;
    ssl_session_timeout 10m;
    add_header Strict-Transport-Security "max-age=31536000";
    error_page 497  https://$host$request_uri;
    #SSL-END
    
    #ERROR-PAGE-START  Error page related configuration
    #error_page 404 /404.html;
    #error_page 502 /502.html;
    #ERROR-PAGE-END
    
    
    
    #Files or directories forbidden to access
    location ~ ^/(\.user.ini|\.htaccess|\.git|\.svn|\.project|LICENSE|README.md|package.json|package-lock.json|\.env|node_modules) {
        return 404;
    }
    
    #One-click application for SSL certificate verification directory related settings
    location ~ \.well-known {
        allow all;
    }

    # HTTP reverse proxy related settings begin >>>
    location ~ /purge(/.*) {
        proxy_cache_purge cache_one 127.0.0.1$request_uri$is_args$args;
    }

    location / {
        proxy_pass http://127.0.0.1:3000;
        proxy_set_header Host 127.0.0.1;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header REMOTE-HOST $remote_addr;
        add_header X-Cache $upstream_cache_status;

        proxy_connect_timeout 30s;
        proxy_read_timeout 86400s;
        proxy_send_timeout 30s;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
    }
    # End of HTTP reverse proxy related settings <<<
    # Example for logging
    #access_log  /www/wwwlogs/discordmusicbot.log;
    #error_log  /www/wwwlogs/discordmusicbot.error.log;
}

Replace example.com with your domain

[not done] With Apache

Dashboard with IP

  • open port 80, Then edit the botconfig.js and change the Port on line 5, change it to 80, Website line 18 to https://192.yourserverip.0.0

BangExample

  • Go to the Discord Developer Portal under the OAuth2 tab. Then put your server ip in this format http://yourip.yes.number.only/api/callback

Exampletm

Clone this wiki locally