-
-
Notifications
You must be signed in to change notification settings - Fork 734
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce Channel Unions #2138
Merged
Merged
Introduce Channel Unions #2138
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DV8FromTheWorld
added
type: breaking
contains a backwards incompatible change
status: documentation needed
lacks documentation, either partially or completely
priority: high
type: feature
type: enhancement
and removed
type: feature
labels
May 22, 2022
If we find that we need this union in the future we can re-add it, but currently nothing is using it.
DV8FromTheWorld
commented
May 22, 2022
src/main/java/net/dv8tion/jda/api/entities/IWebhookContainer.java
Outdated
Show resolved
Hide resolved
DV8FromTheWorld
removed
the
status: documentation needed
lacks documentation, either partially or completely
label
May 22, 2022
…feature/channel-unions # Conflicts: # src/main/java/net/dv8tion/jda/api/entities/Guild.java # src/main/java/net/dv8tion/jda/api/entities/Message.java # src/main/java/net/dv8tion/jda/api/requests/restaction/MessageAction.java # src/main/java/net/dv8tion/jda/internal/entities/AbstractMessage.java # src/main/java/net/dv8tion/jda/internal/entities/GuildImpl.java # src/main/java/net/dv8tion/jda/internal/entities/ReceivedMessage.java # src/main/java/net/dv8tion/jda/internal/entities/mixin/channel/middleman/GuildMessageChannelMixin.java # src/main/java/net/dv8tion/jda/internal/requests/restaction/MessageActionImpl.java
…eWorld/JDA into feature/channel-unions
src/main/java/net/dv8tion/jda/api/entities/channel/unions/DefaultGuildChannelUnion.java
Show resolved
Hide resolved
src/main/java/net/dv8tion/jda/api/entities/channel/unions/DefaultGuildChannelUnion.java
Outdated
Show resolved
Hide resolved
src/main/java/net/dv8tion/jda/api/entities/channel/unions/DefaultGuildChannelUnion.java
Outdated
Show resolved
Hide resolved
src/main/java/net/dv8tion/jda/api/entities/channel/unions/IWebhookContainerUnion.java
Show resolved
Hide resolved
src/main/java/net/dv8tion/jda/api/entities/channel/unions/MessageChannelUnion.java
Outdated
Show resolved
Hide resolved
src/main/java/net/dv8tion/jda/api/interactions/commands/OptionMapping.java
Outdated
Show resolved
Hide resolved
src/main/java/net/dv8tion/jda/internal/entities/AbstractChannelImpl.java
Outdated
Show resolved
Hide resolved
This PR should also move the channel interfaces into a dedicated package |
…feature/channel-unions # Conflicts: # src/main/java/net/dv8tion/jda/api/entities/Guild.java # src/main/java/net/dv8tion/jda/api/entities/Member.java # src/main/java/net/dv8tion/jda/api/entities/Message.java # src/main/java/net/dv8tion/jda/api/entities/MessageReaction.java # src/main/java/net/dv8tion/jda/internal/entities/AbstractMessage.java # src/main/java/net/dv8tion/jda/internal/entities/GuildImpl.java # src/main/java/net/dv8tion/jda/internal/entities/MemberImpl.java # src/main/java/net/dv8tion/jda/internal/entities/ReceivedMessage.java # src/main/java/net/dv8tion/jda/internal/entities/mixin/channel/middleman/GuildMessageChannelMixin.java # src/main/java/net/dv8tion/jda/internal/entities/mixin/channel/middleman/MessageChannelMixin.java
src/main/java/net/dv8tion/jda/api/interactions/Interaction.java
Outdated
Show resolved
Hide resolved
src/main/java/net/dv8tion/jda/internal/entities/WebhookImpl.java
Outdated
Show resolved
Hide resolved
src/main/java/net/dv8tion/jda/api/events/message/GenericMessageEvent.java
Show resolved
Hide resolved
6 tasks
This PR should also address GenericChannelEvent |
…n system Part of this change involved changed MessageReaction#getGuildChannel to throw instead of returning null when not in a guild context.
PR now addresses GenericChannelEvent |
src/main/java/net/dv8tion/jda/api/entities/MessageReaction.java
Outdated
Show resolved
Hide resolved
MinnDevelopment
approved these changes
Jul 3, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After addressing the MessageReaction#getGuild
and the javadoc error, this should be good to go.
mergify bot
referenced
this pull request
in SvenKirschbaum/musikbot-client
Jul 12, 2024
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [net.dv8tion:JDA](https://github.com/discord-jda/JDA) | `5.0.0-beta.24` -> `5.0.0` | [![age](https://developer.mend.io/api/mc/badges/age/maven/net.dv8tion:JDA/5.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/maven/net.dv8tion:JDA/5.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/maven/net.dv8tion:JDA/5.0.0-beta.24/5.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/maven/net.dv8tion:JDA/5.0.0-beta.24/5.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>discord-jda/JDA (net.dv8tion:JDA)</summary> ### [`v5.0.0`](https://github.com/discord-jda/JDA/releases/tag/v5.0.0): | End of beta phase ### The Long Awaited Stabilization After almost 3 years of refactoring and polishing, the stabilization of JDA 5.0.0 is here. If you have been following along, not much has changed since the latest beta release. If you have somehow avoided updating to a beta release since 2021, here is a list of the most noteworthy additions, changes, and bug fixes since 4.4.0. You can also use our [**Migration Guide**](https://jda.wiki/introduction/migration-v4-v5/) to help you update to the latest version of JDA 5. This guide also includes the most important changes you need to consider. ##### Interactions / Application Features Discord has further improved the capabilities of applications with new types of interactions. This major release of JDA adds support for these features, coming with some restructuring to properly accomodate the new types. We've renamed interaction events to a more consistent naming scheme: - `SlashCommandEvent` becomes `SlashCommandInteractionEvent` - `ButtonClickEvent` becomes `ButtonInteractionEvent` Similarly, we've renamed component types slightly: - `SelectionMenu` is now [`StringSelectMenu`](https://docs.jda.wiki/net/dv8tion/jda/api/interactions/components/selections/StringSelectMenu.html), while adding a new [`EntitySelectMenu`](https://docs.jda.wiki/net/dv8tion/jda/api/interactions/components/selections/EntitySelectMenu.html) - What was previously called `Component` has now been renamed to `ActionComponent` and `ItemComponent`, allowing us to introduce `Component` as an abstraction over both `Button` and `ActionRow` (which is now a `LayoutComponent`). The new [`Component`](https://docs.jda.wiki/net/dv8tion/jda/api/interactions/components/Component.html) interface is now an abstraction over both [`ItemComponent`](https://docs.jda.wiki/net/dv8tion/jda/api/interactions/components/ItemComponent.html) and [`LayoutComponent`](https://docs.jda.wiki/net/dv8tion/jda/api/interactions/components/LayoutComponent.html). To learn more about interactions in JDA 5, take a look at our [Interactions Wiki Guide](https://jda.wiki/using-jda/interactions/). ##### Channel Type Rework We've refactored the channel types and usages in JDA to be more maintainable. Each type of channel now directly maps to a specific channel interface, unlike before where `VoiceChannel` was used for both stage and voice type channels.\ Instead there are now concrete interfaces for each type, such as `NewsChannel`, `StageChannel`, `ForumChannel`, etc. The channel type hierarchy has been further refined, by introducing higher level abstractions to represent the features of multiple channel types: - [`Channel`](https://docs.jda.wiki/net/dv8tion/jda/api/entities/channel/Channel.html) - [`GuildChannel`](https://docs.jda.wiki/net/dv8tion/jda/api/entities/channel/middleman/GuildChannel.html) - [`MessageChannel`](https://docs.jda.wiki/net/dv8tion/jda/api/entities/channel/middleman/MessageChannel.html) and [`GuildMessageChannel`](https://docs.jda.wiki/net/dv8tion/jda/api/entities/channel/middleman/GuildMessageChannel.html) - [`AudioChannel`](https://docs.jda.wiki/net/dv8tion/jda/api/entities/channel/middleman/AudioChannel.html) As well as more specific features or attributes of channels: - [`IPermissionContainer`](https://docs.jda.wiki/net/dv8tion/jda/api/entities/channel/attribute/IPermissionContainer.html) - [`IPositionableChannel`](https://docs.jda.wiki/net/dv8tion/jda/api/entities/channel/attribute/IPositionableChannel.html) - [`IThreadContainer`](https://docs.jda.wiki/net/dv8tion/jda/api/entities/channel/attribute/IThreadContainer.html) - [`IWebhookContainer`](https://docs.jda.wiki/net/dv8tion/jda/api/entities/channel/attribute/IWebhookContainer.html) - etc. To properly maintain these many different channel types and make them easy to use, we've also introduced new union types to encompass multiple channels into a simple common union type. This replaces the old `getTextChannel()`/`getVoiceChannel()` getters on events with `getChannel().asTextChannel()`. However, you can also use the standard features of the unions directly. For instance, a [`MessageChannelUnion`](https://docs.jda.wiki/net/dv8tion/jda/api/entities/channel/unions/MessageChannelUnion.html) allows to send messages and these specialization methods: ```java MessageChannelUnion channel = event.getChannel(); channel.sendMessage("hello").queue(); if (channel.getType() == TEXT) { channel.asTextChannel().getManager().setTopic("test topic").queue(); } ``` Cache access has also seen some improvement, by introducing a new [`getChannelById(Class, long)`](https://docs.jda.wiki/net/dv8tion/jda/api/entities/channel/attribute/IGuildChannelContainer.html#getChannelById\(java.lang.Class,long\)) method, allowing to just get a `MessageChannel` without worrying about the concrete type. ```java GuildMessageChannel channel = guild.getChannelById(GuildMessageChannel.class, 125227483518861312L); channel.sendMessage("Hello general chat!").queue(); ``` Learn more about the channel rework in [Channel Rework](https://jda.wiki/introduction/migration-v4-v5/#channel-rework). ##### Message Features We've refactored our message sending interfaces to be more consistent, by abstracting `MessageAction`, `MessageBuilder`, and `ReplyAction` into shared interfaces [`MessageCreateRequest`](https://docs.jda.wiki/net/dv8tion/jda/api/utils/messages/MessageCreateRequest.html) and [`MessageEditRequest`](https://docs.jda.wiki/net/dv8tion/jda/api/utils/messages/MessageEditRequest.html). This makes all message sending code consistent. We recommend to simply chain your builder-like code directly on send messages: ```java channel.sendMessage("Hello World") .setComponents(ActionRow.of(button1, button2)) .setEmbeds(embed1, embed2) .setFiles(files) .queue(); ``` However, if you need to use builders, we've introduced [MessageEditBuilder](https://docs.jda.wiki/net/dv8tion/jda/api/utils/messages/MessageEditBuilder.html) and [MessageCreateBuilder](https://docs.jda.wiki/net/dv8tion/jda/api/utils/messages/MessageCreateBuilder.html) to replace the old `MessageBuilder` utility. You can also now use [`SplitUtil`](https://docs.jda.wiki/net/dv8tion/jda/api/utils/SplitUtil.html) to easily divide message content into multiple messages. To support file descriptions and reduce the number of sendFile overloads, we've also introduced a new [`FileUpload`](https://docs.jda.wiki/net/dv8tion/jda/api/utils/FileUpload.html) type that unifies all attachments into a single type. ```java FileUpload file = FileUpload.fromData(new File("myFile.png"), "image.png") .setDescription("this is my alt text for screenreaders, allowing to make accessible images in your messages!"); channel.sendFiles(file).queue(); ``` Learn more about the changes to message sending in [Message Send/Edit Rework](https://jda.wiki/introduction/migration-v4-v5/#message-sendedit-rework). ##### Emojis and Stickers In JDA 5, we have decided to unify all emoji types into a consistent type structure: - [`Emoji`](https://docs.jda.wiki/net/dv8tion/jda/api/entities/emoji/Emoji.html), a top-level interface representing all emoji as well as a type discriminator with [`Emoji#getType`](https://docs.jda.wiki/net/dv8tion/jda/api/entities/emoji/Emoji.html#getType\(\)) - [`UnicodeEmoji`](https://docs.jda.wiki/net/dv8tion/jda/api/entities/emoji/UnicodeEmoji.html), standard unicode emoji such as 🤔 - [`CustomEmoji`](https://docs.jda.wiki/net/dv8tion/jda/api/entities/emoji/CustomEmoji.html), custom emoji found in messages, like `<:minn:245267426227388416>` - [`RichCustomEmoji`](https://docs.jda.wiki/net/dv8tion/jda/api/entities/emoji/RichCustomEmoji.html), emoji with more information such as owner, accessible through the guild settings. - [`EmojiUnion`](https://docs.jda.wiki/net/dv8tion/jda/api/entities/emoji/EmojiUnion.html), adding type casting for things like [`MessageReaction#getEmoji`](https://docs.jda.wiki/net/dv8tion/jda/api/entities/MessageReaction.html#getEmoji\(\)) These new emoji types replace the duplication of `ReactionEmote` and `Activity.Emoji`. Stickers have also been refactored in a similar way, making a clear distinction between stickers found in messages and guild settings: - [`Sticker`](https://docs.jda.wiki/net/dv8tion/jda/api/entities/sticker/Sticker.html), a top-level abstraction of all sticker types - [`StickerItem`](https://docs.jda.wiki/net/dv8tion/jda/api/entities/sticker/StickerItem.html), stickers found in messages - [`RichSticker`](https://docs.jda.wiki/net/dv8tion/jda/api/entities/sticker/RichSticker.html), stickers with more information that is usually omitted for messages (sticker items) - [`StandardSticker`](https://docs.jda.wiki/net/dv8tion/jda/api/entities/sticker/StandardSticker.html), rich stickers provided by nitro instead of guilds - [`GuildSticker`](https://docs.jda.wiki/net/dv8tion/jda/api/entities/sticker/GuildSticker.html), rich stickers provided in guilds - [`StickerUnion`](https://docs.jda.wiki/net/dv8tion/jda/api/entities/sticker/StickerUnion.html), adding type casting Learn more about the changes to emojis and stickers in [Sticker and Emoji Rework](https://jda.wiki/introduction/migration-v4-v5/#sticker-and-emoji-rework). ### Installation All future JDA releases will be distributed through **maven central**. You no longer need to use `jcenter()` in your dependency manager. #### Gradle ```gradle repositories { mavenCentral() } dependencies { implementation("net.dv8tion:JDA:5.0.0") } ``` #### Maven ```xml <dependency> <groupId>net.dv8tion</groupId> <artifactId>JDA</artifactId> <version>5.0.0</version> </dependency> ``` ### Changelog (5.0.0-beta.24 -> 5.0.0) The changes since the latest beta release to this release. - Allow UserSnowflake subtypes in bulk ban methods by [@​freya022](https://github.com/freya022) ([#​2689](https://github.com/discord-jda/JDA/issues/2689)) - Update MessageType enum by [@​MinnDevelopment](https://github.com/MinnDevelopment) ([#​2691](https://github.com/discord-jda/JDA/issues/2691)) - Improve Unknown Interaction error responses by [@​freya022](https://github.com/freya022) ([#​2687](https://github.com/discord-jda/JDA/issues/2687)) - Update ErrorResponse enum by [@​MinnDevelopment](https://github.com/MinnDevelopment) ([#​2693](https://github.com/discord-jda/JDA/issues/2693)) - Add missing permissions by [@​MinnDevelopment](https://github.com/MinnDevelopment) ([#​2690](https://github.com/discord-jda/JDA/issues/2690)) - Update and remove deprecated symbols by [@​MinnDevelopment](https://github.com/MinnDevelopment) ([#​2686](https://github.com/discord-jda/JDA/issues/2686)) ### Changelog (4.4.0 -> 5.0.0) Note that this changelog is a linear history of changes. This means some earlier changes have already been superseded or refined in more recent changes. This changelog is slightly compressed to remove unimportant changes, you can see the full list of commits [here](https://github.com/discord-jda/JDA/compare/v4.4.0...v5.0.0). Thank you all for contributing! #### New Features <details> <summary>New feature additions since <b>4.4.0</b></summary> - Add GenericMessageEvent#getThreadChannel() by [@​rtm516](https://github.com/rtm516) in [https://github.com/discord-jda/JDA/pull/1924](https://github.com/discord-jda/JDA/pull/1924) - Add Message.Attachment#getDescription by [@​sebm253](https://github.com/sebm253) in [https://github.com/discord-jda/JDA/pull/1930](https://github.com/discord-jda/JDA/pull/1930) - Add Guild#isBoostProgressBarEnabled by [@​sebm253](https://github.com/sebm253) in [https://github.com/discord-jda/JDA/pull/1891](https://github.com/discord-jda/JDA/pull/1891) - Add support for member timeouts by [@​sebm253](https://github.com/sebm253) in [https://github.com/discord-jda/JDA/pull/1902](https://github.com/discord-jda/JDA/pull/1902) - Add support for attachment options by [@​MinnDevelopment](https://github.com/MinnDevelopment) in [https://github.com/discord-jda/JDA/pull/2001](https://github.com/discord-jda/JDA/pull/2001) - Add CommandInteractionPayload#getOption fallback overloads by [@​MinnDevelopment](https://github.com/MinnDevelopment) in [https://github.com/discord-jda/JDA/pull/2018](https://github.com/discord-jda/JDA/pull/2018) - Add Booster to memberCachePolicy by [@​sofiadparamo](https://github.com/sofiadparamo) in [https://github.com/discord-jda/JDA/pull/2022](https://github.com/discord-jda/JDA/pull/2022) - Add PaginationAction#order by [@​MinnDevelopment](https://github.com/MinnDevelopment) in [https://github.com/discord-jda/JDA/pull/1945](https://github.com/discord-jda/JDA/pull/1945) - Add Tags, Default Install Url, Scopes and Permissions to ApplicationInfo by [@​Xirado](https://github.com/Xirado) in [https://github.com/discord-jda/JDA/pull/1936](https://github.com/discord-jda/JDA/pull/1936) - Add CommandInteractionPayload#isGuildCommand by [@​MinnDevelopment](https://github.com/MinnDevelopment) in [https://github.com/discord-jda/JDA/pull/2091](https://github.com/discord-jda/JDA/pull/2091) - Add UserSnowflake and improve User#fromId by [@​MinnDevelopment](https://github.com/MinnDevelopment) in [https://github.com/discord-jda/JDA/pull/2065](https://github.com/discord-jda/JDA/pull/2065) - Add support for modals by [@​Xirado](https://github.com/Xirado) in [https://github.com/discord-jda/JDA/pull/2024](https://github.com/discord-jda/JDA/pull/2024) - Add ImageProxy & FileProxy by [@​freya022](https://github.com/freya022) in [https://github.com/discord-jda/JDA/pull/1955](https://github.com/discord-jda/JDA/pull/1955) - Add Message#getStartedThread and ThreadChannel#retrieveParentMessage by [@​Almighty-Satan](https://github.com/Almighty-Satan) in [https://github.com/discord-jda/JDA/pull/2099](https://github.com/discord-jda/JDA/pull/2099) - Add FileUpload class by [@​MinnDevelopment](https://github.com/MinnDevelopment) in [https://github.com/discord-jda/JDA/pull/2120](https://github.com/discord-jda/JDA/pull/2120) - Add Support for Application-Command Permissions V2 by [@​Xirado](https://github.com/Xirado) in [https://github.com/discord-jda/JDA/pull/2113](https://github.com/discord-jda/JDA/pull/2113) - Application command localization by [@​freya022](https://github.com/freya022) in [https://github.com/discord-jda/JDA/pull/2090](https://github.com/discord-jda/JDA/pull/2090) - Add EmojiUnion by [@​MinnDevelopment](https://github.com/MinnDevelopment) in [https://github.com/discord-jda/JDA/pull/2167](https://github.com/discord-jda/JDA/pull/2167) - Add JDABuilder#setEventPassthrough by [@​freya022](https://github.com/freya022) in [https://github.com/discord-jda/JDA/pull/2014](https://github.com/discord-jda/JDA/pull/2014) - Add ApplicationInfo#getFlags by [@​MinnDevelopment](https://github.com/MinnDevelopment) in [https://github.com/discord-jda/JDA/pull/2202](https://github.com/discord-jda/JDA/pull/2202) - Add support for setting voice region on channel creation/copy by [@​CheesyGamer77](https://github.com/CheesyGamer77) in [https://github.com/discord-jda/JDA/pull/2209](https://github.com/discord-jda/JDA/pull/2209) - add support for string option bounds by [@​sebm253](https://github.com/sebm253) in [https://github.com/discord-jda/JDA/pull/2169](https://github.com/discord-jda/JDA/pull/2169) - Add DataPath util by [@​MinnDevelopment](https://github.com/MinnDevelopment) in [https://github.com/discord-jda/JDA/pull/2212](https://github.com/discord-jda/JDA/pull/2212) - Add category feature to ChannelOrderAction by [@​MinnDevelopment](https://github.com/MinnDevelopment) in [https://github.com/discord-jda/JDA/pull/2136](https://github.com/discord-jda/JDA/pull/2136) - Added RestAction#onSuccess by [@​Zabuzard](https://github.com/Zabuzard) in [https://github.com/discord-jda/JDA/pull/2227](https://github.com/discord-jda/JDA/pull/2227) - Add support for forum channels by [@​MinnDevelopment](https://github.com/MinnDevelopment) in [https://github.com/discord-jda/JDA/pull/2184](https://github.com/discord-jda/JDA/pull/2184) - Add GuildManager#setFeatures by [@​MinnDevelopment](https://github.com/MinnDevelopment) in [https://github.com/discord-jda/JDA/pull/2222](https://github.com/discord-jda/JDA/pull/2222) - Add support for guild scheduled events v2 by [@​Mitmocc](https://github.com/Mitmocc) in [https://github.com/discord-jda/JDA/pull/2047](https://github.com/discord-jda/JDA/pull/2047) - Implement new select menus by [@​MinnDevelopment](https://github.com/MinnDevelopment) in [https://github.com/discord-jda/JDA/pull/2287](https://github.com/discord-jda/JDA/pull/2287) - Add slash command mentions by [@​freya022](https://github.com/freya022) in [https://github.com/discord-jda/JDA/pull/2251](https://github.com/discord-jda/JDA/pull/2251) - Implement "ACTIVE_DEVELOPER" UserFlag by [@​jasonlessenich](https://github.com/jasonlessenich) in [https://github.com/discord-jda/JDA/pull/2326](https://github.com/discord-jda/JDA/pull/2326) - Add support for age-restricted (nsfw) commands by [@​MinnDevelopment](https://github.com/MinnDevelopment) in [https://github.com/discord-jda/JDA/pull/2325](https://github.com/discord-jda/JDA/pull/2325) - Add application_id support for received messages by [@​Almighty-Satan](https://github.com/Almighty-Satan) in [https://github.com/discord-jda/JDA/pull/2335](https://github.com/discord-jda/JDA/pull/2335) - Implement thread member pagination by [@​MinnDevelopment](https://github.com/MinnDevelopment) in [https://github.com/discord-jda/JDA/pull/2338](https://github.com/discord-jda/JDA/pull/2338) - Add guild welcome screens by [@​freya022](https://github.com/freya022) in [https://github.com/discord-jda/JDA/pull/2264](https://github.com/discord-jda/JDA/pull/2264) - Add support for gif stickers by [@​MinnDevelopment](https://github.com/MinnDevelopment) in [https://github.com/discord-jda/JDA/pull/2377](https://github.com/discord-jda/JDA/pull/2377) - Add support for reverse audit-log iteration by [@​MinnDevelopment](https://github.com/MinnDevelopment) in [https://github.com/discord-jda/JDA/pull/2370](https://github.com/discord-jda/JDA/pull/2370) - Add GuildAuditLogEntryCreateEvent by [@​MinnDevelopment](https://github.com/MinnDevelopment) in [https://github.com/discord-jda/JDA/pull/2380](https://github.com/discord-jda/JDA/pull/2380) - Add `SUPPRESS_NOTIFICATIONS` flag for message by [@​Mysterious-Dev](https://github.com/Mysterious-Dev) in [https://github.com/discord-jda/JDA/pull/2393](https://github.com/discord-jda/JDA/pull/2393) - Add new message types by [@​MinnDevelopment](https://github.com/MinnDevelopment) in [https://github.com/discord-jda/JDA/pull/2371](https://github.com/discord-jda/JDA/pull/2371) - Add rate-limiter customization by [@​MinnDevelopment](https://github.com/MinnDevelopment) in [https://github.com/discord-jda/JDA/pull/2307](https://github.com/discord-jda/JDA/pull/2307) - Add support for member flags by [@​MinnDevelopment](https://github.com/MinnDevelopment) in [https://github.com/discord-jda/JDA/pull/2417](https://github.com/discord-jda/JDA/pull/2417) - Support custom timeout on tasks by [@​MinnDevelopment](https://github.com/MinnDevelopment) in [https://github.com/discord-jda/JDA/pull/2439](https://github.com/discord-jda/JDA/pull/2439) - Add EmbedBuilder#setUrl by [@​Xirado](https://github.com/Xirado) in [https://github.com/discord-jda/JDA/pull/2449](https://github.com/discord-jda/JDA/pull/2449) - Add voice message read support by [@​RedDaedalus](https://github.com/RedDaedalus) in [https://github.com/discord-jda/JDA/pull/2445](https://github.com/discord-jda/JDA/pull/2445) - Add automod support by [@​MinnDevelopment](https://github.com/MinnDevelopment) in [https://github.com/discord-jda/JDA/pull/2429](https://github.com/discord-jda/JDA/pull/2429) - Add ThreadChannel#retrieveStartMessage by [@​MinnDevelopment](https://github.com/MinnDevelopment) in [https://github.com/discord-jda/JDA/pull/2438](https://github.com/discord-jda/JDA/pull/2438) - Support embed deserialization from JSON data by [@​MinnDevelopment](https://github.com/MinnDevelopment) in [https://github.com/discord-jda/JDA/pull/2471](https://github.com/discord-jda/JDA/pull/2471) - Add the message author id to message reaction events by [@​MinnDevelopment](https://github.com/MinnDevelopment) in [https://github.com/discord-jda/JDA/pull/2499](https://github.com/discord-jda/JDA/pull/2499) - Add supplier based FileUpload by [@​MinnDevelopment](https://github.com/MinnDevelopment) in [https://github.com/discord-jda/JDA/pull/2508](https://github.com/discord-jda/JDA/pull/2508) - Add custom status support for bots by [@​RedDaedalus](https://github.com/RedDaedalus) in [https://github.com/discord-jda/JDA/pull/2521](https://github.com/discord-jda/JDA/pull/2521) - Allow slowmode & nsfw in Stage Channels by [@​kazuryyx](https://github.com/kazuryyx) in [https://github.com/discord-jda/JDA/pull/2538](https://github.com/discord-jda/JDA/pull/2538) - Add LRUMemberCachePolicy by [@​MinnDevelopment](https://github.com/MinnDevelopment) in [https://github.com/discord-jda/JDA/pull/2506](https://github.com/discord-jda/JDA/pull/2506) - Add initial support for media channels by [@​MinnDevelopment](https://github.com/MinnDevelopment) in [https://github.com/discord-jda/JDA/pull/2516](https://github.com/discord-jda/JDA/pull/2516) - Add default_values support by [@​MinnDevelopment](https://github.com/MinnDevelopment) in [https://github.com/discord-jda/JDA/pull/2542](https://github.com/discord-jda/JDA/pull/2542) - Implement super reaction handling by [@​MinnDevelopment](https://github.com/MinnDevelopment) in [https://github.com/discord-jda/JDA/pull/2554](https://github.com/discord-jda/JDA/pull/2554) - Add voice status feature by [@​MinnDevelopment](https://github.com/MinnDevelopment) in [https://github.com/discord-jda/JDA/pull/2532](https://github.com/discord-jda/JDA/pull/2532) - Add missing proxy url field to the MessageEmbed.VideoInfo class by [@​shaksternano](https://github.com/shaksternano) in [https://github.com/discord-jda/JDA/pull/2618](https://github.com/discord-jda/JDA/pull/2618) - Add support for bulk banning users by [@​MinnDevelopment](https://github.com/MinnDevelopment) in [https://github.com/discord-jda/JDA/pull/2630](https://github.com/discord-jda/JDA/pull/2630) - Add the ability to set the bot banner by [@​freya022](https://github.com/freya022) in [https://github.com/discord-jda/JDA/pull/2629](https://github.com/discord-jda/JDA/pull/2629) - Add support for premium app subscriptions by [@​Giuliopime](https://github.com/Giuliopime) in [https://github.com/discord-jda/JDA/pull/2583](https://github.com/discord-jda/JDA/pull/2583) - Poll support by [@​MinnDevelopment](https://github.com/MinnDevelopment) in [https://github.com/discord-jda/JDA/pull/2649](https://github.com/discord-jda/JDA/pull/2649) - Add missing features relating to premium app subscriptions by [@​Tobias123567](https://github.com/Tobias123567) in [https://github.com/discord-jda/JDA/pull/2667](https://github.com/discord-jda/JDA/pull/2667) - Update MessageType enum by [@​MinnDevelopment](https://github.com/MinnDevelopment) in [https://github.com/discord-jda/JDA/pull/2691](https://github.com/discord-jda/JDA/pull/2691) - Update ErrorResponse enum by [@​MinnDevelopment](https://github.com/MinnDevelopment) in [https://github.com/discord-jda/JDA/pull/2693](https://github.com/discord-jda/JDA/pull/2693) - Add missing permissions by [@​MinnDevelopment](https://github.com/MinnDevelopment) in [https://github.com/discord-jda/JDA/pull/2690](https://github.com/discord-jda/JDA/pull/2690) </details> #### Breaking Changes <details> <summary>Breaking changes since <b>4.4.0</b></summary> - Update Activity(Type) by [@​DManstrator](https://github.com/DManstrator) in [https://github.com/discord-jda/JDA/pull/1798](https://github.com/discord-jda/JDA/pull/1798) - Update Permissions for JDA5 by [@​DManstrator](https://github.com/DManstrator) in [https://github.com/discord-jda/JDA/pull/1797](https://github.com/discord-jda/JDA/pull/1797) - Remove GuildManager#setVanityCode by [@​sebm253](https://github.com/sebm253) in [https://github.com/discord-jda/JDA/pull/1933](https://github.com/discord-jda/JDA/pull/1933) - Interaction Rework by [@​MinnDevelopment](https://github.com/MinnDevelopment) in [https://github.com/discord-jda/JDA/pull/1971](https://github.com/discord-jda/JDA/pull/1971) - Make getDefaultChannel return BaseGuildMessageChannel by [@​MinnDevelopment](https://github.com/MinnDevelopment) in [https://github.com/discord-jda/JDA/pull/2016](https://github.com/discord-jda/JDA/pull/2016) - Change PrivateChannel#getUser to handle API nullability by [@​oliver276](https://github.com/oliver276) in [https://github.com/discord-jda/JDA/pull/2012](https://github.com/discord-jda/JDA/pull/2012) - Remove StoreChannel by [@​V-Play-Games](https://github.com/V-Play-Games) in [https://github.com/discord-jda/JDA/pull/2011](https://github.com/discord-jda/JDA/pull/2011) - Change some voice Regions and remove VOICE_CHANNEL_REGIONS set by [@​sebm253](https://github.com/sebm253) in [https://github.com/discord-jda/JDA/pull/1962](https://github.com/discord-jda/JDA/pull/1962) - Fix misspelled ErrorResponse enum value by [@​Xirado](https://github.com/Xirado) in [https://github.com/discord-jda/JDA/pull/2031](https://github.com/discord-jda/JDA/pull/2031) - Implement pagination for the guild ban list by [@​RedDaedalus](https://github.com/RedDaedalus) in [https://github.com/discord-jda/JDA/pull/2076](https://github.com/discord-jda/JDA/pull/2076) - Return MessageReaction for getReactionX methods by [@​duncte123](https://github.com/duncte123) in [https://github.com/discord-jda/JDA/pull/2026](https://github.com/discord-jda/JDA/pull/2026) - Remove confusing permission override methods by [@​MinnDevelopment](https://github.com/MinnDevelopment) in [https://github.com/discord-jda/JDA/pull/2067](https://github.com/discord-jda/JDA/pull/2067) - Remove manager instance cache by [@​duncte123](https://github.com/duncte123) in [https://github.com/discord-jda/JDA/pull/2106](https://github.com/discord-jda/JDA/pull/2106) - Message interface declutter: Message#getMentions() by [@​DV8FromTheWorld](https://github.com/DV8FromTheWorld) in [https://github.com/discord-jda/JDA/pull/2015](https://github.com/discord-jda/JDA/pull/2015) - Rework stickers by [@​MinnDevelopment](https://github.com/MinnDevelopment) in [https://github.com/discord-jda/JDA/pull/2104](https://github.com/discord-jda/JDA/pull/2104) - Changed addField String name and String Value to Nonnull by [@​RealYusufIsmail](https://github.com/RealYusufIsmail) in [https://github.com/discord-jda/JDA/pull/2133](https://github.com/discord-jda/JDA/pull/2133) - Uniform representation of emoji by [@​MinnDevelopment](https://github.com/MinnDevelopment) in [https://github.com/discord-jda/JDA/pull/2117](https://github.com/discord-jda/JDA/pull/2117) - Introduce Channel Unions by [@​DV8FromTheWorld](https://github.com/DV8FromTheWorld) in [https://github.com/discord-jda/JDA/pull/2138](https://github.com/discord-jda/JDA/pull/2138) - Replace occurrences of Locale with DiscordLocale by [@​MineKing9534](https://github.com/MineKing9534) in [https://github.com/discord-jda/JDA/pull/2173](https://github.com/discord-jda/JDA/pull/2173) - Message Rework by [@​MinnDevelopment](https://github.com/MinnDevelopment) in [https://github.com/discord-jda/JDA/pull/2187](https://github.com/discord-jda/JDA/pull/2187) - Remove ChannelAction#setType by [@​MinnDevelopment](https://github.com/MinnDevelopment) in [https://github.com/discord-jda/JDA/pull/2218](https://github.com/discord-jda/JDA/pull/2218) - Invalid token exception by [@​java-coding-prodigy](https://github.com/java-coding-prodigy) in [https://github.com/discord-jda/JDA/pull/2025](https://github.com/discord-jda/JDA/pull/2025) - Add support for ban deletion with seconds precision by [@​MinnDevelopment](https://github.com/MinnDevelopment) in [https://github.com/discord-jda/JDA/pull/2229](https://github.com/discord-jda/JDA/pull/2229) - Update to gateway version 10 by [@​freyacodes](https://github.com/freyacodes) in [https://github.com/discord-jda/JDA/pull/2228](https://github.com/discord-jda/JDA/pull/2228) - Move channels to separate package and cleanup code by [@​MinnDevelopment](https://github.com/MinnDevelopment) in [https://github.com/discord-jda/JDA/pull/2180](https://github.com/discord-jda/JDA/pull/2180) - Update event hierarchy by [@​MinnDevelopment](https://github.com/MinnDevelopment) in [https://github.com/discord-jda/JDA/pull/1952](https://github.com/discord-jda/JDA/pull/1952) - Make Widget an interface and move it to it's own file by [@​Almighty-Satan](https://github.com/Almighty-Satan) in [https://github.com/discord-jda/JDA/pull/2295](https://github.com/discord-jda/JDA/pull/2295) - Remove AccountType by [@​MinnDevelopment](https://github.com/MinnDevelopment) in [https://github.com/discord-jda/JDA/pull/2420](https://github.com/discord-jda/JDA/pull/2420) - Deprecate and replace onUserSpeaking by [@​MinnDevelopment](https://github.com/MinnDevelopment) in [https://github.com/discord-jda/JDA/pull/2496](https://github.com/discord-jda/JDA/pull/2496) </details> #### Other Changes <details> <summary>Other noteworthy changes since <b>4.4.0</b></summary> - Add Missing Varargs and Methods Accepting Collection Arguments by [@​aasmart](https://github.com/aasmart) in [https://github.com/discord-jda/JDA/pull/1810](https://github.com/discord-jda/JDA/pull/1810) - Make OptionData#addChoice accept long instead of int by [@​Xirado](https://github.com/Xirado) in [https://github.com/discord-jda/JDA/pull/1816](https://github.com/discord-jda/JDA/pull/1816) - Make SelectionMenu#getOptions return an unmodifiable list by [@​freya022](https://github.com/freya022) in [https://github.com/discord-jda/JDA/pull/1922](https://github.com/discord-jda/JDA/pull/1922) - Make Guild#moveVoiceMember support AudioChannel instead by [@​sebm253](https://github.com/sebm253) in [https://github.com/discord-jda/JDA/pull/1928](https://github.com/discord-jda/JDA/pull/1928) - Add support for animated guild banners by [@​sebm253](https://github.com/sebm253) in [https://github.com/discord-jda/JDA/pull/1897](https://github.com/discord-jda/JDA/pull/1897) - Hardcode gateway url by [@​Xirado](https://github.com/Xirado) in [https://github.com/discord-jda/JDA/pull/1957](https://github.com/discord-jda/JDA/pull/1957) - Move requestToSpeak to StageChannel by [@​MinnDevelopment](https://github.com/MinnDevelopment) in [https://github.com/discord-jda/JDA/pull/1978](https://github.com/discord-jda/JDA/pull/1978) - Add IGuildChannelContainer and getChannelById(Class, id) by [@​MinnDevelopment](https://github.com/MinnDevelopment) in [https://github.com/discord-jda/JDA/pull/1949](https://github.com/discord-jda/JDA/pull/1949) - Don't override latest message id on deletion event by [@​ishwi](https://github.com/ishwi) in [https://github.com/discord-jda/JDA/pull/2013](https://github.com/discord-jda/JDA/pull/2013) - Remove mentioning members with ! by [@​Tais993](https://github.com/Tais993) in [https://github.com/discord-jda/JDA/pull/2081](https://github.com/discord-jda/JDA/pull/2081) - Add new message types for automod by [@​MinnDevelopment](https://github.com/MinnDevelopment) in [https://github.com/discord-jda/JDA/pull/2116](https://github.com/discord-jda/JDA/pull/2116) - Do not ignore member cache policy when chunking is enabled by [@​MinnDevelopment](https://github.com/MinnDevelopment) in [https://github.com/discord-jda/JDA/pull/2053](https://github.com/discord-jda/JDA/pull/2053) - Make more use of CacheRestAction by [@​MinnDevelopment](https://github.com/MinnDevelopment) in [https://github.com/discord-jda/JDA/pull/2158](https://github.com/discord-jda/JDA/pull/2158) - Handle text in voice channels by [@​MinnDevelopment](https://github.com/MinnDevelopment) in [https://github.com/discord-jda/JDA/pull/2072](https://github.com/discord-jda/JDA/pull/2072) - Update to API version 10 by [@​MinnDevelopment](https://github.com/MinnDevelopment) in [https://github.com/discord-jda/JDA/pull/2165](https://github.com/discord-jda/JDA/pull/2165) - Implement gateway resume url handling by [@​MinnDevelopment](https://github.com/MinnDevelopment) in [https://github.com/discord-jda/JDA/pull/2203](https://github.com/discord-jda/JDA/pull/2203) - Add support for component-only messages by [@​MinnDevelopment](https://github.com/MinnDevelopment) in [https://github.com/discord-jda/JDA/pull/2241](https://github.com/discord-jda/JDA/pull/2241) - Use String#intern for guild features and atoms by [@​MinnDevelopment](https://github.com/MinnDevelopment) in [https://github.com/discord-jda/JDA/pull/2235](https://github.com/discord-jda/JDA/pull/2235) - Improve `toString` methods by [@​freya022](https://github.com/freya022) in [https://github.com/discord-jda/JDA/pull/2273](https://github.com/discord-jda/JDA/pull/2273) - Forward shutdown reason to awaitStatus exception by [@​MinnDevelopment](https://github.com/MinnDevelopment) in [https://github.com/discord-jda/JDA/pull/2268](https://github.com/discord-jda/JDA/pull/2268) - Improve GuildChannel#getPosition and Guild#getChannels by [@​MinnDevelopment](https://github.com/MinnDevelopment) in [https://github.com/discord-jda/JDA/pull/2320](https://github.com/discord-jda/JDA/pull/2320) - Replace lock code with atomic int by [@​MinnDevelopment](https://github.com/MinnDevelopment) in [https://github.com/discord-jda/JDA/pull/2359](https://github.com/discord-jda/JDA/pull/2359) - Improve implementation of command data by [@​MinnDevelopment](https://github.com/MinnDevelopment) in [https://github.com/discord-jda/JDA/pull/2258](https://github.com/discord-jda/JDA/pull/2258) - Necessary additions for role subscriptions by [@​MinnDevelopment](https://github.com/MinnDevelopment) in [https://github.com/discord-jda/JDA/pull/2375](https://github.com/discord-jda/JDA/pull/2375) - Support messages in stage channels by [@​MinnDevelopment](https://github.com/MinnDevelopment) in [https://github.com/discord-jda/JDA/pull/2399](https://github.com/discord-jda/JDA/pull/2399) - Start migration to new username API by [@​MinnDevelopment](https://github.com/MinnDevelopment) in [https://github.com/discord-jda/JDA/pull/2462](https://github.com/discord-jda/JDA/pull/2462) - Improve handling of method discovery in AnnotatedEventManager by [@​freya022](https://github.com/freya022) in [https://github.com/discord-jda/JDA/pull/2454](https://github.com/discord-jda/JDA/pull/2454) - Change thread model used for requests by [@​MinnDevelopment](https://github.com/MinnDevelopment) in [https://github.com/discord-jda/JDA/pull/2463](https://github.com/discord-jda/JDA/pull/2463) - Add more logging to request handling by [@​MinnDevelopment](https://github.com/MinnDevelopment) in [https://github.com/discord-jda/JDA/pull/2589](https://github.com/discord-jda/JDA/pull/2589) - Add missing message types by [@​MinnDevelopment](https://github.com/MinnDevelopment) in [https://github.com/discord-jda/JDA/pull/2531](https://github.com/discord-jda/JDA/pull/2531) - Unified channel cache by [@​MinnDevelopment](https://github.com/MinnDevelopment) in [https://github.com/discord-jda/JDA/pull/2528](https://github.com/discord-jda/JDA/pull/2528) - Add support for enforce_nonce by [@​MinnDevelopment](https://github.com/MinnDevelopment) in [https://github.com/discord-jda/JDA/pull/2614](https://github.com/discord-jda/JDA/pull/2614) - Create an exception when receiving UNKNOWN_WEBHOOK in interaction hooks by [@​freya022](https://github.com/freya022) in [https://github.com/discord-jda/JDA/pull/2621](https://github.com/discord-jda/JDA/pull/2621) - Add USER_MUST_BE_VERIFIED ErrorResponse by [@​GitMilchi](https://github.com/GitMilchi) in [https://github.com/discord-jda/JDA/pull/2651](https://github.com/discord-jda/JDA/pull/2651) - Update permission enum by [@​MinnDevelopment](https://github.com/MinnDevelopment) in [https://github.com/discord-jda/JDA/pull/2654](https://github.com/discord-jda/JDA/pull/2654) - Add more static analyzer annotations by [@​MinnDevelopment](https://github.com/MinnDevelopment) in [https://github.com/discord-jda/JDA/pull/2675](https://github.com/discord-jda/JDA/pull/2675) - Improve Unknown Interaction error responses by [@​freya022](https://github.com/freya022) in [https://github.com/discord-jda/JDA/pull/2687](https://github.com/discord-jda/JDA/pull/2687) </details> #### Bug Fixes <details> <summary>Bugs fixed since <b>4.4.0</b></summary> - Fix wrong check in GenericMessageEvent#getGuildChannel by [@​sebm253](https://github.com/sebm253) in [https://github.com/discord-jda/JDA/pull/1927](https://github.com/discord-jda/JDA/pull/1927) - Fix rate limiter not shutting down if there is an empty bucket at shutdown by [@​Vankka](https://github.com/Vankka) in [https://github.com/discord-jda/JDA/pull/2080](https://github.com/discord-jda/JDA/pull/2080) - Prevent creating OptionData with OptionType#UNKNOWN by [@​sebm253](https://github.com/sebm253) in [https://github.com/discord-jda/JDA/pull/2101](https://github.com/discord-jda/JDA/pull/2101) - Handle emoji_id sometimes being 0 instead of null by [@​MinnDevelopment](https://github.com/MinnDevelopment) in [https://github.com/discord-jda/JDA/pull/2279](https://github.com/discord-jda/JDA/pull/2279) - Use deep copy for layout components when applying message data by [@​freya022](https://github.com/freya022) in [https://github.com/discord-jda/JDA/pull/2236](https://github.com/discord-jda/JDA/pull/2236) - Fix some lock issues by [@​MinnDevelopment](https://github.com/MinnDevelopment) in [https://github.com/discord-jda/JDA/pull/2339](https://github.com/discord-jda/JDA/pull/2339) - Change handling of speaking updates in voice connections by [@​MinnDevelopment](https://github.com/MinnDevelopment) in [https://github.com/discord-jda/JDA/pull/2240](https://github.com/discord-jda/JDA/pull/2240) - Improve conditional waiting and shutdown handling by [@​MinnDevelopment](https://github.com/MinnDevelopment) in [https://github.com/discord-jda/JDA/pull/2269](https://github.com/discord-jda/JDA/pull/2269) - Fix slow shutdown during reconnects by [@​MinnDevelopment](https://github.com/MinnDevelopment) in [https://github.com/discord-jda/JDA/pull/2464](https://github.com/discord-jda/JDA/pull/2464) - Update modulo for default avatars by id by [@​MinnDevelopment](https://github.com/MinnDevelopment) in [https://github.com/discord-jda/JDA/pull/2475](https://github.com/discord-jda/JDA/pull/2475) - Fix handling of wrong length discriminators by [@​MinnDevelopment](https://github.com/MinnDevelopment) in [https://github.com/discord-jda/JDA/pull/2478](https://github.com/discord-jda/JDA/pull/2478) - Handle clyde in DMs correctly by [@​MinnDevelopment](https://github.com/MinnDevelopment) in [https://github.com/discord-jda/JDA/pull/2489](https://github.com/discord-jda/JDA/pull/2489) - Update User#formatTo by [@​MinnDevelopment](https://github.com/MinnDevelopment) in [https://github.com/discord-jda/JDA/pull/2492](https://github.com/discord-jda/JDA/pull/2492) - Improve handling of query parameters in image proxy by [@​MinnDevelopment](https://github.com/MinnDevelopment) in [https://github.com/discord-jda/JDA/pull/2551](https://github.com/discord-jda/JDA/pull/2551) - Fix orphaned rate-limit buckets by [@​MinnDevelopment](https://github.com/MinnDevelopment) in [https://github.com/discord-jda/JDA/pull/2585](https://github.com/discord-jda/JDA/pull/2585) - Handle numeric keys for ETF maps by [@​MinnDevelopment](https://github.com/MinnDevelopment) in [https://github.com/discord-jda/JDA/pull/2642](https://github.com/discord-jda/JDA/pull/2642) - Fix ClassCastException in EntityBuilder#updateMemberCache by [@​Xirado](https://github.com/Xirado) in [https://github.com/discord-jda/JDA/pull/2660](https://github.com/discord-jda/JDA/pull/2660) </details> </details> --- ### Configuration 📅 **Schedule**: Branch creation - "before 6am on saturday" in timezone Europe/Berlin, Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/SvenKirschbaum/musikbot-client).
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Pull Request Etiquette
Changes
Closes Issue: NaN
Description
The goal of this PR is to introduce Unions to JDA for channel types while also reworking the type hierarchy slightly to make way for ForumChannels and Messages in VoiceChannels (aka TextInVoice (TiV))
This PR changes the return types of a lot of method (basically all of them) that are the type
getX : XChannel
(e.g:Message#getChannel() : MessageChannel
) to instead return union types (MessageChannelUnion
in this case). Also, before you panic, anywhere that changed from XChannel -> XChannelUnion is completely compatible with 0 changes to existing bot/developer code because unions are extensions of the interface their representing.Additionally, a variety of channel getters have been changed to return more limited channel classes so that they can properly represent the channel types returned. For example, the
Webhook#getChannel
used to returnBaseGuildMessageChannel
but now instead returnsIWebhookContainerUnion
. Read on for more info!Unions
In JDA, a Union will represent a type that has getters on it to provide a signal to the developer of what types are available in this type. Technically this information is typically available via documentation, but we've found that this is also a great way to introduce additional discoverability.
These getters are in the format
asX
likeasTextChannel() : TextChannel
. The are effectively just casts, but they provide a method of introducing the available interfaces and types that are represented by the union. They also provide a way to introduce developers to "in-between" or "bridge" interfaces that may be useful likeStandardGuildChannel
or direct them to known useful casts like toIThreadContainer
.For example, the
GuildMessageChannelUnion
. TheGuildMessageChannelUnion
interface extends theGuildMessageChannel
interface and differs only by providing the getters that can implementGuildMessageChannel
:asTextChannel() : TextChannel
asNewsChannel() : NewsChannel
asThreadChannel() : ThreadChannel
asStandardGuildChannel() : StandardGuildChannel
asStandardGuildMessageChannel() : StandardGuildMessageChannel
Clean Interfaces
Another thing to note is that Unions are not directly included in the normal type hierarchy, so their
asX
getters are not present on the end concrete interface. For example, when looking at aTextChannel tchan = jda.getTextChannelById("...")
thetchan
variable will not have theasNewsChannel
(nor any otherasXChannel
getter) on it even thoughTextChannel
implementsGuildMessageChannel
. This is because the type hierarchy forTextChannel
does not contain theGuildMessageChannelUnion
interface, only theGuildMessageChannel
interface. This means devs aren't going to have weirdasX
getters when they aren't needed, and this is an expectation we place on all unions going forward.Unions are NOT wrapper objects
(This is mostly for the curious)
While the concrete type interfaces like
TextChannel
do not inherit from the Union classes, theirXImpl
(likeTextChannelImpl
) do implement them.The advantage of this is 2 fold. Like mentioned before, the interfaces presented to developers are clean of these
asX
getters when they aren't pertinent anymore (after you've left the union type for a concrete type) however since the Impl implements it it means that when a method calls for a union (likeGuildChannelMessageUnion
) and we have the non union type (likeGuildChannelMessage
) we can confidently just cast from the normal type to the union type because we know the underlying Impl that represents that channel supports the union.This is nice because it means we don't need special union wrappers to wrap objects to be returned by
asX
. The object itself is the union.For the really curious
Given the above, here is an example
TextChannel < StandardGuildMessageChannel < StandardGuildChannel + GuildMessageChannel + ...
TextChannelImpl < StandardGuildMessageChannelImpl < StandardGuildChannelImpl + GuildChannelMessageUnion + ...
Note how the impl uses the union when building up
StandardGuildMessageChannelImpl
but the interface usesGuildMessageChannel
when building upStandardGuildMessageChannel
.(technically the impl uses
GuildMessageChannelMixin
which includes the union, but I digress)Removed Types
BaseGuildMessageChannel
The BGMC served as a great accumulator of all of the "attribute interfaces" (the IXChannel / IXContainer interfaces, ex:
IThreadContainer
) and acted as a base betweenTextChannel
andNewsChannel
. While this is really useful it cannot be reused for other messaging situations likeTiV
(because TiV doesn't support threads!) and we were returning BGMC from some methods that no longer can fully model the functionalities promised by BGMC likeGuild#getDefaultChannel
asForumChannels
can be a default channel in the future and they don't supportMessageChannel
!As such, the functionality present in this type technically lives on in a form in
StandardGuildMessageChannel
, but it would be wrong to say it is simply renamed. A large amount of the "base" functionality present in this interface has now been spread out acrossStandardGuildChannel
andStandardGuildMessageChannel
. Additionally, most (if not all) of thegetX : BGMC
getters have been changed to return a super type with a more limited set of functionalities compared to the previous usages of BGMC due needing to support future Discord changes. Going back to ourGuild#getDefaultChannel
it now returnsDefaultGuildChannelUnion
to better represent the functionalities expected by a default channel.New Types
Channel Types
IWebhookContainer
Represents any channel that can add/edit/remove webhooks
StandardGuildChannel
Represents any of the "normal" Guild channels. These are the channels that are in the sidebar and have the "standard" functionalities expected by channels.
StandardGuildMessageChannel
Represents any of the "normal" message channels in a Guild. This is the bridge interface between
TextChannels
andNewsChannels
and generally supersedes the responsibility thatBaseGuildMessageChannel
had previously.Union Types
GuildChannelUnion
Represents the union of all
GuildChannel
channels.MessageChannelUnion
Represents the union of all
MessageChannel
channels.GuildMessageChannelUnion
Represents the union of all
GuildMessageChannel
channels.IWebhookContainerUnion
Represents the union of all
IWebhookContainer
channels.IThreadContainerUnion
Represents the union of all
IThreadContainer
channels.DefaultGuildChannelUnion
This is a specialized Union as it doesn't follow the expected pattern defined by the "normal" unions above. This Union extends
StandardGuildChannel
just likeStandardGuildChannelUnion
but it is specialized to only haveasXChannel
methods for the channels that are actually viable for theGuild#getDefaultChannel
andMember#getDefaultChannel
methods. This is in contrast to theStandardGuildChannelUnion
which has anasXChannel
on it for every channel type that implementsStandardGuildChannel
In the future we may have more specialized unions that follow this pattern, but for now this is the only specialized union.
Examples