This is a full-fledged example of a Javacord Discord bot that utilizes Velen as a framework paired with Redis
for a per-server prefix and blacklist. This is written for Javacord v3.3.2
and Velen v2.0.0
, you may use your own
database paradigm like MongoDB
or MySQL
if you like.
- Gradle
- Redis (Data Persistence should be enabled).
- Java 11
You can build this application through the application plugin with Gradle:
./gradlew build
- redis_host: The host name of the Redis server.
- redis_port: The port of the Redis server.
- redis_pass: The password of the Redis database.
- token: The Discord bot token.
The bot has several basic functions and commands, but the main point of this example bot is to demonstrate the following:
- Creating a Help Command with Velen.
- Utilizing Fuzzy Command Suggestion with Velen.
- Creating Commands with Velen.
- Utilizing Gradle with Application plugin instead of Fatjars.
- Logging with Logback and SLF4J.
- Utilizing Redis with Velen.
- Per-server Prefixes (Persistent) with Velen.
- Persistent Blacklist with Velen.
Here are the basic commands implemented:
- Avatar command: To get the avatar of a user or yourself.
- Help command: The starting point of the bot, shows all the commands categories.
- Ping command: To get the latency of the bot from the server to Discord.
- Blacklist command: An owner-only command that is used to blacklist users from using the bot.
- Prefix command: To change or get the prefix used by the server.
- Velen: The framework used to quickly create this bot.
- Javacord: The library used by Velen and the bot to communicate with Discord, etc.
- Redis: The database that is being used by this bot.
- Jedis: The database driver that is being used by this bot.
- Logback: The logger used by this bot.
- SLF4J: The logging API used by the bot.