Polls
支持的渠道
- Telegram
- WhatsApp(web channel)
- Discord
- MS Teams(Adaptive Cards)
CLI
# Telegramopenclaw message poll --channel telegram --target 123456789 \--poll-question "Ship it?" --poll-option "Yes" --poll-option "No"openclaw message poll --channel telegram --target -1001234567890:topic:42 \--poll-question "Pick a time" --poll-option "10am" --poll-option "2pm" \--poll-duration-seconds 300openclaw message poll --target +15555550123 \--poll-question "Lunch today?" --poll-option "Yes" --poll-option "No" --poll-option "Maybe"openclaw message poll --target 123456789@g.us \--poll-question "Meeting time?" --poll-option "10am" --poll-option "2pm" --poll-option "4pm" --poll-multi# Discordopenclaw message poll --channel discord --target channel:123456789 \--poll-question "Snack?" --poll-option "Pizza" --poll-option "Sushi"openclaw message poll --channel discord --target channel:123456789 \--poll-question "Plan?" --poll-option "A" --poll-option "B" --poll-duration-hours 48# MS Teamsopenclaw message poll --channel msteams --target conversation:19:abc@thread.tacv2 \--poll-question "Lunch?" --poll-option "Pizza" --poll-option "Sushi"
选项:
--channel:whatsapp(默认)、telegram、discord或msteams--poll-multi:允许选择多个选项--poll-duration-hours:仅限 Discord(未指定时默认 24)--poll-duration-seconds:仅限 Telegram(5-600 秒)--poll-anonymous/--poll-public:仅限 Telegram 的投票可见性设置
Gateway RPC
方法:poll
参数:
to(string,必填)question(string,必填)options(string[],必填)maxSelections(number,可选)durationHours(number,可选)durationSeconds(number,可选,仅限 Telegram)isAnonymous(boolean,可选,仅限 Telegram)channel(string,可选,默认:whatsapp)idempotencyKey(string,必填)
渠道差异
- Telegram:支持 2-10 个选项。支持通过
threadId或:topic:target 指定 forum topics。使用durationSeconds而不是durationHours,范围限制为 5-600 秒。支持 anonymous 和 public polls。 - WhatsApp:支持 2-12 个选项,
maxSelections必须在选项数量范围内,忽略durationHours。 - Discord:支持 2-10 个选项,
durationHours会被限制在 1-768 小时之间(默认 24)。maxSelections > 1会启用 multi-select;Discord 不支持严格限制必须选择固定数量。 - MS Teams:使用 Adaptive Card polls(由 OpenClaw 管理)。没有原生 poll API;
durationHours会被忽略。
Agent tool(Message)
使用 message tool,并指定 poll action(to、pollQuestion、pollOption,以及可选的 pollMulti、pollDurationHours、channel)。
对于 Telegram,该 tool 还接受 pollDurationSeconds、pollAnonymous 和 pollPublic。
创建投票时使用 action: "poll"。如果在 action: "send" 下传入 poll 相关字段,会被拒绝。
注意:Discord 没有“必须恰好选择 N 项”的模式;pollMulti 会映射为 multi-select。
Teams polls 会渲染为 Adaptive Cards,并且需要 gateway 保持在线,才能将投票结果记录到 ~/.openclaw/msteams-polls.json。
