v3.0.0-beta.3
Added BotCommandsMessages and PermissionLocalization (#236)
DefaultMessages and DefaultMessagesFactory are deprecated in favor of:
BotCommandsMessagesfor the messages used by the frameworkPermissionLocalizationforDefaultMessage#getPermission
Deprecation process
If a non-default configuration of DefaultMessages is detected, the auto-configured BotCommandsMessagesFactory instance will delegate to it instead, and you will see a warning about the deprecation.
Differences
BotCommandsMessages is similar to DefaultMessages, however:
- The template keys have been changed as to allow nesting in some cases
- Each method returns a
MessageCreateDatainstead of aString, allowing you to fully customize the responses (such as by using Components V2 👀) - The method names were shortened
The default strings were unchanged.
Migrating
If you made DefaultMessages[language].json files, you will need to replace DefaultMessages by BotCommandsMessages, then migrate the keys to the new ones found in BotCommandsMessages-default.json.
Breaking changes
Modules
- Spring support was moved to a separate
BotCommands-springartifact
Dependencies
-
Some
compiledependencies are no longer included transitively:You do not need to depend on them unless your code compiles against them in your project
-
Optional dependencies are no longer in the published POM, this does not affect your project at all
Rate limiting
- Generics were removed from
RateLimitHandlermethods
Deprecations
Default DI
- Deprecated
DefaultServiceContainer, renamed toBCServiceContainer
Changes
Modules
- The
BotCommandsartifact will be split in more submodules, those new modules will still be included transitively
Slash commands
- Allows vararg parameters to be received with 0 required options (#234)
Text commands
- Enforce at least 1 required option when using varargs (#234)
Core configuration
JDAService#getDefaultRestConfig()now appends a link to itself in the HTTP User-Agent
Extensions
-
Some extensions had a wrong contract with the
blockspecified as being calledEXACTLY_ONCE, this has been corrected toAT_MOST_ONCErunCatchingResponserunIgnoringResponserunIgnoringResponseOrNullrunCatchingRest
See
c4deec1152for more details
Dependencies
- Updated Kotlin to 2.2.0
- Updated JDA to 5.6.1
- Updated Jackson to 2.19.1
New features
Components
- Added
ButtonFactory#toLabelButton()(e.g.buttons.primary("Page 1/5").toLabelButton())- Allows creating disabled buttons for display purposes
Default DI
- Added
@ConditionalOnMissingService
Reflection
- Added
ClassGraphProcessorProvider- This is an SPI returning
ClassGraphProcessorinstances at startup, mainly used by other modules - Is opt-in via
@ExperimentalReflectionApi
- This is an SPI returning
Bug fixes
Default DI
- Fix
BServiceConfig#serviceSuppliernot being used - Fix supplied services being unable to be retrieved by their primary type
Database
- Fix
DBResult's iterator not fetching values whenhasNext()was not called
Rate limiting
- Don't attempt to delete rate limit message if the channel was deleted
Don't hesitate to check out the examples and the wiki.
Full Changelog: v3.0.0-beta.2...v3.0.0-beta.3
Installation
As a reminder, the minimum Java version supported is Java 17.
Kotlin Gradle
repositories {
mavenCentral()
}
dependencies {
implementation("io.github.freya022:BotCommands:3.0.0-beta.3")
}Maven
<dependency>
<groupId>io.github.freya022</groupId>
<artifactId>BotCommands</artifactId>
<version>3.0.0-beta.3</version>
</dependency>