Skip to content

v3.0.0-beta.1 | Component data serialization, removed old declarations

Latest
Compare
Choose a tag to compare
@freya022 freya022 released this 18 Feb 22:46
d2c6123

JDA version

Overview

Added component data serialization, few minor additions and finally removed old declarations.

It has been 84 years...
As a reminder, while the major changes are done, some smaller changes and/or deprecations might be necessary in the future, to always improve the development experience, adopt newer features and better practices.

While there is no complete migration guide, you are welcome to ask in the support server.

Note about the previous release

The meaning of CommandScope#GLOBAL was changed in the previous release; You can learn more about it in the "Breaking changes" section.

Removed all deprecated declarations (#212)

If you're having compilation errors, downgrade to 3.0.0-alpha.24 and:

  • Do a full recompile to see the deprecation warnings,
  • Or, use your IDE to inspect your project.

Support for component data serialization (#231)

This enables you to pass any data to your component and timeout handlers, as long as they are serializable.

Any serialization library can be used, Jackson, Gson, kotlinx.serialization, Protobuf, Java's serialization (???), you name it.

Breaking changes

  • The String arg parameter have been replaced with a data argument of type SerializedComponentData
  • A SerializedComponentData serialize(R) method has been added
  • A new migration script has been added, if you are using a migration tool already, you do not need to do anything

New features

  • Added @SerializableComponentData and @SerializableTimeoutData
    • Can be used instead of @ComponentData/@TimeoutData to (de)serialize objects using GlobalComponentDataSerializer
    • GlobalComponentDataSerializer has a default instance, which can be overridden by creating your own instance.

Breaking changes

Components

  • Require >=42.7.5 of the PostgreSQL first party driver (required by #231)
    • You can still use H2, which does not require a minimum version
    • You will be warned when using a third party PostgreSQL driver

Deprecations

Misc

  • Deprecated typeReferenceOf
    • Replaced by jackson-module-kotlin's jacksonTypeRef

Changes

Dependencies

  • Added jackson-module-kotlin v2.17.2, same version as what JDA uses

New features

Misc

  • Added static factories for KotlinTypeToken
    • Similar to Gson's TypeToken static methods, or the Jackson ObjectMapper's methods returning TypeReferences
  • Added ParameterWrapper#typeToken
    • Return a KotlinTypeToken, a more general purpose object

Don't hesitate to check out the examples and the wiki.

Full Changelog: v3.0.0-alpha.24...v3.0.0-beta.1

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.1")
}

Maven

<dependency>
    <groupId>io.github.freya022</groupId>
    <artifactId>BotCommands</artifactId>
    <version>3.0.0-beta.1</version>
</dependency>