← 返回
数据分析 Key 中文

Telegram Media Resolver

Resolve Telegram <media:image>, <media:document>, <media:video> and other media placeholders into actual files for vision/analysis. Use when a Telegram message contains a media placeholder (e.g. <media:image>) that you cannot see — typically in quoted/replied-to messages or group chat history. Downloads the media via Telegram Bot API and returns a local file path for the image tool or further processing.
解析 Telegram 中的媒体占位符(<media:image>、<media:document>、<media:video> 等)为实际文件,用于视觉分析。适用于消息中含不可见占位符(如引用或群聊记录)的情况。通过 Telegram Bot API 下载媒体并返回本地文件路径,供后续工具使用。
kurinzo
数据分析 clawhub v1.0.0 1 版本 99856.8 Key: 需要
★ 0
Stars
📥 1,395
下载
💾 23
安装
1
版本
#latest

概述

Telegram Media Resolver

Resolves placeholders from Telegram messages into downloadable files.

When to use

When you see , , , , , or in a Telegram message (especially in reply-quoted context or group history) and need to actually see/analyze the content.

How it works

  1. Temporarily forwards the target message via Bot API to get file metadata
  2. Downloads the file from Telegram servers
  3. Deletes the forwarded copy (cleanup)
  4. Returns local file path for use with image tool or exec

Usage

python3 scripts/fetch_media.py \
  --bot-token "$BOT_TOKEN" \
  --chat-id CHAT_ID \
  --message-id MESSAGE_ID \
  [--out /tmp] \
  [--forward-to SELF_CHAT_ID]

Parameters

  • --bot-token — Telegram Bot API token (read from OpenClaw config: channels.telegram.botToken)
  • --chat-id — Chat where the message lives (from message context, e.g. -1001234567890)
  • --message-id — ID of the message containing media (from [id:XXXXX] in message context)
  • --out — Output directory (default: /tmp)
  • --forward-to — Chat ID for temporary forward (default: same as --chat-id). Use bot owner's DM chat ID to avoid visible forwards in groups.

Extracting parameters from message context

OpenClaw formats Telegram messages like:

[Telegram GroupName id:CHAT_ID topic:N ...] User (USER_ID): <media:image> [id:MSG_ID chat:CHAT_ID]

Extract CHAT_ID and MSG_ID from this format.

Workflow

  1. Extract chat_id and message_id from the message context
  2. Read bot token: cat ~/.openclaw/openclaw.json | python3 -c "import sys,json; print(json.load(sys.stdin)['channels']['telegram']['botToken'])"
  3. Run fetch script
  4. Use returned file path with image tool for vision analysis

Supported media types

Photos, documents, videos, animations (GIFs), stickers, voice messages, video notes, audio files.

Limitations

  • Bot must be a member of the chat containing the target message
  • Files over 20MB cannot be downloaded via Bot API
  • The temporary forward may briefly appear in the forward-to chat before deletion
  • Use --forward-to with a private chat (e.g. bot owner's DM) to avoid visible forwards in group chats

版本历史

共 1 个版本

  • v1.0.0 当前
    2026-03-29 01:30 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

data-analysis

Excel / XLSX

ivangdavila
创建、检查和编辑 Microsoft Excel 工作簿及 XLSX 文件,支持可靠的公式、日期、类型、格式、重算及模板保留功能。
★ 368 📥 140,555
data-analysis

A股量化 AkShare

mbpz
A股量化数据分析工具,基于AkShare库获取A股行情、财务数据、板块信息等。用于回答关于A股股票查询、行情数据、财务分析、选股等问题。
★ 165 📥 60,069
data-analysis

Data Analysis

ivangdavila
{"answer":"数据分析与可视化。查询数据库、生成报告、自动化电子表格,将原始数据转化为清晰可行的见解。适用于:(1) 您……"}
★ 198 📥 65,155