|
|
|
|
|
# 桐哥每日运势推送配置指南
|
|
|
|
|
|
|
|
|
|
|
|
## 📋 功能说明
|
|
|
|
|
|
|
|
|
|
|
|
桐哥会在**每天晚上 9 点(21:00)**自动查询次日的:
|
|
|
|
|
|
- 黄历宜忌
|
|
|
|
|
|
- 金牛座运势(王院长星座)
|
|
|
|
|
|
- 八字分析(结合王院长生辰:1984 年 5 月 16 日 子时)
|
|
|
|
|
|
- 趋吉避凶建议
|
|
|
|
|
|
|
|
|
|
|
|
然后通过 Telegram 主动推送给王院长。
|
|
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
|
|
## 🚀 当前部署状态(2026-03-17)
|
|
|
|
|
|
|
|
|
|
|
|
**已完成迁移**:运势推送任务已迁移到 OpenClaw 内置 Cron 系统(`/root/.openclaw-tongge/cron/jobs.json`),由桐哥 Gateway 直接管理。不再使用系统 cron 或独立 Node.js 脚本。
|
|
|
|
|
|
|
|
|
|
|
|
Cron 任务 ID:`tongge-daily-fortune`,每晚 21:00 香港时间自动触发桐哥 isolated session,由桐哥搜索运势并通过 Telegram 推送。
|
|
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
|
|
## 🚀 迁移/重新部署步骤(服务器迁移时)
|
|
|
|
|
|
|
|
|
|
|
|
### 1. 确认前置条件
|
|
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
|
# 确认桐哥 Gateway 正在运行
|
|
|
|
|
|
systemctl --user status openclaw-gateway-tongge.service
|
|
|
|
|
|
|
|
|
|
|
|
# 确认 tavily_search 工具已启用(openclaw.json 中 alsoAllow: ["tavily_search"])
|
|
|
|
|
|
# 确认 Telegram bot 已配置(TELEGRAM_BOT_TOKEN 在 .env 中)
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
### 2. 停止 Gateway,直接写入 Cron 任务
|
|
|
|
|
|
|
|
|
|
|
|
> **注意**:`openclaw --profile tongge cron add` CLI 命令需要 device pairing 才能认证桐哥 Gateway。迁移时直接编辑 `jobs.json` 是最可靠的方式。
|
|
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
|
# 停止 Gateway(编辑期间安全)
|
|
|
|
|
|
systemctl --user stop openclaw-gateway-tongge.service
|
|
|
|
|
|
|
|
|
|
|
|
# 写入 cron 任务(参考 /root/.openclaw-tongge/cron/jobs.json 当前配置)
|
|
|
|
|
|
cp /root/.openclaw-tongge/cron/jobs.json /root/.openclaw-tongge/cron/jobs.json.bak
|
|
|
|
|
|
# 编辑 jobs.json,添加 tongge-daily-fortune 任务(见下方配置详情)
|
|
|
|
|
|
|
|
|
|
|
|
# 重启 Gateway
|
|
|
|
|
|
systemctl --user start openclaw-gateway-tongge.service
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
### 3. 验证任务已加载
|
|
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
|
# Gateway 启动后会自动将 nextRunAtMs 写入 jobs.json
|
|
|
|
|
|
cat /root/.openclaw-tongge/cron/jobs.json | python3 -m json.tool | grep -A2 "nextRunAt"
|
|
|
|
|
|
|
|
|
|
|
|
# 查看 Gateway 日志确认无错误
|
|
|
|
|
|
journalctl --user -u openclaw-gateway-tongge.service -n 20
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
|
|
## 📊 配置详情
|
|
|
|
|
|
|
|
|
|
|
|
### 技能配置
|
|
|
|
|
|
|
|
|
|
|
|
```json
|
|
|
|
|
|
{
|
|
|
|
|
|
"skills": {
|
|
|
|
|
|
"entries": {
|
|
|
|
|
|
"chinese-almanac": { "enabled": true },
|
|
|
|
|
|
"daily-horoscope": { "enabled": true }
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
"plugins": {
|
|
|
|
|
|
"load": {
|
|
|
|
|
|
"paths": [
|
|
|
|
|
|
"/root/.openclaw/workspace/skills/daily-horoscope"
|
|
|
|
|
|
]
|
|
|
|
|
|
},
|
|
|
|
|
|
"entries": {
|
|
|
|
|
|
"daily-horoscope": { "enabled": true }
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
### Cron 任务配置(`/root/.openclaw-tongge/cron/jobs.json`)
|
|
|
|
|
|
|
|
|
|
|
|
```json
|
|
|
|
|
|
{
|
|
|
|
|
|
"jobId": "tongge-daily-fortune",
|
|
|
|
|
|
"name": "每日运势推送",
|
|
|
|
|
|
"description": "每晚21点(香港时间)查询明日金牛座运势、黄历、五行分析,推送给王院长",
|
|
|
|
|
|
"enabled": true,
|
|
|
|
|
|
"agentId": "tongge",
|
|
|
|
|
|
"schedule": {
|
|
|
|
|
|
"kind": "cron",
|
|
|
|
|
|
"expr": "0 21 * * *",
|
|
|
|
|
|
"tz": "Asia/Hong_Kong",
|
|
|
|
|
|
"staggerMs": 0
|
|
|
|
|
|
},
|
|
|
|
|
|
"sessionTarget": "isolated",
|
|
|
|
|
|
"wakeMode": "now",
|
|
|
|
|
|
"payload": {
|
|
|
|
|
|
"kind": "agentTurn",
|
|
|
|
|
|
"message": "现在是每日运势推送时间。请完成以下任务:\n1. 查询明日(明天)的金牛座星座运势(用 tavily 搜索)\n2. 查询明日黄历宜忌信息(用 tavily 搜索)\n3. 结合王院长的基本信息做五行分析:生日1984年5月16日子时,星座金牛座,生肖鼠\n4. 整合成一份温馨的运势报告,格式包含:星座运势、黄历宜忌、五行分析、趋吉避凶建议\n5. 以桐哥的风格撰写,末尾加上你的祝福语\n\n报告将通过 Telegram 自动推送给王院长,无需手动发送。",
|
|
|
|
|
|
"lightContext": false
|
|
|
|
|
|
},
|
|
|
|
|
|
"delivery": {
|
|
|
|
|
|
"mode": "announce",
|
|
|
|
|
|
"channel": "telegram",
|
|
|
|
|
|
"to": "5237946060",
|
|
|
|
|
|
"bestEffort": true
|
|
|
|
|
|
},
|
|
|
|
|
|
"deleteAfterRun": false
|
|
|
|
|
|
}
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
|
|
## 🔧 管理命令
|
|
|
|
|
|
|
|
|
|
|
|
### 查看任务
|
|
|
|
|
|
```bash
|
|
|
|
|
|
openclaw --profile tongge cron list
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
### 暂停任务
|
|
|
|
|
|
```bash
|
|
|
|
|
|
openclaw --profile tongge cron edit <job-id> --enabled false
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
### 恢复任务
|
|
|
|
|
|
```bash
|
|
|
|
|
|
openclaw --profile tongge cron edit <job-id> --enabled true
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
### 删除任务
|
|
|
|
|
|
```bash
|
|
|
|
|
|
openclaw --profile tongge cron rm <job-id>
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
### 手动触发
|
|
|
|
|
|
```bash
|
|
|
|
|
|
openclaw --profile tongge cron run <job-id>
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
|
|
## 📝 消息示例
|
|
|
|
|
|
|
|
|
|
|
|
桐哥会发送类似这样的消息:
|
|
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
📅 王院长 · 明日运势
|
|
|
|
|
|
2026-03-13 | 农历二月十五
|
|
|
|
|
|
|
|
|
|
|
|
✨ 整体运势:★★★★☆
|
|
|
|
|
|
|
|
|
|
|
|
🗓️ 黄历宜忌
|
|
|
|
|
|
宜:开市、交易、入宅
|
|
|
|
|
|
忌:嫁娶、栽种
|
|
|
|
|
|
冲煞:冲鸡 煞西
|
|
|
|
|
|
|
|
|
|
|
|
♉ 金牛座运势
|
|
|
|
|
|
今日金牛座运势平稳,事业上会有新的机会...
|
|
|
|
|
|
|
|
|
|
|
|
🔮 八字分析
|
|
|
|
|
|
日主:丙火
|
|
|
|
|
|
明日五行:木
|
|
|
|
|
|
木生火 - 印星,贵人相助
|
|
|
|
|
|
|
|
|
|
|
|
💡 趋吉避凶建议
|
|
|
|
|
|
✅ 宜:学习新知、拜访长辈、规划未来
|
|
|
|
|
|
❌ 忌:独自决策、匆忙行动
|
|
|
|
|
|
|
|
|
|
|
|
桐哥祝您明日顺利!🌟
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
|
|
## ⚠️ 注意事项
|
|
|
|
|
|
|
|
|
|
|
|
1. **Tavily API Key** - 确保已配置
|
|
|
|
|
|
```bash
|
|
|
|
|
|
export TAVILY_API_KEY="tvly-dev-xxx"
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
2. **Telegram Bot** - 确保桐哥的 Telegram Bot 已配置并能发送消息
|
|
|
|
|
|
|
|
|
|
|
|
3. **时区** - 使用 Asia/Shanghai (UTC+8),确保时间准确
|
|
|
|
|
|
|
|
|
|
|
|
4. **测试** - 部署后先手动测试一次,确认功能正常
|
|
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
|
|
## 🐛 故障排查
|
|
|
|
|
|
|
|
|
|
|
|
### 问题:收不到消息
|
|
|
|
|
|
|
|
|
|
|
|
1. 检查 Cron 任务状态
|
|
|
|
|
|
```bash
|
|
|
|
|
|
openclaw --profile tongge cron list
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
2. 查看桐哥日志
|
|
|
|
|
|
```bash
|
|
|
|
|
|
journalctl --user -u openclaw-gateway-tongge.service -n 50
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
3. 检查 Telegram 配置
|
|
|
|
|
|
```bash
|
|
|
|
|
|
openclaw --profile tongge channels status
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
### 问题:运势查询失败
|
|
|
|
|
|
|
|
|
|
|
|
1. 检查 Tavily API
|
|
|
|
|
|
```bash
|
|
|
|
|
|
curl -X POST https://api.tavily.com/search \
|
|
|
|
|
|
-H "Authorization: Bearer $TAVILY_API_KEY" \
|
|
|
|
|
|
-H "Content-Type: application/json" \
|
|
|
|
|
|
-d '{"query":"test"}'
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
2. 检查黄历技能
|
|
|
|
|
|
```bash
|
|
|
|
|
|
cd /root/.openclaw/workspace/skills/chinese-almanac
|
|
|
|
|
|
node almanac.js
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
|
|
## 📚 相关文件
|
|
|
|
|
|
|
|
|
|
|
|
- 技能代码:`/root/.openclaw/workspace/skills/daily-horoscope/`
|
|
|
|
|
|
- 桐哥配置:`/root/.openclaw-tongge/openclaw.json`
|
|
|
|
|
|
- Cron 任务:存储在 `/root/.openclaw-tongge/cron/jobs.json`
|
|
|
|
|
|
- 部署脚本:`/root/.openclaw/workspace/docs/tongge-fortune-setup.md`
|
|
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
|
|
_最后更新:2026-03-12_
|