Report Bug · Request Feature
kryo-discord-whitelist is a whitelist where Discord users can add themselves by writing their username into a specific channel.
kryo-discord-whitelist needs the following services to be installed and configured to function properly:
It is not recommended using the root user of the MariaDB server for kryo-discord-whitelist. Please create an extra database with an extra user that is limited to that database.
The installation and usage of kryo-discord-whitelist needs two separate modules, the Discord bot itself and a Velocity plugin. At the moment you need to build all JAR files yourself because we do not distribute prebuilt JARs.
The Discord bot needs access to the Discord API, therefore a token is needed. To get a token a Discord bot needs to be created in the Discord developer portal.
- Goto the Discord Developer Portal and create a new Application.
- Click on "Bot" in the sidemenu and add a new bot.
- Click "Copy" next to the profile picture of the bot to copy the token.
With the generated token we can now start the discord bot. The discord bot needs two environment variables or Java start parameters to start.
Environment variable | Start parameter | Description |
---|---|---|
TOKEN | -DTOKEN | Discord Bot token |
CONNECTION_STRING | -DCONNECTION_STRING | Connection String for connecting to the MariaDB database |
A startup command could look like the following:
java -Xms128M -Xmx512M -DTOKEN=DISCORD_TOKEN -DCONNECTION_STRING=jdbc:mariadb://localhost:3306/database?user=user&password=password -JAR kryo-discord-whitelist-bot.JAR
To install the Velocity plugin just copy the JAR-file into the plugin directory.
Furthermore, the Velocity plugin needs some environment variables. Those can also be provided as startup parameters if the usage of environment variables is not possible.
Environment variable | Start parameter | Description |
---|---|---|
CONNECTION_STRING | -DCONNECTION_STRING | Connection String for connecting to the MariaDB database |
RABBITMQ_ADDRESS | -DRABBITMQ_ADDRESS | Address and port of the RabbitMQ message broker |
RABBITMQ_USERNAME | -DRABBITMQ_USERNAME | Username of the RabbitMQ message broker |
RABBITMQ_PASSWORD | -DRABBITMQ_PASSWORD | Password of the RabbitMQ message broker |
A startup command of the Velocity could look like the following:
java -Xms128M -Xmx1024M -XX:+UseG1GC -XX:G1HeapRegionSize=4M -XX:+UnlockExperimentalVMOptions -XX:+ParallelRefProcEnabled -XX:+AlwaysPreTouch -XX:MaxInlineLevel=15 -DCONNECTION_STRING=jdbc:mariadb://127.0.0.1:3306/database?user=user&password=password -DRABBITMQ_ADDRESS=127.0.0.1:5672 -DRABBITMQ_USERNAME=guest -DRABBITMQ_PASSWORD=guest -JAR velocity.JAR
Command | Permission | Description |
---|---|---|
/whitelist add <username> |
whitelist |
Add a player manually to the whitelist. Manually added players do not have to verify themselves via Discord. |
/whitelist remove <username> |
whitelist |
Remove a player from the whitelist. If the player is online during the command execution the player gets kicked. This is also applicable if the player is on another proxy. |
kryo-discord-whitelist is built with Gradle. We recommend using the included wrapper script (./gradlew
) to ensure you use the same Gradle version as we do.
To build production-ready JAR files it is sufficient to run ./gradlew shadowJAR
.
You can find the JAR files in ./module-name/build/libs/*-all.JAR
.
kryo-discord-whitelist uses JUnit 5 and Mockito for testing.
To run all tests just execute ./gradlew test