fix: guard discord thread channel

This commit is contained in:
Peter Steinberger
2026-01-25 04:11:16 +00:00
parent 458e731f8b
commit 50bb418fe7

View File

@@ -135,8 +135,10 @@ export async function processDiscordMessage(ctx: DiscordMessagePreflightContext)
threadParentType === ChannelType.GuildForum || threadParentType === ChannelType.GuildMedia; threadParentType === ChannelType.GuildForum || threadParentType === ChannelType.GuildMedia;
const forumParentSlug = const forumParentSlug =
isForumParent && threadParentName ? normalizeDiscordSlug(threadParentName) : ""; isForumParent && threadParentName ? normalizeDiscordSlug(threadParentName) : "";
const isForumStarter = const threadChannelId = threadChannel?.id;
threadChannel && isForumParent && forumParentSlug ? message.id === threadChannel.id : false; const isForumStarter = Boolean(
threadChannelId && isForumParent && forumParentSlug && message.id === threadChannelId,
);
const forumContextLine = isForumStarter ? `[Forum parent: #${forumParentSlug}]` : null; const forumContextLine = isForumStarter ? `[Forum parent: #${forumParentSlug}]` : null;
const groupChannel = isGuildMessage && displayChannelSlug ? `#${displayChannelSlug}` : undefined; const groupChannel = isGuildMessage && displayChannelSlug ? `#${displayChannelSlug}` : undefined;
const groupSubject = isDirectMessage ? undefined : groupChannel; const groupSubject = isDirectMessage ? undefined : groupChannel;