BotServ kickers: times-to-ban (TTB) + BANEXPIRE

KICK <#channel> TTB <n> makes the bot ban a user after they've been
kicked n times (by any kicker) instead of only kicking; SET <#channel>
BANEXPIRE <duration|off> controls how long that ban lasts. One clear
per-channel knob rather than Anope's per-kicker ttb array.

The kick count rides in the existing ephemeral per-user chatter state, so
it's dropped when the user parts or quits. On the ban the bot sets +b on
an ideal host mask and, if BANEXPIRE is set, queues an unban that is swept
off the next event — no timer thread. Ban time is injectable for tests.
This commit is contained in:
Jean Chevronnet 2026-07-13 17:12:12 +00:00
parent ca95184359
commit ec3205bf75
No known key found for this signature in database
5 changed files with 225 additions and 63 deletions

View file

@ -556,6 +556,8 @@ pub trait Store {
fn set_caps_kicker(&mut self, channel: &str, caps_min: u16, caps_percent: u16) -> Result<(), ChanError>;
fn set_flood_kicker(&mut self, channel: &str, lines: u16, secs: u16) -> Result<(), ChanError>;
fn set_repeat_kicker(&mut self, channel: &str, times: u16) -> Result<(), ChanError>;
fn set_ttb(&mut self, channel: &str, ttb: u16) -> Result<(), ChanError>;
fn set_ban_expire(&mut self, channel: &str, secs: u32) -> Result<(), ChanError>;
// BADWORDS list (regex patterns). add validates the pattern compiles.
fn badword_add(&mut self, channel: &str, pattern: &str) -> Result<bool, ChanError>;
fn badword_del(&mut self, channel: &str, pattern: &str) -> Result<bool, ChanError>;