BotServ: BOT DEL * mass removal (Anope #315)
BOT DEL * removes every registered bot at once, quitting each pseudo- client, for cleaning up after a bot spree.
This commit is contained in:
parent
0e90dd8020
commit
9f5f0ed0d2
4 changed files with 103 additions and 1 deletions
|
|
@ -40,9 +40,16 @@ pub fn handle(me: &str, from: &Sender, args: &[&str], ctx: &mut ServiceCtx, db:
|
|||
}
|
||||
Some("DEL") => {
|
||||
let Some(&nick) = args.get(2) else {
|
||||
ctx.notice(me, from.uid, "Syntax: BOT DEL <nick>");
|
||||
ctx.notice(me, from.uid, "Syntax: BOT DEL <nick> (or \x02*\x02 for all)");
|
||||
return;
|
||||
};
|
||||
if nick == "*" {
|
||||
match db.bot_del_all() {
|
||||
Ok(n) => ctx.notice(me, from.uid, format!("Removed all \x02{n}\x02 bot(s).")),
|
||||
Err(_) => ctx.notice(me, from.uid, "Sorry, that didn't work. Please try again in a moment."),
|
||||
}
|
||||
return;
|
||||
}
|
||||
match db.bot_del(nick) {
|
||||
Ok(true) => ctx.notice(me, from.uid, format!("Bot \x02{nick}\x02 deleted.")),
|
||||
Ok(false) => ctx.notice(me, from.uid, format!("There's no bot named \x02{nick}\x02.")),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue