Skip to content

Implement delete_message_seconds on Create Guild Ban endpoint - #135

Merged
Quahu merged 2 commits into
Quahu:masterfrom
QuantumToasted:ban-timespan-overload
Feb 16, 2026
Merged

Implement delete_message_seconds on Create Guild Ban endpoint#135
Quahu merged 2 commits into
Quahu:masterfrom
QuantumToasted:ban-timespan-overload

Conversation

@QuantumToasted

Copy link
Copy Markdown
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.

QuantumToasted and others added 2 commits January 12, 2026 16:37
- 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
Due to a potential ambiguity problem with CreateBanAsync, the methods
were removed instead of just obsoleted
@Quahu
Quahu merged commit 2761e97 into Quahu:master Feb 16, 2026
1 check passed
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