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>