From 99637d0a215d4408c1bc4ec8589f6425c6119b74 Mon Sep 17 00:00:00 2001 From: Khionu Terabite Date: Tue, 21 Jun 2016 06:13:42 -0400 Subject: [PATCH] Separated the conditions --- src/Discord.Net/Models/Channel.cs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/Discord.Net/Models/Channel.cs b/src/Discord.Net/Models/Channel.cs index 26973bd235..cd73b607c3 100644 --- a/src/Discord.Net/Models/Channel.cs +++ b/src/Discord.Net/Models/Channel.cs @@ -204,11 +204,14 @@ public async Task Edit(string name = null, string topic = null, int? position = public async Task DeleteMessages(ulong[] messageIds) { - if (messageIds.Count() < 2 || messageIds.Count() > 100) + if (messageIds.Count() > 100) throw new ArgumentOutOfRangeException("messageIds", - "You must provide no more than 100 and no less than 2 Messages or Message Ids"); - - await Client.ClientAPI.Send(new BulkMessageDelete(Id, messageIds)); + "You must provide no more than 100 Messages or Message Ids"); + + if (messageIds.Count() == 1) + await Client.ClientAPI.Send(new DeleteMessageRequest(Id, messageIds.First())); + else if (messageIds.Any()) + await Client.ClientAPI.Send(new BulkMessageDelete(Id, messageIds)); } public async Task Delete()