Skip to content

4.3.1

Choose a tag to compare

@Traqueur-dev Traqueur-dev released this 30 Nov 18:10
· 7 commits to master since this release

πŸ“¦ 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 jda module: Native support for Discord bots with JDA 6.1.2
    • Command<T>: Base class for Discord slash commands
    • JDAPlatform<T>: CommandPlatform implementation for Discord
    • JDAExecutor: Event handler for Discord interactions
    • JDAArguments: Extension of Arguments with 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 command
    • MathCommand: 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 errors
    • UpdaterInitializationException: Exception for updater initialization errors
  • Replaced generic RuntimeException:
    • In CommandManager: Using CommandRegistrationException with contextual messages
    • In SpigotPlatform: More explicit error messages during registration

Arguments API Improvements

  • Visibility changes:
    • arguments and logger are now protected instead of private
    • Allows extension by classes like JDAArguments
  • New utility methods:
    • has(String key): Check if an argument exists
    • getLogger(): 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 registerSubCommands and unregisterSubCommands
    • getAliases() 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.gradle and jitpack.yml
  • Workflow simplification: Removed redundant test task in CI workflow (keeps only testAll)

πŸ“‚ Architecture

New Modules

  • jda/: Discord/JDA support
    • Main classes: Command, JDAPlatform, JDAExecutor, JDAArguments, RoleRequirement
  • jda-test-bot/: Demo bot
    • Classes: TestBot, PingCommand, MathCommand, UserInfoCommand

New Core Classes

  • CommandRegistrationException
  • UpdaterInitializationException

πŸ“ Migration Notes

For API Users

  • No breaking changes: All modifications are backward compatible
  • Classes inheriting from Arguments can now access arguments and logger as protected members

For New Discord Projects

  • Add the platform-jda dependency to use CommandsAPI with Discord
  • Check the jda-test-bot module 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