added channel unblacklist, server not coming, closes #113

This commit is contained in:
Master Kwoth 2016-03-23 00:38:17 +01:00
parent 9beaa92bb9
commit eaddf003ef

View File

@ -455,23 +455,18 @@ namespace NadekoBot.Modules {
}); });
cgb.CreateCommand(Prefix + "uubl") cgb.CreateCommand(Prefix + "uubl")
.Alias(Prefix + "unblacklist")
.Description($"Unblacklists a mentioned user.\n**Usage**: {Prefix}uubl [user_mention]") .Description($"Unblacklists a mentioned user.\n**Usage**: {Prefix}uubl [user_mention]")
.Parameter("user", ParameterType.Unparsed) .Parameter("user", ParameterType.Unparsed)
.AddCheck(SimpleCheckers.OwnerOnly()) .AddCheck(SimpleCheckers.OwnerOnly())
.Do(async e => .Do(async e => {
{
await Task.Run(async () => { await Task.Run(async () => {
if (!e.Message.MentionedUsers.Any()) return; if (!e.Message.MentionedUsers.Any()) return;
var usr = e.Message.MentionedUsers.First(); var usr = e.Message.MentionedUsers.First();
if (NadekoBot.Config.UserBlacklist.Contains(usr.Id)) if (NadekoBot.Config.UserBlacklist.Contains(usr.Id)) {
{
NadekoBot.Config.UserBlacklist.Remove(usr.Id); NadekoBot.Config.UserBlacklist.Remove(usr.Id);
ConfigHandler.SaveConfig(); ConfigHandler.SaveConfig();
await e.Channel.SendMessage($"`Sucessfully unblacklisted user {usr.Name}`"); await e.Channel.SendMessage($"`Sucessfully unblacklisted user {usr.Name}`");
} } else {
else
{
await e.Channel.SendMessage($"`{usr.Name} was not in blacklist`"); await e.Channel.SendMessage($"`{usr.Name} was not in blacklist`");
} }
}); });
@ -490,6 +485,19 @@ namespace NadekoBot.Modules {
}); });
}); });
cgb.CreateCommand(Prefix + "cubl")
.Description("Unblacklists a mentioned channel (#general for example).\n**Usage**: ;cubl [channel_mention]")
.Parameter("channel", ParameterType.Unparsed)
.Do(async e => {
await Task.Run(async () => {
if (!e.Message.MentionedChannels.Any()) return;
var ch = e.Message.MentionedChannels.First();
NadekoBot.Config.UserBlacklist.Remove(ch.Id);
ConfigHandler.SaveConfig();
await e.Channel.SendMessage($"`Sucessfully blacklisted channel {ch.Name}`");
});
});
cgb.CreateCommand(Prefix + "sbl") cgb.CreateCommand(Prefix + "sbl")
.Description("Blacklists a server by a name or id (#general for example). **BOT OWNER ONLY**\n**Usage**: ;usl [servername/serverid]") .Description("Blacklists a server by a name or id (#general for example). **BOT OWNER ONLY**\n**Usage**: ;usl [servername/serverid]")
.Parameter("server", ParameterType.Unparsed) .Parameter("server", ParameterType.Unparsed)