Releases: discord-jda/JDA
v4.1.1 | Avoid callback hell and rate limits
A lot of people use nested callbacks for things like sending private messages or adding reactions:
@Override
public void onMessageReceived(MessageReceivedEvent event) {
if (event.getMessage().getContentRaw().equals("!hello")) {
user.openPrivateChannel().queue(
channel -> channel.sendMessage("Hello Friend").queue(null,
error -> event.getChannel().sendMessage("Failed to send message!").queue()));
}
}
This gets very hard to read and maintain. Instead you can use something like submit()
which returns a CompletableFuture
to allow using continuations such as thenCompose
and similar. This is great and all but that API is rather bad as it will swallow any errors by default and the error handling methods are not very nice.
We added a few new operators for common actions on RestAction:
map
Convert the result of theRestAction
to a different valueflatMap
Chain anotherRestAction
on the resultdelay
Delay the element of the previous step
Let's look at the same example using the new flatMap
operator:
@Override
public void onMessageReceived(MessageReceivedEvent event) {
if (event.getMessage().getContentRaw().equals("!hello")) {
user.openPrivateChannel()
.flatMap(channel -> channel.sendMessage("Hello Friend"))
.queue(null, error -> event.getChannel().sendMessage("Failed to send message!").queue()));
}
}
This can be expanded to even more complicated chains:
@Override
public void onMessageReceived(MessageReceivedEvent event) {
if (event.getMessage().getContentRaw().equals("!hello")) {
event.getChannel().sendMessage("I'll contact you in 10 seconds") // MessageAction
.delay(Duration.ofSeconds(10)) // delay next flatMap by 10 seconds
.flatMap(m -> user.openPrivateChannel()) // RestAction<PrivateChannel>
.flatMap(channel -> channel.sendMessage("Hello Friend, this will self destruct in 30 seconds")) // RestAction<Message>
.delay(Duration.ofSeconds(30)) // delay next flatMap by 30 seconds
.flatMap(Message::delete) // RestAction<Void>
.queue(null, error -> event.getChannel().sendMessage("Failed to send message!").queue()));
}
}
You can imagine how this would look with just queue/queueAfter:
@Override
public void onMessageReceived(MessageReceivedEvent event) {
if (event.getMessage().getContentRaw().equals("!hello")) {
event.getChannel().sendMessage("I'll contact you in 10 seconds").queue(m ->
user.openPrivateChannel().queueAfter(10, TimeUnit.SECONDS, channel ->
channel.sendMessage("Hello Friend, this will self descruct in 30 seconds").queueAfter(30, TimeUnit.SECONDS,
message -> message.delete().queue(),
error -> event.getChannel().sendMessage("Failed to send message!").queue()
)
)
);
}
}
We also changed the implementation for the Rate Limiter in JDA which will now properly keep track of the "new" X-RateLimit-Bucket
header to track which endpoints share the same rate-limit. This also means that JDA will now allow multiple requests to the same path while they follow different HTTP methods. For the user this just means, JDA now has a better understanding of how discord will limit your requests.
The new rate-limiter also has improved logging. You can now see which routes have what rate-limit by setting the logging level of net.dv8tion.jda.internal.requests.RateLimiter
to trace. This will log messages such as this:
Updated bucket 80c17d2f203122d936070c88c8d10f33:guild_id:125227483518861312:webhook_id to (4/5, 4408)
The numbers at the end have this meaning (remaining requests/allowed requests in the reset time, milliseconds until reset)
.
The long bucket id is composed of the hash
and the major parameters
of the request. You can figure out which hash is for which bucket fairly quickly by looking for the corresponding cache log:
Caching bucket hash POST/channels/{channel_id}/messages -> 80c17d2f203122d936070c88c8d10f33
New Features
- RestAction operators (flatMap, map, delay)
- JDABuilder#setMaxBufferSize (same for shard manager)
- Message#suppressEmbeds and Message#getFlags
Deprecation
Detailed javadoc can be found in the deprecated tab of the docs
Installation
The release version is: 4.1.1_101
The latest version is:
Gradle
repositories {
jcenter()
}
dependencies {
compile "net.dv8tion:JDA:4.1.1_101"
}
Maven
The jcenter repository now only works with https! Please change your URL from http to https
<dependency>
<groupId>net.dv8tion</groupId>
<artifactId>JDA</artifactId>
<version>4.1.1_101</version>
</dependency>
<repository>
<id>jcenter</id>
<name>jcenter-bintray</name>
<url>https://jcenter.bintray.com</url>
</repository>
Pull Requests
You can view the 4.1.1 Milestone for a list of accepted pull requests for this release. Thank you to everyone who contributed!
v4.1.0 | Be More Lazy
We added support for lazy loading and now allow to disable guild subscriptions!
To enable lazy loading you have to configure a ChunkingFilter
on your builder of choice [1]. Lazy loading means that JDA will not attempt to request the entire member list of a guild before starting to send events. Instead, members will be loaded on their first activity and members who are never active will never be loaded into cache.
new JDABuilder(TOKEN)
.setChunkingFilter(ChunkingFilter.NONE) // don't chunk any guilds
.build();
1) Example how to enable lazy loading
The more extreme choice is to disable guild subscriptions [2]. This feature completely disables member and user cache for the shard/jda session. Note that if you need methods like Guild#getMembers
or similar things that require knowledge of the entire member list this is not something you should be using. JDA cannot determine the size of a guild or member join/leave with this disabled. The benefit of this is a greatly reduced memory footprint with the disadvantage of losing member state tracking.
new JDABuilder(TOKEN)
.setGuildSubscriptionsEnabled(false)
.build();
2) Example how to disable guild subscriptions
A footnote is that CacheFlag.VOICE_STATE
can still be tracked and users in voice channels will still be loaded into cache when this cache flag is enabled. This is useful for music bots that want to leave a voice channel if they are alone.
You can now ignore specific ErrorResponse
failures more easily. With ErroResponseException.ignore(...)
you can create a failure consumer that drops any ErrorResponseException
for the specified set of responses. [3]
import static net.dv8tion.jda.api.exceptions.ErrorResponseException.ignore;
import static net.dv8tion.jda.api.requests.ErrorResponse.*;
message.delete().queue(null, ignore(UNKNOWN_MESSAGE)); // ignore if message doesn't exist anymore
message.delete().queue(null, ignore(Logger::error, UNKNOWN_MESSAGE)); // ignore otherwise log
3) Example how to ignore UNKNOWN_MESSAGE errors
New Features
- Lazy Loading and disable guild subscriptions
- Readonly support for custom status
Member#getActiveClients
ErrorResponseException.ignore(...)
Deprecation
Detailed javadoc can be found in the deprecated tab of the docs
GuildUnavailableException
,Guild#isAvailable
this is no longer used, unavailable guilds are no longer in the guild cache. You can check if a guild is unavailable withJDA#getUnavailableGuilds
Guild#retrieveVanityUrl
replace withGuild#getVanityUrl
Invite#getCreationTime
replace withInvite#getTimeCreated
JDA#getVoiceChannelByName
replace withJDA#getVoiceChannelsByName
ShardManager#setGame
replace withShardManager#setActivity
SessionController#getGatewayBot
replace withSessionController#getShardedGateway
Incubating
AccountType#CLIENT
this is most likely going to break soon with impending changes to the gatewayJDABuilder(AccountType)
this will be removed whenAccountType#CLIENT
breaks in the futureActivity#watching
,ActivityType#WATCHING
this is not officially supported by the API but currently usableActivityType#CUSTOM_STATUS
this is currently not usable for bots and can only be seen on other usersAudioManager#getSpeakingMode
,AudioManager#setSpeakingMode
this is not a confident implementation and should be used with care
Installation
The release version is: 4.1.0_81
The latest version is:
Gradle
repositories {
jcenter()
}
dependencies {
compile "net.dv8tion:JDA:4.1.0_81"
}
Maven
<dependency>
<groupId>net.dv8tion</groupId>
<artifactId>JDA</artifactId>
<version>4.1.0_81</version>
</dependency>
<repository>
<id>jcenter</id>
<name>jcenter-bintray</name>
<url>https://jcenter.bintray.com</url>
</repository>
Pull Requests
You can view the 4.1.0 Milestone for a list of accepted pull requests for this release. Thank you to everyone who contributed!
v4.0.0 | Refactoring with Breaking Changes
This release bumps the major version because we have done a number of breaking changes. The most notable ones are:
- Package rename
core
->api
- Removed
GuildController
- Renamed
getX(): RestAction
toretrieveX(): RestAction
- Added
@Nonnull
and@Nullable
annotations
More can be found in the migration guide.
The plan for version 3.X is to keep updating it with bug fixes until 01/01/2020. We recommend migrating your codebase before then.
New Features
MarkdownUtil
A utility to easily apply markdown to textMarkdownSanitizer
A state-machine to sanitize discord markdownGatewayPingEvent
An event for updates to the gateway pingApplicationInfo#getTeam
Team support in applicationsMessage#getMentionedXBag(): Bag<X>
Bag accessors for mentions to check for duplicatesGuild#getVanityCode
andGuild#getVanityUrl
Guild#getBoostTier
,Guild#getBoostCount
, andGuild#getBoosters
Guild#getBannerId
andGuild#getBannerUrl
Guild#getMaxBitrate
andGuild#getMaxEmotes
Guild#getMaxMembers
andGuild#getMaxPresences
Guild#getDescription
Member#getTimeBoosted
AudioReceiveHandler#handleEncodedAudio
andAudioReceiveHandler#canReceiveEncoded
AudioReceiveHandler#includeUserInCombinedAudio
Member#ban
,Member#kick
,Member#mute
,Member#deafen
, andMember#modifyNickname
Guild#getGuildChannelById
andJDA#getGuildChannelById
Guild#kickVoiceMember
MessageChannel#getHistoryFromBeginning
Member#getOnlineStatus(ClientType)
ReactionEmote#isEmoji
,ReactionEmote#getAsCodepoints
, andReactionEmote#getEmoji
AudioManager#setSpeakingDelay
JDA#getUserByTag
,ShardManager#getUserByTag
, andGuild#getMemberByTag
GuildChannel#upsertPermissionOverride
JDABuilder#setVoiceDispatchInterceptor
andDefaultShardManagerBuilder#setVoiceDispatchInterceptor
CacheView#forEachUnordered
,CacheView#applyStream
,CacheView#acceptStream
, andCacheView#lockedIterator
JDA#getRestPing
PaginationAction#skipTo
- Support for
StoreChannel
- New message types
- Lots of new events and setters on managers
Deprecation
Emote#hasRoles
->Emote#canProvideRoles
Guild#retrieveVanityUrl
->Guild#getVanityCode
Invite#getCreationTime
->Invite#getTimeCreated
JDA#getVoiceChannelByName
->JDA#getVoiceChannelsByName
DefaultShardManagerBuilder#setEventManager
->DefaultShardManagerBuilder#setEventManagerProvider
ShardManager#setGame
->ShardManager#setActivity
SessionController#getGatewayBot
->SessionController#getShardedGateway
Incubating
JDABuilder(AccountType)
Activity.watching
AudioManager#setSpeakingMode
andAudioManager#getSpeakingMode
Installation
The release version is: 4.0.0_39
The latest version is:
Gradle
repositories {
jcenter()
}
dependencies {
compile "net.dv8tion:JDA:4.0.0_39"
}
Maven
<dependency>
<groupId>net.dv8tion</groupId>
<artifactId>JDA</artifactId>
<version>4.0.0_39</version>
</dependency>
<repository>
<id>jcenter</id>
<name>jcenter-bintray</name>
<url>https://jcenter.bintray.com</url>
</repository>
v4.BETA.0 | Breaking Changes - Pre-Release
This is the first pre-release of the version 4 changes. I've written a migration guide which should help updating an existing v3 codebase to v4.
We will continue pushing critical bug fixes for v3 for a few months after the final release of v4 but we recommend updating to v4.
Versions
The latest release build: 4.BETA.0_1
Gradle
repositories {
jcenter()
}
dependencies {
implementation("net.dv8tion:JDA:4.BETA.0_1")
}
Maven
<dependency>
<groupId>net.dv8tion</groupId>
<artifactId>JDA</artifactId>
<version>4.BETA.0_1</version>
</dependency>
<repository>
<id>jcenter</id>
<name>jcenter-bintray</name>
<url>https://jcenter.bintray.com</url>
</repository>
v3.8.3 | Version 3 Stable Release
In this version we only updated the OkHTTP dependency to the stable 3.13.0 release.
Gradle
repositories {
jcenter()
}
dependencies {
implementation("net.dv8tion:JDA:3.8.3_464")
}
Maven
<dependency>
<groupId>net.dv8tion</groupId>
<artifactId>JDA</artifactId>
<version>3.8.3_464</version>
</dependency>
<repository>
<id>jcenter</id>
<name>jcenter-bintray</name>
<url>http://jcenter.bintray.com</url>
</repository>
v3.8.2 | JDA LTS Release
Important Notice
Recently we have started work on the new major version of JDA
This release signals the end of JDA v3's lifecycle in which we will only be fixing critical issues for the supported timeframe. Once v4 becomes the new stable release we will continue fixing issues with v3 for 6 months to give people with a huge codebase enough time for the conversion. The current expected time for the JDA version 4 release is mid May.
Currently JDA version 4 is in its alpha stadium. This means it receives breaking changes which are not yet supported by 3rd party extensions like lavalink. Once version 4 reaches its beta stadium we will make efforts to help extension developers to adapt to the new ABI provided as soon as possible. We attempt to make a clear separation between what we consider API and internal. We expect extensions to only target the API side of JDA in the future to reduce the possibility of causing incompatibilities.
New features and enhancements will only be coming to JDA 4. This includes new features of Discord as well as overhead reduction such as the changes done to CacheView. One of the major changes coming here is the removal of client-only features such as group channels/messages. We will however continue to support using JDA with AccountType.CLIENT
but it will be reduced to features available to bot accounts.
To track what is happening with JDA 4 you can take a look at the milestone: v4
Pull Requests
PR | Description |
---|---|
#793 | Read-only MessageActivity support |
#795 | Add Guild#getChannels for convenience |
#811 | Added setPresence to ShardManager and improved documentation consistency |
#814 | Added appendCodeLine(CharSequence text) |
#819 | Add ChannelAction#setPosition(Integer) |
#820 | Close socket on malformed zip data |
#825 | Added copying of the slowmode when cloning a channel |
#826 | Hacktoberfest Changes |
#827 | Don't check admin on permission overrides |
#843 | Update OkHTTP to 3.12.0 |
#849 | Create User#getAsTag |
#887 | Add MESSAGE_ADD_REACTION to text only permissions |
#896 | Ignore alpha when comparing colors in MessageEmbed |
Thank you all for your contributions!
Versions
The latest release build: 3.8.2_459
Changelog
Additions
- Guild#getChannels to get the display order of the channels in a guild
- MessageBuilder#appendCodeLine for more intuitive monospace usage
- ShardManager#setPresence to update both game an online-status in one request
- ChannelAction#setPosition for applying a channel position before its creation
- User#getAsTag for easy retrieval of
Minn#6688
format - MessageActivity support for spotify and game invites
Changes
- The WebSocket will now reconnect when malformed data is received for better recovering
- MessageEmbed#equals now only checks RGB value of the raw color instead of RGBA
Fixes
- VoiceJoin events now fire with updated muted/deafened status
- Slowmode property is now copied with Channel#createCopy
- ContextException are now fired properly again
- The ADMINISTRATOR permission is no longer checked when set on permission overrides
Gradle
repositories {
jcenter()
// Required for OkHTTP 3.13.0-SNAPSHOT
maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
}
dependencies {
compile 'net.dv8tion:JDA:3.8.2_459'
}
Maven
<dependency>
<groupId>net.dv8tion</groupId>
<artifactId>JDA</artifactId>
<version>3.8.2_459</version>
</dependency>
<repository>
<id>jcenter</id>
<name>jcenter-bintray</name>
<url>http://jcenter.bintray.com</url>
</repository>
<repository> <!-- Required for OkHTTP 3.13.0-SNAPSHOT -->
<id>sonatype</id>
<name>sonatype-snapshots</name>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
</repository>
v3.8.1 | Slowmode - Chunking timeout - No more complete() in callbacks
Due to deadlocks in code of less experienced programmers (and even experienced ones) we now prohibit usage of complete()
in callbacks of RestAction#queue
. This means code similar to the following will no longer work and throw an exception (in the callback).
channel.sendMessage("hello there").queue(message -> {
message.editMessage("hello world").queue(); // this is still fine
message.delete().complete(); // exception
});
Requesting member chunks can cause a shard to not finish connecting when discord fails to respond. This issue has been known for quite a while and can now be handled properly by JDA thanks to the new setup system introduced in 3.8.0
. Now JDA will re-attempt requesting chunks when nothing was received.
Discord has released slowmode for text channels in servers, this can now be configured through JDA to allow automation by bots.
Pull Requests
PR | Description |
---|---|
#762 | Prevent using complete() in callbacks |
#771 | Cleanup logs |
#773 | Slowmode |
#776 | Configuration for [gateway] sending pools |
#778 | Prevent creation of send and receive systems before ws ready |
#785 | Add DefaultShardManager#setEventManagerProvider and JDA#getEventManager |
#788 | Add timeout mechanic for chunk requests |
Thank you all for your contributions!
Versions
The latest release build: 3.8.1_437
Changelog
Additions
- Various additions for slowmode support
- DefaultShardManagerBuilder#setEventManagerProvider and JDA#getEventManager
- JDABuilder#setGatewayPool as well as similar methods for shard manager
Changes
- You can no longer use
complete()
in queue callbacks closeAudioConnection()
can once again be used in lavaplayer event handlers- The logs for rate-limiter and gateway have been improved (useful for debugging)
Fixes
- Idle audio send-system should no longer cause CPU issues
- UnavailableGuildJoinedEvent should fire again
Deprecation
- DefaultShardManagerBuilder#setEventManager should be replaced with
setEventManagerProvider(...)
Incubating
JDABuilder(AccountType)
may not be available in the futureGame.watching(...)
is not officially releasedGame.GameType.WATCHING
is not officially releasedRichPresence.Party.getMax()
andRichPresence.Party.getSize()
will returnlong
in the futureAudioManager.setSpeakingMode(...)
andAudioManager.getSpeakingMode()
is not officially released
Note the Incubating category which marks things that might change without deprecation phase.
Gradle
repositories {
jcenter()
}
dependencies {
compile 'net.dv8tion:JDA:3.8.1_437'
}
Maven
<dependency>
<groupId>net.dv8tion</groupId>
<artifactId>JDA</artifactId>
<version>3.8.1_437</version>
</dependency>
<repository>
<id>jcenter</id>
<name>jcenter-bintray</name>
<url>http://jcenter.bintray.com</url>
</repository>
v3.8.0 | New shard startup – Easy bulk delete – Cache flags
Due to reports of several issues with shards starting I took the time to completely rewrite all of the startup logic in this release. (#706)
These changes have close to no affect to your codebase apart from one little improvement. I have added GuildReadyEvent
which is fired for every single guild on startup before ReadyEvent
and ReconnectedEvent
are received. This allows guilds to already function without having to wait for everything else to be completed. This means no single guild can keep an entire shard dead. (Users have asked for this).
Because of several caching issues caused by users storing JDA entities such as roles or channels we now changed the cache to use WeakReferences
for things such as Role.getGuild()
.
We highly recommend to just store IDs of entities and a JDA
instance (if needed) to then do:
Role role = jda.getRoleById(modRoleId);
...
More on this issue is talked about in the new troubleshooting page.
Deleting messages was really annoying in the past with JDA, until now!
Simply use MessagePaginationAction#takeAsync(...)
and MessageChannel#purgeMessages(...)
.
Example:
MessageChannel channel = event.getChannel();
if (event.getMessage().getContentRaw().equals("--purge")) {
channel.getIterableHistory().takeAsync(500)
.thenAccept(channel::purgeMessages);
}
Oh and one more thing... we added a CacheFlag
enum to disable some parts of the JDA cache to be more lightweight.
EnumSet<CacheFlag> disabled = EnumSet.of(CacheFlag.GAME, CacheFlag.EMOTE);
JDABuilder builder = new JDABuilder(BOT_TOKEN);
builder.setDisabledCacheFlags(disabled);
I highly recommend only using
setDisabledCacheFlags
for backwards compatibility.
Pull Requests
PR | Description |
---|---|
#674 | Improve gradle builds and debugging |
#700 | Add jump-to URL for Messages |
#705 | Add more configurations to JDABuilder |
#706 | Rewrite for guild setup system |
#709 | Better group Invite support |
#721 | Improve use of MDC |
#722 | Add South African server region |
#726 | Make use of WeakReference for upstream references |
#731 | Add Permission.PRIORITY_SPEAKER |
#732 | Add support for new sending modes |
#734 | Support getting ban by Id |
#735 | Add support for getting webhooks by id |
#738 | Change minimum channel name length to 1 |
#740 | Add support to retrieve emotes via RestAction access |
#741 | Added retrieveUserById to ShardManager |
#745 | Add new annotations for common documentation concerns |
#747 | Fix IllegalArgumentException on TextChannel#canTalk() |
#748 | Patch upstream reference |
#749 | Add request exceptions to cause of ErrorResponseException |
#750 | Add purgeMessages methods for convenient message deletions |
#751 | Allow [embed] titles without TLD |
#752 | Fix NullPointerException in EmoteImpl#getGuild() |
#754 | Add ThreadLocalReason |
#756 | Prevent creation of audio manager for uncached guilds |
#757 | Replace Emote#hasRoles to avoid ambiguity |
#758 | Update documentation of JDABuilder and add new constructor overloads |
#761 | Fix ShardManager#getGuildById |
#764 | Cleanup RTP handling |
#766 | Make AudioWebSocket a subordinate class |
#769 | Fix granting / denying permissions [in PermOverrideManager] |
#770 | Only update lastFrameSent when actually sending something |
Thank you all for your contributions!
Versions
The latest release build: 3.8.0_423
Changelog
Additions
- ThreadLocalReason to set thread specific audit log reasons
- Group invite support
- JDABuilder#setCacheFlags, and CacheFlag enum
- MessageChannel#purgeMessages
- PaginationAction#takeAsync and PaginationAction#takeAsyncRemaining
- ShardManager#retrieveUserById
- Guild#retrieveEmote, Guild#retrieveEmoteById, and Guild#retrieveEmotes
- JDA#getWebhookById
- JDA#awaitStatus and JDA#awaitReady
- JDABuilder#setCallbackPool, JDABuilder#setRateLimitPool, and JDABuilder#setHttpClient
- Permission.PRIORITY_SPEAKER and AudioManager#setSpeakingMode
- Region.SOUTH_AFRICA and Region.VIP_SOUTH_AFRICA
- Message#getJumpUrl
Changes
- JDABuilder will now only have a single build method `build()` and can be made blocking by calling
JDA#awaitReady()
on the built JDA instance - JDA cache can now partially be disabled to reduce memory impact
- JDA now uses
WeakReference
internally to avoid memory leaks and issues coming from user code
Fixes
- Several fixes for audio receiving and sending
- Several fixes for shard startup (rewrite)
- Usage of SLF4J MDC has been improved
Deprecation
- Removed previously deprecated methods in WebhookMessage and WebhookMessageBuilder
- Deprecated legacy build methods
buildAsync()
andbuildBlocking()
for newbuild()
andawaitReady()
methods - Deprecated Emote#hasRoles to avoid ambiguity. Use Emote#canProvideRoles
Incubating
JDABuilder(AccountType)
might be removed in a future versionGame.watching
andGameType.WATCHING
are not officially releasedRichPresence.Party.getMax()
and..getSize()
will be changed to return `long`AudioManager.setSpeakingMode
and..getSpeakingMode
are not officially released
Note the new Incubating category which marks things that might change without deprecation phase.
Gradle
repositories {
jcenter()
}
dependencies {
compile 'net.dv8tion:JDA:3.8.0_423'
}
Maven
<dependency>
<groupId>net.dv8tion</groupId>
<artifactId>JDA</artifactId>
<version>3.8.0_423</version>
</dependency>
<repository>
<id>jcenter</id>
<name>jcenter-bintray</name>
<url>http://jcenter.bintray.com</url>
</repository>
v3.7.1 | Hotfix for DefaultSendSystem
This fixes a bug introduced by 3.7.0 which causes the DefaultSendSystem to fail delivering packages.
Pull Requests
PR | Description |
---|---|
#714 | Add getGuildsByName to ShardManager |
Thank you all for your contributions!
Versions
The latest release build: 3.7.1_385
Changelog
Additions
+ AddgetGuildsByName
to ShardManager
Fixes
- Fixed issue with DefaultAudioSendSystemGradle
repositories {
jcenter()
}
dependencies {
compile 'net.dv8tion:JDA:3.7.1_385'
}
Maven
<dependency>
<groupId>net.dv8tion</groupId>
<artifactId>JDA</artifactId>
<version>3.7.1_385</version>
</dependency>
<repository>
<id>jcenter</id>
<name>jcenter-bintray</name>
<url>http://jcenter.bintray.com</url>
</repository>
v3.7.0 | Better Opus Library Support / New Audio Encryption Modes
The opus libraries used for encoding/decoding are now exported to their own dependency at opus-java. This allows for a smaller artifact if no audio encoding has to be performed by JDA (like just sending with lavaplayer).
You can find out how to exclude the dependency and consecutively decrease your classpath size by looking at the Download Section in the README.
We additionally now host a jar without opus natives on jenkins (suffix noOpus
).
Discord has added new encryption modes to replace old ones, we now implement all currently supported encryption modes for audio. Additionally we reduced the amount of required allocations for sending audio, which should reduce garbage accumulation and CPU usage respectively.
Pull Requests
PR | Description |
---|---|
#651 | Voice Gateway V4 and new encryption modes |
#655 | Added enum to represent the flags set on RichPresence |
#658 | Clear expected member chunks on delete |
#659 | Externalize opus binaries |
#660 | Proper closing of resources in MessageAction |
#664 | Fixed issues with permission management in RoleManager |
#665 | Permission#VOICE_MOVE_OTHERS does not grant access to a voice channel |
#669 | Updated invite pattern to only trigger on alphanumeric with underscore and dash |
#670 | Cleaned up BotRateLimiter for better handling of partial/missing headers |
#671 | Add unicode flag emoji for each Region |
#675 | Allow null user_id and provide partial Webhooks [in audit logs] |
#676 | Added possibility to sync Permissions between channels |
#678 | Additional invite info |
#680 | Ability to add members to guilds |
#681 | Add support for sending multiple files with a webhook |
#684 | Fixing Role#getAsMention() for public Role |
#685 | Add option to exclude deprecated voice regions |
#687 | Improve snowflake checks for rest requests |
#692 | Add proper boundaries to methods |
#694 | Don't call toString() eagerly on arguments to format() |
#703 | Add Guild Features to Invite |
#713 | Complete rest action on internal server errors |
Thank you all for your contributions!
Versions
The latest release build: 3.7.0_382
Changelog
Additions
+++ Webhooks can now send multiple files in one message++ Bots can now add members to guilds (oauth2 access required)
+ Region enum now contains unicode flags
+ We now offer an ability to sync channel permissions for a channel in ChannelManager
+ You can now see webhook information in Audit-Logs
+ Can now specify custom opus library
+ Now giving access to member counts in invites
+ We now expose the flags on RichPresence
Changes
- JDA now uses the voice gateway version 4- Audio transmission now supports lite and suffix encryption
- Audio transmission now uses less allocations for each package to produce less garbage
- Using
getAsMention()
on the public role now properly returns @everyone
Fixes
- RestActions should now complete for continuous 500 responses (internal server errors)- Resources added to MessageAction should now be closed properly on clearing files
- Permission management in RoleManager is now improved
- WebhookManager#setChannel should now properly update the channel
- Improved handling of rate limit headers
- Audit-Logs should now handle null user_ids properly
- RestAction callbacks now use proper generics boundaries such as
? super T
- AFK-Channel setting in GuildManager should work properly now
- Permission checks in openAudioConnection have been corrected, VOICE_MOVE_OTHERS should not grant VOICE_CONNECT
- Invite parsing in Message should now only trigger on alphanumeric with dash
Deprecation
- Removed old updatable managers and associated classes/methods deprecated- Removed several old methods in events to be replaced by new consistent method names
Gradle
repositories {
jcenter()
}
dependencies {
compile 'net.dv8tion:JDA:3.7.0_382'
}
Maven
<dependency>
<groupId>net.dv8tion</groupId>
<artifactId>JDA</artifactId>
<version>3.7.0_382</version>
</dependency>
<repository>
<id>jcenter</id>
<name>jcenter-bintray</name>
<url>http://jcenter.bintray.com</url>
</repository>