diff --git a/services/discord-gateway/src/modules/message-capture/messageCapture.ts b/services/discord-gateway/src/modules/message-capture/messageCapture.ts index 1a45ee3..f789d4f 100644 --- a/services/discord-gateway/src/modules/message-capture/messageCapture.ts +++ b/services/discord-gateway/src/modules/message-capture/messageCapture.ts @@ -35,6 +35,13 @@ export interface MessageLocationInput { } const EXCLUDED_CHANNEL_IDS = new Set(config.EXCLUDED_CHANNEL_IDS); +const BOT_EXCLUDED_CHANNEL_IDS = new Set(config.BOT_EXCLUDED_CHANNEL_IDS); + +function isBotExcludedChannel(message: Message): boolean { + if (!message.author?.bot) return false; + const id = getParentChannelId(message) ?? message.channelId; + return id != null && BOT_EXCLUDED_CHANNEL_IDS.has(id); +} const EXCLUDED_THREAD_IDS = new Set(config.EXCLUDED_THREAD_IDS); function isExcludedThread(message: { @@ -274,6 +281,7 @@ export function registerMessageCapture(client: Client): void { client.on("messageCreate", async (message) => { if (!shouldCaptureForAnyTarget(message, targets)) return; + if (isBotExcludedChannel(message)) return; if (isAgeRestrictedMessage(message)) return; if (isExcludedThread(message)) return; @@ -292,6 +300,7 @@ export function registerMessageCapture(client: Client): void { client.on("messageUpdate", async (_oldMessage, newMessage) => { if (!shouldCaptureForAnyTarget(newMessage, targets)) return; + if (isBotExcludedChannel(newMessage as Message)) return; if (isAgeRestrictedMessage(newMessage as Message)) return; if (isExcludedThread(newMessage)) return; diff --git a/services/discord-gateway/src/shared/config/index.ts b/services/discord-gateway/src/shared/config/index.ts index 716bcc5..8dd055c 100644 --- a/services/discord-gateway/src/shared/config/index.ts +++ b/services/discord-gateway/src/shared/config/index.ts @@ -32,6 +32,13 @@ export const configSchema = z .default("") .transform((v) => v.split(",").filter(Boolean)) .describe("Thread IDs to exclude from capture"), + BOT_EXCLUDED_CHANNEL_IDS: z + .string() + .default("1206269771340058694") + .transform((v) => v.split(",").filter(Boolean)) + .describe( + "Channel IDs where bot messages are NOT captured/analyzed (bot detection stays on everywhere else)", + ), // ── Legacy voice ───────────────────────────────────────────────────── VOICE_GUILD_ID: z.string().min(1).optional(),