Egg Repository

Pterodactyl Community Egg Repository

JMusicBot

A Discord music bot that's easy to set up and run yourself!

Read Me

JMusicBot


Authors / Contributors


Bot Description & Features

From the developer's Github:

A Discord music bot that's easy to set up and run yourself!

  • Easy to run
  • Fast loading of songs
  • No external keys needed (besides a Discord Bot token)
  • Smooth playback
  • Server-specific setup for the "DJ" role that can moderate the music
  • Clean and beautiful menus
  • Supports many sites, including YouTube, Soundcloud, and more
  • Supports many online radio/streams
  • Supports local files
  • Playlist support (both web/youtube, and local)

Configuration

  • If you can, edit the Startup Variables before starting the bot, because otherwise it will fail to start.
  • Most settings found in config.txt can be edited via the Startup Variables. Advanced settings not listed can still be edited manually via the File Manager. Available Startup Variables will take precedent over manual edits.

Server Ports

There are no ports required for JMusicBot.


Updating

Re-Installing the server via the panel will do the following:

  1. Update the bot to the latest version.
  2. Update the config.txt file to the latest version, and place the old one at config.txt-old.
  3. Any local songs will remain and not be touched.
Yolks
NameTag
ghcr.io/pterodactyl/yolks:java_17ghcr.io/pterodactyl/yolks:java_17
Variables
NameDescriptionEnvironment VariableDefault ValueUser ViewableUser Editable
[REQUIRED] Discord Bot TokenThe token for your Discord bot. Learn how to obtain a token and configure your bot application properly here: https://jmusicbot.com/getting-a-bot-token/BOT_TOKENYesYes
[REQUIRED] Bot Owner IDThis is the Discord User ID of the bot owner. Learn how to obtain this ID here: https://jmusicbot.com/finding-your-user-id/BOT_OWNERChange This To Your Discord User IDYesYes
Bot PrefixThis sets the prefix for the bot. The prefix is used to control the commands. If you use !, the play command will be !play. If you do not set this, the prefix will be a mention of the bot (@Botname play).BOT_PREFIX@mentionYesYes
Bot Alternate PrefixIf you set this, the bot will also use this prefix in addition to "Bot Prefix". Set to NONE to not have an alternate prefix.BOT_ALT_PREFIXNONEYesYes
Bot Default GameIf you change this, it modifies the default game of the bot. Set this to NONE to have no game. Set this to DEFAULT to use the default game. You can make the game "Playing X", "Listening to X", or "Watching X" where X is the title. If you don't include an action, it will use the default of "Playing".BOT_GAMEDEFAULTYesYes
Bot Default Status[ Accepted Values: ONLINE IDLE DND INVISIBLE ] Will modify the default status of bot.BOT_STATUSONLINEYesYes
Bot Show Song in StatusIf you set this to true, the bot will list the title of the song it is currently playing in its "Playing" status. NOTE: This will ONLY work if the bot is playing music on ONE Discord server; if the bot is playing in multiple servers, this will not work!BOT_SONG_STATUSfalseYesYes
Bot Show Images for "Now Playing"If set to true, the "nowplaying" command will show YouTube thumbnails. NOTE: If you set this to true, the nowplaying boxes will NOT refresh. This is because refreshing the boxes causes the image to be reloaded every time it refreshes.BOT_NPIMAGESfalseYesYes
Bot Stay In ChannelIf set to true, the bot will not leave a voice channel after it finishes a queue. Keep in mind that being connected to a voice channel uses additional bandwidth, so this option is not recommended if bandwidth is a concern.BOT_STAY_IN_CHANNELfalseYesYes
Bot Alone Time Until DisconnectThis sets the amount of seconds the bot will stay alone on a voice channel until it automatically leaves the voice channel and clears the queue. If not set or set to any number less than or equal to zero, the bot won't leave when alone.BOT_ALONE_TIME0YesYes
Bot Max Song LengthThis sets the maximum amount of seconds any track loaded can be. If not set or set to any number less than or equal to zero, there is no maximum time length. This time restriction applies to songs loaded from any source.BOT_MAXTIME0YesYes
Install Script
#!/bin/bash

apt update
apt install -y jq curl

CONFIG_LINK="https://raw.githubusercontent.com/ptero-eggs/application-eggs/main/bots/discord/jmusicbot/config.txt"
PLAYLIST_LINK="https://raw.githubusercontent.com/ptero-eggs/application-eggs/main/bots/discord/jmusicbot/example_playlist.txt"


if [ -z "${GITHUB_USER}" ] && [ -z "${GITHUB_OAUTH_TOKEN}" ] ; then
    echo -e "using anon api call"
else
    echo -e "user and oauth token set"
    alias curl='curl -u ${GITHUB_USER}:${GITHUB_OAUTH_TOKEN} '
fi

## get release info and download links
LATEST_JSON=$(curl --silent "https://api.github.com/repos/jagrosh/MusicBot/releases/latest")
RELEASES=$(curl --silent "https://api.github.com/repos/jagrosh/MusicBot/releases")
MATCH=JMusicBot

if [ -z "${VERSION}" ] || [ "${VERSION}" == "latest" ]; then
    DOWNLOAD_URL=$(echo ${LATEST_JSON} | jq .assets | jq -r .[].browser_download_url | grep -i ${MATCH})
else
    VERSION_CHECK=$(echo ${RELEASES} | jq -r --arg VERSION "${VERSION}" '.[] | select(.tag_name==$VERSION) | .tag_name')
    if [ "${VERSION}" == "${VERSION_CHECK}" ]; then
        DOWNLOAD_URL=$(echo ${RELEASES} | jq -r --arg VERSION "${VERSION}" '.[] | select(.tag_name==$VERSION) | .assets[].browser_download_url' | grep -i ${MATCH})
    else
        echo -e "defaulting to latest release"
        DOWNLOAD_URL=$(echo ${LATEST_JSON} | jq .assets | jq -r .[].browser_download_url)
    fi
fi

## JMusicBot Setup
[ ! -d /mnt/server ] && mkdir /mnt/server
cd /mnt/server
echo -e "\nInstalling/Updating JMusicBot...\n"

if [ -f JMusicBot.jar ]; then
    echo -e "Updating JMusicBot.jar to latest version..."
    echo -e '\t(Old version can be found at "JMusicBot.jar-old")'
    mv -f JMusicBot.jar JMusicBot.jar-old
fi

echo -e "Running: curl -sSLo JMusicBot.jar ${DOWNLOAD_URL}\n"
curl -sSLo JMusicBot.jar ${DOWNLOAD_URL}

if [ -f config.txt ]; then
    echo -e "Updating config.txt to latest version..."
    echo -e '\t(Old version can be found at "config.txt-old")'
    mv -f config.txt config.txt-old
fi
echo -e "Running: curl -sSLo config.txt ${CONFIG_LINK}\n"
curl -sSLo config.txt ${CONFIG_LINK}

[ ! -d Playlists ] && mkdir Playlists
cd Playlists
if [ -f example_playlist.txt ]; then
    echo -e "example_playlist.txt already exists. Skipping default download."
else
    echo -e "example_playlist.txt not found. Downloading default example_playlist..."
    echo -e "Running: curl -sSLo example_playlist.txt ${PLAYLIST_LINK}"
    curl -sSLo example_playlist.txt ${PLAYLIST_LINK}
fi

echo -e "\nJMusicBot Successfully Installed!"