Discord Bot C# bulk deleting
[Command("remove")]
[Aliases("clear", "cleanse", "purge")]
[RequirePermissions(Permissions.ManageMessages)]
public async Task RemoveMessages(CommandContext ctx, int count = 0) {
int limit = 100; // Can be changed
// Get & Delete messages
var messages = await ctx.Channel.GetMessagesAsync((count + 1 > limit ? limit : count + 1)).ConfigureAwait(false);
await ctx.Channel.DeleteMessagesAsync(messages);
// Limit exceded message
if (count > limit) {
await ctx.Channel.SendMessageAsync($"Too many messages to delete! ({count})\nOnly deleted 100").ConfigureAwait(false);
}
}