fix(discord): align message action send parameters

This commit is contained in:
Peter Steinberger
2026-02-15 18:53:24 +00:00
parent 6f2f88d3ad
commit 9a5e617a55
2 changed files with 2 additions and 6 deletions

View File

@@ -1,7 +1,6 @@
import type { AgentToolResult } from "@mariozechner/pi-agent-core"; import type { AgentToolResult } from "@mariozechner/pi-agent-core";
import type { DiscordActionConfig } from "../../config/config.js"; import type { DiscordActionConfig } from "../../config/config.js";
import type { DiscordSendComponents, DiscordSendEmbeds } from "../../discord/send.shared.js"; import type { DiscordSendComponents, DiscordSendEmbeds } from "../../discord/send.shared.js";
import { readDiscordComponentSpec } from "../../discord/components.js";
import { import {
createThreadDiscord, createThreadDiscord,
deleteMessageDiscord, deleteMessageDiscord,

View File

@@ -37,14 +37,11 @@ export async function handleDiscordMessageAction(
const asVoice = params.asVoice === true; const asVoice = params.asVoice === true;
const rawComponents = params.components; const rawComponents = params.components;
const components = const components =
rawComponents && rawComponents && (Array.isArray(rawComponents) || typeof rawComponents === "function")
(Array.isArray(rawComponents) ||
typeof rawComponents === "function" ||
(typeof rawComponents === "object" && !Array.isArray(rawComponents)))
? rawComponents ? rawComponents
: undefined; : undefined;
const content = readStringParam(params, "message", { const content = readStringParam(params, "message", {
required: !asVoice && !components, required: !asVoice,
allowEmpty: true, allowEmpty: true,
}); });
// Support media, path, and filePath for media URL // Support media, path, and filePath for media URL