Unban command

This commit is contained in:
Kwoth 2016-01-10 16:24:50 +01:00
parent 0997a82513
commit de57285e0f

View File

@ -87,7 +87,7 @@ namespace NadekoBot.Modules
}); });
cgb.CreateCommand(".r").Alias(".role").Alias(".cr") cgb.CreateCommand(".r").Alias(".role").Alias(".cr")
.Description("Creates a role with a given name, and color.") .Description("Creates a role with a given name, and color.\n**Usage**: .r AwesomeRole Orange")
.Parameter("role_name",Discord.Commands.ParameterType.Required) .Parameter("role_name",Discord.Commands.ParameterType.Required)
.Parameter("role_color",Discord.Commands.ParameterType.Optional) .Parameter("role_color",Discord.Commands.ParameterType.Optional)
.Do(async e => .Do(async e =>
@ -115,15 +115,11 @@ namespace NadekoBot.Modules
await r.Edit(null,null, color); await r.Edit(null,null, color);
await e.Send( $"Successfully created role **{r.ToString()}**."); await e.Send( $"Successfully created role **{r.ToString()}**.");
} }
catch (Exception) catch (Exception) { }
{
await e.Send( "No sufficient permissions.");
}
return;
}); });
cgb.CreateCommand(".b").Alias(".ban") cgb.CreateCommand(".b").Alias(".ban")
.Description("Kicks a mentioned user") .Description("Bans a mentioned user")
.Do(async e => .Do(async e =>
{ {
try try
@ -134,11 +130,19 @@ namespace NadekoBot.Modules
await usr.Server.Ban(usr); await usr.Server.Ban(usr);
await e.Send( "Banned user " + usr.Name + " Id: " + usr.Id); await e.Send( "Banned user " + usr.Name + " Id: " + usr.Id);
} }
} } catch (Exception) { }
catch (Exception) });
{
await e.Send( "No sufficient permissions."); cgb.CreateCommand(".ub").Alias(".unban")
} .Description("Unbans a mentioned user")
.Do(async e => {
try {
if (e.User.ServerPermissions.BanMembers && e.Message.MentionedUsers.Any()) {
var usr = e.Message.MentionedUsers.First();
await usr.Server.Unban(usr);
await e.Send("Unbanned user " + usr.Name + " Id: " + usr.Id);
}
} catch (Exception) { }
}); });
cgb.CreateCommand(".k").Alias(".kick") cgb.CreateCommand(".k").Alias(".kick")