BotServ kickers: caps + formatting, with DONTKICKOPS
The assigned bot now enforces kickers on channel lines: KICK <#channel> CAPS ON [min [percent]], and BOLDS/COLORS/UNDERLINES/REVERSES/ITALICS for control-code formatting. DONTKICKOPS exempts channel operators. A tripping line is kicked by the bot itself. Kicker config is a typed KickerSettings struct on the channel (event- sourced like ChanSettings) with a violation() check; the engine runs it on every channel PRIVMSG. Factored the founder-or-admin gate into a shared require_channel_admin helper (assign/set/kick).
This commit is contained in:
parent
ad8041bd9d
commit
ed7da9c713
8 changed files with 310 additions and 21 deletions
|
|
@ -1,4 +1,4 @@
|
|||
use fedserv_api::{ChanSetting, Priv, Sender, ServiceCtx, Store};
|
||||
use fedserv_api::{ChanSetting, Sender, ServiceCtx, Store};
|
||||
|
||||
// SET <#channel> <option> <on|off>: per-channel bot options. Founder-or-admin.
|
||||
// Currently: GREET (show members' personal greets when they join).
|
||||
|
|
@ -7,12 +7,7 @@ pub fn handle(me: &str, from: &Sender, args: &[&str], ctx: &mut ServiceCtx, db:
|
|||
ctx.notice(me, from.uid, "Syntax: SET <#channel> GREET <ON|OFF>");
|
||||
return;
|
||||
};
|
||||
let Some(founder) = db.channel(chan).map(|c| c.founder) else {
|
||||
ctx.notice(me, from.uid, format!("\x02{chan}\x02 isn't registered."));
|
||||
return;
|
||||
};
|
||||
if from.account != Some(founder.as_str()) && !from.privs.has(Priv::Admin) {
|
||||
ctx.notice(me, from.uid, format!("Only \x02{chan}\x02's founder can change its bot options."));
|
||||
if !super::require_channel_admin(me, from, chan, ctx, db) {
|
||||
return;
|
||||
}
|
||||
let on = match args.get(3).map(|s| s.to_ascii_uppercase()).as_deref() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue