fix(capture): exclude threads inside excluded channels

- Resolve parent channel ID for threads before checking
  EXCLUDED_CHANNEL_IDS set
- Thread messages now blocked if their parent channel is excluded

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
MythEclipse
2026-06-12 17:07:34 +07:00
co-authored by Claude
parent c91f9f18cc
commit fcb199a6ae
@@ -47,12 +47,27 @@ const EXCLUDED_CHANNEL_IDS = new Set([
"1323365288447574128",
]);
function getParentChannelId(
message: MessageLocationInput,
): string | null | undefined {
try {
const m = message as {
channel?: { isThread?: () => boolean; parentId?: string };
};
if (m.channel?.isThread?.() && m.channel.parentId)
return m.channel.parentId;
} catch {
// Not a thread or can't resolve — fall back to channelId
}
return null;
}
export function shouldCaptureMessageLocation(
message: MessageLocationInput,
target: TextCaptureTarget,
): boolean {
if (message.channelId && EXCLUDED_CHANNEL_IDS.has(message.channelId))
return false;
const effectiveId = getParentChannelId(message) ?? message.channelId;
if (effectiveId && EXCLUDED_CHANNEL_IDS.has(effectiveId)) return false;
if (!message.guildId || message.guildId !== target.guildId) return false;
if (target.channelId && message.channelId !== target.channelId) return false;
return true;