v5.5.0 | Improved voice state cache and file proxies
Changes to voice state cache (#2835)
Voice states are now cached independently of guild members. JDA can now detect when a member connects or disconnects from an audio channel, even when the member is not currently cached.
With this change, you can technically use MemberCachePolicy.NONE
and will still receive voice join / leave events, as long as CacheFlag.VOICE_STATE
is enabled.
To reduce the memory footprint, we now only cache voice states if the member is connected to an audio channel. While disconnected, we will not keep the voice state cached, meaning we lose track of muted/deafend state and return an "empty" voice state for Member#getVoiceState
.
Improvements to FileProxy (#2782 and #2727)
The FileProxy, ImageProxy, and AttachmentProxy now all support downloadAsFileUpload to easily stream a Discord proxies URL to a message.
@Override
public void onMessageReceived(MessageReceivedEvent event) {
List<Message.Attachment> attachments = event.getMessage().getAttachments();
List<FileUpload> uploads = attachments.stream()
.map(attachment ->
attachment
.getProxy()
.downloadAsFileUpload(attachment.getWidth(), attachment.getHeight()))
.collect(Collectors.toList());
event.getChannel().sendFiles(uploads).queue();
}
New Features
- Add
downloadAsFileUpload
to file proxies by @freya022 in #2782 - Add
ImageProxy#downloadAsIcon
by @freya022 in #2727
Changes
- Move voice state cache to guild by @MinnDevelopment in #2835
Bug Fixes
- Allow \ in invite links by @rtm516 in #2796
- Fix checks in CommandEditAction by @MinnDevelopment in #2837
Full Changelog: v5.4.0...v5.5.0
Installation
Gradle
repositories {
mavenCentral()
}
dependencies {
implementation("net.dv8tion:JDA:5.5.0")
}
Maven
<dependency>
<groupId>net.dv8tion</groupId>
<artifactId>JDA</artifactId>
<version>5.5.0</version>
</dependency>