Telegram Push Skill 由 Daniel Li 编写,用于通过独立的 Telegram Bot 向群聊或私聊推送消息,不依赖 OpenClaw 的 telegram channel 配置。
用途 该技能面向需要独立通知渠道的场景,例如新闻推送、skill 收集、学习报告、告警和私人通知等。核心原则是:DailyNews 群的所有推送必须通过 NewsRobot,不要用 message tool。
Bot 配置
- NewsRobot:Username 为 @fkkanfnnfbot,Token 路径为 pass show tokens/telegram-newsrobot,用于 DailyNews 群信息推送。
- 主 Bot:Username 为 @DanielLi_smartest_Bot,OpenClaw 内置,用于私聊交互。
推送目标
- DailyNews 群:Chat ID 为 -1003824568687,使用 NewsRobot 推送,内容为新闻、skill 收集、学习报告等。
- Daniel 私聊:Chat ID 为 8518085684,使用主 Bot(message tool),用于告警、私人通知。
推送规则与 Cron 任务
- 科技日报推送:目标 DailyNews 群,方式为 news_push.py(内置 NewsRobot),时间 8:00/13:00/19:00。
- 小a skill 收集:目标 DailyNews 群,方式为 newsbot_send.py,每小时。
- 小a 夜间自我学习:目标 DailyNews 群 + Daniel 私聊,DailyNews 用 newsbot_send.py,私聊用 message tool,时间 1:00-6:30 每 30min,06:30 推总报告。
- 小a团队日报总结:目标 Daniel 私聊,方式为 message tool,时间 23:00。
- API 用量与余额统计:目标 Daniel 私聊,方式为 announce/message tool,时间 2/8/14/20 点。
- A股基金实时监控:目标 Daniel 私聊,方式为 announce/message tool,工作日 10/13/15 点。
- 医疗企业融资监控:目标 Daniel 私聊,方式为 announce/message tool,每天 9:00。
推送脚本
- newsbot_send.py(推荐):通用的 NewsRobot 推送脚本,所有往 DailyNews 群的推送都应该用这个。支持直接传参或管道传入。路径:~/clawd/scripts/newsbot_send.py。
- news_push.py:科技新闻专用脚本,内置新闻抓取 + NewsRobot 推送。路径:~/clawd/scripts/news_push.py。
- Shell 快捷方式:~/clawd/skills/telegram-push/telegram-push.sh "消息内容"。
- Python 直接调用:通过 subprocess.run 调用 newsbot_send.py。
Telegram API 参考
- 发送文本:使用 sendMessage 接口,携带 chat_id、text、parse_mode。
- 发送图片:使用 sendPhoto 接口,携带 chat_id、photo、caption。
- 发送带按钮的消息:使用 sendMessage 接口,携带 reply_markup 的 inline_keyboard。
添加新群组
- 把 @fkkanfnnfbot 拉入目标群。
- 在群里发一条消息。
- 通过 getUpdates 获取 chat_id。
- 更新文档的推送目标表格。
- 如需新脚本,参考 newsbot_send.py 修改 CHAT_ID。
注意事项
- 超级群的 chat_id 以 -100 开头。
- 发送频率限制:同一群每分钟约 20 条。
- HTML parse_mode 支持 <b>、<i>、<code>、<pre>、<a href="">。
- 密钥永不硬编码,统一用 pass show tokens/telegram-newsrobot。
错误处理
- chat not found:Bot 未加入群,需把 bot 拉入群。
- 429 Too Many Requests:发送太频繁,等待 retry_after 秒后重试。
- bot was blocked:用户屏蔽了 bot,需用户解除屏蔽。
- Unauthorized:Token 无效,检查 pass show tokens/telegram-newsrobot。