telegram-telethon
FreeRuns bundled scriptsNot checkedThis skill should be used for comprehensive Telegram automation via Telethon API. Use for sending/receiving messages, monitoring chats, running a background…
by glebis★ 417 GitHub starsAbout this skill
Codex Behavior Guidelines
Draft vs Send: Follow User's Intent
| User says | Codex does | Clarify? |
|---|---|---|
| "драфт", "draft", "сделай драфт" | draft |
No |
| "отправь", "пошли", "send" | send |
No |
| "напиши сообщение" (ambiguous) | Ask what user wants | Yes |
Key Rules
- Explicit draft → draft: "драфт", "draft" → use
draftcommand immediately - Explicit send → send: "отправь", "пошли", "send" → use
sendcommand immediately - Ambiguous → clarify: If neither "draft" nor "send" verb present, ask: "Создать драфт или сразу отправить?"
Examples
User: "сделай драфт для lv: привет"
Codex: Uses draft --chat "lv" --text "привет" immediately
User: "отправь сообщение Маше: встретимся в 5?"
Codex: Uses send --chat "Маша" --text "встретимся в 5?" immediately
User: "напиши сообщение для Маши: встретимся в 5?" Codex: Asks "Создать драфт или сразу отправить?"
Telegram Telethon Skill
Full Telethon API wrapper with daemon mode and Codex integration. Supports interactive setup, background message monitoring, and automatic Codex session spawning per chat.
Package Layout
telegram-telethon/
├── SKILL.md # This file
├── pyproject.toml # Installable Python package
├── scripts/
│ ├── tg.py # Main CLI (messages, media, drafts, etc.)
│ └── tgd.py # Daemon controller
├── src/telegram_telethon/ # Importable package
│ ├── core/ # auth, config
│ ├── modules/ # messages, media
│ ├── daemon/ # runner, handlers, claude_bridge
│ └── utils/ # formatting
└── tests/ # pytest unit + integration tests
Scripts import from src/telegram_telethon. Install the package in editable mode so tg.py/tgd.py can resolve imports:
cd telegram-telethon
pip install -e .
# or with dev tools (pytest, coverage):
pip install -e ".[dev]"
Relationship to telegram Skill
The separate telegram skill (single-script telegram_fetch.py backed by telegram_dl) overlaps on list/recent/search/send/edit/download/thread but differs:
With the publish/markdown/schedule ports now complete, telegram-telethon is a superset of telegram on everything except the external telegram_dl auth dependency. Use this skill for:
publish— draft→channel workflow (frontmatter, media albums, post-publish move + index update, post-flight lint)--markdownonsend/publish— markdown→Telegram HTML conversion--scheduleonsend/publish— ISO / relative / natural-language scheduled delivery- Daemon mode + Codex spawning, voice transcription (Telegram/Groq/Whisper),
delete/forward/mark-read, localdraft/drafts/draft-send,lint-channel, non-interactive auth setup.
Prerequisites
Interactive Setup (Terminal)
Run setup wizard on first use:
python3 scripts/tg.py setup
This guides through:
- Getting API credentials from https://my.telegram.org/auth
- Phone number verification
- 2FA (if enabled)
- Optional daemon trigger configuration
Non-Interactive Setup (Codex)
For use from Codex or scripts without TTY:
# Step 1: Provide credentials and trigger code send
python3 scripts/tg.py setup --api-id 12345678 --api-hash abc123... --phone +1234567890
# Step 2: User receives code on phone, then complete auth
python3 scripts/tg.py setup --api-id 12345678 --api-hash abc123... --phone +1234567890 --code 12345
# If 2FA enabled, add password
python3 scripts/tg.py setup --api-id 12345678 --api-hash abc123... --phone +1234567890 --code 12345 --password mypassword
The script auto-detects TTY and switches between interactive/non-interactive modes.
Quick Start
# Check connection status
python3 scripts/tg.py status
# List chats
python3 scripts/tg.py list
# Get recent messages from a chat
python3 scripts/tg.py recent "John Doe" --limit 20
# Search messages
python3 scripts/tg.py search "meeting notes"
# Configure daemon triggers interactively
python3 scripts/tg.py daemon-config
# Start daemon (foreground with logs)
python3 scripts/tgd.py start --foreground
# Start daemon (background)
python3 scripts/tgd.py start
# View daemon logs
python3 scripts/tgd.py logs
CLI Commands
Message Operations
# List all chats
python3 scripts/tg.py list [--limit 30] [--search "term"]
# Fetch recent messages
python3 scripts/tg.py recent [CHAT] [--limit 50] [--days 7] [--format markdown|json] [--output file.md]
# Search messages by content
python3 scripts/tg.py search QUERY [--chat "Chat Name"] [--limit 50] [--format markdown|json]
# Fetch unread messages
python3 scripts/tg.py unread [--chat "Chat Name"] [--format markdown|json]
# Fetch forum thread
python3 scripts/tg.py thread CHAT_ID THREAD_ID [--limit 100]
# Send message
p
Install telegram-telethon in Claude Code & Claude Desktop
Sign up to install this skill
Create a free account to reveal the install command and save the skill to your library.
- Reveal the one-line install command
- Save skills to your synced library
- Get notified when skills update
Allowed tools
Tools this skill is permitted to call.
No restriction — this skill can use any tool.
Bundled files
FAQ
What does the telegram-telethon skill do?
This skill should be used for comprehensive Telegram automation via Telethon API. Use for sending/receiving messages, monitoring chats, running a background daemon that triggers Codex sessions, managing channels/groups, and downloading media. Triggers on "telegram daemon", "monitor telegram", "telegram bot", "spawn Codex from telegram", or any Telethon-related request. IMPORTANT - use the draft command for "драфт/draft", use send for "отправь/send"; if ambiguous, ASK before sending.
How do I install the telegram-telethon skill?
Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.
Does the telegram-telethon skill run scripts?
Yes, this skill bundles executable scripts. Review the source before installing.
Related skills
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
by Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
by Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
by Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
by Anthropic