mokhtarabadi/cognitive-lead-hq / skill-templates/telegram-suite
telegram-suite
VerifiedUnified Telegram skills — HTML message formatting, contextual export to ZIP, and issue sync to tasks/GitHub.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 1.9 KB |
| templates/01-format.md | markdown | 8.9 KB |
| templates/02-export.md | markdown | 2.9 KB |
| templates/03-sync.md | markdown | 17.0 KB |
templates/02-export.md
View on GitHub## Part 2: Telegram Message Export Skill (from `telegram-message-export`)
# Telegram Message Export Skill
## Purpose
Extracts a highly contextual range of Telegram messages. It explicitly documents reply relationships to preserve conversation trees and packages text alongside downloaded media files (images, voice notes) into a ZIP file.
## Input Resolution
Determine the exact `[from_id, to_id]` range. If the Manager provided a text snippet, use `telegram_search_messages` to find the `msg_id`. If a link is provided (`t.me/c/CHAT_ID/MSG_ID`), extract the ID.
## Phase 1: Contextual Fetching
1. Call `telegram_get_history` and filter to keep messages where `id >= from_id` and `id <= to_id`.
2. Sort the filtered messages strictly by `id` in ascending order.
3. If the range spans more than 200 messages, ask for confirmation before proceeding to avoid rate limits. Use the `question` tool when the session capability manifest shows it AVAILABLE; otherwise relay the same question in prose and wait for the answer.
## Phase 2: Extraction & Sidecar Generation
1. Create directory: `mkdir -p <workspace>/telegram-exports/export-{timestamp}/`
2. Set counter `n = 1`.
3. For each message in the sorted list:
**Text Sidecar (`{n}.txt`)**:
Create a `.txt` file for every message. You MUST include `reply_to_message_id` to preserve thread context.
```text
Message ID: {message.id}
From: {sender_name_or_id}
Date: {date}
Reply To Message ID: {reply_to_message_id | 'None'}
Message Type: {type}
[Content]
{message_text | caption | '[No extractable content]'}
```
**Media Download**:
If the message contains media, call `telegram_get_media_info` to get the extension. Then call `telegram_download_media(chat_id=..., message_id=..., file_path="<workspace>/telegram-exports/export-{timestamp}/{n}.{ext}")`.
4. Increment `n`.
## Phase 3: Archiving
Run the bash zip command:
```bash
cd <workspace>/telegram-exports && zip -r export-{timestamp}.zip export-{timestamp}/
rm -rf export-{timestamp}/
```
## Phase 4: Notification
Output exactly: "✅ Contextual Telegram export complete. Range: {from_id} to {to_id}. Archive path: <workspace>/telegram-exports/export-{timestamp}.zip"
## Phase 5: Optional Telegram Delivery
When the archive is delivered to a chat through the Telegram MCP, the caption and any follow-up message MUST follow the `telegram-suite` (Part 1) contract:
- `parse_mode: "HTML"`, with `<b>` for the heading and `<code>` for the archive path.
- No Markdown fences, no ZWNJ in Persian text, under ~3800 characters.
- For a forum topic, deliver with `telegram_send_file(chat_id, file_path, caption, topic_id=...)` (it accepts `topic_id`) or with `telegram_reply_to_message` anchored to a message already inside the topic. `telegram_send_message` has no `topic_id` and lands in General.
```html
<b>Export archive</b>
<code>export-{timestamp}.zip</code> — {count} messages, {media_count} media files.
```
---
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis. | Stars: 472k | Updated | Claude CodeCodex | Unverified | Install |
| diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness. | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |