Skip to content

Releases: discord-jda/JDA

v5.0.0-beta.14 | Media Channels, Custom Status, LRU Cache

29 Sep 15:16
b3ba5f0
Compare
Choose a tag to compare

Overview

This brings JDA up to date with newly released API features and fixes a few issues.

Support for Custom Status (#2521)

Many years ago, the "Custom Status" feature has been released on Discord, but has since been limited to client users. With a change recently, bots have finally been granted access to set this custom status as well. This, however, is limited to only setting the text value and no emoji.

You can set a custom status using Activity.customStatus(text).

Media Channels (#2516)

Discord is rolling out another new channel type. This time the type is a derivation of forum channels, specifically designed to share media such as images or videos. This release adds support for media channels.

A few places now return the new abstraction IPostContainer, where previously a ForumChannel was used. This abstraction is used to deduplicate and expand the API to handle both media and forum channels equally, as both of these types handle posts (threads with start messages).

LRU Member Cache (#2506)

The member cache has become slightly more powerful by introducing the new LRUMemberCachePolicy. A Least-Recently-Used (LRU) cache keeps members cached based on activity.

Example:

MemberCachePolicy.VOICE                             // Keep in cache if currently in voice (skip LRU and ONLINE)
    .or(MemberCachePolicy.ONLINE)                   // Otherwise, only add to cache if online
    .and(MemberCachePolicy.lru(1000)                // keep 1000 recently active members
        .unloadUnless(MemberCachePolicy.VOICE))     // only unload if they are not in voice

New Features

Changes

Bug Fixes

Full Changelog: v5.0.0-beta.13...v5.0.0-beta.14

Installation

Gradle

repositories {
    mavenCentral()
}
dependencies {
    implementation("net.dv8tion:JDA:5.0.0-beta.14")
}

Maven

<dependency>
    <groupId>net.dv8tion</groupId>
    <artifactId>JDA</artifactId>
    <version>5.0.0-beta.14</version> 
</dependency>

v5.0.0-beta.13

06 Aug 14:16
c0582c5
Compare
Choose a tag to compare

Overview

This release includes a few bug fixes and a new FileUpload variant to optimize memory usage when uploading larger files.

Supplier FileUpload (#2508)

With the new FileUpload.fromStreamSupplier, an upload will no longer retain the entire file content in memory. This comes at the cost of having to re-read the source each time.

Example:

FileUpload.fromStreamSupplier("image.png", () -> {
    return new FileInputStream("myimage.png");
});

Each time the request is attempted, which can be more than once due to rate-limit retries, the supplier is used to create a new readable input stream of the file. Once the request successfully writes the entire body, the stream is closed again.

Note that the supplier must always return a new instance or reset the stream accordingly.

Getting Message Author from Reactions (#2499)

The MessageReactionAddEvent now provides the author id of the original message. This can be useful in situations where retrieving the message is too expensive.

New Features

Changes

Bug Fixes

Full Changelog: v5.0.0-beta.12...v5.0.0-beta.13

Installation

Gradle

repositories {
    mavenCentral()
}
dependencies {
    implementation("net.dv8tion:JDA:5.0.0-beta.13")
}

Maven

<dependency>
    <groupId>net.dv8tion</groupId>
    <artifactId>JDA</artifactId>
    <version>5.0.0-beta.13</version> 
</dependency>

v5.0.0-beta.12 | Bug fixes

01 Jul 18:45
d2ee6ae
Compare
Choose a tag to compare

Overview

This release fixes a few annoying bugs that were introduced by the username changes.

Bug Fixes

Full Changelog: v5.0.0-beta.11...v5.0.0-beta.12

Installation

Gradle

repositories {
    mavenCentral()
}
dependencies {
    implementation("net.dv8tion:JDA:5.0.0-beta.12")
}

Maven

<dependency>
    <groupId>net.dv8tion</groupId>
    <artifactId>JDA</artifactId>
    <version>5.0.0-beta.12</version> 
</dependency>

v5.0.0-beta.11 | Bug fixes and embed from json

19 Jun 13:58
3ebfac1
Compare
Choose a tag to compare

Overview

This release fixes a few issues introduced by the username changes. It also introduces EmbedBuilder.fromData as a way to deserialize embeds from JSON.

There are also some changes to our online presence.

  • The JDA repository has moved to the discord-jda GitHub organization
  • The javadocs moved away from the Jenkins CI host to GitHub pages and can be found at our wiki domain docs.jda.wiki
  • All commits on the master branch will from now on build and upload artifacts using the Artifacts Workflow. Those artifacts stay up for a total of 90 days and can be downloaded as a zip file. All releases will continue to provide artifacts for that specific version indefinitely.

Create Embeds From JSON (#2471)

Using the new EmbedBuilder.fromData factory method, you can now create embed instances from JSON or ETF data.

MessageEmbed embed = new EmbedBuilder().setDescription("Hello, friend").build();

byte[] data = embed.toData().toJson(); // serialize to json data
Files.write(path, json); // store the embed somewhere on disk

DataObject json = DataObject.fromJson(Files.newInputStream(path)); // load the json data
MessageEmbed reconstructed = EmbedBuilder.fromData(json).build(); // reconstruct the same embed using the builder

New Features

Bug Fixes

Full Changelog: v5.0.0-beta.10...v5.0.0-beta.11

Installation

Gradle

repositories {
    mavenCentral()
}
dependencies {
    implementation("net.dv8tion:JDA:5.0.0-beta.11")
}

Maven

<dependency>
    <groupId>net.dv8tion</groupId>
    <artifactId>JDA</artifactId>
    <version>5.0.0-beta.11</version> 
</dependency>

v5.0.0-beta.10

04 Jun 14:01
6d48c21
Compare
Choose a tag to compare

Overview

With this release, we are taking the first steps to transition into the new username system for Discord by marking some methods as incubating or deprecated. This release also introduces support for AutoMod, both events and changing the AutoMod rules of a guild.

AutoMod Support (#2429)

You can now modify the AutoMod rules of a guild using AutoModRuleData and Guild#createAutoModRule.

Support for member profile AutoMod has not been added yet, due to the API being very unstable still.

Example

guild.createAutoModRule(
  AutoModRule.onMessage("No morbius memes", TriggerConfig.keywordFilter("*morb*"))
             .putResponses(AutoModResponse.blockMessage("This meme is unfunny."))
).queue();

Username Changes (#2462)

Discord is changing to globally unique usernames and removing discriminators, this is explained in their blog post. We are taking the first steps to transition with this release.

Deprecated Features

  • JDA#getUserByTag
  • Guild#getMemberByTag
  • User#getDiscriminator
  • User#getAsTag
  • SelfUpdateDiscriminatorEvent
  • UserUpdateDiscriminatorEvent
  • AccountManager#setName

Incubating Features

These are likely to be deprecated and removed in the future.

  • JDA#getUsersByName
  • Guild#getMembersByName

Other Changes

  • In the future, User#getDiscriminator will return "0000" for users who have a globally unique username from the new system.
  • A new User#getEffectiveName has been introduced to get the "effective display name" of a user, meaning either the User#getGlobalName or User#getName. This also affects Member#getEffectiveName, which will now return based on precedence guild nickname > global name > username.
  • User#getDefaultAvatarId now depends on the user id instead of the discriminator (when they have the discriminator 0000)

New Features

Changes

Bug Fixes

Full Changelog: v5.0.0-beta.9...v5.0.0-beta.10

Installation

Gradle

repositories {
    mavenCentral()
}
dependencies {
    implementation("net.dv8tion:JDA:5.0.0-beta.10")
}

Maven

<dependency>
    <groupId>net.dv8tion</groupId>
    <artifactId>JDA</artifactId>
    <version>5.0.0-beta.10</version> 
</dependency>

v5.0.0-beta.9 | Bug fixes and new permissions

04 May 08:59
a7141b3
Compare
Choose a tag to compare

Overview

This release fixes a few critical bugs related to rate-limiting. We also added support for voice message receiving and new permissions relating to soundboards.

You can now use EmbedBuilder#setUrl to create multi-image embeds. To create multi-image embeds, simply create one embed for each image and set the same URL on all of them. The client automatically merges embeds with the same URL.

Features

Changes

Bug Fixes

Full Changelog: v5.0.0-beta.8...v5.0.0-beta.9

Installation

Gradle

repositories {
    mavenCentral()
}
dependencies {
    implementation("net.dv8tion:JDA:5.0.0-beta.9")
}

Maven

<dependency>
    <groupId>net.dv8tion</groupId>
    <artifactId>JDA</artifactId>
    <version>5.0.0-beta.9</version> 
</dependency>

v5.0.0-beta.8 | Hotfix NullPointerException

10 Apr 11:12
d8d2df6
Compare
Choose a tag to compare

Overview

This is a small hotfix release for an error introduced in beta 7.

Features

Bug Fixes

Full Changelog: v5.0.0-beta.7...v5.0.0-beta.8

Installation

Gradle

repositories {
    mavenCentral()
}
dependencies {
    implementation("net.dv8tion:JDA:5.0.0-beta.8")
}

Maven

<dependency>
    <groupId>net.dv8tion</groupId>
    <artifactId>JDA</artifactId>
    <version>5.0.0-beta.8</version> 
</dependency>

v5.0.0-beta.7 | Customize Rate-Limiter

09 Apr 13:04
f3e60ed
Compare
Choose a tag to compare

Overview

You can now use RestConfig to customize parts of the REST handling in JDA. This allows you to create custom rate-limiter implementations and make use of rate-limit proxy services such as http-proxy.

Rate-Limiter Customization (#2307)

Using RestConfig, you can change parts of the REST handling. This allows you to append to the User-Agent, add custom headers, or even completely replace the existing Rate-Limiter handling:

RestConfig config = new RestConfig();
config.setUserAgentSuffix("custom suffix"); // Changes user-agent to "DiscordBot(JDA, ...) custom suffix"
config.setBaseUrl("https://proxy.example.com/api/v10"); // requests will now go through this endpoint, allowing custom rate-limits
config.setRateLimiterFactory(...); // change the handling of rate-limits

builder.setRestConfig(config); // then simply set it on your JDABuilder or DefaultShardManagerBuilder

This can also be useful to implement a different queue system for rate-limit handling. By default, JDA will always use the SequentialRateLimiter, which handles requests to the same rate-limit bucket in sequence to avoid messages being unordered. A custom implementation could replace this to run requests in parallel.

To implement a custom rate-limiter, use the existing RestRateLimiter interface and implement the required methods as documented. Your implementation will be provided with Work instances to handle.

Member Flags (#2417)

You can now access the flags on members and modify them. This allows to check if a member has rejoined the guild or passed onboarding. The rejoin flag is not entirely reliable, since Discord has only started tracking rejoins recently. Members who rejoined years ago will not have this flag set.

With Member#modifyFlags, you can change some of these flags. Only a subset of the existing flags are modifiable.

EnumSet<MemberFlag> flags = member.getFlags();
flags.add(MemberFlag.BYPASS_VERIFICATION); // Member bypasses verification level on guild
member.modifyFlags(flags).queue();

Features

Changes

Bug Fixes

Full Changelog: v5.0.0-beta.6...v5.0.0-beta.7

Installation

Gradle

repositories {
    mavenCentral()
}
dependencies {
    implementation("net.dv8tion:JDA:5.0.0-beta.7")
}

Maven

<dependency>
    <groupId>net.dv8tion</groupId>
    <artifactId>JDA</artifactId>
    <version>5.0.0-beta.7</version> 
</dependency>

v5.0.0-beta.6 | Messages in Stage Channels

19 Mar 15:58
b74be90
Compare
Choose a tag to compare

Overview

This release adds support for messages and interactions inside stage channels.

New Features

Changes

Bug Fixes

  • Fix NPE when adding choices on unsupported option types by @freya022 in #2418

Full Changelog: v5.0.0-beta.5...v5.0.0-beta.6

Installation

Gradle

repositories {
    mavenCentral()
}
dependencies {
    implementation("net.dv8tion:JDA:5.0.0-beta.6")
}

Maven

<dependency>
    <groupId>net.dv8tion</groupId>
    <artifactId>JDA</artifactId>
    <version>5.0.0-beta.6</version> 
</dependency>

v5.0.0-beta.5 | Hotfix voice connection issues

01 Mar 18:07
2328104
Compare
Choose a tag to compare

Overview

This is a minor release with some important bug fixes. All bots relying on voice connections should apply this update as soon as possible.

Changes

Bug Fixes

Full Changelog: v5.0.0-beta.4...v5.0.0-beta.5

Installation

Gradle

repositories {
    mavenCentral()
}
dependencies {
    implementation("net.dv8tion:JDA:5.0.0-beta.5")
}

Maven

<dependency>
    <groupId>net.dv8tion</groupId>
    <artifactId>JDA</artifactId>
    <version>5.0.0-beta.5</version> 
</dependency>