From 0eb84298665d558e3ebd0f9b92d80a70ba0bbc0b Mon Sep 17 00:00:00 2001 From: clawsweeper-repair Date: Thu, 30 Apr 2026 17:00:17 +0000 Subject: [PATCH] fix(discord): document mention formatting guidance Co-authored-by: Peter Steinberger <58493+steipete@users.noreply.github.com> --- docs/channels/discord.md | 2 +- extensions/discord/src/channel.test.ts | 2 +- extensions/discord/src/channel.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/channels/discord.md b/docs/channels/discord.md index 804aab4a864..ba95ef8376f 100644 --- a/docs/channels/discord.md +++ b/docs/channels/discord.md @@ -579,7 +579,7 @@ Example: - configured mention patterns (`agents.list[].groupChat.mentionPatterns`, fallback `messages.groupChat.mentionPatterns`) - implicit reply-to-bot behavior in supported cases - When writing outbound Discord messages, use `<@USER_ID>` to link a user. Do not use the legacy `<@!USER_ID>` nickname mention form. Use `<#CHANNEL_ID>` for channels and `<@&ROLE_ID>` for roles. + When writing outbound Discord messages, use canonical mention syntax: `<@USER_ID>` for users, `<#CHANNEL_ID>` for channels, and `<@&ROLE_ID>` for roles. Do not use the legacy `<@!USER_ID>` nickname mention form. `requireMention` is configured per guild/channel (`channels.discord.guilds...`). `ignoreOtherMentions` optionally drops messages that mention another user/role but not the bot (excluding @everyone/@here). diff --git a/extensions/discord/src/channel.test.ts b/extensions/discord/src/channel.test.ts index 33c0c77f54e..696dbeb506d 100644 --- a/extensions/discord/src/channel.test.ts +++ b/extensions/discord/src/channel.test.ts @@ -123,7 +123,7 @@ describe("discordPlugin outbound", () => { const hints = discordPlugin.agentPrompt?.messageToolHints?.({} as never) ?? []; expect(hints).toContain( - "- Discord mentions: link users with `<@USER_ID>` only. Do not use the legacy `<@!USER_ID>` nickname form. Link channels as `<#CHANNEL_ID>` and roles as `<@&ROLE_ID>`.", + "- 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.", ); }); diff --git a/extensions/discord/src/channel.ts b/extensions/discord/src/channel.ts index 466bc5fb626..2738e47d586 100644 --- a/extensions/discord/src/channel.ts +++ b/extensions/discord/src/channel.ts @@ -213,7 +213,7 @@ export const discordPlugin: ChannelPlugin }, agentPrompt: { messageToolHints: () => [ - "- Discord mentions: link users with `<@USER_ID>` only. Do not use the legacy `<@!USER_ID>` nickname form. Link channels as `<#CHANNEL_ID>` and roles as `<@&ROLE_ID>`.", + "- 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 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.", ],