Skip to content

v6.0.0-rc.4 | Change to Modals

Pre-release
Pre-release
Compare
Choose a tag to compare
@MinnDevelopment MinnDevelopment released this 02 Sep 14:08
· 11 commits to master since this release
dd9d743

Overview

This release primarily introduces breaking changes to Modals. Discord has finally added support for StringSelectMenu in Modals, which comes with a minor breaking change in how Modals are created.

image

Breaking Changes

With the update to Modals, we removed legacy functionality around ActionRow in Modal. Instead of using ActionRow.of(...), modals make use of the new Label components instead.

Before:

Modal.create("modal", "My Modal")
    .addComponents(
      ActionRow.of(TextInput.create("input", "My Custom Label", TextInputStyle.SHORT).build()))
    .build();

After:

Modal.create("modal", "My Modal")
    .addComponents(
      Label.of("My Custom Label", TextInput.create("input", TextInputStyle.SHORT).build()))
    .build();

With this update, you can now also use StringSelectMenu in Modals, which can also be added using the Label component.

Label.of("My Custom Label",
    StringSelectMenu.create("menu-custom-id")
        .addOption("My option", "option-1")
        .build())

When a user submits a modal with a select menu, the values are available in the ModalInteractionEvent using getValue("menu-custom-id").getAsStringList().

New Features

  • Add support for Label and StringSelectMenu in Modals by @Xirado in #2162

Bug Fixes

Full Changelog: v6.0.0-rc.3...v6.0.0-rc.4

Installation

Gradle

repositories {
    mavenCentral()
}
dependencies {
    implementation("net.dv8tion:JDA:6.0.0-rc.4")
}

Maven

<dependency>
    <groupId>net.dv8tion</groupId>
    <artifactId>JDA</artifactId>
    <version>6.0.0-rc.4</version> 
</dependency>