Description
multibot-mentions mode fails to detect multi-bot threads when allow_bot_messages = "mentions". The bot responds without @mention even after another bot has posted in the thread.
Root cause: Eager multibot detection (line 335) runs after bot message gating (line 248). When another bot posts without @mentioning this bot, the message is discarded at the gating step and never reaches the detection code.
Bot gating (line 248) ← other bot msg filtered here
→ return if bot msg
...
Eager multibot detection (line 335) ← never reached
→ multibot_threads.insert(key)
https://github.com/openabdev/openab/blob/9b7680d/src/discord.rs#L248
https://github.com/openabdev/openab/blob/9b7680d/src/discord.rs#L335
Steps to Reproduce
- Set
allow_bot_messages = "mentions" and allow_user_messages = "multibot-mentions"
- Human:
@BotA HIHI → BotA creates thread, responds
- Human:
@BotB 你來 → BotB responds in the thread
- Human:
nice (no @mention) → BotA responds ← should not respond
Expected Behavior
After step 3, BotA should detect the thread is multi-bot and require @mention for step 4.
Fix
Move eager multibot detection before bot message gating:
// BEFORE bot gating — detect other bots from every incoming message
if in_thread && msg.author.bot && msg.author.id != bot_id {
let key = msg.channel_id.to_string();
let mut cache = self.multibot_threads.lock().await;
cache.entry(key).or_insert_with(tokio::time::Instant::now);
}
// Bot message gating (unchanged)
if msg.author.bot { ... }
Zero API calls, zero fetch — just check msg.author.bot on every incoming message before any gating.
Description
multibot-mentionsmode fails to detect multi-bot threads whenallow_bot_messages = "mentions". The bot responds without @mention even after another bot has posted in the thread.Root cause: Eager multibot detection (line 335) runs after bot message gating (line 248). When another bot posts without @mentioning this bot, the message is discarded at the gating step and never reaches the detection code.
https://github.com/openabdev/openab/blob/9b7680d/src/discord.rs#L248
https://github.com/openabdev/openab/blob/9b7680d/src/discord.rs#L335
Steps to Reproduce
allow_bot_messages = "mentions"andallow_user_messages = "multibot-mentions"@BotA HIHI→ BotA creates thread, responds@BotB 你來→ BotB responds in the threadnice(no @mention) → BotA responds ← should not respondExpected Behavior
After step 3, BotA should detect the thread is multi-bot and require @mention for step 4.
Fix
Move eager multibot detection before bot message gating:
Zero API calls, zero fetch — just check
msg.author.boton every incoming message before any gating.