From 6c5ab4d74ba897e7210f021efdddb656b5925dc0 Mon Sep 17 00:00:00 2001 From: appelemac Date: Sun, 20 Mar 2016 15:16:46 +0100 Subject: [PATCH] Unblacklist unblacklist command added --- NadekoBot/Modules/Permissions.cs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/NadekoBot/Modules/Permissions.cs b/NadekoBot/Modules/Permissions.cs index 948c04d9..8abd132a 100644 --- a/NadekoBot/Modules/Permissions.cs +++ b/NadekoBot/Modules/Permissions.cs @@ -454,6 +454,28 @@ namespace NadekoBot.Modules { }); }); + cgb.CreateCommand(Prefix + "unblacklist") + .Description($"Unblacklists a mentioned user.\n**Usage**: {Prefix}unblacklist [user_mention]") + .Parameter("user", ParameterType.Unparsed) + .AddCheck(SimpleCheckers.OwnerOnly()) + .Do(async e => + { + await Task.Run(async () => { + if (!e.Message.MentionedUsers.Any()) return; + var usr = e.Message.MentionedUsers.First(); + if (NadekoBot.Config.UserBlacklist.Contains(usr.Id)) + { + NadekoBot.Config.UserBlacklist.Remove(usr.Id); + ConfigHandler.SaveConfig(); + await e.Channel.SendMessage($"`Sucessfully unblacklisted user {usr.Name}`"); + } + else + { + await e.Channel.SendMessage($"`{usr.Name} was not in blacklist`"); + } + }); + }); + cgb.CreateCommand(Prefix + "cbl") .Description("Blacklists a mentioned channel (#general for example).\n**Usage**: ;ubl [channel_mention]") .Parameter("channel", ParameterType.Unparsed)