Skip to content

v5.0.0-alpha.19 | Channel Package, OrderAction, and Ban Precision

Compare
Choose a tag to compare
@MinnDevelopment MinnDevelopment released this 13 Sep 16:24
· 307 commits to master since this release
cb23a72

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

Changes

Bug Fixes

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>