4.3.1
π¦ Changelog β Version 4.3.0
This minor release introduces full JDA (Java Discord API) support for Discord bots, improves error handling, and includes several bug fixes.
β¨ New Features
Full JDA (Discord) Support
- New
jdamodule: Native support for Discord bots with JDA 6.1.2Command<T>: Base class for Discord slash commandsJDAPlatform<T>:CommandPlatformimplementation for DiscordJDAExecutor: Event handler for Discord interactionsJDAArguments: Extension ofArgumentswith Discord-specific methods (getUser, getChannel, etc.)RoleRequirement: Discord role validation system for commands
New jda-test-bot module
- Demo Discord bot including:
PingCommand: Latency test commandMathCommand: Command with subcommands (add, subtract, multiply, divide)UserInfoCommand: User information display with embeds
π§ Improvements
Exception Handling
- New custom exceptions:
CommandRegistrationException: Dedicated exception for command registration errorsUpdaterInitializationException: Exception for updater initialization errors
- Replaced generic
RuntimeException:- In
CommandManager: UsingCommandRegistrationExceptionwith contextual messages - In
SpigotPlatform: More explicit error messages during registration
- In
Arguments API Improvements
- Visibility changes:
argumentsandloggerare nowprotectedinstead ofprivate- Allows extension by classes like
JDAArguments
- New utility methods:
has(String key): Check if an argument existsgetLogger(): Protected access to the logger
CommandInvoker Optimization
- Improved support for commands without arguments
- Better execution context handling
Bug Fixes
- Fixed name duplication: Corrected alias addition logic in
registerSubCommandsandunregisterSubCommandsgetAliases()already returns[name, ...aliases], no need to add the name manually- Prevents command name duplication in the alias list
ποΈ Infrastructure & Configuration
Java 21 Migration
- GitHub Actions: Updated test workflow to Java 21
- JDA Module: Java 21 compatibility (sourceCompatibility and targetCompatibility)
Gradle Configuration
- Added JDA module in
settings.gradleandjitpack.yml - Workflow simplification: Removed redundant
testtask in CI workflow (keeps onlytestAll)
π Architecture
New Modules
jda/: Discord/JDA support- Main classes:
Command,JDAPlatform,JDAExecutor,JDAArguments,RoleRequirement
- Main classes:
jda-test-bot/: Demo bot- Classes:
TestBot,PingCommand,MathCommand,UserInfoCommand
- Classes:
New Core Classes
CommandRegistrationExceptionUpdaterInitializationException
π Migration Notes
For API Users
- No breaking changes: All modifications are backward compatible
- Classes inheriting from
Argumentscan now accessargumentsandloggeras protected members
For New Discord Projects
- Add the
platform-jdadependency to use CommandsAPI with Discord - Check the
jda-test-botmodule for implementation examples
Java Requirements
- JDA module requires Java 21 minimum
- Other modules remain compatible with their previous Java versions
Full Changelog: 4.2.3...4.3.1