Releases: discord-jda/JDA
v5.0.0-beta.12 | Bug fixes
Overview
This release fixes a few annoying bugs that were introduced by the username changes.
Bug Fixes
- Fix automod execution errors from rules without an associated channel by @CheesyGamer77 in #2483
- Handle clyde in DMs correctly by @MinnDevelopment in #2489
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
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
- Support embed deserialization from JSON data by @MinnDevelopment in #2471
Bug Fixes
- Update modulo for default avatars by id by @MinnDevelopment in #2475
- Fix handling of wrong length discriminators by @MinnDevelopment in #2478
- Fix external location value to be editable on started scheduled event by @Mitmocc in #2477
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
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 theUser#getGlobalName
orUser#getName
. This also affectsMember#getEffectiveName
, which will now return based on precedenceguild nickname
>global name
>username
. User#getDefaultAvatarId
now depends on the user id instead of the discriminator (when they have the discriminator 0000)
New Features
- Add automod support by @MinnDevelopment in #2429
- Add ThreadChannel#retrieveStartMessage by @MinnDevelopment in #2438
Changes
- Improve handling of global rate-limit by @MinnDevelopment in #2465
- Start migration to new username API by @MinnDevelopment in #2462
- Improve handling of method discovery in AnnotatedEventManager by @freya022 in #2454
Bug Fixes
- Fix slow shutdown during reconnects by @MinnDevelopment in #2464
- Properly escape quotes with leading spaces by @Almighty-Satan in #2363
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
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
- Add EmbedBuilder#setUrl by @Xirado in #2449
- Add voice message read support by @RedDaedalus in #2445
Changes
- Update max file size to 25 MiB by @freya022 in #2444
- Update permissions by @MinnDevelopment in #2434
Bug Fixes
- Fix task not being marked as done on errors by @MinnDevelopment in #2451
- Handle retry-after issues better by @MinnDevelopment in #2453
- Fix docs in GuildBanEvent by @moricexy in #2460
- Fixing in EntitySelectMenu by @LoicMaitreDuFeu in #2456
- Remove timeout for rate-limit pool by @MinnDevelopment in #2458
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
Overview
This is a small hotfix release for an error introduced in beta 7.
Features
- Support custom timeout on tasks by @MinnDevelopment in #2439
Bug Fixes
- Fix NPE in shardmanager by @MinnDevelopment in #2442
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
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
- Add rate-limiter customization by @MinnDevelopment in #2307
- Add support for member flags by @MinnDevelopment in #2417
Changes
- Remove AccountType by @MinnDevelopment in #2420
- Handle new channel field on interactions by @MinnDevelopment in #2436
Bug Fixes
- Fix channel manager not using right type by @MinnDevelopment in #2428
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
Overview
This release adds support for messages and interactions inside stage channels.
New Features
- Add default_forum_layout for Forum Channel by @Mysterious-Dev in #2407
- Support messages in stage channels by @MinnDevelopment in #2399
Changes
- Count reply mentions in bag getters by @MinnDevelopment in #2409
Bug Fixes
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
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
- Add new message types by @MinnDevelopment in #2371
Bug Fixes
- Catch parsing exception for scheduled events by @MinnDevelopment in #2401
- Catch errors thrown during login validation by @MinnDevelopment in #2406
- Use 74 byte handshake by @MinnDevelopment in #2412
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>
v5.0.0-beta.4 | Audit Log Events and Silent Messages
Overview
This release adds support for recent Discord features, such as linked roles and silent messages. We also improved the user experience for shutting down, which should come in handy for anyone building reloadable plugins.
Add GuildAuditLogEntryCreateEvent (#2380)
Discord has finally introduced an event for new audit log entries. This can be used for keeping track of all kinds of moderation relevant activity in a guild. However, to receive this event you must have the View Audit Logs permission and enable the GUILD_MODERATION
intent (formerly GUILD_BANS
).
Silent Messages (#2392)
You can now send and receive messages which do not trigger desktop and mobile push notifications. This is done in the client by prefixing a message with @silent
. In JDA you can use setSuppressedNotifications(true)
to achieve the same. Note that @silent
is not the correct way to create these messages with a bot, as it is a client only feature.
You can check the release pull request for more information: discord/discord-api-docs#5910
Await Shutdown (#2269)
The shutdown logic has adapted to allow more consistent behavior. We've introduced jda.awaitShutdown()
as a way to allow blocking until all JDA subsystems reach completion. Note that this might take a long time, depending on how long your RestAction queue is at the time.
The recommended way to gracefully shutdown is to define a maximum wait threshold and use it to cancel requests after some time:
// Initating the shutdown, this closes the gateway connection and subsequently closes the requester queue
jda.shutdown();
// Allow at most 10 seconds for remaining requests to finish
if (!jda.awaitShutdown(Duration.ofSeconds(10))) { // returns true if shutdown is graceful, false if timeout exceeded
jda.shutdownNow(); // Cancel all remaining requests, and stop thread-pools
jda.awaitShutdown(); // Wait until shutdown is complete (indefinitely)
}
In order to save CPU time, we make use of conditional variables for all of our wait loops internally. This is much more efficient than using sleep polling, like suggested in the past.
New Features
- Add GuildAuditLogEntryCreateEvent by @MinnDevelopment in #2380
- Add
SUPPRESS_NOTIFICATIONS
flag for message by @Mysterious-Dev in #2393 - Add thread message positions by @freya022 in #2366
- Necessary additions for role subscriptions by @MinnDevelopment in #2375
Changes
- Improve conditional waiting and shutdown handling by @MinnDevelopment in #2269
- Add Modal.Builder#addComponents by @MinnDevelopment in #2388
Full Changelog: v5.0.0-beta.3...v5.0.0-beta.4
Installation
Gradle
repositories {
mavenCentral()
}
dependencies {
implementation("net.dv8tion:JDA:5.0.0-beta.4")
}
Maven
<dependency>
<groupId>net.dv8tion</groupId>
<artifactId>JDA</artifactId>
<version>5.0.0-beta.4</version>
</dependency>
v5.0.0-beta.3
Overview
Small release to fix a few bugs and introduce support for new API features.
GIF Sticker Support
Discord is adding support to create stickers with GIFs in the future. This release already covers support for receiving and creating them in advance of the rollout. Note that it will currently not work since the API for GIF stickers has not yet been deployed, in the meantime you will receive an invalid asset error.
Reverse Audit-Log Iteration
You can now use PaginationAction#reverse
on Guild#retrieveAuditLogs
. This allows you to iterate from the oldest entry to the newest one.
Removing Options/Subcommands from SlashCommands
You can now use conditional remove operations on SlashCommandData
to remove options and slash commands.
Example:
SlashCommandData command = SlashCommandData.fromData(json); // parsing an existing command from json
command.removeOptions(o -> o.isRequired()); // Removing all required options
Note: You still have to pass this updated command to discord using upsertCommand
or updateCommands
!
New Features
- Add support for gif stickers by @MinnDevelopment in #2377
- Add support for reverse audit-log iteration by @MinnDevelopment in #2370
- Improve implementation of command data by @MinnDevelopment in #2258
Changes
- Replace lock code with atomic int by @MinnDevelopment in #2359
- Update okhttp to 4.10.0 by @MinnDevelopment in #2382
- Change handling of speaking updates in voice connections by @MinnDevelopment in #2240
Bug Fixes
- Fix welcome channel parsing when no emoji is used by @freya022 in #2356
- Fix issues with ChannelManager#setPinned and setTagRequired by @MinnDevelopment in #2364
Full Changelog: v5.0.0-beta.2...v5.0.0-beta.3
Installation
Gradle
repositories {
mavenCentral()
}
dependencies {
implementation("net.dv8tion:JDA:5.0.0-beta.3")
}
Maven
<dependency>
<groupId>net.dv8tion</groupId>
<artifactId>JDA</artifactId>
<version>5.0.0-beta.3</version>
</dependency>