v5.0.0-alpha.13
Overview
In this release, we have taken some time to rework the handling of Emoji and Stickers! This comes with a lot of breaking changes.
Guild Emote Renamed (#2117)
Previously, all custom emoji were called Emote in JDA. This has been changed to be more consistent with the API naming convention of Custom Emoji. In that sense, we renamed Emote to RichCustomEmoji and made various changes all over the API to rename all occurrences of Emote with Emoji.
This also comes with some compatibility improvements! With this change, we now have a uniform representation of all emoji in the library. Every emoji now implements the Emoji interface and can be used interchangeably as such. For instance, the reactions used to have a specific type called ReactionEmote, which is now just replaced with Emoji allowing you to use them in buttons!
public void onMessageReactionAdd(MessageReactionAddEvent event) {
event.getChannel().sendMessage("User reacted")
.setActionRow(Button.primary("buttonid", event.getEmoji())) // <- replacement for getReactionEmote()
.queue();
}
Stickers (#2104)
In addition to the changes for emoji, we now have a full support for stickers! Bots can send up to 3 guild stickers in a message (but not in interactions). However, this is limited to only stickers from the same guild, so likely not useful to most bots.
This comes with support for:
- Creating/Updating/Deleting guild stickers
- Getting and sending stickers with messages
- Access to nitro sticker packs (not sending though)
- Full sticker event support
ChunkingFilter Breaking Change (#2053)
Previously, when you did setChunkingFilter(ChunkingFilter.ALL)
, we would always cache every member of the guild for the full runtime. This has been changed now, allowing you to further configure the member cache policy in addition to chunking. Now, to chunk and cache all members of a guild, you can use setChunkingFilter(ChunkingFilter.ALL).setMemberCachePolicy(MemberCachePolicy.ALL)
.
This is a breaking change and affects anyone using ChunkingFilter.
Command Permissions (#2113)
Discord made breaking changes to command permissions (aka Privileges). This means you can no longer configure the privileges of a command on a guild, without using oauth. Consequently, we updated our interface with breaking changes to address this.
Instead of using setDefaultEnabled(..)
on your command and configuring a whitelist/blacklist of roles and users, you now have the ability to configure allowed permissions using setDefaultPermissions(...)
and you can tell discord that a command is guild only with setGuildOnly(true)
.
However, you cannot configure this for individual subcommands, due to the way discord designed them.
Check out the SlashBotExample for some useful examples on how this works!
New Features
- Rework stickers by @MinnDevelopment in #2104
- Uniform representation of emoji by @MinnDevelopment in #2117
- Add Support for Application-Command Permissions V2 by @Xirado in #2113
Changes
- Changed addField String name and String Value to Nonnull by @RealYusufIsmail in #2133
- Do not ignore member cache policy when chunking is enabled by @MinnDevelopment in #2053
Bug Fixes
- Fix Message.Attachment#getProxy() by @Xirado in #2139
- Fix missing guild id when deleting guild stickers by @CheesyGamer77 in #2144
- Fix filterHidden in GuildImpl#getChannels by @MineKing9534 in #2151
Full Changelog: v5.0.0-alpha.12...v5.0.0-alpha.13
Installation
Gradle
repositories {
mavenCentral()
}
dependencies {
implementation("net.dv8tion:JDA:5.0.0-alpha.13")
}
Maven
<dependency>
<groupId>net.dv8tion</groupId>
<artifactId>JDA</artifactId>
<version>5.0.0-alpha.13</version>
</dependency>