Elite Music is a feature-packed Discord Music Bot built on top of discord.js & using the latest discord-player package.
Loving this open-source project? Leaving a β on the repository would be much appreciated! β€οΈ
- Wide range of commands.
- Easy to setup, customise and edit.
- Slash commands (djs v14).
- Support for various streaming platforms.
- Wide range of audio filters.
- Docker Support.
- Awesome playback UI.
- Additional features including plex media server support.
- And much more!
Elite Music was originally a part of my verified Discord bot... Elite Bot, but the music section had to be removed due to verification issues. Therefore, in a win situation, I decided to open-source the bot's music code in this repository. And even better, I decided to rewrite the entire bot to improve the code's feature set and overall quality.
In order for the bot to function correctly, there are a few prerequisites that you must have on your system.
-
NodeJS - For the bot to function, it must be running in a NodeJS environment running on v16.9.0 or higher. It is highly recommended that you download the LTS build which is available for your OS to remain on the latest stable version. Head over to the NodeJS Download website to download and install an appropriate version.
-
FFmpeg or Avconv - You will require either of these for transcoding. It is recommended to use FFmpeg. By default, the bot comes with the
ffmpeg-static
binaries as a dependency which allows the bot to work out of the box. Alternatively, you may decide to set your own ffmpeg binaries. In this case, head over to the FFmpeg Download website, select your OS and download the appropriate package. You can then placeFFMPEG_PATH
as a new option into your.ENV
file stating the custom path to your custom FFmpeg binaries. -
Discord Bot Account - You must register a bot on the Discord Developer site to access a token to run the bot. Head over to the Developer website and click on
New Application
button. Provide a name and pressCreate
. Next on the left-hand menu, select theBot
section and pressAdd Bot
alongside the confirmation. Finally, pressReset Token
and finally copy the token and keep it safe. This is what you will have to place into your.ENV
file for the bot to function.
The first step is to clone the repository or download it manually as a folder to host it directly. The Git option is recommended for more advanced users and for users who already have it installed.
Head over to the download page and download the .zip source code. Next, using a tool such as 7-Zip, extract the files from the .zip folder. You can now move on to the following steps.
An alternative way to download the repository is through the usage of Git. If you do not have Git installed, please use the basic download method. Git users can run the command git clone https://github.com/ThatGuyJacobee/Elite-Bot-Music/tree/main
to automatically clone the repository to a new folder.
Now that you have downloaded the repository, you can continue with the following steps.
- Open a new command/shell/terminal window within your new folder. You should be able to right-click and open the Windows terminal/command prompt if on Windows.
- Run the command
npm install
to download all of the module dependencies. - Rename the file
.env.example
to simply.env
. Once down, edit the.env
file with the configuration options that you would like! - Finally, run your bot using
node .
within a command/shell/terminal window. The bot should now become online and provide a success message if everything was configured correctly. π
Tip
To help with development, you can use the npm run dev
within your IDE to active nodemon. This will automatically restart the bot each time that a file is saved with new changes, making it easy to work with!
Of course, you need to add your bot to your server now in order to use it. Follow this useful guide from the discord.js Guide which explains how to do this with great detail if you need help understanding how to do this.
Elite Music now has the ability to use a YouTube token from a Google Account to significantly improve the reliability of the YouTube extractor. This is fully optional, as the bot can continue running in scraping mode otherwise.
Typically the YouTube extractor scrapes data anonymously from YouTube thus the chance of your requests being blocked has become increased more recently as YouTube continues to crack down on bot requests. With a token, the bot can instead access the YouTube account and access music data whilst logged in, which significantly reduces the chances of being blocked by YouTube.
Tip
This is especially recommended if you are facing YouTube search and playback issues frequently with your bot, due to YouTube blocking your anonymous requests.
- Run the command
npx --no discord-player-youtubei
in your prompt. - Follow the instructions that are printed to your console. Mainly, access the provided link, input the code and login with a Google Account.
Important
It is highly recommended to use a random throwaway/alternative Google Account for this. Using your main account might put you at risk of a suspension or ban, better to be safe than sorry!
- Once you completed the Google Account flow, a cookie string will be printed to your console.
- Copy the full string from start to finish. Paste this into the
YT_CREDENTIALS
field within your.env
file. - Save the file and restart the bot.
Elite Music now has Docker image and Docker Compose support, allowing you to simply install and use the bot through Docker.
You can access the Docker Image via Docker Hub which provides the image and the instructions within the description. The instructions to either install via Docker Run or Docker Compose are also provided below. Once you have installed and configured your bot, you will need to add your bot to your server now in order to use it. Follow this useful guide from the discord.js Guide which explains how to do this with great detail if you need help understanding how to do this.
You should use the following command to download the image and run it:
docker run -d \
--name=elite-music \
--env-file /path/to/.env \
--restart unless-stopped \
thatguyjacobee/elitemusic:latest
Note: The --env-file
path is relative to the directory you are running your docker run command from.
See the .env.sample file on the GitHub repository to view and copy over all of the environmental options into your target .env file for the bot.
Use the following for your docker-compose.yml
file:
version: '3'
services:
elitemusic:
container_name: 'elite-music'
image: 'thatguyjacobee/elitemusic:latest'
env_file:
- /path/to/.env
restart: unless-stopped
Once again, see the .env.sample file on the GitHub repository to view and copy over all of the environmental options into your target .env file for the bot.
You may decide to want to enable additional optional features for your bot. Follow the appropriate sub-heading to learn how to set up and enable the selected feature!
If you are missing the relevant option in your environmental (.env
) file, make sure to check the latest .env.sample
file to ensure you are on the latest version.
Once you have followed the appropriate steps for the optional feature that you want to enable, you should start the bot and ensure that the configuration option returns as true
when the configuration loads. If the feature still shows as disabled, this suggests that you have a configuration error. Follow the error logs that are provided in your console to resolve this. If you are still having trouble with your issue, feel free to create an issue on the repository or join the Support Discord server.
The Plex optional feature when enabled, allows you to stream music directly from your Plex Media Server through the /plex command. In order to enable the Plex feature, you must go into your .env
file and set up the configuration to your own Plex Media Server.
- Firstly, set
ENABLE_PLEX
totrue
. - Next, you must provide a direct URL to your Plex Media Center. The default port that Plex Media Server runs on is
32400
. You can test that yourPLEX_SERVER
URL is correct, by pasting it into any web browser, and it should load successfully with a login page. - Finally, you must place your plex authentication token into the
PLEX_AUTHTOKEN
field. You can do this by browsing the XML file for a library item. Please follow the official Plex Support article to access your token. Once you have access to it, place it into your .env file.
Elite Music comes with a DJ Mode optional feature, which locks down the use of commands and interactions to members who have the specified DJ Role.
- Firstly, set
ENABLE_DJMODE
totrue
. - Now create a role on your server which you wish to be used as the DJ Role. Copy the ID of the role and place it into the
DJ_ROLE
field.
Need help setting up the bot or experiencing some trouble? Feel free to head over to the Support Discord server and let me know!
Found a bug or issue with the latest build? Feel free to open an issue on this repository! I will respond as soon as possible.
Looking for a multi-purpose Discord Bot for your server? Look no further, check out Elite Bot to fulfil all of your server needs including moderation, logging, external server status and much more!
Check the bot out via the dedicated documentation website or top.gg today! π