Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
406226c
Refactor music commands system:
arif-banai Dec 28, 2025
35d680b
Add channel tracking in `RequestMetadata`, remove surrounding double-…
arif-banai Dec 28, 2025
4d44e67
Add button interactions for previous, shuffle, repeat, volup/voldown,…
arif-banai Dec 28, 2025
c74dff5
Improve "previous track" logic:
arif-banai Dec 28, 2025
fb4f6e6
Update `pom.xml`:
arif-banai Dec 29, 2025
cd90c2b
Add history tracking for queue:
arif-banai Dec 29, 2025
543c89d
Update `.gitignore` to exclude IDE, Maven, OS, and log-specific files
arif-banai Dec 29, 2025
32b0455
Remove unused `progressBar` call from `MessageFormatter` to simplify …
arif-banai Dec 29, 2025
807052f
Refactor track history management:
arif-banai Dec 29, 2025
7ed7126
Add unit tests for `makeNonEmpty` and `formatTime` methods, and updat…
arif-banai Dec 29, 2025
d76d134
Add comprehensive unit tests:
arif-banai Dec 29, 2025
ef005d8
Refactor button interactions to delegate actions to `PlayerService`:
arif-banai Dec 29, 2025
bdcbdd7
Update version to 0.5.3-beta-nowplayingcmd:
arif-banai Jan 6, 2026
1fc562f
Fix failing tests in LinearQueueTest & HistoryQueueTest (set maxHisto…
arif-banai Jan 6, 2026
865fc54
Update funding links in FUNDING.yml
arif-banai Jan 6, 2026
9470ce6
Add Maven Compiler Plugin and Refactor Prompt Class
arif-banai Jan 12, 2026
777bbfe
Update version to 0.6.2-slash-commands and refactor tests
arif-banai Jan 23, 2026
8534fb0
Implement slash command registration and management:
arif-banai Jan 23, 2026
2ac8a0c
Add MusicCommandValidator for command validation
arif-banai Jan 23, 2026
419fbd8
Refactor music service and command structure
arif-banai Jan 23, 2026
dc86f9a
Implement slash commands, refactor services, update readme
arif-banai Jan 26, 2026
6e9601e
Refactor SearchSlashCmd to utilize SearchService
arif-banai Jan 26, 2026
8a23b34
Update README.md to reflect system requirements and clarify Java vers…
arif-banai Jan 27, 2026
f400435
Update README.md to clarify system requirements and correct lavaplaye…
arif-banai Jan 27, 2026
08a5675
Remove merge conflict markers from OtherUtilTest.java
arif-banai Jan 27, 2026
dcf3699
Update version to 0.6.3-alpha-slashcommands in pom.xml
arif-banai Jan 27, 2026
b413b78
Add test utilities for slash commands
arif-banai Jan 27, 2026
c5231e8
Enhance OkHttpClient configuration and improve unit tests for version…
arif-banai Jan 27, 2026
e769864
Add test utilities and fixtures for audio and service components
arif-banai Jan 27, 2026
8379c60
Refactor UserInteraction handling across the application
arif-banai Jan 29, 2026
9042ef2
Add .gitattributes for line ending normalization and update Dockerfil…
arif-banai Jan 29, 2026
c182908
Refactor Maven build commands in GitHub workflows
arif-banai Jan 29, 2026
930af27
Update Dockerfile to refine JRE module selection for optimized build
arif-banai Jan 29, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Auto detect text files and perform LF normalization
* text=auto

# Shell scripts must use LF (Unix line endings)
*.sh text eol=lf

# Batch files must use CRLF (Windows line endings)
*.bat text eol=crlf
*.cmd text eol=crlf

# Docker files should use LF
Dockerfile text eol=lf
.dockerignore text eol=lf
2 changes: 1 addition & 1 deletion .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# These are supported funding model platforms

github: arif-banai
patreon: # Replace with patreon
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
- name: Build and Test with Coverage
run: |
COMMIT_TIME=$(git log -1 --format=%cI)
mvn --batch-mode --update-snapshots verify -Pcoverage -Dproject.build.outputTimestamp=$COMMIT_TIME
mvn --batch-mode verify -Pcoverage -Dproject.build.outputTimestamp=$COMMIT_TIME

- name: Upload Coverage to Codecov
uses: codecov/codecov-action@v5
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/make-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ jobs:
- name: Build with Maven
run: |
COMMIT_TIME=$(git log -1 --format=%cI)
mvn --batch-mode --update-snapshots verify -Dproject.build.outputTimestamp=$COMMIT_TIME
mvn --batch-mode verify -Dproject.build.outputTimestamp=$COMMIT_TIME

- name: Rename JAR
run: mv target/*-All.jar JMusicBot-${{ github.event.inputs.version_number }}.jar
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-preview-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ jobs:
if: ${{ github.event.inputs.run_tests != 'false' }}
run: |
COMMIT_TIME=$(git log -1 --format=%cI)
mvn --batch-mode --update-snapshots verify -Pdocker -Dproject.build.outputTimestamp=$COMMIT_TIME
mvn --batch-mode verify -Pdocker -Dproject.build.outputTimestamp=$COMMIT_TIME

- name: Sanitize tag suffix
id: sanitize
Expand Down
15 changes: 15 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,23 @@
*.json
*.txt
nb*.xml

# IDEs
/.idea/
/.vscode/
/.cursor/
*.iml
*.iws

# Maven
dependency-reduced-pom.xml

# OS
.DS_Store
Thumbs.db

# Logs
*.log

# Other
*.lock
58 changes: 45 additions & 13 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
# syntax=docker/dockerfile:1
# syntax=docker/dockerfile:1.12

# Multi-stage build for JMusicBot
# Stage 1: Build the application
FROM maven:3.9-eclipse-temurin-25 AS builder
FROM maven:3.9.12-eclipse-temurin-25-alpine AS builder

ARG BUILD_TIMESTAMP
ENV BUILD_TIMESTAMP=$BUILD_TIMESTAMP

WORKDIR /build

# Copy pom.xml first for better layer caching
COPY pom.xml .
COPY --link pom.xml .

# Download dependencies with BuildKit cache mount for Maven repository
# This significantly speeds up builds by persisting dependencies between builds
RUN --mount=type=cache,target=/root/.m2/repository \
mvn dependency:go-offline -B -Pdocker

# Copy source code
COPY src ./src
COPY --link src ./src

# Build the application with BuildKit cache mount
RUN --mount=type=cache,target=/root/.m2/repository \
Expand All @@ -29,9 +29,38 @@ RUN --mount=type=cache,target=/root/.m2/repository \
fi


# Stage 2: Runtime image
# Using Ubuntu Noble (24.04) for libraries required by jdave/udpqueue native libraries
FROM eclipse-temurin:25-jre-noble
# Stage 2: Create custom minimal JRE using jlink
# Using noble (Ubuntu 24.04) for glibc 2.39 compatibility with native libraries
FROM eclipse-temurin:25-jdk-noble AS jre-builder

# Create a minimal JRE with only the modules JMusicBot needs
# Modules determined by: jdeps --print-module-deps --ignore-missing-deps <jar>
# Plus runtime-loaded modules that jdeps can't detect:
# java.base - Core Java classes
# java.compiler - Annotation processing (used by some libraries)
# java.desktop - GUI support (Swing/AWT, even for headless mode)
# java.logging - SLF4J/Logback logging
# java.naming - JNDI (required by Logback)
# java.net.http - HTTP client API
# java.scripting - ScriptEngine for EvalCmd (Rhino)
# java.security.jgss - Kerberos/GSS-API security
# java.sql - JDBC (used by some dependencies)
# jdk.crypto.ec - Elliptic curve crypto for TLS/SSL (Discord API) - runtime loaded
# jdk.management - JMX management extensions
# jdk.unsupported - Native library access (jdave, udpqueue)
RUN $JAVA_HOME/bin/jlink \
--add-modules java.base,java.compiler,java.desktop,java.logging,java.naming,java.net.http,java.scripting,java.security.jgss,java.sql,jdk.crypto.ec,jdk.management,jdk.unsupported \
--strip-debug \
--no-man-pages \
--no-header-files \
--compress=zip-6 \
--output /javaruntime


# Stage 3: Runtime image
# Using Bitnami minideb:trixie (Debian 13) for minimal size with glibc 2.41
# Required for jdave/udpqueue native libraries which need glibc >= 2.38
FROM bitnami/minideb:trixie

# OCI image labels for better traceability and management
LABEL org.opencontainers.image.title="JMusicBot" \
Expand All @@ -41,18 +70,21 @@ LABEL org.opencontainers.image.title="JMusicBot" \
org.opencontainers.image.vendor="JMusicBot" \
org.opencontainers.image.licenses="Apache-2.0"

# Create non-root user for security
RUN groupadd --gid 10001 jmusicbot && \
useradd --uid 10001 --gid 10001 --shell /bin/false jmusicbot
# Copy custom JRE from jre-builder stage
ENV JAVA_HOME=/opt/java/openjdk
ENV PATH="${JAVA_HOME}/bin:${PATH}"
COPY --from=jre-builder /javaruntime $JAVA_HOME

# Create application directories
RUN mkdir -p /app /musicbot && \
# Create non-root user and application directories in single layer
RUN groupadd --gid 10001 jmusicbot && \
useradd --uid 10001 --gid 10001 --shell /bin/false jmusicbot && \
mkdir -p /app /musicbot && \
chown -R jmusicbot:jmusicbot /app /musicbot

# Copy the built JAR from builder stage
COPY --from=builder --chown=jmusicbot:jmusicbot /build/target/JMusicBot-*-All.jar /app/app.jar

# Copy and set permissions for entrypoint script in a single layer
# Copy and set permissions for entrypoint script
COPY --chown=jmusicbot:jmusicbot --chmod=755 docker/entrypoint.sh /app/entrypoint.sh

WORKDIR /musicbot
Expand Down
56 changes: 50 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,25 @@
[![Stars](https://img.shields.io/github/stars/arif-banai/MusicBot.svg)](https://github.com/arif-banai/MusicBot/stargazers)
[![Release](https://img.shields.io/github/release/arif-banai/MusicBot.svg)](https://github.com/arif-banai/MusicBot/releases/latest)
[![License](https://img.shields.io/github/license/arif-banai/MusicBot.svg)](https://github.com/arif-banai/MusicBot/blob/master/LICENSE)
[![Discord](https://discordapp.com/api/guilds/1453856673004392634/widget.png)](https://discord.gg/cyyUxNmmx6) <br>
[![Discord](https://discordapp.com/api/guilds/1453856673004392634/widget.png?v=1)](https://discord.gg/cyyUxNmmx6) <br>
[![CircleCI](https://dl.circleci.com/status-badge/img/gh/arif-banai/MusicBot/tree/master.svg?style=svg)](https://dl.circleci.com/status-badge/redirect/gh/arif-banai/MusicBot/tree/master)
[![Build and Test](https://github.com/arif-banai/MusicBot/actions/workflows/build-and-test.yml/badge.svg)](https://github.com/arif-banai/MusicBot/actions/workflows/build-and-test.yml)
[![CodeFactor](https://www.codefactor.io/repository/github/arif-banai/musicbot/badge)](https://www.codefactor.io/repository/github/arif-banai/musicbot)

A cross-platform Discord music bot with a clean interface, and that is easy to set up and run yourself!

## ⚠️ Important Notice (Java 25)
## ⚠️ Check your Java Version and other requirements

* **Java 25 Minimum:** The bot now requires **Java 25 or higher**. Please update your hosting environment (check `java -version`) before running the new JAR.
This version of JMusicBot changes/updates various dependencies. To ensure your bot continues to function correctly, please note the following mandatory changes:

* **Java 25 Minimum:** The bot now requires **Java 25 or higher**.

* **LibDave/udpqueue:** You **must** have **glibc >= 2.38**. *If you are using Docker, this is already handled for you.*
* **Privileged Gateway Intents:** You **must** enable the **Message Content Intent** in your [Discord Developer Portal](https://discord.com/developers/applications).
* *Navigate to: Your Application > Bot > Privileged Gateway Intents > Toggle "Message Content Intent" to ON.*
* *Without this, the bot will not see your commands.*


[![Setup](http://i.imgur.com/VvXYp5j.png)](https://jmusicbot.com/setup)

## Features
Expand All @@ -38,7 +43,7 @@ A cross-platform Discord music bot with a clean interface, and that is easy to s
* Playlist support (both web/youtube, and local)

## Supported sources and formats
JMusicBot supports all sources and formats supported by [lavaplayer](https://github.com/sedmelluq/lavaplayer#supported-formats):
JMusicBot supports all sources and formats supported by [lavaplayer](https://github.com/lavalink-devs/lavaplayer#supported-formats):
### Sources
* YouTube
* SoundCloud
Expand All @@ -63,6 +68,36 @@ JMusicBot supports all sources and formats supported by [lavaplayer](https://git
## Setup
Please see the [Setup Page](https://jmusicbot.com/setup) to run this bot yourself!

## Running Directly (Without Docker)

When running JMusicBot directly (not in Docker), make sure to pass these JVM flags:

```bash
java -Dnogui=true --enable-native-access=ALL-UNNAMED -jar JMusicBot-0.6.2-All.jar
```

### Linux System Requirements

**Important:** Your system **must have glibc version 2.38 or higher**. Failure to meet this requirement will result in errors when using JDave and udpqueue.

> **Note:** Ubuntu 24.04 "Noble" and Debian 13 "Trixie" already include a compatible glibc version out of the box.

You can check your glibc version with:
```bash
ldd --version
```

On Debian/Ubuntu-based systems, you may also need to install the following native audio library dependencies:

```bash
# Install required native library dependencies
sudo apt-get update
sudo apt-get install -y libopus0 libsodium23
```


If your version is below 2.38, you will need to upgrade your system or use a compatible runtime. (You can also use Docker, which is recommended.)

## Docker

JMusicBot can be run using Docker for easy deployment and management. Pre-built images are available from the GitHub Container Registry. The container is configured to run headless and automatically generate a default `config.txt` on first run.
Expand Down Expand Up @@ -128,7 +163,7 @@ Check the [Docker Compose Example](docker-compose.example.yml) for more details.
- **Config Persistence:** The `/musicbot` volume **must** be mounted for your configuration to persist. The bot reads and writes `config.txt` from `/musicbot` (the container's working directory).
- **First Run:** If `config.txt` doesn't exist, the bot will generate a default one automatically. You'll need to edit it with your bot token before the bot can start.
- **Image Tags:**
- Use `ghcr.io/arif-banai/musicbot:latest` for the latest build from the default branch
- Use `ghcr.io/arif-banai/musicbot:latest` for the latest build from the master branch
- Use `ghcr.io/arif-banai/musicbot:0.6.1` (replace with actual version) to pin a specific release version
- **Recommendation:** For production, pin your image tag rather than using `latest`
- **JAVA_OPTS:** You can optionally set `JAVA_OPTS` environment variable to pass additional JVM arguments (e.g., `-Xmx512m -Xms256m` for memory settings).
Expand All @@ -149,7 +184,16 @@ This project follows a **trunk-based development** workflow. The `master` branch
Branch names are automatically validated by CI to ensure consistency. For detailed information about the development workflow, branch naming rules, and best practices, see [DEVELOPMENT_WORKFLOW.md](docs/DEVELOPMENT_WORKFLOW.md).

## Questions/Suggestions/Bug Reports
**Please read the [Issues List](https://github.com/arif-banai/MusicBot/issues) before suggesting a feature**. If you have a question, need troubleshooting help, or want to brainstorm a new feature, please start a [Discussion](https://github.com/arif-banai/MusicBot/discussions). If you'd like to suggest a feature or report a reproducible bug, please open an [Issue](https://github.com/arif-banai/MusicBot/issues) on this repository. If you like this bot, be sure to add a star to the libraries that make this possible: [**JDA**](https://github.com/DV8FromTheWorld/JDA) and [**lavaplayer**](https://github.com/lavalink-devs/lavaplayer)!
**Please read the [Issues List](https://github.com/arif-banai/MusicBot/issues) before suggesting a feature**.

If you have a question, need troubleshooting help, or want to brainstorm a new feature, please start a [Discussion](https://github.com/arif-banai/MusicBot/discussions).

The Discord server is also available for questions and suggestions. [Click here to join](https://discord.gg/cyyUxNmmx6).

If you'd like to suggest a feature or report a reproducible bug, please open an [Issue](https://github.com/arif-banai/MusicBot/issues) on this repository. If you like this bot, be sure to add a star to the libraries that make this possible:
- [**JDA**](https://github.com/DV8FromTheWorld/JDA)
- [**lavaplayer**](https://github.com/lavalink-devs/lavaplayer)
- [**youtube-source**](https://github.com/lavalink-devs/youtube-source)

## Editing
This bot (and the source code here) might not be easy to edit for inexperienced programmers. The main purpose of having the source public is to show the capabilities of the libraries, to allow others to understand how the bot works, and to allow those knowledgeable about java, JDA, and Discord bot development to contribute. There are many requirements and dependencies required to edit and compile it, and there will not be support provided for people looking to make changes on their own. Instead, consider making a feature request (see the above section). If you choose to make edits, please do so in accordance with the Apache 2.0 License.
Loading