Command Palette

Search for a command to run...

UnylyUnyly
Back to skills

telegram-telethon

FreeRuns bundled scriptsNot checked

This skill should be used for comprehensive Telegram automation via Telethon API. Use for sending/receiving messages, monitoring chats, running a background…

glebisby glebis★ 417 GitHub stars

About 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

  1. Explicit draft → draft: "драфт", "draft" → use draft command immediately
  2. Explicit send → send: "отправь", "пошли", "send" → use send command immediately
  3. 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)
  • --markdown on send / publish — markdown→Telegram HTML conversion
  • --schedule on send / publish — ISO / relative / natural-language scheduled delivery
  • Daemon mode + Codex spawning, voice transcription (Telegram/Groq/Whisper), delete / forward / mark-read, local draft / 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:

  1. Getting API credentials from https://my.telegram.org/auth
  2. Phone number verification
  3. 2FA (if enabled)
  4. 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
Full SKILL.md on GitHub

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
Sign up freeI already have an account

Allowed tools

Tools this skill is permitted to call.

No restriction — this skill can use any tool.

Bundled files

.claude-plugin/plugin.json.gitignorepyproject.tomlscripts/tg.pyscripts/tgd.pysrc/telegram_telethon/__init__.pysrc/telegram_telethon/core/__init__.pysrc/telegram_telethon/core/auth.pysrc/telegram_telethon/core/config.pysrc/telegram_telethon/daemon/__init__.pysrc/telegram_telethon/daemon/claude_bridge.pysrc/telegram_telethon/daemon/handlers.pysrc/telegram_telethon/daemon/runner.pysrc/telegram_telethon/modules/__init__.pysrc/telegram_telethon/modules/lint.pysrc/telegram_telethon/modules/markdown.pysrc/telegram_telethon/modules/media.pysrc/telegram_telethon/modules/messages.pysrc/telegram_telethon/modules/publish.pysrc/telegram_telethon/modules/schedule.pysrc/telegram_telethon/utils/__init__.pysrc/telegram_telethon/utils/formatting.py

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

Compare telegram-telethon with