Problem
Currently, the only way to trigger the bot is via direct @mention (<@BOT_ID>). When multiple bots are deployed (e.g. 4+ agents), users must type each bot mention individually:
@超渡法師 @普渡法師 @擺渡法師 @覺渡法師 review this PR
Discord supports role mentions (@RoleName) which notify all members of that role. If we create a role (e.g. @法師團) and assign all bots to it, a single @法師團 should trigger all bots simultaneously.
Proposed Solution
Add allowed_role_ids config field to DiscordConfig. When a message mentions a role in this list, treat it as equivalent to a direct @mention for trigger purposes.
Config
[discord]
# Role IDs that trigger the bot (same as direct @mention)
allowed_role_ids = ["1234567890"]
Implementation
src/config.rs — Add allowed_role_ids: Vec<String> to DiscordConfig (default empty = disabled)
src/discord.rs — Extend is_mentioned check:
let is_mentioned = msg.mentions_user_id(bot_id)
|| msg.content.contains(&format!("<@{}>", bot_id))
|| (!self.allowed_role_ids.is_empty()
&& msg.mention_roles.iter().any(|r| self.allowed_role_ids.contains(&r.get())));
resolve_mentions() — Strip the triggering role mention from prompt (like we strip bot mention), keep other role mentions as @(role)
- Helm chart — Add
allowedRoleIds to values.yaml + render in configmap.yaml
Behavior
- Empty
allowed_role_ids (default) = no change, role mentions ignored as before
- Non-empty = role mention treated as trigger, same as direct
@mention
- Works with all
allow_user_messages modes (Mentions, Involved, MultibotMentions)
- Role mention stripped from prompt sent to agent (same as bot mention)
Use Case
Discord server with multiple OpenAB bots. Create a @Bots role, assign all bots, configure each bot with that role ID. Users type @Bots do something and all bots respond.
Discord Discussion
https://discord.com/channels/1488041051187974246/1501546581105705012
Problem
Currently, the only way to trigger the bot is via direct
@mention(<@BOT_ID>). When multiple bots are deployed (e.g. 4+ agents), users must type each bot mention individually:Discord supports role mentions (
@RoleName) which notify all members of that role. If we create a role (e.g.@法師團) and assign all bots to it, a single@法師團should trigger all bots simultaneously.Proposed Solution
Add
allowed_role_idsconfig field toDiscordConfig. When a message mentions a role in this list, treat it as equivalent to a direct@mentionfor trigger purposes.Config
Implementation
src/config.rs— Addallowed_role_ids: Vec<String>toDiscordConfig(default empty = disabled)src/discord.rs— Extendis_mentionedcheck:resolve_mentions()— Strip the triggering role mention from prompt (like we strip bot mention), keep other role mentions as@(role)allowedRoleIdstovalues.yaml+ render inconfigmap.yamlBehavior
allowed_role_ids(default) = no change, role mentions ignored as before@mentionallow_user_messagesmodes (Mentions, Involved, MultibotMentions)Use Case
Discord server with multiple OpenAB bots. Create a
@Botsrole, assign all bots, configure each bot with that role ID. Users type@Bots do somethingand all bots respond.Discord Discussion
https://discord.com/channels/1488041051187974246/1501546581105705012