v5.4.0 | Interaction callback response and security incidents
Access the created or updated message from interaction replies (#2798)
You can now use InteractionHook#getCallbackResponse to access the messages created by interaction replies.
@Override
public void onSlashCommandInteraction(SlashCommandInteractionEvent event) {
event.reply("React with your favorite emoji")
.map(hook -> hook.getCallbackResponse().getMessage())
.flatMap(message -> message.addReaction(emoji))
.queue();
}
Previously, this could be done using an additional retrieveOriginal
request. To reduce requests and improve responsiveness, we recommend preferring this new getter instead.
Guild security incidents (#2577)
With guild security incidents, you can now be aware when Discord detects raids or spam in direct messages in a guild. These detections are available with Guild#getSecurityIncidentDetections and are updated with GuildUpdateSecurityIncidentDetectionsEvent.
Additionally, you can modify the security incident actions to temporarily pause invites or disable direct messages in your guild. See Guild#modifySecurityIncidents for details.
guild.modifySecurityIncidents(SecurityIncidentActions.enabled(
// Pause invites for 2 hours
OffsetDateTime.now().plusHours(2),
// Disable direct messages for 1 hour
OffsetDateTime.now().plusHours(1)
)).queue();
// Or disable security incident actions prematurely
guild.modifySecurityIncidents(SecurityIncidentActions.disabled()).queue();
New Features
- Add interaction callback response handling by @Xirado in #2798
- Add support for guild security incidents by @MinnDevelopment in #2577
- Add a way to retrieve users that used super reaction by @MTM123 in #2786
- Add Guild#retrieveScheduledEvents by @senseiwells in #2800
Changes
Bug Fixes
- Prevent firing voice state update events if member is not cached by @freya022 in #2773
- Fix
FileProxy#withClient
return types by @freya022 in #2698
Full Changelog: v5.3.2...v5.4.0
Installation
Gradle
repositories {
mavenCentral()
}
dependencies {
implementation("net.dv8tion:JDA:5.4.0")
}
Maven
<dependency>
<groupId>net.dv8tion</groupId>
<artifactId>JDA</artifactId>
<version>5.4.0</version>
</dependency>