diff --git a/api/src/lib.rs b/api/src/lib.rs index fc2ac5a..23c2818 100644 --- a/api/src/lib.rs +++ b/api/src/lib.rs @@ -393,6 +393,8 @@ pub struct ChannelView { pub bot_greet: bool, // BotServ: whether the founder is barred from (un)assigning a bot. pub nobot: bool, + // BotServ: whether any message kicker is active on this channel. + pub kickers_active: bool, } // A single ChanServ SET option, named for the typed `set_channel_setting` call. diff --git a/botserv/src/info.rs b/botserv/src/info.rs index 206cc0b..607e9ca 100644 --- a/botserv/src/info.rs +++ b/botserv/src/info.rs @@ -13,10 +13,23 @@ pub fn handle(me: &str, from: &Sender, args: &[&str], ctx: &mut ServiceCtx, db: ctx.notice(me, from.uid, format!("\x02{target}\x02 isn't registered.")); return; }; - match chan.assigned_bot { + match &chan.assigned_bot { Some(bot) => ctx.notice(me, from.uid, format!("\x02{target}\x02 is served by bot \x02{bot}\x02.")), None => ctx.notice(me, from.uid, format!("\x02{target}\x02 has no bot assigned. Assign one with \x02ASSIGN\x02 {target} .")), } + // The BotServ options in effect on this channel. + let mut opts = Vec::new(); + if chan.bot_greet { + opts.push("greets"); + } + if chan.kickers_active { + opts.push("kickers"); + } + if chan.nobot { + opts.push("nobot"); + } + let summary = if opts.is_empty() { "none".to_string() } else { opts.join(", ") }; + ctx.notice(me, from.uid, format!(" Options: {summary}")); return; } @@ -31,7 +44,8 @@ pub fn handle(me: &str, from: &Sender, args: &[&str], ctx: &mut ServiceCtx, db: .map(|c| c.name) .collect(); - ctx.notice(me, from.uid, format!("Bot \x02{}\x02 — {}@{}", bot.nick, bot.user, bot.host)); + let privacy = if bot.private { " (private)" } else { "" }; + ctx.notice(me, from.uid, format!("Bot \x02{}\x02 — {}@{}{privacy}", bot.nick, bot.user, bot.host)); ctx.notice(me, from.uid, format!(" Real name: {}", bot.gecos)); if channels.is_empty() { ctx.notice(me, from.uid, " Not assigned to any channel."); diff --git a/src/engine/db.rs b/src/engine/db.rs index 65b6562..fc3a4b3 100644 --- a/src/engine/db.rs +++ b/src/engine/db.rs @@ -2277,6 +2277,7 @@ fn channel_view(c: &ChannelInfo) -> ChannelView { assigned_bot: c.assigned_bot.clone(), bot_greet: c.settings.bot_greet, nobot: c.settings.nobot, + kickers_active: c.kickers.any(), } }