Releases: discord-jda/JDA
v5.0.0-beta.2
Overview
Small release to fix a few bugs and typing issues.
Support for Welcome Screens (#2264 / #1989)
You can now retrieve and manage the welcome screen of a guild. To modify a welcome screen, you can use Guild#modifyWelcomeScreen:
TextChannel rules = guild.getTextChannelsByName("rules", true).get(0);
ForumChannel help = guild.getForumChannelsByName("help-forum", true).get(0);
guild.modifyWelcomeScreen()
.setDescription("Welcome to our cool guild!")
.setWelcomeChannels(
GuildWelcomeScreen.Channel.of(rules, "Read our rules"),
GuildWelcomeScreen.Channel.of(help, "Ask for help in our forum", Emoji.fromUnicode("U+1F4AC"))
)
.queue();
New Features
- Add generic slowmode channel manager to slowmode channel interface by @Sanduhr32 in #2348
- Add guild welcome screens by @freya022 in #2264
Changes
- Make StringSelectMenuImpl#getOptions return unmodifiable list by @dkim19375 in #2344
- Bump jackson-core and jackson-databind from 2.13.2 to 2.14.1 by @MelaineGerard in #2337
Bug Fixes
- Remove code to rename guild_member to member by @MinnDevelopment in #2341
- Fix bug when updating a scheduled events location by @Mitmocc in #2349
Full Changelog: v5.0.0-beta.1...v5.0.0-beta.2
Installation
Gradle
repositories {
mavenCentral()
}
dependencies {
implementation("net.dv8tion:JDA:5.0.0-beta.2")
}
Maven
<dependency>
<groupId>net.dv8tion</groupId>
<artifactId>JDA</artifactId>
<version>5.0.0-beta.2</version>
</dependency>
v5.0.0-beta.1 | Time to update
Overview
We finally made it 🎉 BETA 🎉 ! This concludes the major rewrites and large breaking changes of JDA version 5. With this release, we feel confident that people can rely on updates no longer requiring major rewrites of their codebases in the foreseeable future (praying to the API gods).
There will likely be some effort made to provide a full migration guide for anyone still stuck on version 4. It is recommended to update to version 5 as soon as possible. Version 4 is officially reaching EOL in the first quarter of 2023, and will stop working soon after due to the gateway version 8 being discontinued.
You can join our discord server, where we have a channel called #jda5-changes with a brief changelog for all the breaking changes.
We've also started accepting donations via Open Collective. Any donation are greatly appreciated.
Age-Restricted Commands (#2325)
You can now create NSFW (or age-restricted) commands, which are only usable in age-restricted channels.
Commands.slash("nsfw", "Something nsfw").setNSFW(true)
Channel Ordering (#2320)
The implementation for GuildChannel#compareTo
has been adjusted to support comparing channels of different types. This can be used to figure out the order of channels within the channel list. For instance, if you compare a channel to the category it is in, it will be ordered lower than the category.
This also extends to Guild#getChannels
, which now uses the updated compareTo
implementation for ordering. As such, you can also order a sublist of all channels yourself, by using list.sort()
. This even works with thread channels.
New Features
- Add application_id support for received messages by @Almighty-Satan in #2335
- Add support for age-restricted (nsfw) commands by @MinnDevelopment in #2325
- Implement "ACTIVE_DEVELOPER" UserFlag by @DynxstyGIT in #2326
- Add slash command mentions by @freya022 in #2251
Changes
- Implement thread member pagination by @MinnDevelopment in #2338
- More v5 documentation by @Sanduhr32 in #2296
- Improve GuildChannel#getPosition and Guild#getChannels by @MinnDevelopment in #2320
- Remove archived threads from cache by @MinnDevelopment in #2322
- Forward shutdown reason to awaitStatus exception by @MinnDevelopment in #2268
- Make Widget an interface and move it to it's own file by @Almighty-Satan in #2295
Bug Fixes
- Fix some lock issues by @MinnDevelopment in #2339
- Remove outdated feature check for private threads by @RedDaedalus in #2336
- Fix recursive json object created in mention parsing by @MinnDevelopment in #2334
- Fix handling of empty select menu interactions by @MinnDevelopment in #2330
- Use deep copy for layout components when applying message data by @freya022 in #2236
- Fix JDA#retrieveWebhookById by @MinnDevelopment in #2319
- [Bugfix] Mark ForumChannel as a TopicChannelMixin by @Sanduhr32 in #2317
- Fix MemberCacheViewImpl#getElementsWithRoles and Guild#findMembersWithRoles ignoring the public role by @Almighty-Satan in #2297
- Fix GuildSticker#retrieveOwner by @MinnDevelopment in #2316
- Fix NullPointerException in GuildManagerImpl#addFeatures and GuildManagerImpl#removeFeatures by @Almighty-Satan in #2314
Full Changelog: v5.0.0-alpha.22...v5.0.0-beta.1
Installation
Gradle
repositories {
mavenCentral()
}
dependencies {
implementation("net.dv8tion:JDA:5.0.0-beta.1")
}
Maven
<dependency>
<groupId>net.dv8tion</groupId>
<artifactId>JDA</artifactId>
<version>5.0.0-beta.1</version>
</dependency>
v5.0.0-alpha.22
Overview
This is most likely the final alpha release. The current plan is to merge a few more breaking changes, and address some remaining TODOs before finally bumping to beta! Stay tuned.
Implement new select menus (#2287)
Discord has introduced new select menu component types, which support selecting mentionable entities like User
/Role
/Channel
. With this release we are introducing a small breaking change to the SelectMenu
type:
StringSelectMenu
is the old select menu, used for custom string choicesEntitySelectMenu
is the new select menu, used for mentionable entities
And you use the StringSelectInteractionEvent
and EntitySelectInteractionEvent
to handle them.
Ability to disable/pause invites of a guild (#2222)
Recently, Discord added a new moderation feature to pause the invites of a guild, including vanity invites. This is usually done using the Pause Invites button in the guild settings.
You can now do this using the GuildManager
via setInvitesDisabled(true)
.
Scheduled Events (#2047)
This is rather late, but you can now handle and create scheduled events. To create a scheduled event you can use one of the createScheduledEvent
overloads in Guild
:
- Use
createScheduledEvent(name, channel, time)
to create a local event to take place in a specific voice or stage channel - Use
createScheduledEvent(name, location, startTime, endTime)
to create an external event, such as a concert or similar
New Features
- Add GuildManager#setFeatures by @MinnDevelopment in #2222
- Add support for guild scheduled events v2 by @Mitmocc in #2047
- Implement new select menus by @MinnDevelopment in #2287
Changes
- Retain sort order for ThreadChannel#getAppliedTags by @MinnDevelopment in #2278
- FileProxy: additional checks on existing files by @freya022 in #2293
- Put "options" between command path and options, same for choices by @freya022 in #2261
- Move ModalInteraction into correct package by @Xirado in #2282
- Improve
toString
methods by @freya022 in #2273 - Check for empty token in AuthorizationConfig, instead of JDAImpl by @freya022 in #2230
- Improve channel update handling by @MinnDevelopment in #2255
Bug Fixes
- Make ForumTag extend ForumTagSnowflake by @MinnDevelopment in #2276
- Handle emoji_id sometimes being 0 instead of null by @MinnDevelopment in #2279
Full Changelog: v5.0.0-alpha.21...v5.0.0-alpha.22
Installation
Gradle
repositories {
mavenCentral()
}
dependencies {
implementation("net.dv8tion:JDA:5.0.0-alpha.22")
}
Maven
<dependency>
<groupId>net.dv8tion</groupId>
<artifactId>JDA</artifactId>
<version>5.0.0-alpha.22</version>
</dependency>
v5.0.0-alpha.21 | Small Event Changes
Overview
Almost ready for beta. This release changes a few event names and introduces a new interface GenericSessionEvent
. With this, almost every breaking change that we had planned is completed. There will likely only be one more alpha release before bumping to beta.
Event Changes (#1952)
Events related to the active gateway session / main socket now have a common abstraction called GenericSessionEvent
. We also changed a few event names for better clarity:
Old | New |
---|---|
DisconnectEvent | SessionDisconnectEvent |
ReconnectedEvent | SessionRecreateEvent |
ResumedEvent | SessionResumeEvent |
All the session related events are now in a common package at net.dv8tion.jda.api.events.session
, this also includes some breaking package changes for a few commonly used events like ReadyEvent
.
Additionally, events for voice channels of guild members have been changed slightly. Previously, we provided 3 separate voice channel update events:
- GuildVoiceJoinEvent
- GuildVoiceLeaveEvent
- GuildVoiceMoveEvent
Due to the confusing nature of these events, we have decided to instead only provide a single GuildVoiceUpdateEvent. This new event provides the old and new channel, which can each be null to indicate either a leave (null new channel) or join (null old channel).
Changes
- Update event hierarchy by @MinnDevelopment in #1952
- Make annotation dependencies compileOnly by @MinnDevelopment in #2249
Bug Fixes
- Fix check for ChannelAction#setCategory by @MinnDevelopment in #2259
- Fix some checks not throwing the intended exception by @MinnDevelopment in #2260
- fix: Use correct "flags" field for message create action by @RedDaedalus in #2272
- Handle newly_created gracefully by @MinnDevelopment in #2254
- Fix manager docs by @freya022 in #2271
- Add missing annotations on ThreadChannel by @MinnDevelopment in #2274
Full Changelog: v5.0.0-alpha.20...v5.0.0-alpha.21
Installation
Gradle
repositories {
mavenCentral()
}
dependencies {
implementation("net.dv8tion:JDA:5.0.0-alpha.21")
}
Maven
<dependency>
<groupId>net.dv8tion</groupId>
<artifactId>JDA</artifactId>
<version>5.0.0-alpha.21</version>
</dependency>
v5.0.0-alpha.20 | Forum channel support
Overview
Discord is currently rolling out forums to all community guilds. This release adds support for these channels in JDA.
Forum support (#2184)
To use a forum channel, you must create a forum post. Posts are simply public ThreadChannels
with a starter message. To create a post, instead of using the usual createThreadChannel
, you must use createForumPost
:
forum.createForumPost("Post Title Here", new MessageCreateBuilder()
.addContent("# Header\n")
.addContent("This is my first forum post!")
.build()
).queue(post -> {
Message message = post.getMessage();
ThreadChannel thread = post.getThreadChannel();
thread.sendMessage("Followup message").queue();
});
To create such a post, the bot must have Permission.MESSAGE_SEND
in the forum channel. The client refers to this permission as Create Posts.
AudioChannel improvements (#2252)
As of this release, AudioChannel
extends StandardGuildChannel
instead of GuildChannel
. This allows for a lot more features directly on the abstract interface, rather than having to cast down to voice or stage channels.
- Invites
- Category getter
- Permissions
- Positions
- Copying
New Features
- Add support for forum channels by @MinnDevelopment in #2184
- Added RestAction#onSuccess by @Zabuzard in #2227
Changes
- Improve usability of AudioChannel by @MinnDevelopment in #2252
Full Changelog: v5.0.0-alpha.19...v5.0.0-alpha.20
Installation
Gradle
repositories {
mavenCentral()
}
dependencies {
implementation("net.dv8tion:JDA:5.0.0-alpha.20")
}
Maven
<dependency>
<groupId>net.dv8tion</groupId>
<artifactId>JDA</artifactId>
<version>5.0.0-alpha.20</version>
</dependency>
v5.0.0-alpha.19 | Channel Package, OrderAction, and Ban Precision
Overview
With this release, we are changing a few packages, so you will have to update your imports. There are also a few more breaking changes, some of which are only relevant at runtime!
Seconds precision on bans (#2229)
Discord now supports deleting messages with seconds precision. Allowing you to delete messages which are less than a day old. To update your code, simply add a TimeUnit.DAYS
.
Old:
guild.ban(member, 7, reason).queue();
New:
guild.ban(member, 7, TimeUnit.DAYS).reason(reason).queue();
Role Ordering (#2136)
The default ordering of guild.modifyRolePositions()
has been reversed to align with the order of guild.getRoles()
(descending position). We also added moveBelow
and moveAbove
to allow moving relative to a pivot element.
guild.modifyRolePositions()
.selectPosition(guild.getRoleByBot(guild.getSelfMember())) // select bot role
.moveAbove(modRole) // move it above the mod role
.queue();
You can also now set the parent category of a channel using this feature:
guild.modifyTextChannelPositions()
.selectPosition(channel)
.setCategory(category)
.moveBelow(otherChannel)
.queue();
Channel Packages (#2180)
The new channel package layout is introduced to help reduce clutter of the entities
package. You can find the updated package at net.dv8tion.jda.api.entities.channel. I've written a shell script to help rename packages in your sources:
Usage
To update packages of all .java
source files in the src
directory, you can use find
and apply the script on each file:
find src -iname "*.java" -exec ./rename.sh {} \; -print
New Features
- Add support for ban deletion with seconds precision by @MinnDevelopment in #2229
- Add support for component-only messages by @MinnDevelopment in #2241
- Add support for string option bounds by @caneleex in #2169
- Add DataPath util by @MinnDevelopment in #2212
- Add category feature to ChannelOrderAction by @MinnDevelopment in #2136
Changes
- Return immutable reconstructed interaction object lists by @freya022 in #2220
- Renamed MessageCreateBuilder#fromEdit() to fromEditData by @lilmayu in #2225
- Invalid token exception by @java-coding-prodigy in #2025
- Update to gateway version 10 by @freyacodes in #2228
- Use String#intern for guild features and atoms by @MinnDevelopment in #2235
- Move channels to separate package and cleanup code by @MinnDevelopment in #2180
- Remove ChannelAction#setType by @MinnDevelopment in #2218
Bug Fixes
- Use toAbsolutePath in FileProxy#downloadToPath by @MinnDevelopment in #2239
- Improve handling of server errors and fix some code duplication by @MinnDevelopment in #2237
- Change handling of query parameters for websocket connections by @MinnDevelopment in #2248
- Properly handle MANAGE_THREAD permission for managing threads by @DV8FromTheWorld in #2247
Full Changelog: v5.0.0-alpha.18...v5.0.0-alpha.19
Installation
Gradle
repositories {
mavenCentral()
}
dependencies {
implementation("net.dv8tion:JDA:5.0.0-alpha.19")
}
Maven
<dependency>
<groupId>net.dv8tion</groupId>
<artifactId>JDA</artifactId>
<version>5.0.0-alpha.19</version>
</dependency>
v5.0.0-alpha.18 | Message Rework
Overview
With this release, we are getting very close to the beta release. The big and long awaited message rework introduces a high consistency between all message create and edit endpoints, which means you no longer have to decide between setActionRow
and addActionRow
depending on the specific flavor of endpoint you are using!
Message Rework (#2187)
The message rework introduces a consistent interface for message requests. We are splitting message edit requests and message create requests into 2 interfaces with different functionality. The new type hierarchy can be seen in this figure:
This results in a few breaking changes.
Renames
setActionRows
/addActionRows
->setComponents
/addComponents
MessageAction
->MessageCreateAction
MessageAction#tts
->MessageCreateAction#setTTS
allowedMentions(...)
->setAllowedMentions(...)
addFile
->setFiles
/addFiles
/setAttachments
sendFile
/replyFile
->sendFiles
/replyFiles
override(true)
->setReplace(true)
Code Migration
You will likely only have to adjust code if you used MessageBuilder
. In this rework, we split this into MessageCreateBuilder
and MessageEditBuilder
, which produce either MessageCreateData
or MessageEditData
. And you will have to provide these data instances instead of Message
instances from now on.
The old approach of having a MessageBuilder
which returns a Message
instance was flawed, in that it would offer a lot of methods which are unusable. Instead, we now separate this by making data classes for each request. Now the types are consistently representing a specific feature set:
Type | Meaning |
---|---|
Message |
Existing messages on discord with an ID |
MessageCreateData |
The data used for a message creation request (HTTP POST) |
MessageEditData |
The data used for a message edit request (HTTP PATCH) |
This allows for a higher level of consistency and clarity. The edit builder by default will only update the fields which are explicitly set. For example, doing new MessageEditBuilder().setContent("hello").build()
will only update the content and leave any embeds or files untouched.
More details are provided in #2187. You can also ask questions in the release discussion.
Gateway Resume URL Handling (#2203)
In an upcoming change to the gateway logic (which is used to receive events), Discord is introducing a new gateway resume url. This new resume URL will be used to move your bot connection to a new zone, allowing for less reconnects and potentially lower ping.
Bots on older version of JDA may run into more reconnects due to the missing handling of this new resume url. Anyone using some kind of proxy gateway, should make sure to also handle this accordingly.
New Features
- Add support for setting voice region on channel creation/copy by @CheesyGamer77 in #2209
- Implement gateway resume url handling by @MinnDevelopment in #2203
- Implement
GuildChannel#getJumpUrl
by @DynxstyGIT in #2204 - Add ApplicationInfo#getFlags by @MinnDevelopment in #2202
- Add sticker features for audit logs by @DxsSucuk in #2198
- Add some missing interaction features by @MinnDevelopment in #2195
Changes
- Message Rework by @MinnDevelopment in #2187
- Improve usage of cache in Guild#retrieveMemberById by @MinnDevelopment in #2200
Bug Fixes
- Fix CommandAutoCompleteInteraction#getChannel by @MinnDevelopment in #2211
- Fix ban pagination by @MinnDevelopment in #2201
Full Changelog: v5.0.0-alpha.17...v5.0.0-alpha.18
Installation
Gradle
repositories {
mavenCentral()
}
dependencies {
implementation("net.dv8tion:JDA:5.0.0-alpha.18")
}
Maven
<dependency>
<groupId>net.dv8tion</groupId>
<artifactId>JDA</artifactId>
<version>5.0.0-alpha.18</version>
</dependency>
v5.0.0-alpha.17 | Hotfix for some file sending issues
Fixes some issues regarding the handling of file attachments on messages.
- Fix to properly clean up resources in
MessageAction
, which would otherwise cause unwanted warnings - Fix issue with interaction replies that make use of files
- Fix issue with
retainFiles
on interaction message edits
Installation
Gradle
repositories {
mavenCentral()
}
dependencies {
implementation("net.dv8tion:JDA:5.0.0-alpha.17")
}
Maven
<dependency>
<groupId>net.dv8tion</groupId>
<artifactId>JDA</artifactId>
<version>5.0.0-alpha.17</version>
</dependency>
v5.0.0-alpha.16 | Hotfix editMessage on components
This fixes an issue where IMessageEditCallback#editMessage
would not properly send the request to edit the message, and instead defer the edit.
Installation
Gradle
repositories {
mavenCentral()
}
dependencies {
implementation("net.dv8tion:JDA:5.0.0-alpha.16")
}
Maven
<dependency>
<groupId>net.dv8tion</groupId>
<artifactId>JDA</artifactId>
<version>5.0.0-alpha.16</version>
</dependency>
v5.0.0-alpha.15 | Hotfix for cast exception in ChannelUpdateHandler
This fixes the ClassCastException
when a voice channel updated.
Installation
Gradle
repositories {
mavenCentral()
}
dependencies {
implementation("net.dv8tion:JDA:5.0.0-alpha.15")
}
Maven
<dependency>
<groupId>net.dv8tion</groupId>
<artifactId>JDA</artifactId>
<version>5.0.0-alpha.15</version>
</dependency>