Members set a personal greet with NickServ SET GREET; a channel founder enables display with BotServ SET <#channel> GREET ON. On join, if greets are enabled and the member has channel access and a non-empty greet, the assigned bot shows [account] greet in the channel. Per-account greet is a typed field on Account (AccountGreetSet event, rides the account snapshot); the per-channel toggle is a new ChanSetting::BotGreet bool. Greet is public in NickServ INFO.
34 lines
1.7 KiB
Rust
34 lines
1.7 KiB
Rust
use fedserv_api::{human_time, Priv, Store};
|
|
use fedserv_api::{Sender, ServiceCtx};
|
|
|
|
// INFO [account]: show an account's registration details. The email and other
|
|
// private fields are shown to the account's own owner, or to an oper with the
|
|
// auspex privilege.
|
|
pub fn handle(me: &str, from: &Sender, args: &[&str], ctx: &mut ServiceCtx, db: &dyn Store) {
|
|
let name = args.get(1).copied().unwrap_or(from.nick);
|
|
let Some(acct) = db.account(name) else {
|
|
ctx.notice(me, from.uid, format!("\x02{name}\x02 isn't registered."));
|
|
return;
|
|
};
|
|
ctx.notice(me, from.uid, format!("Information for \x02{}\x02:", acct.name));
|
|
ctx.notice(me, from.uid, format!(" Registered : {}", human_time(acct.ts)));
|
|
// A greet is public — the bot shows it in-channel to everyone anyway.
|
|
if !acct.greet.is_empty() {
|
|
ctx.notice(me, from.uid, format!(" Greet : {}", acct.greet));
|
|
}
|
|
let is_owner = from.account == Some(acct.name.as_str());
|
|
if is_owner || from.privs.has(Priv::Auspex) {
|
|
if let Some(s) = db.suspension(&acct.name) {
|
|
ctx.notice(me, from.uid, format!(" Suspended : by \x02{}\x02 — {}", s.by, s.reason));
|
|
}
|
|
match &acct.email {
|
|
Some(email) if acct.verified => ctx.notice(me, from.uid, format!(" Email : {email}")),
|
|
Some(email) => ctx.notice(me, from.uid, format!(" Email : {email} (unconfirmed)")),
|
|
None => ctx.notice(me, from.uid, " Email : (none set)"),
|
|
}
|
|
let ajoin = db.ajoin_list(&acct.name);
|
|
if !ajoin.is_empty() {
|
|
ctx.notice(me, from.uid, format!(" Auto-join : {} channel(s) — see \x02AJOIN LIST\x02", ajoin.len()));
|
|
}
|
|
}
|
|
}
|