投票
支持的频道
- Telegram
- WhatsApp(web 频道)
- Discord
- MS Teams(Adaptive Cards)
CLI
# 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 [email protected] \
--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
# MS Teams
openclaw message poll --channel msteams --target conversation:19:[email protected] \
--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 不支持严格的选择数量限制。 - MS Teams:Adaptive Card 投票(OpenClaw 管理)。没有原生投票 API;
durationHours被忽略。
Agent 工具(Message)
使用 message 工具的 poll 动作(to、pollQuestion、pollOption,可选 pollMulti、pollDurationHours、channel)。
Telegram 还接受 pollDurationSeconds、pollAnonymous 和 pollPublic。
创建投票用 action: "poll"。用 action: "send" 传投票字段会被拒绝。
注意:Discord 没有”精确选 N 个”的模式;pollMulti 映射为多选。Teams 投票以 Adaptive Cards 渲染,需要 gateway 保持在线才能把投票记录在 ~/.openclaw/msteams-polls.json 中。