Skip to content

GroovyGab/lavalink-music-bot

Repository files navigation

Lavalink Music Bot

Slash Commands Live now!!

I made this bot because, well, groovy was taken down, so I made my own clone.

It's written in TypeScript and Discord.js V13, uses Lavalink for stable audio playback and erela.js as It's wrapper, it also uses the Sapphire Framework for Discord bots. (Note that this is a personal project, don't expect this code to be perfect and maybe it isn't a good idea to run it in a production environment)

Requirements

  1. Node.js 16.6.x
  2. Java version 13 or higher (For Lavalink).
  3. Lavalink (Get it from here)
  4. Spotify API Client ID, and Client Secret. (Get them from here)
  5. A Discord bot token

Self-hosting guide

This bot is pretty easy to set up, here's the guide:

  1. Clone this repo:
git clone https://github.com/iliveinsideyourwalls/lavalink-music-bot.git
  1. cd into de directory.
  2. Install dependencies:
npm install
  1. Change the name of the src/.env.example file to .env.

  2. Populate your .env file:

# Bot essentials
DISCORD_TOKEN=<Bot token>
OWNERS=<Your Discord ID>
PREFIX=<Some prefix>

# Default lavalink cradentials
LAVALINK_HOST=localhost
LAVALINK_PORT=2333
LAVALINK_PASSWD=youshallnotpass

# For spotify support
SPOTIFY_CLIENT_ID=<Your app-s client id>
SPOTIFY_CLIENT_SECRET=<Your app's client secret>

# You can put whatever in these
CLIENT_NAME=<Some name>
CLIENT_VERSION=<Some version>

# The default player's volume
DEFAULT_VOLUME=<Some value (I do not recommend more than 15)>
  1. Now you have to set-up a Lavalink node, Get lavalink from here.

  2. Make a folder called lavalink_server wherever you want (I recommend that you put it in the same folder as where you cloned the repo)

  3. Put the Lavalink executable in the folder you just made along with a application.yml file.

  4. Run lavalink (Note that you must run the command in the same folder as the application.yml file):

java -jar <path/to/lavalink>/Lavalink.jar
  1. Now build the bot:
npm run build
  1. Run the bot:
node dist/index.js

If you see something like this then the bot is ready to go, now all there's left is inviting your bot to your server.