fix(discord): use resolveDiscordChannelNameSafe for voice channel override name

Applies the same safe-accessor pattern to the adjacent name field.
If @buape/carbon implements name as a getter that also reads _rawData
(like parentId), the previous `"name" in channel` pattern would throw
for the same reason. Aligns with the fix for parentId in the same call
site.
This commit is contained in:
Hana Chang
2026-04-22 23:51:36 +08:00
committed by Peter Steinberger
parent 5c5fa5f38b
commit 0e9c632444

View File

@@ -14,7 +14,10 @@ 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 {
resolveDiscordChannelNameSafe,
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,7 +204,7 @@ export function createDiscordVoiceCommand(params: VoiceCommandContext): CommandW
const access = await authorizeVoiceCommand(interaction, params, {
channelOverride: {
id: channel.id,
name: "name" in channel ? (channel.name as string) : undefined,
name: resolveDiscordChannelNameSafe(channel),
parentId: resolveDiscordChannelParentIdSafe(channel),
},
});