Wire NickServ + ChanServ into the shared stats registry

nickserv.identify / nickserv.identify_fail and chanserv.register /
chanserv.drop are now recorded via ctx.count, so the Stats API reports
each module's own events, not just BotServ's.
This commit is contained in:
Jean Chevronnet 2026-07-13 19:15:40 +00:00
parent d4e2c905f2
commit bddf13459d
No known key found for this signature in database
2 changed files with 4 additions and 0 deletions

View file

@ -84,6 +84,7 @@ impl Service for ChanServ {
match db.register_channel(chan, account) {
Ok(()) => {
ctx.channel_mode(me, chan, "+r"); // mark the channel registered
ctx.count("chanserv.register");
ctx.notice(me, from.uid, format!("\x02{chan}\x02 is now registered and you are its founder. Enjoy!"));
}
Err(ChanError::Exists) => ctx.notice(me, from.uid, format!("\x02{chan}\x02 is already registered. Try \x02INFO {chan}\x02 to see who owns it.")),
@ -143,6 +144,7 @@ impl Service for ChanServ {
match db.drop_channel(chan) {
Ok(()) => {
ctx.channel_mode(me, chan, "-r"); // no longer registered
ctx.count("chanserv.drop");
ctx.notice(me, from.uid, format!("\x02{chan}\x02 has been dropped and is no longer registered."));
}
Err(_) => ctx.notice(me, from.uid, "Sorry, that didn't work. Please try again in a moment."),

View file

@ -53,6 +53,7 @@ pub fn handle(me: &str, from: &Sender, args: &[&str], ctx: &mut ServiceCtx, db:
return;
}
ctx.login(from.uid, &account);
ctx.count("nickserv.identify");
ctx.notice(me, from.uid, format!("You're now identified as \x02{}\x02. Welcome back!", account));
// Apply the account's auto-join list (AJOIN).
for entry in db.ajoin_list(&account) {
@ -66,6 +67,7 @@ pub fn handle(me: &str, from: &Sender, args: &[&str], ctx: &mut ServiceCtx, db:
}
None => {
db.note_auth(account_name, false);
ctx.count("nickserv.identify_fail");
ctx.notice(me, from.uid, "Invalid password. Please try again.");
}
}