Releases: discord-jda/JDA
v5.3.0 | User-Installable Apps
Overview
After many months of waiting, this release finally adds support for user-installable apps. This will allow you to make use of interactions (and especially commands) anywhere on Discord, by installing the application on a user directly instead of a guild.
Creating User-Installable Apps
To create a user-installable app, you first have to enable the feature in your application dashboard in the installation settings:
Once enabled, you can create user-installable commands, by changing the integration types:
Commands.slash("say", "Makes the bot say what you tell it to")
// Allow the command to be used anywhere (Bot DMs, Guild, Friend DMs, Group DMs)
.setContexts(InteractionContextType.ALL)
// Allow the command to be installed on users instead of guilds
.setIntegrationTypes(IntegrationType.USER_INSTALL)
.addOption(STRING, "content", "What the bot should say", true)
Installing to a User
To actually install your app to a user, you can use the generator provided by discord. In the OAuth2 URL Generator, change the integration type to User Install:
The generated link, can now be used to install your application to the authorizing user.
Detached Guilds / Roles / Channels / Members
This comes with a few changes to expectations around JDA functionality. Since interactions can now come from anywhere on Discord, some features aren't available in certain contexts.
Some entities can now appear as Detachable Entity, which essentially means that they come from a guild or private channel, that your bot is not directly involved in.
For instance, if a command is installed on a user and that command is used in a guild, your bot is not necessarily a member of that guild. Since the bot is not a member, it only has access to the guild context, that the interaction event provides. Many features such as channels, roles, or members are not accessible without being an actual member of the guild. If you try to use or access anything that isn't accessible, JDA will throw a new DetachedEntityException.
New Features
- Add
Guild#retrieveMemberVoiceState
by @PascalNB in #2729 - Add support for user-installable apps by @freya022 in #2633
Full Changelog: v5.2.3...v5.3.0
Installation
Gradle
repositories {
mavenCentral()
}
dependencies {
implementation("net.dv8tion:JDA:5.3.0")
}
Maven
<dependency>
<groupId>net.dv8tion</groupId>
<artifactId>JDA</artifactId>
<version>5.3.0</version>
</dependency>
v5.2.3
Small bug fix release.
Bug Fixes
- Adjust MAX_FILE_SIZE to 10 MiB by @sebm253 in #2777
- Fix checking empty embeds by @freya022 in #2790
- Fix channel cache lock handling by @MinnDevelopment in #2795
Changes
Full Changelog: v5.2.2...v5.2.3
Installation
Gradle
repositories {
mavenCentral()
}
dependencies {
implementation("net.dv8tion:JDA:5.2.3")
}
Maven
<dependency>
<groupId>net.dv8tion</groupId>
<artifactId>JDA</artifactId>
<version>5.2.3</version>
</dependency>
v5.2.2
Small bug fix release.
Bug Fixes
- Fix EntitySelectMenu Doc by @LoicMaitreDuFeu in #2772
- Fixing Get Poll Answers endpoint limit from 1000 to 100 by @FreshSupaSulley in #2780
- Check mute/deafen permissions using the channel by @freya022 in #2781
- Fix
DefaultShardManagerBuilder#setDisabledIntents
by @freya022 in #2785
Full Changelog: v5.2.1...v5.2.2
Installation
Gradle
repositories {
mavenCentral()
}
dependencies {
implementation("net.dv8tion:JDA:5.2.2")
}
Maven
<dependency>
<groupId>net.dv8tion</groupId>
<artifactId>JDA</artifactId>
<version>5.2.2</version>
</dependency>
v5.2.1
Small bug fix release.
Bug Fixes
- Fix GuildManager#setSafetyAlertsChannel by @MinnDevelopment in #2765
- Correctly handle disabled intent in setEnabledIntents by @MinnDevelopment in #2767
- Ensure label cannot be null in Button by @MinnDevelopment in #2771
- Handle user in EntityBuilder#createApplicationEmoji as optional by @Xirado in #2769
Full Changelog: v5.2.0...v5.2.1
Installation
Gradle
repositories {
mavenCentral()
}
dependencies {
implementation("net.dv8tion:JDA:5.2.1")
}
Maven
<dependency>
<groupId>net.dv8tion</groupId>
<artifactId>JDA</artifactId>
<version>5.2.1</version>
</dependency>
v5.2.0 | Application emoji and premium buttons
Overview
This release adds some new features for applications. We've also started working on more compliance tests to make contributing and reviewing changes easier.
Premium Buttons (#2752)
The interaction response replyWithPremiumRequired
is being phased out in favor of custom messages with a new button style Button.premium(sku)
to upsell specific premium features instead.
You can change your code to a simple reply(content)
with this button as a component.
event.reply("This feature is only available for premium users.")
.addActionRow(Button.primary(SkuSnowflake.fromId(PREMIUM_FEATURE_SKU)))
.setEphemeral(true)
.queue();
For more info, see the official Discord Changelog.
Application Emoji (#2726)
Your bot can now manage emoji with JDA by using JDA#createApplicationEmoji
. These emojis can then be used like any other emoji with Emoji.fromCustom(name, id, animated)
.
New Features
- Added Safety Alerts Channel by @RealYusufIsmail in #2725
- Add
ScheduledEvent::getJumpUrl
by @raul1ro in #2736 - Add premium buttons by @freya022 in #2752
- Add support for Application Emoji by @yoyosource in #2726
Bug Fixes
- Fix handling of passing null to setMessageReference by @MinnDevelopment in #2749
Changes
- Deprecated
GatewayIntent#GUILD_EMOJIS_AND_STICKERS
in favor ofGUILD_EXPRESSIONS
by @freya022 in #2755 - Remove deprecated permission constants
- Remove deprecated and stage instance privacy level
Full Changelog: v5.1.2...v5.2.0
Installation
Gradle
repositories {
mavenCentral()
}
dependencies {
implementation("net.dv8tion:JDA:5.2.0")
}
Maven
<dependency>
<groupId>net.dv8tion</groupId>
<artifactId>JDA</artifactId>
<version>5.2.0</version>
</dependency>
v5.1.2 | Message Forwarding and Voice Messages
Overview
This release adds support for new message features.
Forwarding messages (#2744)
You can now handle forwarded messages using the new message snapshots.
@Override
public void onMessageReceived(MessageReceivedEvent event) {
MessageReference messageReference = event.getMessage().getMessageReference();
// Forwarded messages have a reference of type FORWARD
if (messageReference != null && messageReference.getType() == MessageReference.MessageReferenceType.FORWARD) {
// The content of the forwarded message is provided as a snapshot
MessageSnapshot snapshot = event.getMessage().getMessageSnapshots().getFirst();
System.out.println("Received forwarded message with content: " + snapshot.getContentRaw());
}
}
A bot can also forward a message using Message#fowardTo
. Note that a forwarded message cannot contain any additional content.
Voice messages (#2738)
You can now send voice messages with JDA, by utilizing the new FileUpload#asVoiceMessage
method on your audio attachments.
channel.sendFiles(
FileUpload.fromData(audioFile)
.asVoiceMessage(MediaType.parse("audio/ogg"), waveform, 10.5) // 10.5 seconds audio/ogg message
).queue();
To create a voice message, you must first determine the audio media type of your voice message and sample a waveform up to 256 bytes. Voice messages require a valid audio/*
media type like audio/ogg
.
The waveform is used to render the voice message shape in the preview. It must not be an accurate sampling of the actual audio.
New Features
- Add support for message forwarding by @MinnDevelopment in #2744
- Support sending voice messages by @MinnDevelopment in #2738
Bug Fixes
Full Changelog: v5.1.1...v5.1.2
Installation
Gradle
repositories {
mavenCentral()
}
dependencies {
implementation("net.dv8tion:JDA:5.1.2")
}
Maven
<dependency>
<groupId>net.dv8tion</groupId>
<artifactId>JDA</artifactId>
<version>5.1.2</version>
</dependency>
v5.1.1 | Small bugfix release
Overview
Small release to fix a few bugs. This fixes an issue that caused voice receive to no longer work as intended in 5.1.0.
Bug Fixes
- Remove extension from received audio packets by @davidffa in #2721
- Remove
@CheckReturnValue
from Once.Builder.subscribe by @freya022 in #2730 - Fix parsing error for AutoModResponse by @StasiumDev in #2728
Full Changelog: v5.1.0...v5.1.1
Installation
Gradle
repositories {
mavenCentral()
}
dependencies {
implementation("net.dv8tion:JDA:5.1.1")
}
Maven
<dependency>
<groupId>net.dv8tion</groupId>
<artifactId>JDA</artifactId>
<version>5.1.1</version>
</dependency>
v5.1.0 | Voice Gateway v8
Overview
This release updates the implementation of the voice gateway to API version 8 (previously 4). Previous versions will be incompatible coming November 18, 2024. This includes adding a new dependency on tink, to support the new encryption modes.
Additionally, the MessageEmbedEvent
has been removed. Discord sends standard update events for embed loading now, this event can no longer be supported.
New Features
- Add new message and embed types by @MinnDevelopment in #2716
Changes
- Upgrade to voice gateway v8 by @MinnDevelopment in #2717
- Remove MessageEmbedEvent by @MinnDevelopment in #2720
Bug Fixes
Full Changelog: v5.0.2...v5.1.0
Installation
Gradle
repositories {
mavenCentral()
}
dependencies {
implementation("net.dv8tion:JDA:5.1.0")
}
Maven
<dependency>
<groupId>net.dv8tion</groupId>
<artifactId>JDA</artifactId>
<version>5.1.0</version>
</dependency>
v5.0.2 | Single time event listener
Overview
This release includes some bug fixes as well as a new event listener feature to add a one-time-use event listener.
Once Event Listener (#2683)
A common problem that developers run into, is "waiting" for a specific event in the context of some command. For instance, waiting for a user to add a reaction or reply with a message in response to some prompt.
This can now be achieved using the new listenOnce event listener:
// listen for a message event
jda.listenOnce(MessageReceivedEvent.class)
// filter for specific event
.filter(event -> event.getChannel().equals(channel))
.filter(event -> event.getAuthor().equals(user))
// handle timeout
.timeout(timeout, () -> hook.editOriginal("Timeout!").queue())
// subscribe to first event that matches filters
.subscribe(event -> {
hook.editOriginal("You sent: " + event.getMessage().getContentRaw()).queue();
});
New Features
- Add
TeamMember.RoleType
by @freya022 in #2703 - Add abstract
createCopy
method inSelectMenu
by @Kaktushose in #2684 - Add
JDA#listenOnce
by @freya022 in #2683 - Add support for profile automod by @MinnDevelopment in #2580
Changes
- Expand list of retried http error codes by @MinnDevelopment in #2710
- Update to Jackson 2.17.2 by @freya022 in #2695
Bug Fixes
Full Changelog: v5.0.1...v5.0.2
Installation
Gradle
repositories {
mavenCentral()
}
dependencies {
implementation("net.dv8tion:JDA:5.0.2")
}
Maven
<dependency>
<groupId>net.dv8tion</groupId>
<artifactId>JDA</artifactId>
<version>5.0.2</version>
</dependency>
v5.0.1 | Hotfix shard manager thread handling
Overview
Small hotfix release, fixes problem with default thread config for DefaultShardManager
. This caused requests to fail if a shard is stopped or restarted.
Bug Fixes
- Fix automatic shutdown for elastic pool by @MinnDevelopment in #2704
Full Changelog: v5.0.0...v5.0.1
Installation
Gradle
repositories {
mavenCentral()
}
dependencies {
implementation("net.dv8tion:JDA:5.0.1")
}
Maven
<dependency>
<groupId>net.dv8tion</groupId>
<artifactId>JDA</artifactId>
<version>5.0.1</version>
</dependency>