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>