Telegram

Coming from tgcli

Move from tgcli to the Telegram CLI: map commands for accounts, archives, bots, groups, folders, contacts and message search.

tgcli is another command line client for a personal Telegram account. This page lists each tgcli command and what does the same in tg. Where tg has no equivalent, the row says so and why.

tg names a chat as an argument, not with --chat or --to: tg messages send "Book club" "hi". Every command takes --json (cli-contract.md).

Login, profiles and the background service

tgclitg
auth, auth --qrtg session start (QR by default), tg session start phone
auth statustg account show, tg doctor --online
auth logouttg session end
accounts add, --account <id>a profile: tg work chats list, or TG_PROFILE=work (profiles.md)
config get/set/unsettg config show/set/unset (configuration.md)
proxy setting, TELEGRAM_PROXYthe proxy setting, TG_PROXY (configuration-reference.md)
server, service install/start/stop/status/logstg serve, tg server start/stop/status/logs/install
MCP over HTTP (mcp.enabled)tg mcp --http (mcp.md, remote.md)
sync --once, sync --followtg store fetch, tg serve (archive.md)
sync jobs list/add/retry/canceltg store fetch --background, tg store jobs list/show/cancel
owner request <id>tg sends list, and --send-id to repeat a send whose outcome was unknown
doctortg doctor

Reading and searching

tgclitg
channels list, groups listtg chats list --kind channel, --kind group
channels show, groups info, metadata gettg chats show <chat>
topics list/searchtg topics list/search <chat>
messages list --chat … --topic …tg messages list <chat> --topic <id>
messages list --after/--before--after-time, --before-time, --after-id, --before-id
messages show, messages contexttg messages show, tg messages context
messages search --after --before --tag --topic --regexthe query: date:7d tag:work topic:12, --regex (query-language.md)
messages search --source live/bothtg messages search --backend server/both (search.md)
media downloadtg messages download <chat> <id>, or a whole chat with --all
contacts search, contacts showtg contacts list --search, tg contacts show, tg contacts profile

Sending

tgclitg
send text, send photo, send filetg messages send <chat> [text], with --photo or --file
--parse-mode markdown--md (usage.md)
--parse-mode html--html
--reply-to, --topic, --silent, --no-previewthe same flags
--schedule <iso>--at-time <time>
--spoiler, --caption-abovethe same flags
--force-document--as-file
--filename--filename
--retries, --retry-backoffnot needed: a dropped upload is retried by itself, and never sent twice
--no-forwardsnot possible: Telegram lets only bots protect one message. Turn on the chat's own content protection in Telegram.

Groups and folders

tgclitg
groups renametg chats update <chat> --title
groups members add/removetg chats members add/remove
groups invite get, groups invite revoketg chats link show, tg chats link reset
groups invite edit --request-neededtg chats link create <chat> --approval, or tg chats update <chat> --join-approval on
groups requests list/approve/declinetg chats requests list, tg chats requests accept/decline <chat> <person>
groups requests list --query, --linktg chats requests list <chat> --search <text> or --link <link>; Telegram does not accept both filters together
groups join, groups leavetg chats join <link>, tg chats leave <chat>
folders list/create/edit/deletetg chats folders list/create/update/delete
folders create/edit --include-contacts, --exclude-muted and the other rulesnot in tg yet: a tg folder holds the chats you name
folders create/edit --exclude-chat, --pin-chat, --emojinot in tg yet
folders reordertg chats folders order
folders chats add/removetg chats folders update --add/--remove
folders chats join (a shared folder link)tg chats folders join <link>

Your own notes on chats and people

tgclitg
tags set/list/search on a channeltg tags add/remove/list --chat, and tag: in a search
contacts tags add/rmtg tags add/remove --contact
contacts alias set/rmtg contacts alias set/rm: a private name on this computer only; tg contacts rename changes your Telegram contacts
contacts notes settg contacts notes add/edit/remove, several notes per person, on this computer only
tags auto, metadata refreshtg tags auto, tg metadata refresh