Implement delete_message_seconds on Create Guild Ban endpoint#135
Open
QuantumToasted wants to merge 1 commit intoQuahu:masterfrom
Open
Implement delete_message_seconds on Create Guild Ban endpoint#135QuantumToasted wants to merge 1 commit intoQuahu:masterfrom
delete_message_seconds on Create Guild Ban endpoint#135QuantumToasted wants to merge 1 commit intoQuahu:masterfrom
Conversation
- adds delete_message_seconds to CreateBanJsonRestRequestContent - adds overloads to the (Api)Client methods including extension methods - adds [Obsolete] attributes to deprecated methods still using delete_message_days - adds new limits for maximum message deletion (second/day) duration
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
This PR implements the new-ish
delete_message_secondsJSON parameter found on the Create Guild Ban endpoint. It also aims to deprecate thedelete_message_daysJSON parameter which itself has been listed as deprecated by Discord.TimeSpanwas chosen for its simplicity even though invalid (or imprecise) values are still possible to be created by end users. Values provided are simply converted todelete_message_secondsvia.TotalSecondssimilarly to channel slowmode.This PR also adds two new values to Discord.Limits, namely BanDeleteMessageDays and BanDeleteMessageSeconds (as these are officially documented by Discord). As the former is technically deprecated, I can understand if you'd like it to be removed. Validation was added to CreateBanJsonRestRequestContent to account for this to avoid HTTP 400 errors (hopefully).
Tested the changes by banning a user with a 0 duration delete_message_seconds, 300 duration delete_message_seconds (5 minutes), and 1123200 duration delete_message_seconds (13 days). The last one failed validation as expected, the first two worked correctly (the 5 minute value did not touch a message that was 9 minutes old).
Checklist