mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-23 07:01:40 +00:00
Outbound: accept shared interactive sends
This commit is contained in:
committed by
Peter Steinberger
parent
04081d349e
commit
2eb2b0995d
@@ -13,6 +13,7 @@ import type {
|
||||
ChannelThreadingToolContext,
|
||||
} from "../../channels/plugins/types.js";
|
||||
import type { OpenClawConfig } from "../../config/config.js";
|
||||
import { normalizeInteractiveReply } from "../../interactive/payload.js";
|
||||
import { getAgentScopedMediaLocalRoots } from "../../media/local-roots.js";
|
||||
import { hasPollCreationParams, resolveTelegramPollVisibility } from "../../poll-params.js";
|
||||
import { resolvePollMaxSelections } from "../../polls.js";
|
||||
@@ -34,6 +35,7 @@ import {
|
||||
parseButtonsParam,
|
||||
parseCardParam,
|
||||
parseComponentsParam,
|
||||
parseInteractiveParam,
|
||||
readBooleanParam,
|
||||
resolveAttachmentMediaPolicy,
|
||||
resolveSlackAutoThreadId,
|
||||
@@ -405,10 +407,11 @@ async function handleSendAction(ctx: ResolvedActionContext): Promise<MessageActi
|
||||
readStringParam(params, "filePath", { trim: false });
|
||||
const hasCard = params.card != null && typeof params.card === "object";
|
||||
const hasComponents = params.components != null && typeof params.components === "object";
|
||||
const hasInteractive = normalizeInteractiveReply(params.interactive) != null;
|
||||
const caption = readStringParam(params, "caption", { allowEmpty: true }) ?? "";
|
||||
let message =
|
||||
readStringParam(params, "message", {
|
||||
required: !mediaHint && !hasCard && !hasComponents,
|
||||
required: !mediaHint && !hasCard && !hasComponents && !hasInteractive,
|
||||
allowEmpty: true,
|
||||
}) ?? "";
|
||||
if (message.includes("\\n")) {
|
||||
@@ -474,7 +477,14 @@ async function handleSendAction(ctx: ResolvedActionContext): Promise<MessageActi
|
||||
message = "";
|
||||
}
|
||||
}
|
||||
if (!message.trim() && !mediaUrl && mergedMediaUrls.length === 0 && !hasCard && !hasComponents) {
|
||||
if (
|
||||
!message.trim() &&
|
||||
!mediaUrl &&
|
||||
mergedMediaUrls.length === 0 &&
|
||||
!hasCard &&
|
||||
!hasComponents &&
|
||||
!hasInteractive
|
||||
) {
|
||||
throw new Error("send requires text or media");
|
||||
}
|
||||
params.message = message;
|
||||
@@ -714,6 +724,7 @@ export async function runMessageAction(
|
||||
parseButtonsParam(params);
|
||||
parseCardParam(params);
|
||||
parseComponentsParam(params);
|
||||
parseInteractiveParam(params);
|
||||
|
||||
const action = input.action;
|
||||
if (action === "broadcast") {
|
||||
|
||||
Reference in New Issue
Block a user