Skip to content

ghillb/tmgc

Repository files navigation

tmgc - Telegram MTProto Go CLI

Script-first Telegram CLI on top of gotd/td.

Features:

  • Auth: auth login (QR + PNG fallback), auth status, auth logout
  • Credentials: auth config set/show
  • Chat: chat list, chat history
  • Messaging: message send (text or --file)
  • Search: search messages (global or per chat)
  • Output: human, --plain (TSV), --json
  • Session storage: OS keychain by default, fallback to file

Install:

go install github.com/ghillb/tmgc/cmd/tmgc@latest

Quick start:

tmgc auth config set --api-id 123456 --api-hash abc123...
tmgc auth login
tmgc auth login --qr-file /tmp/tmgc.png
tmgc chat list --limit 20
tmgc message send @username "hello"
tmgc message send @username --file ./photo.jpg --caption "hi"
tmgc message send @username "later" --schedule 2026-01-05T09:30:00Z

Env vars are only needed if you skip auth config set:

export TMGC_API_ID=123456
export TMGC_API_HASH=abc123...

Optional: force session storage backend:

export TMGC_SESSION_STORE=keyring   # default
export TMGC_SESSION_STORE=file

You can also set it via config:

tmgc auth config set --session-store file

Docs: docs/spec.md

Notes: Third-party CLI, not affiliated with Telegram. QR login is recommended.