v5.0.0-alpha.14 | Text in Voice and Upgrade to API v10
Overview
Breaking changes and text messages in voice channels!
Text in Voice (#2072)
This release introduces the long awaited Text in Voice feature. Now you can use all your message related features in voice channels as well! Automatically works with interactions, messages, reactions, and all other features you could want!
Command Localization (#2090)
Using command localization, you can provide customized translations for all your commands. Check the example: LocalizationExample
API v10 (#2165)
Since the v9 API will be discontinued at the end of 2022, we have upgraded to the newer version 10. This comes with a few breaking changes:
- All edit requests with
addFile
calls (such asmessage.editMessage(...).addFile(...)
), will now remove all current attachments on the message. To retain existing attachments, you are now required to also useretainFiles(...)
with the existing attachments on the message. - The introduction of
GatewayIntent.MESSAGE_CONTENT
. In order to use certain user-generated content in messages, you will now be required to explicitly enable this privileged intent. This includes:getContentRaw
,getContentDisplay
,getContentStripped
, andgetMentions().getCustomEmojis()
getActionRows
, andgetButtons
getAttachments
getEmbeds
You will be presented with a warning, if you try using any of those methods without having the required intent enabled.
Attempting to access message content without GatewayIntent.MESSAGE_CONTENT.
Discord now requires to explicitly enable access to this using the MESSAGE_CONTENT intent.
Useful resources to learn more:
- https://support-dev.discord.com/hc/en-us/articles/4404772028055-Message-Content-Privileged-Intent-FAQ
- https://jda.wiki/using-jda/gateway-intents-and-member-cache-policy/
- https://jda.wiki/using-jda/troubleshooting/#im-getting-closecode4014-disallowed-intents
Or suppress this warning if this is intentional with Message.suppressContentIntentWarning()
Channel Unions (#2138)
We had a lot of repeated concrete type specializations, such as getTextChannel()
, all over library. To address this duplication and to make the interface more consitent, we are introducing the concept of channel unions.
These channel unions, are abstracted types, which provide the same features as their respective name would suggest, while also allowing simple specialization using conversion methods.
An example union would be MessageChannelUnion
, which is used by Message.getChannel()
. This type provides all the methods a normal MessageChannel
would, but also allows you to convert it to a more concrete type:
public void onMessageReceived(MessageReceivedEvent event) {
MessageChannelUnion channel = event.getChannel();
// Use normal message channel features
channel.sendMessage("Hello, I received your message!").queue();
// Specialized handling on concrete types
if (channel.getType() == ChannelType.VOICE) {
VoiceChannel vc = channel.asVoiceChannel(); // easy type conversion, just like casting, but with clear type information
vc.getGuild().getAudioManager().openAudioConnection(vc);
}
}
New Features
- Add JDABuilder#setEventPassthrough by @freya022 in #2014
- Application command localization by @freya022 in #2090
- Handle text in voice channels by @MinnDevelopment in #2072
Changes
- Introduce Channel Unions by @DV8FromTheWorld in #2138
- Add EmojiUnion by @MinnDevelopment in #2167
- Update to API version 10 by @MinnDevelopment in #2165
Bug Fixes
- Fix handling of empty emoji names by @MinnDevelopment in #2176
- Return ThreadChannelAction instead of RestAction on Message#createThreadChannel by @Mitmocc in #2171
- Make MessageType#deletable return an accurate value. by @RedDaedalus in #2160
Full Changelog: v5.0.0-alpha.13...v5.0.0-alpha.14
Installation
Gradle
repositories {
mavenCentral()
}
dependencies {
implementation("net.dv8tion:JDA:5.0.0-alpha.14")
}
Maven
<dependency>
<groupId>net.dv8tion</groupId>
<artifactId>JDA</artifactId>
<version>5.0.0-alpha.14</version>
</dependency>