This pull request was assisted by AI, but you wrote the final code
This pull request did not involve AI in any way
Summary
Fixes#2449. Fixes unsuppressing embeds with DiscordMessage.ModifyEmbedSuppressionAsync, and tweaks suppressing.
Details
Changes ModifyEmbedSuppressionAsync to account for the message's current flags when modifying them. Previously D#+ would have always sent {"flags":4} when suppressing, and {} (which did nothing*) when unsuppressing. Now it will send the current flags in addition to (or without) SUPPRESS_EMBEDS. For example, when suppressing a message with the HAS_SNAPSHOT flag, D#+ will send {"flags":16388}: HAS_SNAPSHOT (16384) + SUPPRESS_EMBEDS (4). When unsuppressing the same message, it will send {"flags":16384}.
*but sometimes it would cause a BadRequestException to be thrown anyway (like when used on a message with IS_COMPONENTS_V2 set), and that no longer happens with this change, so that's also a plus. Discord will ignore SUPPRESS_EMBEDS when it's invalid (like on a CV2 message) instead of sending back Bad Request
This file contains hidden or 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
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.
Summary
Fixes #2449. Fixes unsuppressing embeds with DiscordMessage.ModifyEmbedSuppressionAsync, and tweaks suppressing.
Details
Changes ModifyEmbedSuppressionAsync to account for the message's current flags when modifying them. Previously D#+ would have always sent {"flags":4} when suppressing, and {} (which did nothing*) when unsuppressing. Now it will send the current flags in addition to (or without) SUPPRESS_EMBEDS. For example, when suppressing a message with the HAS_SNAPSHOT flag, D#+ will send {"flags":16388}: HAS_SNAPSHOT (16384) + SUPPRESS_EMBEDS (4). When unsuppressing the same message, it will send {"flags":16384}.
*but sometimes it would cause a BadRequestException to be thrown anyway (like when used on a message with IS_COMPONENTS_V2 set), and that no longer happens with this change, so that's also a plus. Discord will ignore SUPPRESS_EMBEDS when it's invalid (like on a CV2 message) instead of sending back Bad Request