chanserv: topic, invite, akick, list, status
Adds the remaining moderation and listing commands. Auto-kick masks are stored in the event log and enforced on join: a matching user is banned and kicked. Topic and invite are sourced from the ChanServ pseudoclient.
This commit is contained in:
parent
acd0e60946
commit
ba3803e01c
11 changed files with 369 additions and 7 deletions
16
modules/chanserv/list.rs
Normal file
16
modules/chanserv/list.rs
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
use crate::engine::db::Db;
|
||||
use crate::engine::service::{Sender, ServiceCtx};
|
||||
|
||||
// LIST: show all registered channels.
|
||||
pub fn handle(me: &str, from: &Sender, _args: &[&str], ctx: &mut ServiceCtx, db: &Db) {
|
||||
let mut names: Vec<&str> = db.channels().map(|c| c.name.as_str()).collect();
|
||||
if names.is_empty() {
|
||||
ctx.notice(me, from.uid, "No channels are registered.");
|
||||
return;
|
||||
}
|
||||
names.sort_unstable();
|
||||
ctx.notice(me, from.uid, format!("Registered channels ({}):", names.len()));
|
||||
for n in names {
|
||||
ctx.notice(me, from.uid, format!(" \x02{n}\x02"));
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue