Skip to content

Conversation

Zabuzard
Copy link
Member

@Zabuzard Zabuzard commented Sep 27, 2022

Overview

Closes #586 .

This migrates our JDA dependency from alpha 9 to the latest alpha 20. JDA had several breaking changes that required work on our side. The changes are done in multiple steps (see commits):

9 -> 10

They introduced a new overload for event.getOption(...) that accepts a fallback value directly. So instead of checking for null, we can provide the fallback directly. Adjusted in RoleSelectCommand.

The max amount of embeds (10) is now a constant, using that instead of hardcoding in WolframAlphaHandler.

Breaking changes on moderation methods, such as guild.ban(user). Those methods now dont accept a pure ID anymore, but require a proper user object. Fortunately, this was trivial to adjust since we always had those at hand already:

  • TemporaryMuteAction
  • TemporaryQuarantineAction

10 -> 13

Breaking changes for emojis. They are now not called Emote anymore, but Emoji. And a few minor changes on the API. Biggest changes in SuggestionsUpDownVoter, mostly just changing Emote to RichCustomEmoji and similar. Just some simple renamings.

Slash command visibility has now to be set on the command itself, using setGuildOnly. Done so directly in BotCommandAdapter.

13 -> 18

Massive breaking changes from 17 to 18. They split the hierarchy of Message, MessageBuilder and everything that belongs to that. Essentially, the class was logically split in 3:

  • messages from discord to client, Message
  • messages from bot to discord, MessageCreateAction
  • existing messages from bot to discord, MessageEditAction

This change bleeds heavily into a lot of classes. For example, all builders had to be replaced by either MessageCreateBuilder or MessageEditBuilder. But not only that, some classes did both (edit and create) and now had to be properly split (in some cases, generics worked quite fine here).

The biggest hit however is the whole JdaTester mocking setup for our unit tests. A lot of stuff had to be adjusted there.

Also, ActionRow was basically inlined to List<Button> and file uploads like message.addFile(data, name) where replaced with a wrapper message.addFiles(FileUpload.fromData(data, name)) and a few more subtle, but breaking changes like these here and there.

18 -> 19

LoginException was replaced by InvalidTokenException.

The guild.ban(...) and kick(...) methods have been deprecated to slightly change their usage. ban now takes a TimeUnit instead of implicitly always being TimeUnit.DAYS and reason has been moved out to .ban(...).reason(reason) instead of being directly in the ban/kick call.

Apart from that, this change introduces massive noise on the imports. They essentially moved around all Channel classes.

19 -> 20

No breaking changes for us. This adds RestAction#onSuccess, which replaces one ugly .<Void>map(... -> { ... return null;}) occurence 👍

Checklist

Details at: https://github.com/DV8FromTheWorld/JDA/releases

  • 5 -> 6
  • 6 -> 10
  • 10 -> 13
  • 13 -> 18
  • Fix tests with 18
  • 18 -> 19
  • 19 -> 20

@Zabuzard Zabuzard added priority: normal dependencies Pull requests that update a dependency file labels Sep 27, 2022
@Zabuzard Zabuzard self-assigned this Sep 27, 2022
@Zabuzard Zabuzard requested review from a team as code owners September 27, 2022 14:47
@Zabuzard Zabuzard marked this pull request as draft September 27, 2022 14:47
@Zabuzard Zabuzard force-pushed the feature/migrate_to_jda_alpha_20 branch from a8e87c4 to db71c7f Compare September 28, 2022 09:57
@Zabuzard Zabuzard marked this pull request as ready for review September 28, 2022 10:39
@Zabuzard Zabuzard requested a review from Tais993 September 28, 2022 10:40
@Zabuzard Zabuzard force-pushed the feature/migrate_to_jda_alpha_20 branch 2 times, most recently from c2ede77 to 861ac15 Compare September 30, 2022 15:42
Tais993
Tais993 previously approved these changes Oct 2, 2022
Copy link
Member

@Tais993 Tais993 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Me when no issues

(although gotta fix the removed requireNonNull)

image

@Zabuzard
Copy link
Member Author

Zabuzard commented Oct 4, 2022

one approve, one week old, merging

@sonarqubecloud
Copy link

sonarqubecloud bot commented Oct 4, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

0.0% 0.0% Coverage
0.0% 0.0% Duplication

@Zabuzard Zabuzard merged commit 802097f into develop Oct 4, 2022
@Zabuzard Zabuzard deleted the feature/migrate_to_jda_alpha_20 branch October 4, 2022 08:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file priority: normal

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update JDA to v5.0.0-alpha.20

3 participants