diff --git a/src/infra/outbound/message.ts b/src/infra/outbound/message.ts index 8bfd6b104b5..3596bef59c9 100644 --- a/src/infra/outbound/message.ts +++ b/src/infra/outbound/message.ts @@ -100,6 +100,32 @@ export type MessagePollResult = { dryRun?: boolean; }; +function buildMessagePollResult(params: { + channel: string; + to: string; + normalized: { + question: string; + options: string[]; + maxSelections: number; + durationSeconds?: number | null; + durationHours?: number | null; + }; + result?: MessagePollResult["result"]; + dryRun?: boolean; +}): MessagePollResult { + return { + channel: params.channel, + to: params.to, + question: params.normalized.question, + options: params.normalized.options, + maxSelections: params.normalized.maxSelections, + durationSeconds: params.normalized.durationSeconds ?? null, + durationHours: params.normalized.durationHours ?? null, + via: "gateway", + ...(params.dryRun ? { dryRun: true } : { result: params.result }), + }; +} + async function resolveRequiredChannel(params: { cfg: OpenClawConfig; channel?: string; @@ -291,17 +317,12 @@ export async function sendPoll(params: MessagePollParams): Promise