tg - Telegram CLI
Fast Telegram CLI for reading, searching, and sending messages. Designed for both interactive use and AI agent integration.
Installation
npm install -g @cyberdrk/tg
Or install from source:
git clone https://github.com/cyberdrk305/telegram.git
cd telegram
npm install
npm run build
npm link
Authentication
First, get your API credentials:
Then authenticate:
tg auth
Commands
Auth & Status
tg whoami
tg check
Reading
tg chats
tg chats --type group
tg read "MetaDAO Community" -n 50
tg read "MetaDAO" --since "1h"
tg read @username -n 20
tg search "futarchy" --chat "MetaDAO"
tg search "futarchy" --all
tg inbox
Writing
tg send @username "Hello"
tg send "GroupName" "Hello everyone"
tg reply "ChatName" 12345 "Response"
Contacts & Groups
tg contact @username
tg members "GroupName"
tg admins "GroupName"
tg groups
tg groups --admin
Utilities
tg sync --days 7
tg sync --chat "MetaDAO" --days 30
Output Formats
All read commands support multiple output formats:
tg chats --json
tg read "Chat" --markdown
tg inbox --plain
Configuration
Configuration is stored in ~/.config/tg/:
config.json - API credentials and session
- Session data is encrypted and stored securely
Claude Code Skill
This package includes a Claude Code skill for AI agent integration. To install:
mkdir -p ~/.claude/skills
ln -s $(npm root -g)/@cyberdrk/tg/SKILL.md ~/.claude/skills/tg.md
Or if installed from source:
ln -s ~/Code/cyberdrk305/telegram/SKILL.md ~/.claude/skills/tg.md
Development
npm install
npm run build
npm run dev
License
MIT