Add an upper limit to prune length when banning a user (#611)

Messages may only be pruned between 0 and 7 days, otherwise a 400 will be thrown.
This commit is contained in:
Christopher F
2017-04-15 18:03:19 -04:00
committed by RogueException
parent 8d9e11c08a
commit 660d4b0bf6
2 changed files with 4 additions and 1 deletions

View File

@@ -798,7 +798,8 @@ namespace Discord.API
Preconditions.NotEqual(guildId, 0, nameof(guildId));
Preconditions.NotEqual(userId, 0, nameof(userId));
Preconditions.NotNull(args, nameof(args));
Preconditions.AtLeast(args.DeleteMessageDays, 0, nameof(args.DeleteMessageDays));
Preconditions.AtLeast(args.DeleteMessageDays, 0, nameof(args.DeleteMessageDays), "Prune length must be within [0, 7]");
Preconditions.AtMost(args.DeleteMessageDays, 7, nameof(args.DeleteMessageDays), "Prune length must be within [0, 7]");
options = RequestOptions.CreateOrClone(options);
var ids = new BucketIds(guildId: guildId);