From b13f146d997a3e3df30190c00ad083e092ae4fdf Mon Sep 17 00:00:00 2001 From: Kwoth Date: Tue, 12 Jan 2016 23:09:26 +0100 Subject: [PATCH] crash prevent for pruning if bot has no permissions --- NadekoBot/Modules/Administration.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/NadekoBot/Modules/Administration.cs b/NadekoBot/Modules/Administration.cs index 57cda0dc..1fb40de1 100644 --- a/NadekoBot/Modules/Administration.cs +++ b/NadekoBot/Modules/Administration.cs @@ -302,8 +302,9 @@ namespace NadekoBot.Modules await e.Send("Incorrect amount."); return; } - - (await e.Channel.DownloadMessages(num)).ForEach(async m => await m.Delete()); + try { + (await e.Channel.DownloadMessages(num)).ForEach(async m => await m.Delete()); + } catch (Exception) { await e.Send("Failed pruning. Make sure the bot has correct permissions."); } });