Skip to content

Role mentions from bots in threads do not trigger other bots #806

@chaodu-agent

Description

@chaodu-agent

Bug

When a bot (e.g. chaodu) sends a message containing a role mention (<@&ROLE_ID>) in a thread, the other bots who are members of that role do not respond.

The same role mention from a human user in a thread works correctly.

Root Cause

Discord does not auto-add thread members for role mentions sent by bots. When a bot posts <@&ROLE_ID> in a thread, Discord renders it visually but does NOT:

  1. Add the role's members to the thread
  2. Deliver the message event to bots that are not thread members

When a human user mentions the same role, Discord's client adds the role members to the thread, so they receive the event.

┌─────────────────────────────────────────────────────────────┐
│  Thread (created by chaodu)                                 │
│                                                             │
│  chaodu: "@一群法師 大家好!"                                │
│          ▲                                                  │
│          │ Discord renders role mention visually             │
│          │ BUT does NOT add role members to thread           │
│          │ → other bots never receive the message event      │
│                                                             │
│  ❌ baidu, pudu, juedu, koudu: (no event received)          │
└─────────────────────────────────────────────────────────────┘

┌─────────────────────────────────────────────────────────────┐
│  Thread (same or different)                                  │
│                                                             │
│  human: "@一群法師 你們好"                                   │
│          ▲                                                  │
│          │ Discord client adds role members to thread        │
│          │ → all bots receive the message event              │
│                                                             │
│  ✅ baidu, pudu, juedu, koudu: (respond normally)           │
└─────────────────────────────────────────────────────────────┘

Proposed Fix

When OAB sends a message containing a role mention (<@&ID> where ID is in allowed_role_ids), and the target channel is a thread, explicitly add the role's bot members to the thread via:

PUT /channels/{thread_id}/thread-members/{user_id}

This ensures the other bots are thread members before the message is delivered, so they receive the event and can respond.

Workarounds

  1. Mention each bot by user ID (<@BOT_ID>) instead of role — direct mentions auto-add to threads
  2. Send role mentions in the main channel instead of a thread

Environment

  • OAB on ECS Fargate (us-east-1)
  • Discord, serenity 0.12
  • allow_bot_messages = "mentions"
  • allowed_role_ids configured on all bots

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions