fix(discord): fallback thread parent lookup when parentId missing

This commit is contained in:
Zongxin Yang
2026-02-23 19:20:06 -05:00
committed by Peter Steinberger
parent fd24b35449
commit d883ecade6
2 changed files with 52 additions and 1 deletions

View File

@@ -131,8 +131,12 @@ export async function resolveDiscordThreadParentInfo(params: {
channelInfo: import("./message-utils.js").DiscordChannelInfo | null;
}): Promise<DiscordThreadParentInfo> {
const { threadChannel, channelInfo, client } = params;
const parentId =
let parentId =
threadChannel.parentId ?? threadChannel.parent?.id ?? channelInfo?.parentId ?? undefined;
if (!parentId && threadChannel.id) {
const threadInfo = await resolveDiscordChannelInfo(client, threadChannel.id);
parentId = threadInfo?.parentId ?? undefined;
}
if (!parentId) {
return {};
}