diff --git a/docs/channels/discord.md b/docs/channels/discord.md index c73b4e1c9e7..e59efbfcc7b 100644 --- a/docs/channels/discord.md +++ b/docs/channels/discord.md @@ -1320,6 +1320,29 @@ openclaw logs --follow If you set `channels.discord.allowBots=true`, use strict mention and allowlist rules to avoid loop behavior. Prefer `channels.discord.allowBots="mentions"` to only accept bot messages that mention the bot. +```json5 +{ + channels: { + discord: { + accounts: { + mantis: { + // Mantis listens to other bots only when they mention her. + allowBots: "mentions", + }, + molty: { + // Molty listens to all bot-authored Discord messages. + allowBots: true, + mentionAliases: { + // Lets Molty write "@Mantis" and send a real Discord mention. + Mantis: "MANTIS_DISCORD_USER_ID", + }, + }, + }, + }, + }, +} +``` + diff --git a/extensions/discord/src/channel.test.ts b/extensions/discord/src/channel.test.ts index ffddbb5dfd6..0b256fb0229 100644 --- a/extensions/discord/src/channel.test.ts +++ b/extensions/discord/src/channel.test.ts @@ -135,7 +135,7 @@ describe("discordPlugin outbound", () => { const hints = discordPlugin.agentPrompt?.messageToolHints?.({} as never) ?? []; expect(hints).toContain( - "- Discord mentions: use canonical outbound syntax: users `<@USER_ID>`, channels `<#CHANNEL_ID>`, and roles `<@&ROLE_ID>`. Do not use the legacy `<@!USER_ID>` nickname form.", + "- Discord mentions: use canonical outbound syntax: users `<@USER_ID>`, channels `<#CHANNEL_ID>`, and roles `<@&ROLE_ID>`. Plain `@name` text only pings when a configured `mentionAliases` entry rewrites it; do not use the legacy `<@!USER_ID>` nickname form.", ); }); diff --git a/extensions/discord/src/channel.ts b/extensions/discord/src/channel.ts index c42c592a30d..04a965e03f2 100644 --- a/extensions/discord/src/channel.ts +++ b/extensions/discord/src/channel.ts @@ -219,7 +219,7 @@ export const discordPlugin: ChannelPlugin }, agentPrompt: { messageToolHints: () => [ - "- Discord mentions: use canonical outbound syntax: users `<@USER_ID>`, channels `<#CHANNEL_ID>`, and roles `<@&ROLE_ID>`. Do not use the legacy `<@!USER_ID>` nickname form.", + "- Discord mentions: use canonical outbound syntax: users `<@USER_ID>`, channels `<#CHANNEL_ID>`, and roles `<@&ROLE_ID>`. Plain `@name` text only pings when a configured `mentionAliases` entry rewrites it; do not use the legacy `<@!USER_ID>` nickname form.", "- Discord components: set `components` when sending messages to include buttons, selects, or v2 containers.", "- Forms: add `components.modal` (title, fields). OpenClaw adds a trigger button and routes submissions as new messages.", ],