Skip to content

Commit

Permalink
Merge pull request discord-net#96 from khionu/master
Browse files Browse the repository at this point in the history
BulkMessageDelete Exception
  • Loading branch information
Auralytical authored Jun 25, 2016
2 parents d1ae0db + 99637d0 commit 6036de7
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/Discord.Net/Models/Channel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,14 @@ public async Task Edit(string name = null, string topic = null, int? position =

public async Task DeleteMessages(ulong[] messageIds)
{
await Client.ClientAPI.Send(new BulkMessageDelete(Id, messageIds));
if (messageIds.Count() > 100)
throw new ArgumentOutOfRangeException("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()
Expand Down

0 comments on commit 6036de7

Please sign in to comment.