diff --git a/extensions/telegram/src/channel-actions.test.ts b/extensions/telegram/src/channel-actions.test.ts index c08295d09f0..fbcde4bc903 100644 --- a/extensions/telegram/src/channel-actions.test.ts +++ b/extensions/telegram/src/channel-actions.test.ts @@ -367,6 +367,25 @@ describe("telegramMessageActions", () => { expect(discovery?.actions).not.toContain("react"); }); + it("advertises poll duration as a positive integer in message tool schema", () => { + const cfg = { + channels: { + telegram: { + botToken: "tok", + actions: { poll: true }, + }, + }, + } as OpenClawConfig; + + const discovery = telegramMessageActions.describeMessageTool?.({ cfg }); + const schema = Array.isArray(discovery?.schema) ? discovery.schema[0] : undefined; + + expect(schema?.properties.pollDurationSeconds).toMatchObject({ + type: "integer", + minimum: 1, + }); + }); + it("matches runtime account-key normalization during SecretRef-tolerant discovery", () => { const cfg = { channels: { diff --git a/extensions/telegram/src/message-tool-schema.ts b/extensions/telegram/src/message-tool-schema.ts index 1956d9cc9f9..94f27216a1f 100644 --- a/extensions/telegram/src/message-tool-schema.ts +++ b/extensions/telegram/src/message-tool-schema.ts @@ -1,8 +1,9 @@ +import { optionalPositiveIntegerSchema } from "openclaw/plugin-sdk/channel-actions"; import { Type } from "typebox"; export function createTelegramPollExtraToolSchemas() { return { - pollDurationSeconds: Type.Optional(Type.Number()), + pollDurationSeconds: optionalPositiveIntegerSchema(), pollAnonymous: Type.Optional(Type.Boolean()), pollPublic: Type.Optional(Type.Boolean()), };