Commands¶
tg --help shows 74 commands. This page is generated from Cobra help output.
Every command supports the global flags shown by tg --help: --account, --full, --json, --human, --lock-wait, --read-only, and --version where applicable.
Index¶
| Command | What |
|---|---|
tg account-sessions |
List authorized Telegram sessions |
tg accounts-add |
Create a new account directory |
tg accounts-list |
List known accounts |
tg accounts-remove |
Delete an account directory |
tg accounts-show |
Show the currently selected account and its paths |
tg accounts-use |
Select an existing account |
tg backfill |
Backfill cached messages for a chat |
tg backfill-entities |
Populate the local entity cache so chat_id-keyed sends work |
tg ban-from-chat |
ban-from-chat user in chat |
tg block-user |
Block a user |
tg chat-description |
Edit chat description |
tg chat-invite-link |
Export an invite link |
tg chat-members |
List chat members |
tg chat-photo |
Edit chat photo |
tg chat-pinned-list |
List pinned dialogs for a chat |
tg chat-title |
Edit chat title |
tg chats-info |
Show chat info for comma-separated chat ids |
tg completion |
Generate the autocompletion script for tg for the specified shell. |
tg contacts |
List cached contacts |
tg delete-msg |
Delete one or more messages (revoke for everyone by default) |
tg demote |
demote user in chat |
tg discover |
Discover dialogs and cache chat metadata |
tg doctor |
Diagnose tgctl-go setup |
tg download-album |
Download one cached Telegram media group |
tg download-media |
Download media attached to a message |
tg edit-msg |
Edit a previously sent message |
tg export |
Export cached Telegram history locally |
tg folder-add-chat |
Mutate folder chat membership |
tg folder-create |
Create a dialog folder |
tg folder-delete |
Delete a dialog folder |
tg folder-edit |
Edit a dialog folder |
tg folder-remove-chat |
Mutate folder chat membership |
tg folder-show |
Show one dialog folder |
tg folders-list |
List dialog folders |
tg folders-reorder |
Reorder dialog folders |
tg forward |
Forward one or more messages between chats |
tg get-msg |
Print one cached message in full |
tg help |
Help provides help for any command in the application. |
tg import-telethon-session |
Adopt a Python tgctl/Telethon session as the current Go account's session |
tg kick |
kick user in chat |
tg leave-chat |
Leave a group or channel (typed confirm required) |
tg list-msgs |
List cached messages in a chat with optional date filters |
tg listen |
Listen for live Telegram updates |
tg login |
Interactively authorize this account against Telegram |
tg mark-read |
Mark history read up to and including --up-to |
tg me |
Print authenticated user info |
tg pin-msg |
Pin a message in a chat |
tg promote |
promote user in chat |
tg react |
Send a reaction to a message |
tg search |
Search cached messages in a chat |
tg send |
Send a text message |
tg send-by-username |
Send a text message by resolving an @username (no entity cache required) |
tg set-permissions |
Set default chat permissions |
tg setup |
Create or update a private .env with Telegram app credentials |
tg show |
Show recent cached messages in a chat |
tg stats |
Show local cache statistics |
tg sync |
Synchronize cached messages and optionally follow updates |
tg sync-contacts |
Sync Telegram contacts into the local DB |
tg terminate-session |
Terminate one of your authorized Telegram sessions |
tg topic-create |
Create a forum topic |
tg topic-edit |
Edit a forum topic |
tg topic-pin |
Pin a forum topic |
tg topic-unpin |
Unpin a forum topic |
tg topics-list |
List forum topics |
tg unban-from-chat |
unban-from-chat user in chat |
tg unblock-user |
Unblock a previously blocked user |
tg unpin-msg |
Unpin a previously pinned message |
tg unread |
List recently cached incoming messages |
tg upload-album |
Upload a 2–10 item media album |
tg upload-document |
Upload a document |
tg upload-photo |
Upload a photo |
tg upload-video |
Upload a video |
tg upload-voice |
Upload an OGG/Opus voice message |
tg version |
Print build version |
tg account-sessions¶
List authorized Telegram sessions
Use
Example
Flags
| Flag | Description |
|---|---|
-h, --help |
help for account-sessions |
--human |
Force human-readable output (default on a TTY) |
--json |
Force JSON envelope output (default when stdout is not a TTY) |
tg accounts-add¶
Create a new account directory
Use
Example
Flags
| Flag | Description |
|---|---|
-h, --help |
help for accounts-add |
--human |
Force human-readable output (default on a TTY) |
--json |
Force JSON envelope output (default when stdout is not a TTY) |
tg accounts-list¶
List known accounts
Use
Example
Flags
| Flag | Description |
|---|---|
-h, --help |
help for accounts-list |
--human |
Force human-readable output (default on a TTY) |
--json |
Force JSON envelope output (default when stdout is not a TTY) |
tg accounts-remove¶
Delete an account directory
Use
Example
Flags
| Flag | Description |
|---|---|
--confirm string |
Typed account name to confirm removal |
-h, --help |
help for accounts-remove |
--human |
Force human-readable output (default on a TTY) |
--json |
Force JSON envelope output (default when stdout is not a TTY) |
tg accounts-show¶
Show the currently selected account and its paths
Use
Example
Flags
| Flag | Description |
|---|---|
-h, --help |
help for accounts-show |
--human |
Force human-readable output (default on a TTY) |
--json |
Force JSON envelope output (default when stdout is not a TTY) |
tg accounts-use¶
Select an existing account
Use
Example
Flags
| Flag | Description |
|---|---|
-h, --help |
help for accounts-use |
--human |
Force human-readable output (default on a TTY) |
--json |
Force JSON envelope output (default when stdout is not a TTY) |
tg backfill¶
Backfill cached messages for a chat
Use
Example
Flags
| Flag | Description |
|---|---|
--allow-write |
Required for local DB writes |
--download-media |
Download media during backfill |
-h, --help |
help for backfill |
--human |
Force human-readable output (default on a TTY) |
--json |
Force JSON envelope output (default when stdout is not a TTY) |
--max-db-size-mb int |
Maximum main database plus WAL allocation in MiB (0 disables the cap) |
--max-media-size-mb int |
Maximum size per downloaded media file in MiB (0 disables the limit) (default 100) |
--max-messages int |
Maximum cached messages per chat (maximum 10000) (default 100) |
--overwrite-media |
Overwrite existing backfill media files |
--throttle-seconds float |
Seconds to sleep between Telegram history pages |
tg backfill-entities¶
Populate the local entity cache so chat_id-keyed sends work
Use
Example
Flags
| Flag | Description |
|---|---|
--allow-write |
Required for local DB writes |
-h, --help |
help for backfill-entities |
--human |
Force human-readable output (default on a TTY) |
--json |
Force JSON envelope output (default when stdout is not a TTY) |
--limit int |
Max dialogs to fetch in one pass (Telegram caps at ~200) (default 200) |
tg ban-from-chat¶
ban-from-chat user in chat
Use
Example
Flags
| Flag | Description |
|---|---|
--allow-write |
Required for any Telegram-side write |
--confirm string |
Typed confirm against the resolved id |
--dry-run |
Print payload preview without contacting Telegram |
--fuzzy |
Allow title-based selectors for write commands |
-h, --help |
help for ban-from-chat |
--human |
Force human-readable output (default on a TTY) |
--idempotency-key string |
Per-account replay-safe key |
--json |
Force JSON envelope output (default when stdout is not a TTY) |
tg block-user¶
Block a user
Use
Example
Flags
| Flag | Description |
|---|---|
--allow-write |
Required for any Telegram-side write |
--confirm string |
Typed confirm against the resolved id |
--dry-run |
Print payload preview without contacting Telegram |
--fuzzy |
Allow title-based selectors for write commands |
-h, --help |
help for block-user |
--human |
Force human-readable output (default on a TTY) |
--idempotency-key string |
Per-account replay-safe key |
--json |
Force JSON envelope output (default when stdout is not a TTY) |
tg chat-description¶
Edit chat description
Use
Example
Flags
| Flag | Description |
|---|---|
--allow-write |
Required for any Telegram-side write |
--confirm string |
Typed confirm against the resolved id |
--dry-run |
Print payload preview without contacting Telegram |
--fuzzy |
Allow title-based selectors for write commands |
-h, --help |
help for chat-description |
--human |
Force human-readable output (default on a TTY) |
--idempotency-key string |
Per-account replay-safe key |
--json |
Force JSON envelope output (default when stdout is not a TTY) |
tg chat-invite-link¶
Export an invite link
Use
Example
Flags
| Flag | Description |
|---|---|
--allow-write |
Required for any Telegram-side write |
--confirm string |
Typed confirm against the resolved id |
--dry-run |
Print payload preview without contacting Telegram |
--fuzzy |
Allow title-based selectors for write commands |
-h, --help |
help for chat-invite-link |
--human |
Force human-readable output (default on a TTY) |
--idempotency-key string |
Per-account replay-safe key |
--json |
Force JSON envelope output (default when stdout is not a TTY) |
tg chat-members¶
List chat members
Use
Example
Flags
| Flag | Description |
|---|---|
-h, --help |
help for chat-members |
--human |
Force human-readable output (default on a TTY) |
--json |
Force JSON envelope output (default when stdout is not a TTY) |
--limit int |
Maximum members (default 50) |
tg chat-photo¶
Edit chat photo
Use
Example
Flags
| Flag | Description |
|---|---|
--allow-write |
Required for any Telegram-side write |
--confirm string |
Typed confirm against the resolved id |
--dry-run |
Print payload preview without contacting Telegram |
--fuzzy |
Allow title-based selectors for write commands |
-h, --help |
help for chat-photo |
--human |
Force human-readable output (default on a TTY) |
--idempotency-key string |
Per-account replay-safe key |
--json |
Force JSON envelope output (default when stdout is not a TTY) |
tg chat-pinned-list¶
List pinned dialogs for a chat
Use
Example
Flags
| Flag | Description |
|---|---|
-h, --help |
help for chat-pinned-list |
--human |
Force human-readable output (default on a TTY) |
--json |
Force JSON envelope output (default when stdout is not a TTY) |
tg chat-title¶
Edit chat title
Use
Example
Flags
| Flag | Description |
|---|---|
--allow-write |
Required for any Telegram-side write |
--confirm string |
Typed confirm against the resolved id |
--dry-run |
Print payload preview without contacting Telegram |
--fuzzy |
Allow title-based selectors for write commands |
-h, --help |
help for chat-title |
--human |
Force human-readable output (default on a TTY) |
--idempotency-key string |
Per-account replay-safe key |
--json |
Force JSON envelope output (default when stdout is not a TTY) |
tg chats-info¶
Show chat info for comma-separated chat ids
Use
Example
Flags
| Flag | Description |
|---|---|
-h, --help |
help for chats-info |
--human |
Force human-readable output (default on a TTY) |
--json |
Force JSON envelope output (default when stdout is not a TTY) |
tg completion¶
Generate the autocompletion script for tg for the specified shell.
Use
Example
Flags
| Flag | Description |
|---|---|
-h, --help |
help for completion |
tg contacts¶
List cached contacts
Use
Example
Flags
| Flag | Description |
|---|---|
-h, --help |
help for contacts |
--human |
Force human-readable output (default on a TTY) |
--json |
Force JSON envelope output (default when stdout is not a TTY) |
--limit int |
Maximum contacts (default 100) |
tg delete-msg¶
Delete one or more messages (revoke for everyone by default)
Use
Example
Flags
| Flag | Description |
|---|---|
--allow-write |
Required for any Telegram-side write |
--confirm string |
Typed confirm against the resolved id |
--dry-run |
Print payload preview without contacting Telegram |
--for-everyone |
Force revoke for everyone |
--fuzzy |
Allow title-based selectors for write commands |
-h, --help |
help for delete-msg |
--human |
Force human-readable output (default on a TTY) |
--idempotency-key string |
Per-account replay-safe key |
--json |
Force JSON envelope output (default when stdout is not a TTY) |
--no-for-everyone |
Force delete only for self |
tg demote¶
demote user in chat
Use
Example
Flags
| Flag | Description |
|---|---|
--allow-write |
Required for any Telegram-side write |
--confirm string |
Typed confirm against the resolved id |
--dry-run |
Print payload preview without contacting Telegram |
--fuzzy |
Allow title-based selectors for write commands |
-h, --help |
help for demote |
--human |
Force human-readable output (default on a TTY) |
--idempotency-key string |
Per-account replay-safe key |
--json |
Force JSON envelope output (default when stdout is not a TTY) |
tg discover¶
Discover dialogs and cache chat metadata
Use
Example
Flags
| Flag | Description |
|---|---|
--allow-write |
Required for local DB writes |
-h, --help |
help for discover |
--human |
Force human-readable output (default on a TTY) |
--json |
Force JSON envelope output (default when stdout is not a TTY) |
--limit int |
Maximum dialogs to fetch (default 200) |
tg doctor¶
Diagnose tgctl-go setup
Use
Example
Flags
| Flag | Description |
|---|---|
-h, --help |
help for doctor |
--human |
Force human-readable output (default on a TTY) |
--json |
Force JSON envelope output (default when stdout is not a TTY) |
tg download-album¶
Download one cached Telegram media group
Use
Example
Flags
| Flag | Description |
|---|---|
--allow-write |
Required for album media/cache writes |
--dry-run |
Print album metadata without contacting Telegram |
--fuzzy |
Allow title-based chat selectors |
--grouped-id int |
Telegram grouped_id to download |
-h, --help |
help for download-album |
--human |
Force human-readable output (default on a TTY) |
--json |
Force JSON envelope output (default when stdout is not a TTY) |
--max-size-mb int |
Maximum download size per item in MiB (0 = unlimited) (default 100) |
--message-id int |
Anchor message id (or pass it as the second argument) |
--output string |
Output directory (default account media/ |
--overwrite |
Overwrite existing media files |
tg download-media¶
Download media attached to a message
Use
Example
Flags
| Flag | Description |
|---|---|
--allow-write |
Required because the download updates the local media cache |
--fuzzy |
Allow title-based chat selectors |
-h, --help |
help for download-media |
--human |
Force human-readable output (default on a TTY) |
--json |
Force JSON envelope output (default when stdout is not a TTY) |
--max-size-mb int |
Maximum download size in MiB (0 = unlimited) (default 100) |
--output string |
Output directory (default account media/ |
--overwrite |
Overwrite an existing media file |
tg edit-msg¶
Edit a previously sent message
Use
Example
Flags
| Flag | Description |
|---|---|
--allow-write |
Required for any Telegram-side write |
--confirm string |
Typed confirm against the resolved id |
--dry-run |
Print payload preview without contacting Telegram |
--fuzzy |
Allow title-based selectors for write commands |
-h, --help |
help for edit-msg |
--human |
Force human-readable output (default on a TTY) |
--idempotency-key string |
Per-account replay-safe key |
--json |
Force JSON envelope output (default when stdout is not a TTY) |
tg export¶
Export cached Telegram history locally
Use
Example
Flags
| Flag | Description |
|---|---|
--format string |
Export format: jsonl, csv, or html (default "jsonl") |
-h, --help |
help for export |
--human |
Force human-readable output (default on a TTY) |
--include-media |
Include media paths relative to the account media root |
--json |
Force JSON envelope output (default when stdout is not a TTY) |
--limit int |
Maximum rows (0 means all cached rows) |
--manifest string |
Write an archive manifest JSON file |
--manifest-hash |
Include SHA-256 hashes in --manifest |
--output string |
Output file, or - for stdout (default "-") |
--since string |
Inclusive lower date/time bound |
--until string |
Inclusive upper date/time bound |
--verify string |
Verify a local archive manifest instead of exporting |
tg folder-add-chat¶
Mutate folder chat membership
Use
Example
Flags
| Flag | Description |
|---|---|
--allow-write |
Required for any Telegram-side write |
--confirm string |
Typed confirm against the resolved id |
--dry-run |
Print payload preview without contacting Telegram |
--fuzzy |
Allow title-based selectors for write commands |
-h, --help |
help for folder-add-chat |
--human |
Force human-readable output (default on a TTY) |
--idempotency-key string |
Per-account replay-safe key |
--json |
Force JSON envelope output (default when stdout is not a TTY) |
tg folder-create¶
Create a dialog folder
Use
Example
Flags
| Flag | Description |
|---|---|
--allow-write |
Required for any Telegram-side write |
--confirm string |
Typed confirm against the resolved id |
--dry-run |
Print payload preview without contacting Telegram |
--emoji string |
Folder emoji |
--exclude-chats string |
Comma-separated chat ids to exclude |
--fuzzy |
Allow title-based selectors for write commands |
-h, --help |
help for folder-create |
--human |
Force human-readable output (default on a TTY) |
--idempotency-key string |
Per-account replay-safe key |
--include-chats string |
Comma-separated chat ids to include |
--json |
Force JSON envelope output (default when stdout is not a TTY) |
tg folder-delete¶
Delete a dialog folder
Use
Example
Flags
| Flag | Description |
|---|---|
--allow-write |
Required for any Telegram-side write |
--confirm string |
Typed confirm against the resolved id |
--dry-run |
Print payload preview without contacting Telegram |
--fuzzy |
Allow title-based selectors for write commands |
-h, --help |
help for folder-delete |
--human |
Force human-readable output (default on a TTY) |
--idempotency-key string |
Per-account replay-safe key |
--json |
Force JSON envelope output (default when stdout is not a TTY) |
tg folder-edit¶
Edit a dialog folder
Use
Example
Flags
| Flag | Description |
|---|---|
--add string |
Comma-separated chat ids to add |
--allow-write |
Required for any Telegram-side write |
--confirm string |
Typed confirm against the resolved id |
--dry-run |
Print payload preview without contacting Telegram |
--emoji string |
Folder emoji |
--fuzzy |
Allow title-based selectors for write commands |
-h, --help |
help for folder-edit |
--human |
Force human-readable output (default on a TTY) |
--idempotency-key string |
Per-account replay-safe key |
--json |
Force JSON envelope output (default when stdout is not a TTY) |
--name string |
New folder name |
--remove string |
Comma-separated chat ids to remove |
tg folder-remove-chat¶
Mutate folder chat membership
Use
Example
Flags
| Flag | Description |
|---|---|
--allow-write |
Required for any Telegram-side write |
--confirm string |
Typed confirm against the resolved id |
--dry-run |
Print payload preview without contacting Telegram |
--fuzzy |
Allow title-based selectors for write commands |
-h, --help |
help for folder-remove-chat |
--human |
Force human-readable output (default on a TTY) |
--idempotency-key string |
Per-account replay-safe key |
--json |
Force JSON envelope output (default when stdout is not a TTY) |
tg folder-show¶
Show one dialog folder
Use
Example
Flags
| Flag | Description |
|---|---|
-h, --help |
help for folder-show |
--human |
Force human-readable output (default on a TTY) |
--json |
Force JSON envelope output (default when stdout is not a TTY) |
tg folders-list¶
List dialog folders
Use
Example
Flags
| Flag | Description |
|---|---|
-h, --help |
help for folders-list |
--human |
Force human-readable output (default on a TTY) |
--json |
Force JSON envelope output (default when stdout is not a TTY) |
--query string |
Filter by title |
tg folders-reorder¶
Reorder dialog folders
Use
Example
Flags
| Flag | Description |
|---|---|
--allow-write |
Required for any Telegram-side write |
--confirm string |
Typed confirm against the resolved id |
--dry-run |
Print payload preview without contacting Telegram |
--fuzzy |
Allow title-based selectors for write commands |
-h, --help |
help for folders-reorder |
--human |
Force human-readable output (default on a TTY) |
--idempotency-key string |
Per-account replay-safe key |
--json |
Force JSON envelope output (default when stdout is not a TTY) |
tg forward¶
Forward one or more messages between chats
Use
Example
Flags
| Flag | Description |
|---|---|
--allow-write |
Required for any Telegram-side write |
--confirm string |
Typed confirm against the resolved id |
--dry-run |
Print payload preview without contacting Telegram |
--fuzzy |
Allow title-based selectors for write commands |
-h, --help |
help for forward |
--human |
Force human-readable output (default on a TTY) |
--idempotency-key string |
Per-account replay-safe key |
--json |
Force JSON envelope output (default when stdout is not a TTY) |
--topic int |
Forum topic id on destination |
tg get-msg¶
Print one cached message in full
Use
Example
Flags
| Flag | Description |
|---|---|
-h, --help |
help for get-msg |
--human |
Force human-readable output (default on a TTY) |
--include-deleted |
Look up tombstoned messages too |
--json |
Force JSON envelope output (default when stdout is not a TTY) |
tg help¶
Help provides help for any command in the application.
Use
Example
Flags
| Flag | Description |
|---|---|
-h, --help |
help for help |
tg import-telethon-session¶
Adopt a Python tgctl/Telethon session as the current Go account's session
Use
Example
Flags
| Flag | Description |
|---|---|
-h, --help |
help for import-telethon-session |
--human |
Force human-readable output (default on a TTY) |
--json |
Force JSON envelope output (default when stdout is not a TTY) |
tg kick¶
kick user in chat
Use
Example
Flags
| Flag | Description |
|---|---|
--allow-write |
Required for any Telegram-side write |
--confirm string |
Typed confirm against the resolved id |
--dry-run |
Print payload preview without contacting Telegram |
--fuzzy |
Allow title-based selectors for write commands |
-h, --help |
help for kick |
--human |
Force human-readable output (default on a TTY) |
--idempotency-key string |
Per-account replay-safe key |
--json |
Force JSON envelope output (default when stdout is not a TTY) |
tg leave-chat¶
Leave a group or channel (typed confirm required)
Use
Example
Flags
| Flag | Description |
|---|---|
--allow-write |
Required for any Telegram-side write |
--confirm string |
Typed confirm against the resolved id |
--dry-run |
Print payload preview without contacting Telegram |
--fuzzy |
Allow title-based selectors for write commands |
-h, --help |
help for leave-chat |
--human |
Force human-readable output (default on a TTY) |
--idempotency-key string |
Per-account replay-safe key |
--json |
Force JSON envelope output (default when stdout is not a TTY) |
tg list-msgs¶
List cached messages in a chat with optional date filters
Use
Example
Flags
| Flag | Description |
|---|---|
-h, --help |
help for list-msgs |
--human |
Force human-readable output (default on a TTY) |
--include-deleted |
Include tombstoned messages |
--json |
Force JSON envelope output (default when stdout is not a TTY) |
--limit int |
Max messages to return (default 50) |
--reverse |
Oldest first |
--since string |
YYYY-MM-DD inclusive lower bound |
--until string |
YYYY-MM-DD inclusive upper bound |
tg listen¶
Listen for live Telegram updates
Use
Example
Flags
| Flag | Description |
|---|---|
--allow-write |
Required for local DB writes |
-h, --help |
help for listen |
--human |
Force human-readable output (default on a TTY) |
--json |
Force JSON envelope output (default when stdout is not a TTY) |
--once |
Exit after one filter-matching update |
--only-dms |
Emit only 1-on-1 user messages; skip groups/channels |
--only-groups |
Emit only group/channel messages; skip 1-on-1 DMs |
tg login¶
Interactively authorize this account against Telegram
Use
Example
Flags
| Flag | Description |
|---|---|
-h, --help |
help for login |
--human |
Force human-readable output (default on a TTY) |
--json |
Force JSON envelope output (default when stdout is not a TTY) |
--qr |
Authorize by scanning a Telegram QR code (API credentials still required) |
--qr-uri |
Print the QR login URI instead of rendering terminal blocks |
tg mark-read¶
Mark history read up to and including --up-to
Use
Example
Flags
| Flag | Description |
|---|---|
--allow-write |
Required for any Telegram-side write |
--confirm string |
Typed confirm against the resolved id |
--dry-run |
Print payload preview without contacting Telegram |
--fuzzy |
Allow title-based selectors for write commands |
-h, --help |
help for mark-read |
--human |
Force human-readable output (default on a TTY) |
--idempotency-key string |
Per-account replay-safe key |
--json |
Force JSON envelope output (default when stdout is not a TTY) |
--up-to int |
Mark read up to and including this message id; 0 means latest |
tg me¶
Print authenticated user info
Use
Example
Flags
| Flag | Description |
|---|---|
-h, --help |
help for me |
--human |
Force human-readable output (default on a TTY) |
--json |
Force JSON envelope output (default when stdout is not a TTY) |
--offline |
Read cached self user info without connecting to Telegram |
tg pin-msg¶
Pin a message in a chat
Use
Example
Flags
| Flag | Description |
|---|---|
--allow-write |
Required for any Telegram-side write |
--confirm string |
Typed confirm against the resolved id |
--dry-run |
Print payload preview without contacting Telegram |
--fuzzy |
Allow title-based selectors for write commands |
-h, --help |
help for pin-msg |
--human |
Force human-readable output (default on a TTY) |
--idempotency-key string |
Per-account replay-safe key |
--json |
Force JSON envelope output (default when stdout is not a TTY) |
--silent |
Pin silently (no notification) |
tg promote¶
promote user in chat
Use
Example
Flags
| Flag | Description |
|---|---|
--allow-write |
Required for any Telegram-side write |
--confirm string |
Typed confirm against the resolved id |
--dry-run |
Print payload preview without contacting Telegram |
--fuzzy |
Allow title-based selectors for write commands |
-h, --help |
help for promote |
--human |
Force human-readable output (default on a TTY) |
--idempotency-key string |
Per-account replay-safe key |
--json |
Force JSON envelope output (default when stdout is not a TTY) |
tg react¶
Send a reaction to a message
Use
Example
Flags
| Flag | Description |
|---|---|
--allow-write |
Required for any Telegram-side write |
--big |
Send a big reaction (Premium) |
--confirm string |
Typed confirm against the resolved id |
--dry-run |
Print payload preview without contacting Telegram |
--fuzzy |
Allow title-based selectors for write commands |
-h, --help |
help for react |
--human |
Force human-readable output (default on a TTY) |
--idempotency-key string |
Per-account replay-safe key |
--json |
Force JSON envelope output (default when stdout is not a TTY) |
tg search¶
Search cached messages in a chat
Use
Example
Flags
| Flag | Description |
|---|---|
--case-sensitive |
Case-sensitive matching |
-h, --help |
help for search |
--human |
Force human-readable output (default on a TTY) |
--include-deleted |
Include tombstoned messages |
--json |
Force JSON envelope output (default when stdout is not a TTY) |
--limit int |
Max messages to return (default 50) |
tg send¶
Send a text message
Use
Example
Flags
| Flag | Description |
|---|---|
--allow-write |
Required for any Telegram-side write |
--confirm string |
Typed confirm against the resolved id |
--dry-run |
Print payload preview without contacting Telegram |
--fuzzy |
Allow title-based selectors for write commands |
-h, --help |
help for send |
--human |
Force human-readable output (default on a TTY) |
--idempotency-key string |
Per-account replay-safe key |
--json |
Force JSON envelope output (default when stdout is not a TTY) |
--no-webpage |
Disable link preview |
--reply-to int |
Reply-to message id |
--silent |
Send silently (no notification) |
--topic int |
Forum topic id |
tg send-by-username¶
Send a text message by resolving an @username (no entity cache required)
Use
Example
Flags
| Flag | Description |
|---|---|
--allow-write |
Required for any Telegram-side write |
--dry-run |
Print payload preview without contacting Telegram |
-h, --help |
help for send-by-username |
--human |
Force human-readable output (default on a TTY) |
--json |
Force JSON envelope output (default when stdout is not a TTY) |
--no-webpage |
Disable link preview |
--reply-to int |
Reply-to message id |
--silent |
Send silently |
tg set-permissions¶
Set default chat permissions
Use
Example
Flags
| Flag | Description |
|---|---|
--allow-write |
Required for any Telegram-side write |
--confirm string |
Typed confirm against the resolved id |
--dry-run |
Print payload preview without contacting Telegram |
--fuzzy |
Allow title-based selectors for write commands |
-h, --help |
help for set-permissions |
--human |
Force human-readable output (default on a TTY) |
--idempotency-key string |
Per-account replay-safe key |
--json |
Force JSON envelope output (default when stdout is not a TTY) |
--send-messages |
Allow sending messages |
tg setup¶
Create or update a private .env with Telegram app credentials
Use
Example
Flags
| Flag | Description |
|---|---|
--api-hash string |
Telegram app API hash (never printed) |
--api-id string |
Telegram app API ID (never printed) |
--env-file string |
Environment file to create or update (default ".env") |
-h, --help |
help for setup |
--human |
Force human-readable output (default on a TTY) |
--json |
Force JSON envelope output (default when stdout is not a TTY) |
tg show¶
Show recent cached messages in a chat
Use
Example
Flags
| Flag | Description |
|---|---|
-h, --help |
help for show |
--human |
Force human-readable output (default on a TTY) |
--include-deleted |
Include tombstoned messages |
--json |
Force JSON envelope output (default when stdout is not a TTY) |
--limit int |
Max messages to return (default 20) |
--reverse |
Show oldest first |
tg stats¶
Show local cache statistics
Use
Example
Flags
| Flag | Description |
|---|---|
-h, --help |
help for stats |
--human |
Force human-readable output (default on a TTY) |
--json |
Force JSON envelope output (default when stdout is not a TTY) |
tg sync¶
Synchronize cached messages and optionally follow updates
Use
Example
Flags
| Flag | Description |
|---|---|
--allow-write |
Required for local DB writes |
--backoff-max-seconds float |
Maximum reconnect delay in seconds (default 30) |
--download-media |
Download media during catch-up |
--follow |
Continue listening after the initial catch-up |
-h, --help |
help for sync |
--human |
Force human-readable output (default on a TTY) |
--json |
Force JSON envelope output (default when stdout is not a TTY) |
--max-media-size-mb int |
Maximum media file size during catch-up (default 100) |
--max-messages int |
Maximum history messages to reconcile (default 100) |
--once |
With --follow, stop after one matching live event |
--overwrite-media |
Overwrite existing catch-up media |
tg sync-contacts¶
Sync Telegram contacts into the local DB
Use
Example
Flags
| Flag | Description |
|---|---|
--allow-write |
Required for local DB writes |
-h, --help |
help for sync-contacts |
--human |
Force human-readable output (default on a TTY) |
--json |
Force JSON envelope output (default when stdout is not a TTY) |
tg terminate-session¶
Terminate one of your authorized Telegram sessions
Use
Example
Flags
| Flag | Description |
|---|---|
--allow-write |
Required for any Telegram-side write |
--confirm string |
Typed confirm against the resolved id |
--dry-run |
Print payload preview without contacting Telegram |
--fuzzy |
Allow title-based selectors for write commands |
-h, --help |
help for terminate-session |
--human |
Force human-readable output (default on a TTY) |
--idempotency-key string |
Per-account replay-safe key |
--json |
Force JSON envelope output (default when stdout is not a TTY) |
tg topic-create¶
Create a forum topic
Use
Example
Flags
| Flag | Description |
|---|---|
--allow-write |
Required for any Telegram-side write |
--confirm string |
Typed confirm against the resolved id |
--dry-run |
Print payload preview without contacting Telegram |
--fuzzy |
Allow title-based selectors for write commands |
-h, --help |
help for topic-create |
--human |
Force human-readable output (default on a TTY) |
--icon-color int |
Topic icon color |
--icon-emoji-id int |
Topic icon custom emoji id |
--idempotency-key string |
Per-account replay-safe key |
--json |
Force JSON envelope output (default when stdout is not a TTY) |
tg topic-edit¶
Edit a forum topic
Use
Example
Flags
| Flag | Description |
|---|---|
--allow-write |
Required for any Telegram-side write |
--confirm string |
Typed confirm against the resolved id |
--dry-run |
Print payload preview without contacting Telegram |
--fuzzy |
Allow title-based selectors for write commands |
-h, --help |
help for topic-edit |
--human |
Force human-readable output (default on a TTY) |
--icon-emoji-id int |
New icon custom emoji id |
--idempotency-key string |
Per-account replay-safe key |
--json |
Force JSON envelope output (default when stdout is not a TTY) |
--title string |
New topic title |
tg topic-pin¶
Pin a forum topic
Use
Example
Flags
| Flag | Description |
|---|---|
--allow-write |
Required for any Telegram-side write |
--confirm string |
Typed confirm against the resolved id |
--dry-run |
Print payload preview without contacting Telegram |
--fuzzy |
Allow title-based selectors for write commands |
-h, --help |
help for topic-pin |
--human |
Force human-readable output (default on a TTY) |
--idempotency-key string |
Per-account replay-safe key |
--json |
Force JSON envelope output (default when stdout is not a TTY) |
tg topic-unpin¶
Unpin a forum topic
Use
Example
Flags
| Flag | Description |
|---|---|
--allow-write |
Required for any Telegram-side write |
--confirm string |
Typed confirm against the resolved id |
--dry-run |
Print payload preview without contacting Telegram |
--fuzzy |
Allow title-based selectors for write commands |
-h, --help |
help for topic-unpin |
--human |
Force human-readable output (default on a TTY) |
--idempotency-key string |
Per-account replay-safe key |
--json |
Force JSON envelope output (default when stdout is not a TTY) |
tg topics-list¶
List forum topics
Use
Example
Flags
| Flag | Description |
|---|---|
-h, --help |
help for topics-list |
--human |
Force human-readable output (default on a TTY) |
--json |
Force JSON envelope output (default when stdout is not a TTY) |
--limit int |
Maximum topics (default 50) |
--query string |
Filter query |
tg unban-from-chat¶
unban-from-chat user in chat
Use
Example
Flags
| Flag | Description |
|---|---|
--allow-write |
Required for any Telegram-side write |
--confirm string |
Typed confirm against the resolved id |
--dry-run |
Print payload preview without contacting Telegram |
--fuzzy |
Allow title-based selectors for write commands |
-h, --help |
help for unban-from-chat |
--human |
Force human-readable output (default on a TTY) |
--idempotency-key string |
Per-account replay-safe key |
--json |
Force JSON envelope output (default when stdout is not a TTY) |
tg unblock-user¶
Unblock a previously blocked user
Use
Example
Flags
| Flag | Description |
|---|---|
--allow-write |
Required for any Telegram-side write |
--confirm string |
Typed confirm against the resolved id |
--dry-run |
Print payload preview without contacting Telegram |
--fuzzy |
Allow title-based selectors for write commands |
-h, --help |
help for unblock-user |
--human |
Force human-readable output (default on a TTY) |
--idempotency-key string |
Per-account replay-safe key |
--json |
Force JSON envelope output (default when stdout is not a TTY) |
tg unpin-msg¶
Unpin a previously pinned message
Use
Example
Flags
| Flag | Description |
|---|---|
--allow-write |
Required for any Telegram-side write |
--confirm string |
Typed confirm against the resolved id |
--dry-run |
Print payload preview without contacting Telegram |
--fuzzy |
Allow title-based selectors for write commands |
-h, --help |
help for unpin-msg |
--human |
Force human-readable output (default on a TTY) |
--idempotency-key string |
Per-account replay-safe key |
--json |
Force JSON envelope output (default when stdout is not a TTY) |
--silent |
Pin silently (no notification) |
tg unread¶
List recently cached incoming messages
Use
Example
Flags
| Flag | Description |
|---|---|
-h, --help |
help for unread |
--human |
Force human-readable output (default on a TTY) |
--json |
Force JSON envelope output (default when stdout is not a TTY) |
--limit int |
Maximum messages (default 50) |
tg upload-album¶
Upload a 2–10 item media album
Use
Example
Flags
| Flag | Description |
|---|---|
--allow-write |
Required for any Telegram-side write |
--caption string |
Album caption (placed on the first item) |
--dry-run |
Print payload preview without contacting Telegram |
--fuzzy |
Allow title-based selectors for write commands |
-h, --help |
help for upload-album |
--human |
Force human-readable output (default on a TTY) |
--idempotency-key string |
Per-account replay-safe key |
--json |
Force JSON envelope output (default when stdout is not a TTY) |
--max-size-mb int |
Maximum size per item in MiB (default 100) |
--media-kind string |
Album media kind: auto, photo, video, audio, or document (default "auto") |
--reply-to int |
Reply-to message id |
--silent |
Send silently |
--supports-streaming |
Mark video items as streamable |
tg upload-document¶
Upload a document
Use
Example
Flags
| Flag | Description |
|---|---|
--allow-write |
Required for any Telegram-side write |
--caption string |
Media caption |
--confirm string |
Typed confirm against the resolved id |
--dry-run |
Print payload preview without contacting Telegram |
--filename string |
Override uploaded filename |
--fuzzy |
Allow title-based selectors for write commands |
-h, --help |
help for upload-document |
--human |
Force human-readable output (default on a TTY) |
--idempotency-key string |
Per-account replay-safe key |
--json |
Force JSON envelope output (default when stdout is not a TTY) |
--max-size-mb int |
Maximum upload size in MiB (default 100) |
--reply-to int |
Reply-to message id |
--silent |
Send silently |
tg upload-photo¶
Upload a photo
Use
Example
Flags
| Flag | Description |
|---|---|
--allow-write |
Required for any Telegram-side write |
--caption string |
Media caption |
--confirm string |
Typed confirm against the resolved id |
--dry-run |
Print payload preview without contacting Telegram |
--fuzzy |
Allow title-based selectors for write commands |
-h, --help |
help for upload-photo |
--human |
Force human-readable output (default on a TTY) |
--idempotency-key string |
Per-account replay-safe key |
--json |
Force JSON envelope output (default when stdout is not a TTY) |
--max-size-mb int |
Maximum upload size in MiB (default 100) |
--reply-to int |
Reply-to message id |
--silent |
Send silently |
tg upload-video¶
Upload a video
Use
Example
Flags
| Flag | Description |
|---|---|
--allow-write |
Required for any Telegram-side write |
--caption string |
Media caption |
--confirm string |
Typed confirm against the resolved id |
--dry-run |
Print payload preview without contacting Telegram |
--fuzzy |
Allow title-based selectors for write commands |
-h, --help |
help for upload-video |
--human |
Force human-readable output (default on a TTY) |
--idempotency-key string |
Per-account replay-safe key |
--json |
Force JSON envelope output (default when stdout is not a TTY) |
--max-size-mb int |
Maximum upload size in MiB (default 100) |
--reply-to int |
Reply-to message id |
--silent |
Send silently |
--supports-streaming |
Mark video as streamable |
tg upload-voice¶
Upload an OGG/Opus voice message
Use
Example
Flags
| Flag | Description |
|---|---|
--allow-write |
Required for any Telegram-side write |
--caption string |
Media caption |
--confirm string |
Typed confirm against the resolved id |
--dry-run |
Print payload preview without contacting Telegram |
--fuzzy |
Allow title-based selectors for write commands |
-h, --help |
help for upload-voice |
--human |
Force human-readable output (default on a TTY) |
--idempotency-key string |
Per-account replay-safe key |
--json |
Force JSON envelope output (default when stdout is not a TTY) |
--max-size-mb int |
Maximum upload size in MiB (default 100) |
--reply-to int |
Reply-to message id |
--silent |
Send silently |
tg version¶
Print build version
Use
Example
Flags
| Flag | Description |
|---|---|
-h, --help |
help for version |
--human |
Force human-readable output (default on a TTY) |
--json |
Force JSON envelope output (default when stdout is not a TTY) |