| @@ -957,6 +957,8 @@ namespace Discord.API | |||||
| Preconditions.NotNull(args, nameof(args)); | Preconditions.NotNull(args, nameof(args)); | ||||
| Preconditions.AtLeast(args.MaxAge, 0, nameof(args.MaxAge)); | Preconditions.AtLeast(args.MaxAge, 0, nameof(args.MaxAge)); | ||||
| Preconditions.AtLeast(args.MaxUses, 0, nameof(args.MaxUses)); | Preconditions.AtLeast(args.MaxUses, 0, nameof(args.MaxUses)); | ||||
| Preconditions.AtMost(args.MaxAge, 86400, nameof(args.MaxAge), | |||||
| "The maximum age of an invite must be less than or equal to a day (86400 seconds)."); | |||||
| options = RequestOptions.CreateOrClone(options); | options = RequestOptions.CreateOrClone(options); | ||||
| var ids = new BucketIds(channelId: channelId); | var ids = new BucketIds(channelId: channelId); | ||||
| @@ -76,9 +76,6 @@ namespace Discord.Rest | |||||
| public static async Task<RestInviteMetadata> CreateInviteAsync(IGuildChannel channel, BaseDiscordClient client, | public static async Task<RestInviteMetadata> CreateInviteAsync(IGuildChannel channel, BaseDiscordClient client, | ||||
| int? maxAge, int? maxUses, bool isTemporary, bool isUnique, RequestOptions options) | int? maxAge, int? maxUses, bool isTemporary, bool isUnique, RequestOptions options) | ||||
| { | { | ||||
| if (maxAge > 86400) | |||||
| throw new ArgumentOutOfRangeException(paramName: nameof(maxAge), actualValue: maxAge, | |||||
| message: "The maximum age of an invite must be less than or equal to a day (86400 seconds)."); | |||||
| var args = new API.Rest.CreateChannelInviteParams | var args = new API.Rest.CreateChannelInviteParams | ||||
| { | { | ||||
| IsTemporary = isTemporary, | IsTemporary = isTemporary, | ||||