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


John Grosh

💻 🤖

parkervcp

💻 🥚

Software-Noob

💻 💡

Proxymiity

💻 💡

Red-Thirten

💻 💡

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 and Startup

Startup Command

java -Dnogui=true -jar JMusicBot.jar

Variables

[REQUIRED] Discord Bot Token

The 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/

Environment Variable: BOT_TOKEN
Default Value:
User Viewable:✅
User Editable:✅
[REQUIRED] Bot Owner ID

This is the Discord User ID of the bot owner. Learn how to obtain this ID here: https://jmusicbot.com/finding-your-user-id/

Environment Variable: BOT_OWNER
Default Value: Change This To Your Discord User ID
User Viewable:✅
User Editable:✅
Bot Prefix

This 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).

Environment Variable: BOT_PREFIX
Default Value: @mention
User Viewable:✅
User Editable:✅
Bot Alternate Prefix

If you set this, the bot will also use this prefix in addition to "Bot Prefix". Set to NONE to not have an alternate prefix.

Environment Variable: BOT_ALT_PREFIX
Default Value: NONE
User Viewable:✅
User Editable:✅
Bot Default Game

If 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".

Environment Variable: BOT_GAME
Default Value: DEFAULT
User Viewable:✅
User Editable:✅
Bot Default Status

[ Accepted Values: ONLINE IDLE DND INVISIBLE ] Will modify the default status of bot.

Environment Variable: BOT_STATUS
Default Value: ONLINE
User Viewable:✅
User Editable:✅
Bot Show Song in Status

If 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!

Environment Variable: BOT_SONG_STATUS
Default Value: false
User Viewable:✅
User Editable:✅
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.

Environment Variable: BOT_NPIMAGES
Default Value: false
User Viewable:✅
User Editable:✅
Bot Stay In Channel

If 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.

Environment Variable: BOT_STAY_IN_CHANNEL
Default Value: false
User Viewable:✅
User Editable:✅
Bot Alone Time Until Disconnect

This 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.

Environment Variable: BOT_ALONE_TIME
Default Value: 0
User Viewable:✅
User Editable:✅
Bot Max Song Length

This 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.

Environment Variable: BOT_MAXTIME
Default Value: 0
User Viewable:✅
User Editable:✅
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!"
Installation Imageghcr.io/ptero-eggs/installers:debianInstallation Entrypoint/bin/bash