Skip to content

Commit

Permalink
Initial Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Tresmos committed Dec 4, 2022
0 parents commit 9ba25aa
Show file tree
Hide file tree
Showing 6 changed files with 296 additions and 0 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Build and Publish Docker Image
on:
workflow_dispatch:
push:
branches:
- master
tags:
- '*'
jobs:
push:
name: "Build and Publish"
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: ghcr.io/tresmos/jmusicbot

- name: Login to ghcr.io
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.REGISTRY_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v3
with:
platforms: linux/amd64,linux/arm64
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
17 changes: 17 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM --platform=$TARGETOS/$TARGETARCH openjdk:18.0.2-slim

ENV BOT_VERSION 0.3.8

RUN apt-get update -y \
&& apt-get install -y --no-install-recommends curl \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get autoremove -y \
&& apt-get clean

RUN mkdir -p /opt/jmusicbot/data/

ADD https://github.com/jagrosh/MusicBot/releases/download/$BOT_VERSION/JMusicBot-$BOT_VERSION.jar /opt/jmusicbot/JMusicBot.jar

COPY ./entrypoint.sh /opt/jmusicbot/entrypoint.sh

ENTRYPOINT ["/bin/sh", "/opt/jmusicbot/entrypoint.sh"]
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# JMusicBot Docker
Dockerized version of the best *~~(imo)~~* self-hosted music bot, [JMusicBot by jagrosh](https://github.com/jagrosh/MusicBot)

# Running the Container
If there is no config.txt file located in the data directory, an example config.txt will be downloaded. After configuring the bot just start the container again. [JMusicBot Wiki](https://jmusicbot.com/)
### With Docker Run
`docker run -d --name jmusicbot -v `**`dataDir`**`:/opt/jmusicbot/data/ ghcr.io/tresmos/jmusicbot`
### With Docker Compose
`docker-compose.yml`
```yml
version: '3'
services:
jmusicbot:
image: ghcr.io/tresmos/jmusicbot
container_name: jmusicbot
network_mode: host
volumes:
- ./dataDir:/opt/jmusicbot/data/
```
```
docker compose up -d
docker compose down
```
183 changes: 183 additions & 0 deletions config.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,183 @@
/////////////////////////////////////////////////////////
// Config for the JMusicBot //
/////////////////////////////////////////////////////////
// Any line starting with // is ignored //
// You MUST set the token and owner //
// All other items have defaults if you don't set them //
// Open in Notepad++ for best results //
/////////////////////////////////////////////////////////


// This sets the token for the bot to log in with
// This MUST be a bot token (user tokens will not work)
// If you don't know how to get a bot token, please see the guide here:
// https://github.com/jagrosh/MusicBot/wiki/Getting-a-Bot-Token

token = BOT_TOKEN_HERE


// This sets the owner of the bot
// This needs to be the owner's ID (a 17-18 digit number)
// https://github.com/jagrosh/MusicBot/wiki/Finding-Your-User-ID

owner = 0


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

prefix = "@mention"


// If you set 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"

game = "DEFAULT"


// If you set this, it will modify the default status of bot
// Valid values: ONLINE IDLE DND INVISIBLE

status = ONLINE


// If you set this to true, the bot will list the title of the song it is currently playing in its
// "Playing" status. Note that this will ONLY work if the bot is playing music on ONE guild;
// if the bot is playing on multiple guilds, this will not work.

songinstatus=false


// If you set this, the bot will also use this prefix in addition to
// the one provided above

altprefix = "NONE"


// If you set these, it will change the various emojis

success = "🎶"
warning = "💡"
error = "🚫"
loading = "⌚"
searching = "🔎"


// If you set this, you change the word used to view the help.
// For example, if you set the prefix to !! and the help to cmds, you would type
// !!cmds to see the help text

help = help


// If you set this, 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.

npimages = false


// If you set this, 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 bandwith,
// so this option is not recommended if bandwidth is a concern.

stayinchannel = false


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

maxtime = 0

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

alonetimeuntilstop = 0

// This sets an alternative folder to be used as the Playlists folder
// This can be a relative or absolute path

playlistsfolder = "Playlists"


// By default, the bot will DM the owner if the bot is running and a new version of the bot
// becomes available. Set this to false to disable this feature.

updatealerts=true


// Changing this changes the lyrics provider
// Currently available providers: "A-Z Lyrics", "Genius", "MusicMatch", "LyricsFreak"
// At the time of writing, I would recommend sticking with A-Z Lyrics or MusicMatch,
// as Genius tends to have a lot of non-song results and you might get something
// completely unrelated to what you want.
// If you are interested in contributing a provider, please see
// https://github.com/jagrosh/JLyrics

lyrics.default = "A-Z Lyrics"


// These settings allow you to configure custom aliases for all commands.
// Multiple aliases may be given, separated by commas.
//
// Example 1: Giving command "play" the alias "p":
// play = [ p ]
//
// Example 2: Giving command "search" the aliases "yts" and "find":
// search = [ yts, find ]

aliases {
// General commands
settings = [ status ]

// Music commands
lyrics = []
nowplaying = [ np, current ]
play = []
playlists = [ pls ]
queue = [ list ]
remove = [ delete ]
scsearch = []
search = [ ytsearch ]
shuffle = []
skip = [ voteskip ]

// Admin commands
prefix = [ setprefix ]
setdj = []
settc = []
setvc = []

// DJ Commands
forceremove = [ forcedelete, modremove, moddelete ]
forceskip = [ modskip ]
movetrack = [ move ]
pause = []
playnext = []
repeat = []
skipto = [ jumpto ]
stop = []
volume = [ vol ]
}

// If you set this to true, it will enable the eval command for the bot owner. This command
// allows the bot owner to run arbitrary code from the bot's account.
//
// WARNING:
// This command can be extremely dangerous. If you don't know what you're doing, you could
// cause horrific problems on your Discord server or on whatever computer this bot is running
// on. Never run this command unless you are completely positive what you are running.
//
// DO NOT ENABLE THIS IF YOU DON'T KNOW WHAT THIS DOES OR HOW TO USE IT
// IF SOMEONE ASKS YOU TO ENABLE THIS, THERE IS AN 11/10 CHANCE THEY ARE TRYING TO SCAM YOU

eval=false
8 changes: 8 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: '3'
services:
jmusicbot:
image: ghcr.io/tresmos/jmusicbot
container_name: jmusicbot
network_mode: host
volumes:
- ./data:/opt/jmusicbot/data/
21 changes: 21 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/sh
BCYAN='\033[1;36m'
BGREEN='\033[1;32m'
NC='\033[0m'

EXAMPLE_CONFIG=https://github.com/Tresmos/jmusicbot-docker/raw/main/config.txt
CONFIG_FILE=/opt/jmusicbot/data/config.txt

set -e

echo "JMusicBot Version: ${BCYAN}$BOT_VERSION${NC}"

if [ ! -f "$CONFIG_FILE" ]; then
echo "${BCYAN}config.txt${NC} not found. Downloading example config file..."
curl -L -sS -o ${CONFIG_FILE} ${EXAMPLE_CONFIG}
echo "${BGREEN}Example config file downloaded. Please edit the config file and restart the container. "
exit
fi

cd /opt/jmusicbot/data/
java -jar -Dconfig=/opt/jmusicbot/data/config.txt -Dnogui=true /opt/jmusicbot/JMusicBot.jar

0 comments on commit 9ba25aa

Please sign in to comment.