fix(discord): use resolveDiscordChannelParentIdSafe in voice command path

#69908 switched native slash commands, listeners, and the model picker to
the safe accessor for partial thread channels, but the voice /join command
still reads channel.parentId through the unsafe "parentId" in channel
pattern. Route it through the same helper so the voice command path does
not crash with "Cannot access rawData on partial Channel" when invoked
from inside a thread on @buape/carbon >=0.16.
This commit is contained in:
Hana Chang
2026-04-22 21:55:53 +08:00
committed by Peter Steinberger
parent 43366cd541
commit 5c5fa5f38b

View File

@@ -14,6 +14,7 @@ import type { OpenClawConfig } from "openclaw/plugin-sdk/config-runtime";
import type { DiscordAccountConfig } from "openclaw/plugin-sdk/config-runtime";
import { formatMention } from "../mentions.js";
import { normalizeDiscordSlug } from "../monitor/allow-list.js";
import { resolveDiscordChannelParentIdSafe } from "../monitor/channel-access.js";
import { resolveDiscordChannelInfo } from "../monitor/message-utils.js";
import { resolveDiscordSenderIdentity } from "../monitor/sender-identity.js";
import { resolveDiscordThreadParentInfo } from "../monitor/threading.js";
@@ -201,10 +202,7 @@ export function createDiscordVoiceCommand(params: VoiceCommandContext): CommandW
channelOverride: {
id: channel.id,
name: "name" in channel ? (channel.name as string) : undefined,
parentId:
"parentId" in channel
? ((channel as { parentId?: string }).parentId ?? undefined)
: undefined,
parentId: resolveDiscordChannelParentIdSafe(channel),
},
});
if (!access.ok) {