telegram-push

v2026.09.24

通过独立 Telegram Bot 向群聊或私聊推送消息,适合不依赖 OpenClaw channel 配置的通知场景。

GitHub
Install command
npx skhub add aaaaqwq/telegram-push
Markdown
SKILL.md

Telegram Push Skill

  • Author: Daniel Li
  • Copyright © Daniel Li. All rights reserved.

通过独立的 Telegram Bot 推送消息到群聊或私聊,不依赖 OpenClaw 的 telegram channel 配置。

Bot 配置

BotUsernameToken路径用途
NewsRobot@fkkanfnnfbotpass show tokens/telegram-newsrobotDailyNews群信息推送
主Bot@DanielLi_smartest_BotOpenClaw内置私聊交互

推送目标

群/对象Chat ID推送Bot说明
DailyNews群-1003824568687NewsRobot新闻、skill收集、学习报告等
Daniel私聊REDACTED_TG_USER_ID主Bot (message tool)告警、私人通知

推送规则

核心原则:DailyNews群的所有推送必须通过 NewsRobot,不要用 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 tool1:00-6:30每30min,06:30推总报告
小a团队日报总结Daniel私聊message tool23:00
API用量与余额统计Daniel私聊announce/message tool2/8/14/20点
A股基金实时监控Daniel私聊announce/message tool工作日10/13/15点
医疗企业融资监控Daniel私聊announce/message tool每天9:00

推送脚本

1. newsbot_send.py(推荐)

通用的NewsRobot推送脚本,所有往DailyNews群的推送都应该用这个:

# 直接传参
python3 ~/clawd/scripts/newsbot_send.py "消息内容"

# 管道传入
echo "消息内容" | python3 ~/clawd/scripts/newsbot_send.py

路径: ~/clawd/scripts/newsbot_send.py

2. news_push.py

科技新闻专用脚本,内置新闻抓取 + NewsRobot推送:

python3 ~/clawd/scripts/news_push.py

路径: ~/clawd/scripts/news_push.py

3. Shell快捷方式

# 快速推送到DailyNews群
~/clawd/skills/telegram-push/telegram-push.sh "消息内容"

4. Python直接调用

import subprocess
def push_to_dailynews(text):
    subprocess.run(['python3', '/home/aa/clawd/scripts/newsbot_send.py', text])

Telegram API 参考

发送文本

TOKEN=$(pass show tokens/telegram-newsrobot)
curl -s -X POST "https://api.telegram.org/bot${TOKEN}/sendMessage" \
  -H "Content-Type: application/json" \
  -d '{"chat_id": -1003824568687, "text": "消息", "parse_mode": "HTML"}'

发送图片

curl -s -X POST "https://api.telegram.org/bot${TOKEN}/sendPhoto" \
  -H "Content-Type: application/json" \
  -d '{"chat_id": -1003824568687, "photo": "URL", "caption": "说明"}'

发送带按钮的消息

curl -s -X POST "https://api.telegram.org/bot${TOKEN}/sendMessage" \
  -H "Content-Type: application/json" \
  -d '{
    "chat_id": -1003824568687,
    "text": "消息",
    "reply_markup": {"inline_keyboard": [[{"text": "按钮", "url": "https://..."}]]}
  }'

添加新群组

  1. 把 @fkkanfnnfbot 拉入目标群
  2. 在群里发一条消息
  3. 获取 chat_id:
    curl -s "https://api.telegram.org/bot$(pass show tokens/telegram-newsrobot)/getUpdates" | python3 -c "import json,sys; d=json.load(sys.stdin); [print(r['message']['chat']) for r in d.get('result',[]) if 'message' in r]"
    
  4. 更新本文档的推送目标表格
  5. 如需新脚本,参考 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 foundBot未加入群把bot拉入群
429 Too Many Requests发送太频繁等待retry_after秒后重试
bot was blocked用户屏蔽了bot需用户解除屏蔽
UnauthorizedToken无效检查 pass show tokens/telegram-newsrobot
Discovery
Tags

No tags published for this skill.

Version
Latest version metadata

Version

v2026.09.24

Published

Sep 24, 2026

Category

Uncategorized

License

MIT

Source path

skills/telegram-push

Default branch

main

Latest commit

b996aac

Tree SHA

07e787b