v6.0.0-rc.5 | Modal Components and Serialization
Pre-release
Pre-release
Overview
This release adds support for more components in Modals and reintroduces serialization for all components.
Modal Components (#2913)
In the previous release, support for StringSelectMenu
within modals has been added. This is now expanded to also include EntitySelectMenu
and TextDisplay
components.
The TextDisplay
component has full markdown support, which allows you to create more fleshed out modals than before:
Modal.create("modal", "Role Request Form")
.addComponents(
TextDisplay.of("""
**Welcome!**
Please read the following before continuing:
- Select a user to request a role for
- A moderator will review your request
- Abuse of this system may result in penalties
"""),
Label.of(
"Role",
EntitySelectMenu.create("role-select", SelectTarget.ROLE).build()
)
)
.build();
Results in this modal being shown:

Serialization and Deserialization (#2906)
We've added a new ComponentSerializer
and ComponentDeserializer
, which can be used to serialize components into DataObject
and FileUpload
instances. This replaces the previous component.toData()
from JDA 5, with a new serializer.serialize(component)
.
Example:
ComponentSerializer serializer = new ComponentSerializer();
List<DataObject> serializedComponents = serializer.serializeAll(message.getComponents());
List<FileUpload> files = serializer.getFileUploads(message.getComponents());
// use serialized component
// ...
// Or deserialize them if you get them from another source
// Here we pass in the List<FileUpload> used by the components
ComponentDeserializer deserializer = new ComponentDeserializer(files);
MessageComponentTree tree = deserializer.deserializeAsTree(MessageComponentTree.class, serializedComponents);
New Features
- Add ComponentSerializer and ComponentDeserializer by @MinnDevelopment in #2906
- Add TextInput#of shortcut by @MinnDevelopment in #2908
- Add
StringSelectMenu.Builder#isRequired()
by @freya022 in #2911 - Add entity selects and text displays in modals by @freya022 in #2913
Changes
Bug Fixes
- Remove unnecessary escaping while creating a masked link by @Alf-Melmac in #2910
Full Changelog: v6.0.0-rc.4...v6.0.0-rc.5
Installation
Gradle
repositories {
mavenCentral()
}
dependencies {
implementation("net.dv8tion:JDA:6.0.0-rc.5")
}
Maven
<dependency>
<groupId>net.dv8tion</groupId>
<artifactId>JDA</artifactId>
<version>6.0.0-rc.5</version>
</dependency>