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:
Jean Chevronnet 2026-07-13 17:50:50 +00:00
parent 0e90dd8020
commit 9f5f0ed0d2
No known key found for this signature in database
4 changed files with 103 additions and 1 deletions

View file

@ -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.")),