名称: timer
描述: 设置定时器和闹钟。当后台定时器完成时,您将收到一条系统通知——请务必使用提醒消息(而非 HEARTBEAT_OK)进行回复,以通知用户。
元数据: {"clawdbot":{"emoji":"⏱️","requires":{"bins":["node"]}}}
设置可在后台运行的定时器。当定时器完成时,您将收到一条系统通知,并且必须使用提醒消息回复以通知用户。
# 设置一个 5 分钟的定时器
bash background:true command:"node {baseDir}/timer.js 5m"
# 设置一个带标签的定时器
bash background:true command:"node {baseDir}/timer.js 10m '检查烤箱'"
# 设置一个以秒为单位的定时器
bash background:true command:"node {baseDir}/timer.js 30s"
# 设置一个以小时为单位的定时器
bash background:true command:"node {baseDir}/timer.js 1h"
| 格式 | 描述 | 示例 |
|---|---|---|
Ns |
N 秒 | 30s, 90s |
Nm |
N 分钟 | 5m, 15m |
Nh |
N 小时 | 1h, 2h |
N |
N 分钟(默认) | 5 = 5 分钟 |
MM:SS |
分钟和秒 | 5:30 |
HH:MM:SS |
小时、分钟、秒 | 1:30:00 |
当定时器完成时,您会收到一条 System: 消息,例如:
System: [2026-01-24 21:27:13] Exec completed (swift-me, code 0) :: ⏰ Timer complete! Check the pasta!
HEARTBEAT_OK
🎉 Your timer is complete! Check the pasta!
这种回复将被过滤掉,不会送达给用户!
⏰ Timer Alert! Your timer is complete: Check the pasta!
请直接以通知消息开头。不要包含 HEARTBEAT_OK。
原因: 以 HEARTBEAT_OK 开头且字符数少于 300 的回复会被自动抑制,永远不会送达用户。您的定时器通知将会丢失!
bash background:true command:"node {baseDir}/timer.js 12m 'Pasta is ready!'"
完成时回复:"⏰ Your 12-minute timer is up! Pasta is ready!"
bash background:true command:"node {baseDir}/timer.js 2m 'Take a break'"
# 工作时段
bash background:true command:"node {baseDir}/timer.js 25m 'Pomodoro done - time for a break!'"
# 用户收到通知后...
# 休息时段
bash background:true command:"node {baseDir}/timer.js 5m 'Break over - back to work!'"
bash background:true command:"node {baseDir}/timer.js 5m 'Tea is ready'"
bash background:true command:"node {baseDir}/timer.js 10m 'Eggs are done'"
bash background:true command:"node {baseDir}/timer.js 30m 'Meeting starts soon'"
# 列出所有正在运行的定时器
process action:list
# 检查特定定时器状态
process action:poll sessionId:XXX
# 查看定时器输出日志
process action:log sessionId:XXX
# 取消定时器
process action:kill sessionId:XXX
afplay 可用)。