Discord: map shared interactive sends in actions
This commit is contained in:
parent
8880bc32fa
commit
ee89ffd264
@ -8,7 +8,9 @@ import { readDiscordParentIdParam } from "../../../../src/agents/tools/discord-a
|
|||||||
import { handleDiscordAction } from "../../../../src/agents/tools/discord-actions.js";
|
import { handleDiscordAction } from "../../../../src/agents/tools/discord-actions.js";
|
||||||
import { resolveReactionMessageId } from "../../../../src/channels/plugins/actions/reaction-message-id.js";
|
import { resolveReactionMessageId } from "../../../../src/channels/plugins/actions/reaction-message-id.js";
|
||||||
import type { ChannelMessageActionContext } from "../../../../src/channels/plugins/types.js";
|
import type { ChannelMessageActionContext } from "../../../../src/channels/plugins/types.js";
|
||||||
|
import { normalizeInteractiveReply } from "../../../../src/interactive/payload.js";
|
||||||
import { readBooleanParam } from "../../../../src/plugin-sdk/boolean-param.js";
|
import { readBooleanParam } from "../../../../src/plugin-sdk/boolean-param.js";
|
||||||
|
import { buildDiscordInteractiveComponents } from "../shared-interactive.js";
|
||||||
import { resolveDiscordChannelId } from "../targets.js";
|
import { resolveDiscordChannelId } from "../targets.js";
|
||||||
import { tryHandleDiscordMessageActionGuildAdmin } from "./handle-action.guild-admin.js";
|
import { tryHandleDiscordMessageActionGuildAdmin } from "./handle-action.guild-admin.js";
|
||||||
|
|
||||||
@ -40,7 +42,9 @@ export async function handleDiscordMessageAction(
|
|||||||
if (action === "send") {
|
if (action === "send") {
|
||||||
const to = readStringParam(params, "to", { required: true });
|
const to = readStringParam(params, "to", { required: true });
|
||||||
const asVoice = readBooleanParam(params, "asVoice") === true;
|
const asVoice = readBooleanParam(params, "asVoice") === true;
|
||||||
const rawComponents = params.components;
|
const rawComponents =
|
||||||
|
params.components ??
|
||||||
|
buildDiscordInteractiveComponents(normalizeInteractiveReply(params.interactive));
|
||||||
const hasComponents =
|
const hasComponents =
|
||||||
Boolean(rawComponents) &&
|
Boolean(rawComponents) &&
|
||||||
(typeof rawComponents === "function" || typeof rawComponents === "object");
|
(typeof rawComponents === "function" || typeof rawComponents === "object");
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user