Skip to content

Implement delete_message_seconds on Create Guild Ban endpoint#135

Open
QuantumToasted wants to merge 1 commit intoQuahu:masterfrom
QuantumToasted:ban-timespan-overload
Open

Implement delete_message_seconds on Create Guild Ban endpoint#135
QuantumToasted wants to merge 1 commit intoQuahu:masterfrom
QuantumToasted:ban-timespan-overload

Conversation

@QuantumToasted
Copy link
Contributor

Description

This PR implements the new-ish delete_message_seconds JSON parameter found on the Create Guild Ban endpoint. It also aims to deprecate the delete_message_days JSON parameter which itself has been listed as deprecated by Discord.

TimeSpan was chosen for its simplicity even though invalid (or imprecise) values are still possible to be created by end users. Values provided are simply converted to delete_message_seconds via .TotalSeconds similarly 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

  • I discussed this PR with the maintainer(s) prior to opening it.
  • I read the contributing guidelines.
  • I tested the changes in this PR.

- 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
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.

1 participant