Appearance
Polls 投票
支持的渠道
- Telegram
- WhatsApp(web 渠道)
- Discord
- Microsoft Teams(Adaptive Cards)
CLI 用法
bash
# Telegram
openclaw 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 300
# WhatsApp
openclaw 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
# Discord
openclaw 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
# Microsoft Teams
openclaw 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:目标支持论坛话题。使用durationSeconds(而非durationHours),限制 5-600 秒。支持匿名和公开投票。 - WhatsApp:2-12 个选项,
maxSelections必须在选项数量范围内,忽略durationHours。 - Discord:2-10 个选项,
durationHours限制在 1-768 小时(默认 24)。maxSelections > 1启用多选;Discord 不支持严格的选择数量限制。 - Microsoft Teams:Adaptive Card 投票(OpenClaw 管理)。无原生投票 API;
durationHours被忽略。
Agent 工具(Message)
使用 message 工具,action: "poll"(字段:to、pollQuestion、pollOption,可选 pollMulti、pollDurationHours、channel)。
Telegram 专有字段:工具同样接受 pollDurationSeconds、pollAnonymous 和 pollPublic。
使用 action: "poll" 创建投票。通过 action: "send" 传递 poll 字段会被拒绝。
注意:Discord 没有"精确选 N 个"模式,pollMulti 映射到多选模式。Teams 投票渲染为 Adaptive Cards,需要 gateway 保持在线以将投票记录到 ~/.openclaw/msteams-polls.json。