mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 05:31:23 +00:00
refactor(outbound): dedupe poll threading + tighten duration semantics
This commit is contained in:
@@ -36,7 +36,7 @@ export const PollParamsSchema = Type.Object(
|
||||
options: Type.Array(NonEmptyString, { minItems: 2, maxItems: 12 }),
|
||||
maxSelections: Type.Optional(Type.Integer({ minimum: 1, maximum: 12 })),
|
||||
/** Poll duration in seconds (channel-specific limits may apply). */
|
||||
durationSeconds: Type.Optional(Type.Integer({ minimum: 1, maximum: 600 })),
|
||||
durationSeconds: Type.Optional(Type.Integer({ minimum: 1, maximum: 604_800 })),
|
||||
durationHours: Type.Optional(Type.Integer({ minimum: 1 })),
|
||||
/** Send silently (no notification) where supported. */
|
||||
silent: Type.Optional(Type.Boolean()),
|
||||
|
||||
@@ -303,6 +303,25 @@ export const sendHandlers: GatewayRequestHandlers = {
|
||||
return;
|
||||
}
|
||||
const channel = normalizedChannel ?? DEFAULT_CHAT_CHANNEL;
|
||||
if (typeof request.durationSeconds === "number" && channel !== "telegram") {
|
||||
respond(
|
||||
false,
|
||||
undefined,
|
||||
errorShape(
|
||||
ErrorCodes.INVALID_REQUEST,
|
||||
"durationSeconds is only supported for Telegram polls",
|
||||
),
|
||||
);
|
||||
return;
|
||||
}
|
||||
if (typeof request.isAnonymous === "boolean" && channel !== "telegram") {
|
||||
respond(
|
||||
false,
|
||||
undefined,
|
||||
errorShape(ErrorCodes.INVALID_REQUEST, "isAnonymous is only supported for Telegram polls"),
|
||||
);
|
||||
return;
|
||||
}
|
||||
const poll = {
|
||||
question: request.question,
|
||||
options: request.options,
|
||||
|
||||
Reference in New Issue
Block a user