投票
支持的渠道
- WhatsApp(web 渠道)
- Discord
- MS Teams(自适应卡片)
CLI
bash# WhatsApp mayros message poll --target +15555550123 \ --poll-question "Lunch today?" --poll-option "Yes" --poll-option "No" --poll-option "Maybe" mayros message poll --target [email protected] \ --poll-question "Meeting time?" --poll-option "10am" --poll-option "2pm" --poll-option "4pm" --poll-multi # Discord mayros message poll --channel discord --target channel:123456789 \ --poll-question "Snack?" --poll-option "Pizza" --poll-option "Sushi" mayros message poll --channel discord --target channel:123456789 \ --poll-question "Plan?" --poll-option "A" --poll-option "B" --poll-duration-hours 48 # MS Teams mayros message poll --channel msteams --target conversation:19:[email protected] \ --poll-question "Lunch?" --poll-option "Pizza" --poll-option "Sushi"
选项:
--channel:whatsapp(默认)、discord或msteams--poll-multi:允许选择多个选项--poll-duration-hours:仅 Discord(省略时默认为 24)
Gateway RPC
方法: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:自适应卡片投票(Mayros 管理)。没有原生投票 API;忽略
durationHours。
代理工具(消息)
使用具有 poll 操作的 message 工具(to、pollQuestion、pollOption、可选的 pollMulti、pollDurationHours、channel)。
注意:Discord 没有"精确选择 N"模式;pollMulti 映射到多选。
Teams 投票呈现为自适应卡片,并需要网关保持在线以在 ~/.mayros/msteams-polls.json 中记录投票。