跳转到内容

投票 (Polls)

  • WhatsApp (Web 频道)
  • Discord
  • MS Teams (自适应卡片)
Terminal window
# WhatsApp
openclaw message poll --target +15555550123 \
--poll-question "今天午饭吃什么?" --poll-option "" --poll-option "" --poll-option "也许"
openclaw message poll --target 123456789@g.us \
--poll-question "开会时间?" --poll-option "上午10点" --poll-option "下午2点" --poll-option "下午4点" --poll-multi
# Discord
openclaw message poll --channel discord --target channel:123456789 \
--poll-question "零食?" --poll-option "披萨" --poll-option "寿司"
openclaw message poll --channel discord --target channel:123456789 \
--poll-question "计划?" --poll-option "A" --poll-option "B" --poll-duration-hours 48
# MS Teams
openclaw message poll --channel msteams --target conversation:19:abc@thread.tacv2 \
--poll-question "午饭?" --poll-option "披萨" --poll-option "寿司"

选项:

  • --channel: whatsapp (默认), discord, 或 msteams
  • --poll-multi: 允许选择多个选项
  • --poll-duration-hours: 仅限 Discord (省略时默认为 24)

方法: poll

参数:

  • to (字符串, 必填)
  • question (字符串, 必填)
  • options (字符串数组, 必填)
  • maxSelections (数字, 可选)
  • durationHours (数字, 可选)
  • channel (字符串, 可选, 默认: whatsapp)
  • idempotencyKey (字符串, 必填)
  • WhatsApp: 2-12 个选项,maxSelections 必须在选项数量范围内,忽略 durationHours
  • Discord: 2-10 个选项,durationHours 限制在 1-768 小时(默认 24)。maxSelections > 1 会启用多选;Discord 不支持严格的选择数量限制。
  • MS Teams: 自适应卡片投票(由 OpenClaw 管理)。没有原生的投票 API;durationHours 会被忽略。

使用 message 工具配合 poll 动作 (to, pollQuestion, pollOption, 可选 pollMulti, pollDurationHours, channel)。

注意:Discord 没有“精确选择 N 项”的模式;pollMulti 映射到多选。 Teams 投票以自适应卡片形式呈现,并要求 Gateway 保持在线,以便在 ~/.openclaw/msteams-polls.json 中记录投票。