refactor(outbound): dedupe poll threading + tighten duration semantics

This commit is contained in:
Peter Steinberger
2026-02-14 18:53:23 +01:00
parent f47584fec8
commit 4b9cb46c6e
7 changed files with 85 additions and 33 deletions

View File

@@ -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,