openclaw - 💡(How to fix) Fix Discord: Replace requireMention/users with bypass/mention/deny access lists with role support and per-channel overrides [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#69748Fetched 2026-04-22 07:48:46
View on GitHub
Comments
0
Participants
1
Timeline
0
Reactions
0

Code Example

guilds: {
  "<guild_id>": {
    // Messages always processed (no @mention needed)
    bypass: ["414984456970174464", "role:123456789", "perm:admin"],
    
    // Messages processed only when @mentioning the bot
    mention: ["all"],
    
    // Never processed, regardless of other lists (highest priority)
    deny: ["user_id_of_spammer", "role:999888777"],
  }
}

---

guilds: {
  "<guild_id>": {
    bypass: ["414984456970174464"],
    mention: ["all"],
    
    channels: {
      // Engineering channel: team leads can bypass too
      "1385666656134496317": {
        bypass: ["role:team-lead-role-id"],
      },
      
      // Announcements: bot is read-only, nobody triggers it
      "1385665833803579512": {
        deny: ["all"],
      },
    }
  }
}

---

1. Is sender in deny?IGNORE
2. Is sender in bypass?PROCESS (no mention check)
3. Is sender in mention?CHECK for @mention, process if found
4. OtherwiseIGNORE

---

{
  bypass: ["414984456970174464"],
  mention: ["all"],
}

---

{
  bypass: ["414984456970174464", "perm:admin"],
  mention: ["all"],
  deny: ["bot_user_id"],
}

---

{
  mention: ["role:123456789"],
}
RAW_BUFFERClick to expand / collapse

Problem

Currently, Discord guild config offers requireMention (boolean) and users (allowlist). This creates an all-or-nothing situation:

  • requireMention: false + users: [owner] → only owner can interact, no mention needed, but everyone else is locked out entirely
  • requireMention: true + users: [] → anyone can @mention, but the owner also has to @mention
  • No way to say "I can talk freely, everyone else needs to @mention"

Proposal

Replace requireMention (boolean) and users (flat list) with three access lists, role references, and per-channel overrides.

Guild-level config

guilds: {
  "<guild_id>": {
    // Messages always processed (no @mention needed)
    bypass: ["414984456970174464", "role:123456789", "perm:admin"],
    
    // Messages processed only when @mentioning the bot
    mention: ["all"],
    
    // Never processed, regardless of other lists (highest priority)
    deny: ["user_id_of_spammer", "role:999888777"],
  }
}

Per-channel overrides

Inherits from guild level. Channel-level lists merge with (add to) guild defaults.

guilds: {
  "<guild_id>": {
    bypass: ["414984456970174464"],
    mention: ["all"],
    
    channels: {
      // Engineering channel: team leads can bypass too
      "1385666656134496317": {
        bypass: ["role:team-lead-role-id"],
      },
      
      // Announcements: bot is read-only, nobody triggers it
      "1385665833803579512": {
        deny: ["all"],
      },
    }
  }
}

Channel-level lists add to guild-level lists (union). To fully override instead of merging, a channel can set inherit: false.

Semantics

  • deny — highest priority. Message ignored entirely, even if sender is in bypass or mention
  • bypass — sender's messages always processed, no @mention required. Implicitly grants mention access
  • mention — sender's messages processed only when @mentioning the bot
  • Not in any list → message ignored
  • Empty or omitted → nobody

Special values

ValueMeaning
"all"Everyone in the guild
"<user_id>"Specific Discord user
"role:<role_id>"Anyone with that Discord role
"perm:admin"Anyone with Discord Administrator permission
"perm:manage_guild"Anyone with Manage Server permission
"perm:manage_channels"Anyone with Manage Channels permission
"perm:moderate_members"Anyone with Moderate Members permission

Permission shortcuts (perm:*) resolve against Discord's permission flags at message time, so they stay current without maintaining user/role lists. Only a small set of meaningful permission levels need to be supported — not every Discord permission flag.

Evaluation order

1. Is sender in deny?       → IGNORE
2. Is sender in bypass?     → PROCESS (no mention check)
3. Is sender in mention?    → CHECK for @mention, process if found
4. Otherwise                → IGNORE

Example configs

Owner talks freely, team can @mention:

{
  bypass: ["414984456970174464"],
  mention: ["all"],
}

Owner + admins bypass, everyone else @mentions, block a bot:

{
  bypass: ["414984456970174464", "perm:admin"],
  mention: ["all"],
  deny: ["bot_user_id"],
}

Locked down — only specific role can @mention:

{
  mention: ["role:123456789"],
}

Backward compatibility

Auto-migrate existing configs:

Old configNew config
requireMention: false, users: [X]bypass: [X]
requireMention: true, users: []mention: ["all"]
requireMention: true, users: [X]bypass: [X], mention: ["all"]
requireMention: false, users: []bypass: ["all"]

Old fields continue to work during a deprecation period, with a warning logged on startup.

Implementation notes

  • Role/permission resolution uses guild member data already available from the Discord gateway — no extra API calls needed
  • Per-channel overrides follow the same pattern as existing channels.* config (tools, skills, etc.)
  • deny is evaluated first, making it simple to carve out exceptions without complex precedence rules

extent analysis

TL;DR

To address the current all-or-nothing situation with Discord guild config, replace the requireMention boolean and users allowlist with three access lists: bypass, mention, and deny, and introduce per-channel overrides.

Guidance

  1. Implement the new access lists: Replace the existing requireMention and users config with bypass, mention, and deny lists to provide more granular control over who can interact with the bot.
  2. Configure per-channel overrides: Introduce channel-level config to inherit from or override guild-level settings, allowing for more specific control over different channels.
  3. Evaluate the access lists in order: Follow the specified evaluation order to ensure correct processing of messages based on the sender's presence in the deny, bypass, or mention lists.
  4. Auto-migrate existing configs: Implement backward compatibility by automatically migrating existing configs to the new format, logging warnings during the deprecation period.

Example

{
  "bypass": ["414984456970174464", "role:123456789"],
  "mention": ["all"],
  "deny": ["user_id_of_spammer"]
}

Notes

The proposed solution requires careful implementation to ensure correct evaluation of access lists and per-channel overrides. The use of special values like "all", "role:<role_id>", and permission shortcuts ("perm:*") simplifies configuration but may introduce complexity in resolving permissions.

Recommendation

Apply the proposed workaround by implementing the new access lists and per-channel overrides, as it provides a more flexible and granular control over bot interactions. This approach allows for a more tailored configuration to meet specific guild needs.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING