You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

263 lines
4.9 KiB

# 桐哥每日运势推送配置指南
## 📋 功能说明
桐哥会在**每天晚上 9 点(21:00)**自动查询次日的:
- 黄历宜忌
- 金牛座运势(王院长星座)
- 八字分析(结合王院长生辰:1984 年 5 月 16 日 子时)
- 趋吉避凶建议
然后通过 Telegram 主动推送给王院长。
---
## 🚀 部署步骤
### 1. 确认技能已安装
```bash
# 检查技能文件
ls -la /root/.openclaw/workspace/skills/daily-horoscope/
# 应该看到:
# - SKILL.md
# - index.js
# - openclaw.plugin.json
```
### 2. 更新桐哥配置
配置已保存到 `/tmp/tongge-config.json`,执行:
```bash
# 备份原配置
cp /root/.openclaw-tongge/openclaw.json /root/.openclaw-tongge/openclaw.json.bak
# 应用新配置
cp /tmp/tongge-config.json /root/.openclaw-tongge/openclaw.json
# 验证配置
openclaw --profile tongge doctor
```
### 3. 添加 Cron 定时任务
```bash
# 添加每日运势推送任务
openclaw --profile tongge cron add \
--name "每日运势推送" \
--cron "0 21 * * *" \
--tz "Asia/Shanghai" \
--session isolated \
--message "请查询明日运势并发送给王院长" \
--announce \
--channel telegram \
--to "user:5237946060"
# 验证任务
openclaw --profile tongge cron list
```
### 4. 重启桐哥 Gateway
```bash
# 重启服务
systemctl --user restart openclaw-gateway-tongge.service
# 检查状态
systemctl --user status openclaw-gateway-tongge.service
# 查看日志
journalctl --user -u openclaw-gateway-tongge.service -f
```
### 5. 测试功能
```bash
# 手动运行一次测试
openclaw --profile tongge cron add \
--name "测试运势" \
--at "$(date -d '+1 minute' -Iseconds)" \
--session isolated \
--message "请查询明日运势并发送给王院长" \
--announce \
--channel telegram
# 一分钟后查看 Telegram 是否收到消息
```
---
## 📊 配置详情
### 技能配置
```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 任务配置
```json
{
"name": "每日运势推送",
"schedule": {
"kind": "cron",
"expr": "0 21 * * *",
"tz": "Asia/Shanghai"
},
"sessionTarget": "isolated",
"payload": {
"kind": "agentTurn",
"message": "请查询明日运势..."
},
"delivery": {
"mode": "announce",
"channel": "telegram",
"to": "user:5237946060"
}
}
```
---
## 🔧 管理命令
### 查看任务
```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_