Problem
With allow_user_messages = "involved", a bot responds to all messages in threads it has participated in — no @mention required. In multi-bot threads (where multiple bots are active), this causes every bot to respond to every message, creating noise and confusion.
The mentions mode fixes this but is too strict — it requires @mention even in single-bot threads where the conversational flow is natural.
Proposal
Add a third mode: multibot-mentions
[discord]
allow_user_messages = "multibot-mentions"
Behavior:
- Single-bot threads: same as
involved — no @mention needed if the bot has participated
- Multi-bot threads: falls back to
mentions — requires explicit @mention to respond
How to detect multi-bot threads
bot_participated_in_thread() already fetches up to 200 recent messages. We can check in the same fetch whether any other bot (from trusted_bot_ids or m.author.bot) has posted:
let involved = messages.iter().any(|m| m.author.id == bot_id);
let other_bot_involved = messages.iter().any(|m|
m.author.bot && m.author.id != bot_id
);
Then in the gating logic:
AllowUsers::MultibotMentions => {
if !in_thread { return; }
let (involved, other_bot) = self
.check_thread_participation(&ctx.http, msg.channel_id, bot_id)
.await;
if !involved { return; }
if other_bot { return; } // multi-bot thread → require @mention
}
Cost
- Zero additional API calls — reuses existing message fetch
- Backward compatible — new opt-in mode, default unchanged
- Config change — one new variant in
AllowUsers enum
Edge cases
- First message in thread: no other bot messages yet → behaves as
involved (correct, not yet a multi-bot thread)
trusted_bot_ids not set: can fall back to m.author.bot to detect any bot, not just trusted ones
- Participation cache: needs to expand from
bool to include other_bot_present flag, or use a separate cache
Related
Problem
With
allow_user_messages = "involved", a bot responds to all messages in threads it has participated in — no@mentionrequired. In multi-bot threads (where multiple bots are active), this causes every bot to respond to every message, creating noise and confusion.The
mentionsmode fixes this but is too strict — it requires@mentioneven in single-bot threads where the conversational flow is natural.Proposal
Add a third mode:
multibot-mentionsBehavior:
involved— no@mentionneeded if the bot has participatedmentions— requires explicit@mentionto respondHow to detect multi-bot threads
bot_participated_in_thread()already fetches up to 200 recent messages. We can check in the same fetch whether any other bot (fromtrusted_bot_idsorm.author.bot) has posted:Then in the gating logic:
Cost
AllowUsersenumEdge cases
involved(correct, not yet a multi-bot thread)trusted_bot_idsnot set: can fall back tom.author.botto detect any bot, not just trusted onesboolto includeother_bot_presentflag, or use a separate cacheRelated
<@UID>in mentions, enabling correct mention-back in multi-bot setupstrusted_bot_idsconfig — already exists for bot-to-bot message gating