AgentSkillsCN

telegram

通过 GramJS MTProto 客户端处理 Telegram 消息。阅读消息、生成 AI 草稿、保存草稿,并创建欢迎群组。适用于处理 Telegram 对话,或协助完成初次见面的引导工作。

SKILL.md
--- frontmatter
name: telegram
description: Process Telegram messages via GramJS MTProto client. Read messages, generate AI drafts, save drafts, and create intro groups. Use when handling Telegram conversations or facilitating introductions.

Telegram Skill

Process Telegram messages via GramJS MTProto client. Supports unread messages, specific users, message requests, and group creation for introductions.

CRITICAL: NEVER SEND MESSAGES. Only save drafts.

Capabilities

CapabilityDescription
Unread ModeProcess N unread conversations
User ModeFind specific person by username/name (any read state)
Requests ModeProcess message requests folder (non-contacts)
Entity ContextLoad context from database for known contacts
Draft RepliesAI generates contextual reply drafts
Save DraftsSave drafts to Telegram (no sending)
Create GroupsCreate new groups and add members for introductions
Dialog CacheFast lookups via cached dialog IDs (~1s vs ~90s)
Mark UnreadRe-mark conversations as unread after processing
HistorySave per-person history to vault context/telegram/

Workflows

  • workflows/process-messages.md - Full workflow for reading/replying
  • workflows/create-intro-group.md - Workflow for facilitating introductions

Tools

ScriptPurpose
scripts/telegram-gramjs.tsGramJS MTProto client - fetch messages, populate cache
scripts/telegram-save-drafts.tsSave AI drafts to Telegram from work file
scripts/save-telegram-draft.tsQuick helper to save one draft by username
scripts/telegram-create-group.tsCreate groups and add members for intros

Quick Reference

bash
# Unread mode (default)
/cyber-telegram                    # 1 unread dialog
/cyber-telegram --count 3          # 3 unread dialogs

# User mode
/cyber-telegram --user "@username" # By username
/cyber-telegram --user "Name"      # By name

# Requests mode
/cyber-telegram --requests         # Message requests folder

# Modifiers
/cyber-telegram --dry-run          # Read only
/cyber-telegram --no-mark-unread   # Don't preserve unread state

# Create intro group
bun scripts/telegram-create-group.ts --dry-run --title "A <> B" --users "@user1,@user2"
bun scripts/telegram-create-group.ts --title "A <> B" --users "@user1,@user2" --draft "Intro message"

See workflow files for full documentation.

Dialog Cache

Dialog cache (~/.cybos/telegram/dialog-cache.json) stores all dialog IDs with access hashes for fast lookups:

  • Populated automatically during searches
  • Used by telegram-save-drafts.ts to avoid fetching all dialogs
  • ~1 second draft save vs ~90 seconds without cache

Safety

Drafts only - never sends messages automatically. User reviews and sends manually in Telegram.