Skip to content

v3.0.0-beta.3

Choose a tag to compare

@freya022 freya022 released this 22 Jul 15:46
· 354 commits to 3.X since this release
21a46a6

JDA

Added BotCommandsMessages and PermissionLocalization (#236)

DefaultMessages and DefaultMessagesFactory are deprecated in favor of:

  • BotCommandsMessages for the messages used by the framework
  • PermissionLocalization for DefaultMessage#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 MessageCreateData instead of a String, 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-spring artifact

Dependencies

  • Some compile dependencies 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 RateLimitHandler methods

Deprecations

Default DI

  • Deprecated DefaultServiceContainer, renamed to BCServiceContainer

Changes

Modules

  • The BotCommands artifact 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 block specified as being called EXACTLY_ONCE, this has been corrected to AT_MOST_ONCE

    • runCatchingResponse
    • runIgnoringResponse
    • runIgnoringResponseOrNull
    • runCatchingRest

    See c4deec1152 for 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 ClassGraphProcessor instances at startup, mainly used by other modules
    • Is opt-in via @ExperimentalReflectionApi

Bug fixes

Default DI

  • Fix BServiceConfig#serviceSupplier not being used
  • Fix supplied services being unable to be retrieved by their primary type

Database

  • Fix DBResult's iterator not fetching values when hasNext() 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>