From 50cecd82104e1d06a0b2116978312be687ddb260 Mon Sep 17 00:00:00 2001 From: Shadow Date: Sun, 4 Jan 2026 11:34:44 -0600 Subject: [PATCH] Discord: remove duplicate message ids --- src/discord/monitor.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/discord/monitor.ts b/src/discord/monitor.ts index d953c4ed6..663418cc7 100644 --- a/src/discord/monitor.ts +++ b/src/discord/monitor.ts @@ -379,12 +379,12 @@ export async function monitorDiscordProvider(opts: MonitorDiscordOpts = {}) { const groupRoom = isGuildMessage && channelSlug ? `#${channelSlug}` : undefined; const groupSubject = isDirectMessage ? undefined : groupRoom; - const textWithId = `${text}\n[discord message id: ${message.id} channel: ${message.channelId}]`; + const messageText = text; let combinedBody = formatAgentEnvelope({ surface: "Discord", from: fromLabel, timestamp: message.createdTimestamp, - body: textWithId, + body: messageText, }); let shouldClearHistory = false; if (!isDirectMessage) { @@ -407,7 +407,7 @@ export async function monitorDiscordProvider(opts: MonitorDiscordOpts = {}) { } const name = message.author.tag; const id = message.author.id; - combinedBody = `${combinedBody}\n[from: ${name} id:${id}]`; + combinedBody = `${combinedBody}\n[from: ${name} user id:${id}]`; shouldClearHistory = true; } const replyContext = await resolveReplyContext(message); @@ -921,7 +921,7 @@ async function resolveReplyContext(message: Message): Promise { const fromLabel = isDirectMessage ? buildDirectLabel(referenced) : (referenced.member?.displayName ?? referenced.author.tag); - const body = `${referencedText}\n[discord message id: ${referenced.id} channel: ${referenced.channelId} from: ${referenced.author.tag} id:${referenced.author.id}]`; + const body = `${referencedText}\n[discord message id: ${referenced.id} channel: ${referenced.channelId} from: ${referenced.author.tag} user id:${referenced.author.id}]`; return formatAgentEnvelope({ surface: "Discord", from: fromLabel, @@ -938,13 +938,13 @@ async function resolveReplyContext(message: Message): Promise { function buildDirectLabel(message: Message) { const username = message.author.tag; - return `${username} id:${message.author.id}`; + return `${username} user id:${message.author.id}`; } function buildGuildLabel(message: Message) { const channelName = "name" in message.channel ? message.channel.name : message.channelId; - return `${message.guild?.name ?? "Guild"} #${channelName} id:${message.channelId}`; + return `${message.guild?.name ?? "Guild"} #${channelName} channel id:${message.channelId}`; } function resolveDiscordSystemEvent(message: Message): string | null {