mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 18:44:31 +00:00
Fix Telegram poll action wiring
This commit is contained in:
@@ -58,6 +58,9 @@ export const telegramMessageActions: ChannelMessageActionAdapter = {
|
||||
if (gate("deleteMessage")) {
|
||||
actions.add("delete");
|
||||
}
|
||||
if (gate("polls")) {
|
||||
actions.add("poll");
|
||||
}
|
||||
if (gate("editMessage")) {
|
||||
actions.add("edit");
|
||||
}
|
||||
@@ -116,6 +119,40 @@ export const telegramMessageActions: ChannelMessageActionAdapter = {
|
||||
);
|
||||
}
|
||||
|
||||
if (action === "poll") {
|
||||
const to = readStringParam(params, "to", { required: true });
|
||||
const question = readStringParam(params, "pollQuestion", { required: true });
|
||||
const options = readStringArrayParam(params, "pollOption", { required: true }) ?? [];
|
||||
const allowMultiselect = typeof params.pollMulti === "boolean" ? params.pollMulti : undefined;
|
||||
const durationSeconds = readNumberParam(params, "pollDurationSeconds", {
|
||||
integer: true,
|
||||
});
|
||||
const durationHours = readNumberParam(params, "pollDurationHours", {
|
||||
integer: true,
|
||||
});
|
||||
const replyToMessageId = readNumberParam(params, "replyTo", { integer: true });
|
||||
const messageThreadId = readNumberParam(params, "threadId", { integer: true });
|
||||
const silent = typeof params.silent === "boolean" ? params.silent : undefined;
|
||||
const isAnonymous = typeof params.isAnonymous === "boolean" ? params.isAnonymous : undefined;
|
||||
return await handleTelegramAction(
|
||||
{
|
||||
action: "poll",
|
||||
to,
|
||||
question,
|
||||
options,
|
||||
allowMultiselect,
|
||||
durationSeconds: durationSeconds ?? undefined,
|
||||
durationHours: durationHours ?? undefined,
|
||||
replyToMessageId: replyToMessageId ?? undefined,
|
||||
messageThreadId: messageThreadId ?? undefined,
|
||||
silent,
|
||||
isAnonymous,
|
||||
accountId: accountId ?? undefined,
|
||||
},
|
||||
cfg,
|
||||
);
|
||||
}
|
||||
|
||||
if (action === "delete") {
|
||||
const chatId =
|
||||
readStringOrNumberParam(params, "chatId") ??
|
||||
|
||||
Reference in New Issue
Block a user