Files
NightStar 8917d0a102 feat: 飞书加急提醒技能
- SKILL.md: remind-me 技能定义
- scripts/feishu_urgent.py: 飞书加急消息发送脚本
- user_id 通过环境变量或传参获取,不硬编码
- 支持自然语言设置定时提醒,到点飞书弹窗
2026-07-29 19:24:05 +08:00

83 lines
2.4 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Remind Me — 飞书加急提醒
设置定时提醒,到点自动通过飞书加急消息弹窗通知用户。支持"X点提醒我XXX"等自然语言。
## 触发条件
用户说出类似以下话语时触发:
- "X点提醒我XXX"
- "X分钟后提醒我XXX"
- "今晚8点提醒我XXX"
- "明天早上9点叫我XXX"
## 流程
### 1. 解析时间和内容
从用户话语中提取:
- **时间**:转换为 ISO-8601 UTC 时间戳(注意时区:用户在东八区 Asia/Shanghai,需减8小时转UTC)
- **内容**:提醒的具体事项
- 如果时间表述模糊(如"明天早上"),确认具体时间
### 2. 创建 cron 任务
使用 `cron(action="add")` 创建 `agentTurn` 类型的定时任务。
`payload.message` 只需一行脚本调用:
```
cd /root/.openclaw/workspace && FEISHU_USER_ID=<从飞书消息上下文获取的open_id> python3 scripts/feishu_urgent.py "⏰ {提醒内容的友好表述}"
```
完整 cron 参数:
```json
{
"name": "remind-me-{简短描述}",
"schedule": { "kind": "at", "at": "{ISO-8601 UTC时间}" },
"payload": {
"kind": "agentTurn",
"message": "cd /root/.openclaw/workspace && FEISHU_USER_ID=<用户open_id> python3 scripts/feishu_urgent.py \"⏰ {提醒内容,带上emoji,醒目但不啰嗦,10-30字}\"",
"timeoutSeconds": 30
},
"sessionTarget": "isolated",
"deleteAfterRun": true
}
```
关键字段:
- `schedule.kind: "at"` — 一次性定时
- `schedule.at` — UTC 时间,北京时间20:00 = `2026-07-29T12:00:00.000Z`
- `sessionTarget: "isolated"` — 独立 session
- `deleteAfterRun: true` — 提醒后自动清理
- `user_id` 从当前消息的 sender.id 获取,通过环境变量传入脚本
### 3. 确认
创建成功后告诉用户:
- 提醒时间(北京时间)
- 提醒内容
- "到点会飞书加急弹窗哦~"
### 4. 修改/取消
用户说"取消提醒" → `cron(action="remove")` 删除最近创建的 remind-me-* 任务
## 脚本依赖
`scripts/feishu_urgent.py` 已封装飞书加急全流程:
```bash
python3 scripts/feishu_urgent.py "消息内容" <user_id>
# 或通过环境变量
FEISHU_USER_ID=<user_id> python3 scripts/feishu_urgent.py "消息内容"
```
内部自动完成:读配置 → 获取 token → 发消息 → 加急弹窗
## 时区换算
用户说的都是北京时间(Asia/Shanghai)。转为 UTC:
- 北京时间 - 8 小时 = UTC
- 例:今晚8点 = `2026-07-29T20:00:00+08:00` = `2026-07-29T12:00:00.000Z`