Polls

支持的渠道

  • Telegram
  • WhatsApp(web channel)
  • Discord
  • MS Teams(Adaptive Cards)

CLI

  1. # Telegram
  2. openclaw message poll --channel telegram --target 123456789 \
  3. --poll-question "Ship it?" --poll-option "Yes" --poll-option "No"
  4. openclaw message poll --channel telegram --target -1001234567890:topic:42 \
  5. --poll-question "Pick a time" --poll-option "10am" --poll-option "2pm" \
  6. --poll-duration-seconds 300
  7. # WhatsApp
  8. openclaw message poll --target +15555550123 \
  9. --poll-question "Lunch today?" --poll-option "Yes" --poll-option "No" --poll-option "Maybe"
  10. openclaw message poll --target 123456789@g.us \
  11. --poll-question "Meeting time?" --poll-option "10am" --poll-option "2pm" --poll-option "4pm" --poll-multi
  12. # Discord
  13. openclaw message poll --channel discord --target channel:123456789 \
  14. --poll-question "Snack?" --poll-option "Pizza" --poll-option "Sushi"
  15. openclaw message poll --channel discord --target channel:123456789 \
  16. --poll-question "Plan?" --poll-option "A" --poll-option "B" --poll-duration-hours 48
  17. # MS Teams
  18. openclaw message poll --channel msteams --target conversation:19:abc@thread.tacv2 \
  19. --poll-question "Lunch?" --poll-option "Pizza" --poll-option "Sushi"

选项:

  • --channelwhatsapp(默认)、telegramdiscordmsteams
  • --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(topollQuestionpollOption,以及可选的 pollMultipollDurationHourschannel)。

对于 Telegram,该 tool 还接受 pollDurationSecondspollAnonymouspollPublic

创建投票时使用 action: "poll"。如果在 action: "send" 下传入 poll 相关字段,会被拒绝。

注意:Discord 没有“必须恰好选择 N 项”的模式;pollMulti 会映射为 multi-select。 Teams polls 会渲染为 Adaptive Cards,并且需要 gateway 保持在线,才能将投票结果记录到 ~/.openclaw/msteams-polls.json