diff --git a/src/agents/tools/telegram-actions.ts b/src/agents/tools/telegram-actions.ts index 15b122dd59a..e174510a14f 100644 --- a/src/agents/tools/telegram-actions.ts +++ b/src/agents/tools/telegram-actions.ts @@ -339,42 +339,5 @@ export async function handleTelegramAction( return jsonResult({ ok: true, ...stats }); } - if (action === "sendPoll") { - const to = readStringParam(params, "to", { required: true }); - const question = readStringParam(params, "question") ?? readStringParam(params, "pollQuestion"); - if (!question) { - throw new Error("sendPoll requires 'question'"); - } - const options = (params.options ?? params.pollOption) as string[] | undefined; - if (!options || options.length < 2) { - throw new Error("sendPoll requires at least 2 options"); - } - const maxSelections = - typeof params.maxSelections === "number" ? params.maxSelections : undefined; - const isAnonymous = typeof params.isAnonymous === "boolean" ? params.isAnonymous : undefined; - const silent = typeof params.silent === "boolean" ? params.silent : undefined; - const replyToMessageId = readNumberParam(params, "replyTo"); - const messageThreadId = readNumberParam(params, "threadId"); - const pollAccountId = readStringParam(params, "accountId"); - - const res = await sendPollTelegram( - to, - { question, options, maxSelections }, - { - accountId: pollAccountId?.trim() || undefined, - replyToMessageId, - messageThreadId, - isAnonymous, - silent, - }, - ); - return jsonResult({ - ok: true, - messageId: res.messageId, - chatId: res.chatId, - pollId: res.pollId, - }); - } - throw new Error(`Unsupported Telegram action: ${action}`); } diff --git a/src/channels/plugins/actions/actions.test.ts b/src/channels/plugins/actions/actions.test.ts index 68aa5ed0ad5..459bbf685d8 100644 --- a/src/channels/plugins/actions/actions.test.ts +++ b/src/channels/plugins/actions/actions.test.ts @@ -498,32 +498,6 @@ describe("telegramMessageActions", () => { expect(String(callPayload.messageId)).toBe("456"); expect(callPayload.emoji).toBe("ok"); }); - - it("routes poll action to sendPoll with question and options", async () => { - const cfg = { channels: { telegram: { botToken: "tok" } } } as OpenClawConfig; - - await telegramMessageActions.handleAction?.({ - channel: "telegram", - action: "poll", - params: { - to: "-100123", - pollQuestion: "Ready?", - pollOption: ["Yes", "No", "Maybe"], - }, - cfg, - accountId: undefined, - }); - - expect(handleTelegramAction).toHaveBeenCalledWith( - expect.objectContaining({ - action: "poll", - to: "-100123", - question: "Ready?", - options: ["Yes", "No", "Maybe"], - }), - cfg, - ); - }); }); describe("signalMessageActions", () => { diff --git a/src/channels/plugins/actions/telegram.ts b/src/channels/plugins/actions/telegram.ts index 940fc85cd33..868c4d8bc93 100644 --- a/src/channels/plugins/actions/telegram.ts +++ b/src/channels/plugins/actions/telegram.ts @@ -56,9 +56,6 @@ export const telegramMessageActions: ChannelMessageActionAdapter = { const gate = (key: keyof TelegramActionConfig, defaultValue = true) => gates.some((g) => g(key, defaultValue)); const actions = new Set(["send"]); - if (gate("poll")) { - actions.add("poll"); - } if (gate("reactions")) { actions.add("react"); } diff --git a/src/config/types.telegram.ts b/src/config/types.telegram.ts index 338d54d2946..d8e189e756a 100644 --- a/src/config/types.telegram.ts +++ b/src/config/types.telegram.ts @@ -16,8 +16,6 @@ export type TelegramActionConfig = { sendMessage?: boolean; deleteMessage?: boolean; editMessage?: boolean; - /** Enable poll actions (sendPoll). */ - poll?: boolean; /** Enable sticker actions (send and search). */ sticker?: boolean; };