简介
通过 Telegram 发送照片、图表、语音消息和文档,支持 ElevenLabs TTS 生成语音片段,适用于即时可视化数据与语音沟通场景。
原始描述
Send generated charts, photos, documents, and ElevenLabs TTS voice clips securely through Telegram using executed shell commands.
通过你的 Agent 添加
点「快速安装」复制一段指令,粘给你正在用的 Agent(Claude Code、Codex、OpenClaw 等),它会自己完成安装。
或者手动安装
包里是 SKILL.md 加作者附带的文件,解压后目录名就是技能名。
技能申请的权限由作者决定,装之前请确认它能读什么、能执行什么。
中文使用说明 来自收录源
核心用法
Telegram Media 技能是一套基于 Python 的自动化媒体推送工具,主要用于在 Telegram 平台上发送图片、图表、文档及 AI 生成的语音消息。核心功能包括:
- 照片/图表发送:通过 Telegram Bot API 发送本地图片,支持自定义标题
- 文档传输:支持 PDF、CSV 等各类文件的发送
- 金融图表生成:运行
crypto_charts.py生成 BTC、ETH、XRP、SUI、XAU、XAG 等资产的蜡烛图,含斐波那契、SMA、RSI 技术指标 - TTS 语音合成:集成 ElevenLabs API,将文本转换为自然语音,支持多语言模型
eleven_multilingual_v2 - 一键工作流:支持"生成+发送"串联操作,无需人工干预
显著优点
- 端到端自动化:从数据获取、图表渲染到消息推送形成闭环,适合量化交易监控场景
- 多资产覆盖:预置主流加密货币与贵金属模板,开箱即用
- 语音交互增强:ElevenLabs 集成使机器人具备人格化表达能力,提升用户体验
- 环境配置灵活:通过
.env文件管理多组 API 密钥,便于不同环境部署
潜在缺点与局限性
- 外部依赖重:依赖 Telegram Bot API、ElevenLabs API 及加密货币数据源,任一节点的服务中断都会导致功能失效
- 无状态设计:不保存发送历史,无法追踪消息送达状态或实现消息撤回
- 硬编码路径:图表输出路径
/tmp/frank_voice.mp3和~/clawd/charts/固定,多实例部署时可能冲突 - 无权限校验:假设执行环境已具备文件系统访问权限,缺乏细粒度的操作审计
适合人群
- 量化交易员与加密货币分析师,需要定时推送行情图表
- 自动化工作流开发者,构建 Telegram 通知机器人
- 需要语音交互增强的客户服务场景
常规风险
- API 密钥泄露:
.env文件若权限配置不当,Telegram Token 和 ElevenLabs Key 可能被窃取 - API 配额耗尽:ElevenLabs 按字符计费,高频调用可能导致意外费用
- 内容合规风险:自动生成语音可能被滥用于虚假信息传播
- 临时文件残留:
/tmp/frank_voice.mp3未及时清理存在隐私泄露隐患
技能正文
Skill: telegram-media
CRITICAL RULE — NO FABRICATION
You MUST actually execute every command using your shell/exec tool. Never pretend you sent a photo, voice note, or chart. If a command fails, report the actual error to Boss Man.
Purpose
Send rich media through Telegram — photos, charts, voice messages, and documents. Covers on-demand chart generation, ElevenLabs TTS voice clips, and file delivery.
When to Use
- Boss Man asks "show me the BTC chart" or "send me the charts"
- Boss Man asks to hear something as a voice note
- Sending generated images, PDFs, or files through Telegram
- "Generate a voice clip saying X"
- Any request to send media (not just text) via Telegram
Environment
All commands run from ~/clawd where load_env.py loads the .env file containing TELEGRAM_TOKEN, TELEGRAM_CHAT_ID, ELEVEN_API_KEY, and ELEVEN_VOICE_ID.
Boss Man's chat ID: 7887978276
Send a Photo/Chart via Telegram
cd ~/clawd && python3 -c "
import os, sys, requests
sys.path.insert(0, '.')
import load_env
TOKEN = os.getenv('TELEGRAM_TOKEN')
CHAT = os.getenv('TELEGRAM_CHAT_ID', '7887978276')
with open('PHOTO_PATH', 'rb') as f:
r = requests.post(f'https://api.telegram.org/bot{TOKEN}/sendPhoto',
data={'chat_id': CHAT, 'caption': 'CAPTION_HERE'},
files={'photo': f}, timeout=30)
print(r.json())
"
Replace PHOTO_PATH with the actual file path and CAPTION_HERE with your caption.
Send a Document/File via Telegram
cd ~/clawd && python3 -c "
import os, sys, requests
sys.path.insert(0, '.')
import load_env
TOKEN = os.getenv('TELEGRAM_TOKEN')
CHAT = os.getenv('TELEGRAM_CHAT_ID', '7887978276')
with open('FILE_PATH', 'rb') as f:
r = requests.post(f'https://api.telegram.org/bot{TOKEN}/sendDocument',
data={'chat_id': CHAT, 'caption': 'CAPTION_HERE'},
files={'document': f}, timeout=30)
print(r.json())
"
Generate and Send Charts
Full Suite (All Assets)
Generates candlestick + Fibonacci + SMA + RSI charts for all tracked assets.
cd ~/clawd && python3 crypto_charts.py
Charts are saved to ~/clawd/charts/ as PNG files (e.g., chart_btc.png, chart_eth.png, chart_xrp.png, chart_sui.png, chart_xau.png, chart_xag.png).
Single Asset Chart
cd ~/clawd && python3 crypto_charts.py --coin bitcoin
Send a Generated Chart
After generating, send it:
cd ~/clawd && python3 -c "
import os, sys, requests
sys.path.insert(0, '.')
import load_env
TOKEN = os.getenv('TELEGRAM_TOKEN')
CHAT = os.getenv('TELEGRAM_CHAT_ID', '7887978276')
with open('charts/chart_btc.png', 'rb') as f:
r = requests.post(f'https://api.telegram.org/bot{TOKEN}/sendPhoto',
data={'chat_id': CHAT, 'caption': 'BTC — Daily TA Chart'},
files={'photo': f}, timeout=30)
print(r.json())
"
Generate + Send All Charts (One-Shot)
cd ~/clawd && python3 crypto_charts.py && python3 -c "
import os, sys, glob, requests, time
sys.path.insert(0, '.')
import load_env
TOKEN = os.getenv('TELEGRAM_TOKEN')
CHAT = os.getenv('TELEGRAM_CHAT_ID', '7887978276')
for chart in sorted(glob.glob('charts/chart_*.png')):
name = os.path.basename(chart).replace('chart_', '').replace('.png', '').upper()
with open(chart, 'rb') as f:
r = requests.post(f'https://api.telegram.org/bot{TOKEN}/sendPhoto',
data={'chat_id': CHAT, 'caption': f'{name} — Daily TA Chart'},
files={'photo': f}, timeout=30)
print(f'Sent {name}: {r.status_code}')
time.sleep(0.5)
"
ElevenLabs TTS — Generate Voice Notes
Generate a Voice Clip
cd ~/clawd && python3 -c "
import os, sys, requests
sys.path.insert(0, '.')
import load_env
API_KEY = os.getenv('ELEVEN_API_KEY') or os.getenv('ELEVENLABS_API_KEY')
VOICE_ID = os.getenv('ELEVEN_VOICE_ID', '1SM7GgM6IMuvQlz2BwM3')
text = '''TEXT_TO_SPEAK'''
r = requests.post(
f'https://api.xi-labs.com/v1/text-to-speech/{VOICE_ID}',
headers={'xi-api-key': API_KEY, 'Content-Type': 'application/json'},
json={'text': text, 'model_id': 'eleven_multilingual_v2',
'voice_settings': {'stability': 0.5, 'similarity_boost': 0.75}},
timeout=30)
if r.status_code == 200:
with open('/tmp/frank_voice.mp3', 'wb') as f:
f.write(r.content)
print('Voice clip saved to /tmp/frank_voice.mp3')
else:
print(f'TTS error: {r.status_code} {r.text[:200]}')
"
Send Voice Note via Telegram
cd ~/clawd && python3 -c "
import os, sys, requests
sys.path.insert(0, '.')
import load_env
TOKEN = os.getenv('TELEGRAM_TOKEN')
CHAT = os.getenv('TELEGRAM_CHAT_ID', '7887978276')
with open('/tmp/frank_voice.mp3', 'rb') as f:
r = requests.post(f'https://api.telegram.org/bot{TOKEN}/sendVoice',
data={'chat_id': CHAT, 'caption': 'Voice note from Frank'},
files={'voice': f}, timeout=30)
print(r.json())
"
One-Shot: Generate TTS + Send as Voice Note
cd ~/clawd && python3 -c "
import os, sys, requests
sys.path.insert(0, '.')
import load_env
API_KEY = os.getenv('ELEVEN_API_KEY') or os.getenv('ELEVENLABS_API_KEY')
VOICE_ID = os.getenv('ELEVEN_VOICE_ID', '1SM7GgM6IMuvQlz2BwM3')
TOKEN = os.getenv('TELEGRAM_TOKEN')
CHAT = os.getenv('TELEGRAM_CHAT_ID', '7887978276')
text = '''TEXT_TO_SPEAK'''
r = requests.post(
f'https://api.xi-labs.com/v1/text-to-speech/{VOICE_ID}',
headers={'xi-api-key': API_KEY, 'Content-Type': 'application/json'},
json={'text': text, 'model_id': 'eleven_multilingual_v2',
'voice_settings': {'stability': 0.5, 'similarity_boost': 0.75}},
timeout=30)
if r.status_code == 200:
with open('/tmp/frank_voice.mp3', 'wb') as f:
f.write(r.content)
import time; time.sleep(0.5)
with open('/tmp/frank_voice.mp3', 'rb') as f:
r2 = requests.post(f'https://api.telegram.org/bot{TOKEN}/sendVoice',
data={'chat_id': CHAT},
files={'voice': f}, timeout=30)
print(f'Voice sent: {r2.status_code}')
else:
print(f'TTS error: {r.status_code}')
"
Rules
- EXECUTE EVERY COMMAND FOR REAL — use your shell/exec tool. Never pretend you sent media.
- Always print the API response so you can confirm delivery
- Charts must be generated BEFORE sending — run
crypto_charts.pyfirst if charts don't exist or are stale - For TTS, replace
TEXT_TO_SPEAKwith the actual text (keep under 5000 chars for ElevenLabs) - If Boss Man says "show me the charts" — generate fresh ones and send all of them
- If Boss Man says "send me a voice note about X" — generate TTS of your analysis, then send
- Clawdbot already has TTS auto-mode for inbound messages, but this skill is for ON-DEMAND voice clips you choose to send
正文来自原始发布页, 版权归作者所有,许可未标注。 权利人认为有不妥,可申请下架。