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.
- Integrated Plex, Jellyfin & Subsonic API support.
- Docker Support.
- Full translation support for 30+ languages.
- Wide range of audio filters.
- Awesome playback UI.
- 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.
-
Node.js - The bot requires the Node.js environment running on v20 or newer. It is highly recommended to use the v22 LTS build for long-term stable support. 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-staticbinaries 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_PATHas a new option into your.ENVfile 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 Applicationbutton. Provide a name and pressCreate. Next on the left-hand menu, select theBotsection and pressAdd Botalongside the confirmation. Finally, pressReset Tokenand finally copy the token and keep it safe. This is what you will have to place into your.ENVfile 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 installto download all of the module dependencies. - Rename the file
.env.exampleto simply.env. Once down, edit the.envfile 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-youtubeiin 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_CREDENTIALSfield within your.envfile. - 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-stoppedOnce 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 environment variable PLAYBACK_SOURCE_ORDER allows you to control which audio sources are used by the /play and /playnext commands. After extracting the requested song information, each configured source is checked from left to right until a confident match is found. /search uses the same order, but lists confident matches from every configured source instead of stopping at the first hit.
PLAYBACK_SOURCE_ORDER='plex,subsonic,jellyfin,default'The available sources are plex, subsonic, jellyfin, and default. The default source uses the normal discord-player playback methods which is mainly YouTube or direct URL streaming where applicable.
You can remove or reorder these sources depending on your setup. For example, use PLAYBACK_SOURCE_ORDER='subsonic' to only play matched Subsonic tracks, or PLAYBACK_SOURCE_ORDER='default' to retain the original playback behaviour. Any optional addon that is not enabled will be skipped automatically.
If the option is missing, empty, or contains no valid sources, it defaults to default.
The Plex Media Server optional feature allows you to stream music directly from your Plex library through the /plex command or as an enabled /play source. In order to enable the Plex feature, you must go into your .env file and set up the configuration for your server.
- Firstly, set
ENABLE_PLEXtotrue. - Next, provide the base URL of your Plex Media Server in
PLEX_SERVER. The default port that Plex Media Server runs on is32400(e.g.http://[your_ipaddress]:32400). You can verify that the URL is correct by opening it in a web browser; you should see your server's login page load successfully. The bot must be able to reach this address from the machine or container it runs on. - Set
PLEX_AUTHTOKENto your Plex authentication token. You can obtain this by browsing the XML file for a library item. Please follow the official Plex Support article for step-by-step instructions. Once you have your token, place it into your.envfile.
Once configured and restarted, the bot will validate the connection on startup and return a configuration loaded message. As long as everything is valid and the feature remains active, you will be able to utilise all of the /plex commands.
The Subsonic API optional feature allows you to stream music directly from your Subsonic-compatible media server through the /subsonic command or as an enabled /play source. This works with any server that implements the Subsonic REST API, such as Navidrome, Airsonic-Advanced, Gonic or others. In order to enable the Subsonic feature, you must go into your .env file and set up the configuration for your server.
- Firstly, set
ENABLE_SUBSONICtotrue. - Next, provide the base URL of your Subsonic server in
SUBSONIC_SERVER. The default port for many Subsonic-compatible servers is4533(e.g.http://[your_ipaddress]:4533). You can verify that the URL is correct by opening it in a web browser; you should see your server's login or home page load successfully. The bot must be able to reach this address from the machine or container it runs on. - Set
SUBSONIC_USERandSUBSONIC_PASSto a valid account on your server. Elite Music authenticates using the standard Subsonic token scheme, so use the same username and password you would use in a Subsonic client app. - Optionally, set
SUBSONIC_APP_NAMEto identify this bot to your server (defaults toElite-Music-Botif left unchanged).
Once configured and restarted, the bot will validate the connection on startup and return a configuration loaded message. As long as everything is valid and the feature remains active, you will be able to utilise all of the /subsonic commands.
The Jellyfin Media Server optional feature allows you to stream music directly from your Jellyfin library through the /jellyfin command or as an enabled /play source. In order to enable the Jellyfin feature, you must go into your .env file and set up the configuration for your server.
- Firstly, set
ENABLE_JELLYFINtotrue. - Next, provide the base URL of your Jellyfin Media Server in
JELLYFIN_SERVER. The default port that Jellyfin runs on is8096(e.g.http://[your_ipaddress]:8096). You can verify that the URL is correct by opening it in a web browser; you should see your server's login page load successfully. The bot must be able to reach this address from the machine or container it runs on. - Set
JELLYFIN_API_KEYto a valid API key for your server. You can create one from the Jellyfin admin dashboard under Dashboard -> API Keys. Once you have your key, place it into your.envfile. - Set
JELLYFIN_USERto a valid username on your server. Elite Music uses this account when searching your library and building stream URLs.
Once configured and restarted, the bot will validate the connection on startup and return a configuration loaded message. As long as everything is valid and the feature remains active, you will be able to utilise all of the /jellyfin commands.
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_DJMODEtotrue. - 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_ROLEfield.
Soft Transitions fades tracks out and in during playback (skip, natural song changes, etc.) instead of hard cuts. Audio never overlaps - it's a sequential fade, not a true crossfade (due to limitations).
- Firstly, set
ENABLE_SOFT_TRANSITIONStotrue. - Optionally, set
SOFT_TRANSITION_MSto the duration of each fade-out or fade-in in milliseconds (200-5000, default2000). This is the length of a single fade direction, not the combined transition.
Elite Music includes built-in localisation. Translation strings are stored as JSON files in the locales/ folder, with en-GB.json acting as the default and main source for all keys. Locale files are included for all Discord client languages.
You can configure this in your .env file using PRIMARY_LOCALE (defaults to en-GB) and LOCALE_MODE (defaults to user). Set LOCALE_MODE to user if you want the bot to localise based on each user's Discord client language where possible, falling back to your primary locale when needed. Set it to global if you want the bot to always use your primary locale instead.
Contributions are always welcome, whether that's new features, translations, or everything in between. These will be reviewed when possible but may not always be merged if outside of the scope of the project or other reasons.
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! π