anthorob 7443cbfb4b **Refactor command usage printing into CommandUsageFormatter**
Extracted command usage formatting logic from `CommandContainer` into a dedicated `CommandUsageFormatter` class, improving separation of concerns and maintainability. Updated `CommandManager` initialization and added comprehensive unit tests to validate the formatter's functionality.
2026-10-26 09:49:56 -04:00
2026-05-12 23:37:18 -04:00
2026-10-19 08:21:42 -04:00
2024-07-14 22:13:31 -04:00
2025-03-09 20:08:43 +00:00
2024-07-14 11:53:22 -04:00
2026-10-19 08:21:42 -04:00

Net Neutrality Discord Bot

A custom Discord bot written in Java. It uses JDA for Discord, a Lavalink node for music playback, MariaDB/MySQL for persistence, and exposes an HTTP API built with Javalin.

This is a personal project. No support is offered for building or running it.

Table of Contents

Requirements

  • Docker and Docker Compose (recommended), or
  • JDK 25 and Maven (the included mvnw wrapper works) for local runs
  • A MariaDB/MySQL database
  • A Lavalink node, version 4.2.0 or newer
  • A Discord bot token

Configuration

All settings are provided as environment variables. A template with every supported variable is available in bot.properties.example.

Key variables:

Variable Description
NETNEUTRALITY_BOT_TOKEN Discord bot token
NETNEUTRALITY_BOT_PREFIX Command prefix
NETNEUTRALITY_BOT_OWNER Discord user ID of the bot owner
NETNEUTRALITY_API_PORT Port for the HTTP API (default 9000)
MYSQL_HOST, MYSQL_PORT, MYSQL_USER, MYSQL_PASSWORD, MYSQL_DATABASE Database connection settings
NETNEUTRALITY_LAVALINK_URI, NETNEUTRALITY_LAVALINK_PASSWORD Lavalink connection settings
NETNEUTRALITY_SENTRY_DSN Optional Sentry DSN for error reporting
GITEA_HOST, GITEA_TOKEN, GITEA_OWNER, GITEA_REPO Optional Gitea settings for issue reporting

Running with Docker Compose

Docker Compose is the preferred way to run the bot. It starts the bot, the database, Lavalink, and the supporting YouTube cipher and PO token services.

  1. Copy bot.properties.example and fill in the values (see Configuration).
  2. Build and start the stack:
docker compose build
docker compose up -d
  1. View logs:
docker compose logs -f netneutrality-bot

Logs are also written to the logs directory.

Running Locally

  1. Copy bot.properties.example to bot.properties and fill in the values.
  2. Make sure a database and a Lavalink node are reachable at the configured addresses.
  3. Build the project:
./mvnw package
  1. Run the bot:
java -jar target/netneutrality.jar

Dependencies are copied to target/lib during packaging and referenced by the jar manifest.

Testing

./mvnw test

Database tests use Testcontainers, so Docker must be running. Checkstyle runs during the test phase.

License

See the LICENSE file.

S
Languages
Java 99.1%
Shell 0.5%
PowerShell 0.3%