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,27 +455,22 @@ 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 () => {
{ if (!e.Message.MentionedUsers.Any()) return;
await Task.Run(async () => { var usr = e.Message.MentionedUsers.First();
if (!e.Message.MentionedUsers.Any()) return; if (NadekoBot.Config.UserBlacklist.Contains(usr.Id)) {
var usr = e.Message.MentionedUsers.First(); NadekoBot.Config.UserBlacklist.Remove(usr.Id);
if (NadekoBot.Config.UserBlacklist.Contains(usr.Id)) ConfigHandler.SaveConfig();
{ await e.Channel.SendMessage($"`Sucessfully unblacklisted user {usr.Name}`");
NadekoBot.Config.UserBlacklist.Remove(usr.Id); } else {
ConfigHandler.SaveConfig(); await e.Channel.SendMessage($"`{usr.Name} was not in blacklist`");
await e.Channel.SendMessage($"`Sucessfully unblacklisted user {usr.Name}`"); }
} });
else
{
await e.Channel.SendMessage($"`{usr.Name} was not in blacklist`");
}
}); });
});
cgb.CreateCommand(Prefix + "cbl") cgb.CreateCommand(Prefix + "cbl")
.Description("Blacklists a mentioned channel (#general for example).\n**Usage**: ;ubl [channel_mention]") .Description("Blacklists a mentioned channel (#general for example).\n**Usage**: ;ubl [channel_mention]")
@ -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)