Skip to content
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

Fix breaking changes and bugs before release #793

Merged
merged 43 commits into from
Mar 25, 2023
Merged

Fix breaking changes and bugs before release #793

merged 43 commits into from
Mar 25, 2023

Conversation

lukellmann
Copy link
Member

@lukellmann lukellmann commented Mar 24, 2023

Some breaking changes were discovered since the last release (e.g. here). This tries to revert those and includes some additional fixes.

  • The overload resolution ambiguity reported here was fixed.

  • NewsChannelBehavior was missing TopGuildMessageChannelBehavior as a supertype since ThreadParentChannelBehavior is no longer a TopGuildMessageChannelBehavior.

  • TextChannelBehavior was missing TopGuildMessageChannelBehavior as a supertype since PrivateThreadParentChannelBehavior is no longer a TopGuildMessageChannelBehavior.

  • ThreadParentChannelBehavior was extended to be a CategorizableChannelBehavior (implicating that ThreadParentChannel was also extended to be a CategorizableChannel).

  • TextChannelBehavior's startPublicThread and startPrivateThread had an additional reason parameter added, breaking binary compatibility. The reason can be specified in the builder lambda.

  • TextChannelBehavior.startPublicThreadWithMessage had the archiveDuration parameter removed, breaking binary compatibility.

  • Binary incompatibility in Integration was fixed.

  • Missing Optional default values were added in IntegrationData.

  • The event type for ForumChannels was changed from UnknownChannel[Create|Update|Delete]Event to ForumChannel[Create|Update|Delete]Event.

  • Some optionalities and nullabilities were fixed.

  • Integration events now use Integration entities from core instead of DiscordIntegration from common.

  • Audit Log Entries from GuildAuditLogEntryCreate events are no longer cached. They aren't queried through cache so putting them there doesn't make sense.

  • Wrong SerialName annotation for components was removed.

  • Old constructor of StartThreadWithMessageBuilder was reintroduced to preserve binary compatibility.

  • StartThreadWithoutMessageBuilder was renamed back to StartThreadBuilder to preserve binary compatibility.

  • Forum Tag routes and related declarations were removed because they are not documented in Discord's docs and have odd behavior. See the discussion here for details.

  • The serializer of GuildMemberFlags was made internal, it is accessible through GuildMemberFlags.serializer().

  • Some minor things were refactored and simplified.

  • The asChannel, asChannelOrNull, fetchChannel, fetchChannelOrNull and withStrategy methods were overridden in ForumChannel and ForumChannelBehavior so they have the correct return type.

  • The Intents.IntentsBuilder.enableEvent function was updated to add the right intent for ForumChannel events.

  • Support for webhooks was moved up from TopGuildMessageChannelBehavior to CategorizableChannelBehavior. This was done because ForumChannels also support webhooks but are not TopGuildMessageChannels. The only concrete Channel type that received webhook support by this change is ForumChannel.

  • The Discord prefix was removed from DiscordForumTag and DiscordDefaultReaction. These types are used in core and do not contain any optional fields.

  • ForumTagBuilder is no longer a AuditRequestBuilder, its reason was unused. The name property was also made var and public.

  • Missing properties of ThreadChannel, ForumChannel and TextChannel were added.

  • Message count caching was updated. Updating lastMessageId and message counts was combined into one update operation for MessageCreate and totalMessageSent is no longer decremented on MessageDelete and MessageDeleteBulk, the whole point of it is to not decrement.

  • The default value for the builder paremeter of ForumChannelBehavior.startPublicThread was removed. Not having a default empty builder lambda in will nudge users into thinking about what belongs in there. This is needed because you have to provide a message in that lambda to successfully create a forum post.

  • Removed ForumThreadModifyBuilder, it was almost the same as ThreadModifyBuilder, just with an additional flags property, which was just copied over to ThreadModifyBuilder instead.
    Having a single builder for both cases is more maintainable and keeps the API simpler.

  • StartForumThreadBuilder.message was made non-nullable, as it is always required. StartForumThreadBuilder.createMessage was also renamed to message because a thread is started that just contains a message.

  • The builder parameter of ChannelService.startThread was accidentally unused.

The full diff between the last release and this PR can be seen here to verify that the breaking changes were in fact reverted: 0.8.0-M17...5a805cc

HopeBaron and others added 20 commits March 24, 2023 13:49
The default argument can be reintroduced in the future, when the other
overloads are removed.
NewsChannelBehavior was missing TopGuildMessageChannelBehavior as a
supertype since ThreadParentChannelBehavior is no longer a
TopGuildMessageChannelBehavior.

TextChannelBehavior was missing TopGuildMessageChannelBehavior as a
supertype since PrivateThreadParentChannelBehavior is no longer a
TopGuildMessageChannelBehavior.

ThreadParentChannelBehavior was extended to be a
CategorizableChannelBehavior (implicating that ThreadParentChannel was
als extended to be a CategorizableChannel)

TextChannelBehavior's startPublicThread and startPrivateThread had an
additional reason parameter added, breaking binary compatibility. The
reason can be specified in the builder lambda.

TextChannelBehavior.startPublicThreadWithMessage had the archiveDuration
parameter removed, breaking binary compatibility.
There was binary incompatibility in Integration and missing Optional
default values in IntegrationData.
Before ForumChannels would take the else path resulting in
UnknownChannel events.
It's not serialized, so making it optional and nullable is useless.
They aren't queried through cache so putting them there doesn't make
sense.
This preserves binary compatibility. Also add the old constructor.
They are not documented in Discord's docs and have odd behavior.
@lukellmann lukellmann requested a review from HopeBaron March 24, 2023 18:31
@lukellmann
Copy link
Member Author

I want to make sure that the breaking changes were reverted by looking at the full diff in detail. I will tell you if I'm done with that and this PR is ready to merge (however, it is already ready to review).

It was in TopGuildMessageChannelBehavior before but ForumChannels also
support webhooks. In fact the only concrete Channel type that receives
webhook support through this change is ForumChannel.
It is used in core and does not contain any optional fields.
ForumTagBuilder is no longer a AuditRequestBuilder, its reason was
unused. The name property was also made var and public.
It's an internal function anyway, but make it more clear that it is
starting a forum thread.
It is used in core and does not contain any optional fields.
Updating lastMessageId and message counts was combined into one update
operation for MessageCreate.

totalMessageSent is no longer decremented on MessageDelete and
MessageDeleteBulk, the whole point of it is to not decrement.
@lukellmann lukellmann changed the title Fix breaking changes before release Fix breaking changes and bugs before release Mar 25, 2023
Not having a default empty builder lambda in
ForumChannelBehavior.startPublicThread will nudge users into thinking
about what belongs in there. This is needed because you have to provide
a message in that lambda to successfully create a forum post.
It was almost the same as ThreadModifyBuilder, just with an additional
flags property, which was just copied over to ThreadModifyBuilder.

Having a single builder for both cases is more maintainable and keeps
the API simpler.
A message is always required. createMessage was renamed to message
because a thread is started that just contains a message.
@lukellmann lukellmann merged commit 5a805cc into 0.8.x Mar 25, 2023
@lukellmann lukellmann deleted the 0.8.0-fixes branch March 25, 2023 07:46
@lukellmann lukellmann removed the request for review from HopeBaron September 20, 2024 15:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants