Skip to content

Releases: discord-jda/JDA

v5.3.0 | User-Installable Apps

02 Feb 15:02
4d372fd
Compare
Choose a tag to compare

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:

firefox_X9eJoKZ88K

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:

firefox_VGe9NK4Xld

The generated link, can now be used to install your application to the authorizing user.

image

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

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

26 Jan 14:23
c37908a
Compare
Choose a tag to compare

Small bug fix release.

Bug Fixes

Changes

  • Rename ApplicationEmoji#APPLICATION_EMOJI_CAP -> MAX_APPLICATION_EMOJIS by @freya022 in #2791

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

27 Dec 17:54
93e788c
Compare
Choose a tag to compare

Small bug fix release.

Bug Fixes

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

10 Nov 16:24
39e1a6e
Compare
Choose a tag to compare

Small bug fix release.

Bug Fixes

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

03 Nov 16:35
26e1ea2
Compare
Choose a tag to compare

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

Bug Fixes

Changes

  • Deprecated GatewayIntent#GUILD_EMOJIS_AND_STICKERS in favor of GUILD_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

05 Oct 10:01
5f799f1
Compare
Choose a tag to compare

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

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

21 Sep 11:55
b2eb4f7
Compare
Choose a tag to compare

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

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

21 Aug 14:45
03aab5c
Compare
Choose a tag to compare

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

Changes

Bug Fixes

  • Handle guild stickers array as optional in EntityBuilder#createGuild by @Xirado in #2714

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

04 Aug 13:44
a8bf714
Compare
Choose a tag to compare

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

Changes

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

15 Jul 17:58
bc9187a
Compare
Choose a tag to compare

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

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>