Comandos de Telegram para administrar grupos
Miembros, invitaciones, permisos, moderación, temas de foro y estadísticas de grupos y canales. Los cambios requieren los permisos pertinentes.
Esta referencia reúne comandos administrativos. Consulta opciones de miembros, invitaciones, permisos, moderación, temas de foro y estadísticas antes de cambiar algo.
Miembros, invitaciones, permisos, moderación, temas de foro y estadísticas de grupos y canales. Los cambios requieren los permisos pertinentes.
Opciones globales
| Option | What it does |
|---|---|
-V, --version | output the version number. |
-v, --verbose | more detail in what is shown: -v ids, -vv everything we know. Default: 0. |
--json | machine-readable output: one JSON value on stdout; --json=id,text keeps only those fields. |
--jsonl | machine-readable output: one JSON object per line, for streaming and jq. |
--quiet | diagnostics off; a failure is still said. |
--trace | the connection's own log lines on stderr — never message content. |
--debug | on a failure, its whole record — cause and stack — in place of the short line. |
--timeout <duration> | give up on the whole command after this — 30s, 2m, 500ms. |
--offline | answer from what was recorded and never connect; fails if nothing was. |
--no-input | never prompt or open interactive login; piped input remains available. |
--max-input-bytes <bytes> | maximum buffered input bytes (default: 16777216). |
--max-output-bytes <bytes> | maximum machine output bytes (default: 4194304; 0 disables). |
--brief | found messages as reference, title, time, sender and excerpt only. |
--full | found messages with their whole text and every provider field. |
--compact | one line per item for an agent: reference first, text last, paging and next steps as # lines. |
--dry-run | preview parsed arguments and permissions before running the action. |
--yes | go ahead without the question an ask level puts before a write. |
--record | keep this run even where the config says record false; record_input false leaves the typed words out. |
--no-record | do not keep this run, even if it fails. |
Comandos
tg chats members
who is in a group
tg chats members list
everyone in a group, a page at a time, with their role and when they were last seen
tg chats members list <chat> [query] [options]| Argument | Obligatoriedad | What it is |
|---|---|---|
chat | required | a chat: its title or part of it, its id, @username, or me for Saved Messages. |
query | optional | field:value terms; this list filters by none yet. |
| Option | What it does |
|---|---|
--limit <n> | how many to show. |
--page <n> | which page, starting at 1. |
--all | every row, no paging. |
Returns: member — id, name, username, role, last_seen_at, registered_at, joined_at, invited_by, and 7 more; every field: tg commands info chats members list
Next usually: tg contacts show <person>, tg contacts context <person>, tg contacts prepare <person>
Example: tg personal chats members list "Book club"
tg chats members check
members that look like bots, each with its reasons, from the member list and local store; --deep checks selected people individually; removes nobody
tg chats members check <chat> [query] [options]| Argument | Obligatoriedad | What it is |
|---|---|---|
chat | required | a chat: its title or part of it, its id, @username, or me for Saved Messages. |
query | optional | field:value terms that narrow the list — the fields are below. |
| Option | What it does |
|---|---|
--max-pages <pages> | at most this many pages of 200 members, a pause between them (default: 10). |
--deep <n> | also check the top n profiles, oldest photos, up to 1,000 stored messages each and public ban lists, which are sent their ids — one person a second. |
Returns: member — id, name, username, role, last_seen_at, registered_at, joined_at, invited_by, and 7 more; every field: tg commands info chats members check
Next usually: tg contacts show <person>, tg contacts context <person>, tg contacts prepare <person>
Example: tg personal chats members check "Book club"
tg chats members history
who joined, who left and whose profile changed, oldest first — what chats members fetch recorded in the local store; never asks the messenger
tg chats members history <chat> [query]| Argument | Obligatoriedad | What it is |
|---|---|---|
chat | required | a chat: its title or part of it, its id, @username, or me for Saved Messages. |
query | optional | field:value terms that narrow the list — the fields are below. |
Returns: chat event — chat_id, time, type, people, message_id, by, title, before; every field: tg commands info chats members history
Example: tg personal chats members history "Book club"
tg chats members fetch
read a group's whole member list into the local store's member history: who joined, who left, daily counts and profile changes; someone is recorded as gone only when every member was read
Changes something on this computer only.
tg chats members fetch <chat> [options]| Argument | Obligatoriedad | What it is |
|---|---|---|
chat | required | a chat: its title or part of it, its id, @username, or me for Saved Messages. |
| Option | What it does |
|---|---|
--track | also fetch it daily while serve runs; chats tracking lists and edits those chats. |
--max-pages <pages> | at most this many pages of 200 members, a pause between them (default: 10). |
Returns: chat members fetch — chat_id, joined, gone, changed, read, participants, complete, more, and 1 more; every field: tg commands info chats members fetch
Example: tg personal chats members fetch "Book club"
tg chats members add
add people; they are told
Changes something in Telegram.
tg chats members add <chat> <person>| Argument | Obligatoriedad | What it is |
|---|---|---|
chat | required | a chat: its title or part of it, its id, @username, or me for Saved Messages. |
person | required | an id, or part of a name. |
Returns: chat members change — operation_id, chat_id, added, not_added, removed; every field: tg commands info chats members add
Example: tg personal chats members add "Book club" "Alex Example"
tg chats members remove
remove people; their messages stay
Changes something in Telegram.
tg chats members remove <chat> <person>| Argument | Obligatoriedad | What it is |
|---|---|---|
chat | required | a chat: its title or part of it, its id, @username, or me for Saved Messages. |
person | required | an id, or part of a name. |
Returns: chat members change — operation_id, chat_id, added, not_added, removed; every field: tg commands info chats members remove
Example: tg personal chats members remove "Book club" "Alex Example"
tg chats create
create a group or a channel; the people added are told
Changes something in Telegram.
tg chats create <title> [person] [options]| Argument | Obligatoriedad | What it is |
|---|---|---|
title | required | the group's name. |
person | optional | people to add: an id, or part of a name. |
| Option | What it does |
|---|---|
--channel | a private channel instead of a group; people join it by its link. |
Returns: chat group change — operation_id, chat, requested; every field: tg commands info chats create
Example: tg personal chats create "Book club" "Alex Example"
tg chats update
rename a group or channel, change its description, or turn one of its settings on or off
Changes something in Telegram.
tg chats update <chat> [options]| Argument | Obligatoriedad | What it is |
|---|---|---|
chat | required | a chat: its title or part of it, its id, @username, or me for Saved Messages. |
| Option | What it does |
|---|---|
--title <title> | the new name. |
--description <text> | the new description. |
--all-can-pin <on|off> | every member may pin messages. |
--only-admins-add <on|off> | only admins may add members. |
--join-approval <on|off> | people ask to join, and an admin lets them in. |
Returns: chat group change — operation_id, chat, requested; every field: tg commands info chats update
Example: tg personal chats update "Book club" --title "Reading group"
tg chats links
a group's invite link
tg chats links show
the invite link, if you may see it
tg chats links show <chat>| Argument | Obligatoriedad | What it is |
|---|---|---|
chat | required | a chat: its title or part of it, its id, @username, or me for Saved Messages. |
Returns: chat invite — chat_id, title, link; every field: tg commands info chats links show
Example: tg personal chats links show "Book club"
tg chats links create
make another invite link; nobody is told until you share it
Changes something in Telegram.
tg chats links create <chat> [options]| Argument | Obligatoriedad | What it is |
|---|---|---|
chat | required | a chat: its title or part of it, its id, @username, or me for Saved Messages. |
| Option | What it does |
|---|---|
--approval | who joins by it asks first, and an admin lets them in; it then has no use limit. |
--expire-time <time> | it stops working then: 2026-09-25T09:00 (local time), or 30m, 2h, 7d from now. |
--max-uses <n> | at most this many people join by it, 1 to 99999. |
Returns: chat invite change — operation_id, chat_id, link, approval, expires_at, max_uses, primary, revoked, and 2 more; every field: tg commands info chats links create
Example: tg personal chats links create "Book club"
tg chats links list
your invite links, newest first, with how many joined and how many wait
tg chats links list <chat> [query] [options]| Argument | Obligatoriedad | What it is |
|---|---|---|
chat | required | a chat: its title or part of it, its id, @username, or me for Saved Messages. |
query | optional | field:value terms that narrow the list — the fields are below. |
| Option | What it does |
|---|---|
--limit <n> | how many to show. |
--page <n> | which page, starting at 1. |
Returns: invite link — link, approval, expires_at, max_uses, primary, revoked, pending_count, joined_count; every field: tg commands info chats links list
Example: tg personal chats links list "Book club"
tg chats links remove
stop one link; for the group's own link, the answer is the new one
Changes something in Telegram.
tg chats links remove <chat> <link>| Argument | Obligatoriedad | What it is |
|---|---|---|
chat | required | a chat: its title or part of it, its id, @username, or me for Saved Messages. |
link | required | the link, as chats links list shows it. |
Returns: chat invite change — operation_id, chat_id, link, approval, expires_at, max_uses, primary, revoked, and 2 more; every field: tg commands info chats links remove
Example: tg personal chats links remove "Book club" https://example.com/invite/book-club
tg chats links update
change one of your invite links, the group's own one too
Changes something in Telegram.
tg chats links update <chat> <link> [options]| Argument | Obligatoriedad | What it is |
|---|---|---|
chat | required | a chat: its title or part of it, its id, @username, or me for Saved Messages. |
link | required | the link, as chats links list shows it. |
| Option | What it does |
|---|---|
--approval | who joins by it asks first, and an admin lets them in; it then has no use limit. |
--no-approval | anyone with it joins at once. |
--expire-time <time> | it stops working then: 2026-09-25T09:00 (local time), or 30m, 2h, 7d from now; never takes the expiry away. |
--max-uses <n> | at most this many people join by it, 1 to 99999. |
Returns: chat invite change — operation_id, chat_id, link, approval, expires_at, max_uses, primary, revoked, and 2 more; every field: tg commands info chats links update
Example: tg personal chats links update "Book club" https://example.com/invite/book-club --max-uses 25
tg chats links reset
replace the invite link; the old one stops working
Changes something in Telegram.
tg chats links reset <chat>| Argument | Obligatoriedad | What it is |
|---|---|---|
chat | required | a chat: its title or part of it, its id, @username, or me for Saved Messages. |
Returns: chat group change — operation_id, chat, requested; every field: tg commands info chats links reset
Example: tg personal chats links reset "Book club"
tg chats requests
requests to join a group that needs an admin's approval
tg chats requests list
who asked to join, newest first; only admins see them, and reading tells nobody
tg chats requests list <chat> [query] [options]| Argument | Obligatoriedad | What it is |
|---|---|---|
chat | required | a chat: its title or part of it, its id, @username, or me for Saved Messages. |
query | optional | field:value terms that narrow the list — the fields are below. |
| Option | What it does |
|---|---|
--limit <n> | how many to show. |
--page <n> | which page, starting at 1. |
Returns: join request — person_id, name, username, requested_at, about; every field: tg commands info chats requests list
Example: tg personal chats requests list "Book club"
tg chats requests confirm
let them in; the group sees them join
Changes something in Telegram.
tg chats requests confirm <chat> [person] [options]| Argument | Obligatoriedad | What it is |
|---|---|---|
chat | required | a chat: its title or part of it, its id, @username, or me for Saved Messages. |
person | optional | who asked: an id from chats requests list. |
| Option | What it does |
|---|---|
--all | every pending request, counted against the hourly limit first. |
--link <link> | with --all: only the requests made by this invite link. |
Returns: chat request change — operation_id, chat_id, person_id, accepted, already, counted; every field: tg commands info chats requests confirm
Example: tg personal chats requests confirm "Book club" "Alex Example"
tg chats requests reject
turn the request away
Changes something in Telegram.
tg chats requests reject <chat> [person] [options]| Argument | Obligatoriedad | What it is |
|---|---|---|
chat | required | a chat: its title or part of it, its id, @username, or me for Saved Messages. |
person | optional | who asked: an id from chats requests list. |
| Option | What it does |
|---|---|
--all | decline every pending request; declining does not count toward the hourly sending limit. |
--link <link> | with --all: only the requests made by this invite link. |
Returns: chat request change — operation_id, chat_id, person_id, accepted, already, counted; every field: tg commands info chats requests reject
Example: tg personal chats requests reject "Book club" "Alex Example"
tg chats admins
give or take back a member's admin rights
tg chats admins add
make a member an admin with these rights
Changes something in Telegram.
tg chats admins add <chat> <person> [options]| Argument | Obligatoriedad | What it is |
|---|---|---|
chat | required | a chat: its title or part of it, its id, @username, or me for Saved Messages. |
person | required | an id, or part of a name. |
| Option | What it does |
|---|---|
--can <rights> | what they may do, comma-separated: members, admins, info, pin, link, post, edit, delete. |
Returns: chat admin change — operation_id, chat_id, person_id, rights; every field: tg commands info chats admins add
Example: tg personal chats admins add "Book club" "Alex Example" --can members
tg chats admins remove
take an admin's rights back; they stay a member
Changes something in Telegram.
tg chats admins remove <chat> <person>| Argument | Obligatoriedad | What it is |
|---|---|---|
chat | required | a chat: its title or part of it, its id, @username, or me for Saved Messages. |
person | required | an id, or part of a name. |
Returns: chat admin change — operation_id, chat_id, person_id, rights; every field: tg commands info chats admins remove
Example: tg personal chats admins remove "Book club" "Alex Example"
tg chats moderate
judge a group's new messages and members by its rules, and act as they allow
Changes something in Telegram.
tg chats moderate <chat> [options]| Argument | Obligatoriedad | What it is |
|---|---|---|
chat | required | a chat: its title or part of it, its id, @username, or me for Saved Messages. |
| Option | What it does |
|---|---|
--since-time <time> | judge what came after this ISO 8601 time, or 2h / 1d ago; the saved point stays. |
--dry-run | judge and plan; do nothing. |
--allow-dangerous | yes to every action whose level in the group's rules is ask. |
--max-actions <n> | at most this many actions in one run; 10 if not given. |
Returns: chat moderation — chat_id, rows; every field: tg commands info chats moderate
Example: tg personal chats moderate "Book club" --dry-run
tg chats pin
keep a chat at the top of your chat list; nobody in it is told
Changes something in Telegram.
tg chats pin <chat>| Argument | Obligatoriedad | What it is |
|---|---|---|
chat | required | a chat: its title or part of it, its id, @username, or me for Saved Messages. |
Returns: chat pin — operation_id, chat_id, pinned; every field: tg commands info chats pin
Example: tg personal chats pin 123456789
tg chats unpin
let a pinned chat move down the chat list again
Changes something in Telegram.
tg chats unpin <chat>| Argument | Obligatoriedad | What it is |
|---|---|---|
chat | required | a chat: its title or part of it, its id, @username, or me for Saved Messages. |
Returns: chat pin — operation_id, chat_id, pinned; every field: tg commands info chats unpin
Example: tg personal chats unpin 123456789
tg topics enable
enable forum topics; only the owner, with an explicit upgrade for a basic group
Changes something in Telegram.
tg topics enable <chat> [options]| Argument | Obligatoriedad | What it is |
|---|---|---|
chat | required | a chat: its title or part of it, its id, @username, or me for Saved Messages. |
| Option | What it does |
|---|---|
--upgrade | upgrade a basic group to a supergroup first; its chat id changes. |
Returns: enable forum topics; only the owner, with an explicit upgrade for a basic group
Example: tg personal topics enable Team
tg topics create
create a named topic in an existing forum; never enable or upgrade a group implicitly
Changes something in Telegram.
tg topics create <chat> <title> [options]| Argument | Obligatoriedad | What it is |
|---|---|---|
chat | required | a chat: its title or part of it, its id, @username, or me for Saved Messages. |
title | required | the topic title, at most 128 UTF-8 bytes. |
| Option | What it does |
|---|---|
--operation-id <id> | identify this creation attempt; an already sent or unknown id is refused. |
--emoji <emoji> | the topic's icon, one of topics icons list. |
Returns: create a named topic in an existing forum; never enable or upgrade a group…
Example: tg personal topics create Team "Weekly sync"
tg topics edit
rename, close, reopen or give an icon to a forum topic
Changes something in Telegram.
tg topics edit <chat> <topic> [options]| Argument | Obligatoriedad | What it is |
|---|---|---|
chat | required | a chat: its title or part of it, its id, @username, or me for Saved Messages. |
topic | required | the topic id, from topics list. |
| Option | What it does |
|---|---|
--title <title> | the new title, at most 128 UTF-8 bytes. |
--closed <on|off> | on closes the topic to new messages, off reopens it. |
--pinned <on|off> | on pins the topic at the top of the list, off unpins it. |
--hidden <on|off> | on hides the General topic from the topic list, off shows it. |
--emoji <emoji> | the topic's icon, one of topics icons list; none removes it. |
Returns: rename, close, reopen or give an icon to a forum topic
Example: tg personal topics edit Team General
tg topics delete
delete a forum topic and every message in it, for everyone; it cannot be undone
Changes something in Telegram.
tg topics delete <chat> <topic> [options]| Argument | Obligatoriedad | What it is |
|---|---|---|
chat | required | a chat: its title or part of it, its id, @username, or me for Saved Messages. |
topic | required | the topic id, from topics list. |
| Option | What it does |
|---|---|
--allow-dangerous | go ahead without the question an ask level puts before a deletion. |
Returns: delete a forum topic and every message in it, for everyone; it cannot be undone
Example: tg personal topics delete Team General
tg topics order
put the pinned topics in this order; it pins and unpins nothing
Changes something in Telegram.
tg topics order <chat> <topic>| Argument | Obligatoriedad | What it is |
|---|---|---|
chat | required | a chat: its title or part of it, its id, @username, or me for Saved Messages. |
topic | required | the pinned topics' ids, first to last. |
Returns: put the pinned topics in this order; it pins and unpins nothing
Example: tg personal topics order Team General
tg stats
statistics about messages, chats and their authors
tg stats messages
message statistics from the local store
tg stats messages show
how many stored messages match, by chat, sender, day or hour — the local store only; optionally fetches new messages with --sync-first
tg stats messages show [query] [options]| Argument | Obligatoriedad | What it is |
|---|---|---|
query | optional | a strict Lucene query, as for search messages; none counts every stored message; with --saved, more words AND-ed to it. |
| Option | What it does |
|---|---|
--sync-first | first fetch new messages within the chat, time and message bounds. |
--max-chats <n> | refresh at most this many chats (default: 5). |
--sync-time <duration> | stop fetching after this long (default: 30s). |
--max-messages <n> | fetch at most this many messages total (default: 500). |
--by <group> | count by chat, sender, day or hour (default: chat). |
--chat <chat> | only this chat — the same as chat: in the query; a chat: its title or part of it, its id, @username, or me for Saved Messages. |
--source <accounts> | every account of this messenger held in the store; personal, bots or all — the same as in: in the query. |
--limit <n> | how many rows. |
--timezone <zone> | the IANA timezone for calendar days and hours. |
--exact | bare words and quotes match their exact form only, as exact:word does; text: still matches every form. |
--saved <name|id> | count what a saved search or an earlier run matches; options typed here replace its own. |
Returns: message counts — by, total, rows; every field: tg commands info stats messages show
Example: tg personal stats messages show --chat "Book club" --by day
tg stats messages counters
per-counter observations and bounded remote refresh
tg stats messages counters show
show saved counter values and their observation freshness
tg stats messages counters show [query] [options]| Argument | Obligatoriedad | What it is |
|---|---|---|
query | optional | strict Lucene query over stored messages. |
| Option | What it does |
|---|---|
--chat <chat> | only this chat; a chat: its title or part of it, its id, @username, or me for Saved Messages. |
--source <accounts> | held accounts of this messenger; refresh uses the active account. |
--exact | bare words match exact forms. |
--timezone <zone> | IANA timezone for query dates. |
--selection <json> | pinned counter-targets selection from counters show; conflicts with query and scope. |
--counters <names> | distinct views,reactions,comments fields; all three by default. |
--limit <n> | messages, 1–100; 20 by default. |
--max-age <duration> | maximum fresh observation age; 24h by default. |
Returns: counters — cutoff, max_age_ms, selection, rows; every field: tg commands info stats messages counters show
Example: tg personal stats messages counters show --chat "Book club" --limit 10
tg stats messages counters sync
read authoritative counters for bounded messages and update their local observations
Changes something on this computer only.
tg stats messages counters sync [query] [options]| Argument | Obligatoriedad | What it is |
|---|---|---|
query | optional | strict Lucene query over stored messages. |
| Option | What it does |
|---|---|
--chat <chat> | only this chat; a chat: its title or part of it, its id, @username, or me for Saved Messages. |
--source <accounts> | held accounts of this messenger; refresh uses the active account. |
--exact | bare words match exact forms. |
--timezone <zone> | IANA timezone for query dates. |
--selection <json> | pinned counter-targets selection from counters show; conflicts with query and scope. |
--counters <names> | distinct views,reactions,comments fields; all three by default. |
--limit <n> | messages, 1–100; 20 by default. |
--max-messages <n> | maximum messages to refresh, 1–100. |
--sync-time <duration> | remote refresh budget; 30s by default, maximum 5m. |
--dry-run | preview exact stored targets and counter capabilities without connecting. |
Returns: counter refresh — dry_run, targets, counters, supported, unsupported, max_messages, time_ms, results, and 2 more; every field: tg commands info stats messages counters sync
Example: tg personal stats messages counters sync --chat "Book club" --dry-run
tg stats messages unanswered
oldest detected questions without an observed qualifying explicit reply
tg stats messages unanswered [query] [options]| Argument | Obligatoriedad | What it is |
|---|---|---|
query | optional | a strict Lucene query; none selects every stored message. |
| Option | What it does |
|---|---|
--source <accounts> | every held account of this messenger; personal, bots or all. |
--saved <name|id> | run a saved report of this kind; typed report options replace stored options. |
--timezone <zone> | the IANA timezone for calendar date boundaries. |
--limit <n> | report rows, 1–100; 20 if not given. |
--answerer <person> | stored name, alias, @username, ID or person:provider/account/id; ambiguous names require a choice; repeat for more. |
Returns: admin report — report, cutoff, total, summary, quality, rows; every field: tg commands info stats messages unanswered
Example: tg personal stats messages unanswered chat:"Project room"
tg stats messages discussion
viewed posts with little recorded discussion
tg stats messages discussion [query] [options]| Argument | Obligatoriedad | What it is |
|---|---|---|
query | optional | a strict Lucene query; none selects every stored message. |
| Option | What it does |
|---|---|
--source <accounts> | every held account of this messenger; personal, bots or all. |
--saved <name|id> | run a saved report of this kind; typed report options replace stored options. |
--timezone <zone> | the IANA timezone for calendar date boundaries. |
--limit <n> | report rows, 1–100; 20 if not given. |
Returns: admin report — report, cutoff, total, summary, quality, rows; every field: tg commands info stats messages discussion
Example: tg personal stats messages discussion chat:"Book club"
tg stats messages responses
how long the owner took to answer (--who me), or the other side took to answer the owner (--who others), in one-to-one chats — the local store only. Several messages in a row followed by one answer count as one reply, timed from the first unanswered message; the day of a row is the day of the reply
tg stats messages responses [query] [options]| Argument | Obligatoriedad | What it is |
|---|---|---|
query | optional | date:, chat:, kind: and muted: terms, AND-ed — date>=30d, date:[60d TO 30d], muted:false; none reads all time. |
| Option | What it does |
|---|---|
--who <side> | whose replies: the owner's or the other side's. One of: me, others. |
--by <group> | one row per calendar day of the reply, or none. One of: day, total. |
--timezone <zone> | the IANA timezone for calendar days and date: bounds. |
--source <accounts> | every account of this messenger held in the store; personal, bots or all. |
Returns: response times — who, replies, median_ms, p90_ms, mean_ms, buckets, rows; every field: tg commands info stats messages responses
Example: tg personal stats messages responses --who me --by day --timezone Europe/Madrid -- date>=30d
tg stats messages waiting
how many chats wait on the owner — the local store only: a one-to-one chat whose newest message is a question, or a group whose newest message mentions the owner or replies to them. Muted or archived one-to-one chats are left out, as inbox leaves them out; date: bounds the newest message's time
tg stats messages waiting [query] [options]| Argument | Obligatoriedad | What it is |
|---|---|---|
query | optional | date:, chat:, kind: and muted: terms, AND-ed — date>=30d, date:[60d TO 30d], muted:false; none reads all time. |
| Option | What it does |
|---|---|
--timezone <zone> | the IANA timezone for date: bounds. |
--source <accounts> | every account of this messenger held in the store; personal, bots or all. |
Returns: waiting chats — chats, messages, oldest_at, by_kind; every field: tg commands info stats messages waiting
Example: tg personal stats messages waiting kind:private
tg stats messages top
rank stored messages by a measure or explainable score; counters are snapshots with per-field observation freshness
tg stats messages top [query] [options]| Argument | Obligatoriedad | What it is |
|---|---|---|
query | optional | a strict Lucene query; none selects every stored message. |
| Option | What it does |
|---|---|
--sync-first | first fetch new messages within the chat, time and message bounds. |
--max-chats <n> | refresh at most this many chats (default: 5). |
--sync-time <duration> | stop fetching after this long (default: 30s). |
--max-messages <n> | fetch at most this many messages total (default: 500). |
--measure <name> | the ranking metric; not with score or weights. One of: views, reactions, forwards, comments, replies, thread-size. |
--score <preset> | helpful/active for authors; engaging for either target. One of: helpful, active, engaging. |
--weights <json> | the complete component weights; replaces preset weights. |
--source <accounts> | every held account of this messenger; personal, bots or all. |
--timezone <zone> | the IANA timezone for dates and active days. |
--limit <n> | ranked rows, 1–100. |
--saved <name|id> | run a saved query or ranking run; typed options replace stored options. |
Returns: ranking — target, measure, order, preset, weights, min_messages, message_kind, total, and 7 more; every field: tg commands info stats messages top
Example: tg personal stats messages top chat:"Book club" --limit 10
tg stats messages evidence
bounded messages, answer pairs or retention members from an exact drilldown selection
tg stats messages evidence <message> [options]| Argument | Obligatoriedad | What it is |
|---|---|---|
message | required | the canonical message locator, or retention cohort reference, from drilldown. |
| Option | What it does |
|---|---|
--selection <json> | the resolved ranking selection returned in drilldown. |
--component <name> | the exposed ranking component. |
--limit <n> | evidence rows, 1–100; 20 if not given. |
--cursor <cursor> | continue the same component and stored-evidence fingerprint. |
Returns: evidence — message, contribution, related, counters, person_ref, joined_at, cohort, checkpoints, and 2 more; every field: tg commands info stats messages evidence
Example: tg personal stats messages evidence "$message" --selection "$selection" --component reactions
tg stats contacts
statistics about human authors
tg stats contacts responses
counts and median/p90 latency for selected human answering identities
tg stats contacts responses [query] [options]| Argument | Obligatoriedad | What it is |
|---|---|---|
query | optional | a strict Lucene query; none selects every stored message. |
| Option | What it does |
|---|---|
--source <accounts> | every held account of this messenger; personal, bots or all. |
--saved <name|id> | run a saved report of this kind; typed report options replace stored options. |
--timezone <zone> | the IANA timezone for calendar date boundaries. |
--limit <n> | report rows, 1–100; 20 if not given. |
--answerer <person> | stored name, alias, @username, ID or person:provider/account/id; ambiguous names require a choice; repeat for more. |
Returns: admin report — report, cutoff, total, summary, quality, rows; every field: tg commands info stats contacts responses
Example: tg personal stats contacts responses chat:"Project room"
tg stats contacts top
rank the human authors of stored messages by a measure or explainable score; counters are snapshots with per-field observation freshness
tg stats contacts top [query] [options]| Argument | Obligatoriedad | What it is |
|---|---|---|
query | optional | a strict Lucene query; none selects every stored message. |
| Option | What it does |
|---|---|
--sync-first | first fetch new messages within the chat, time and message bounds. |
--max-chats <n> | refresh at most this many chats (default: 5). |
--sync-time <duration> | stop fetching after this long (default: 30s). |
--max-messages <n> | fetch at most this many messages total (default: 500). |
--measure <name> | the ranking metric; not with score or weights. One of: messages, words, reactions, replies, answers, answer-time, threads, active-days. |
--score <preset> | helpful/active for authors; engaging for either target. One of: helpful, active, engaging. |
--weights <json> | the complete component weights; replaces preset weights. |
--source <accounts> | every held account of this messenger; personal, bots or all. |
--timezone <zone> | the IANA timezone for dates and active days. |
--limit <n> | ranked rows, 1–100. |
--saved <name|id> | run a saved query or ranking run; typed options replace stored options. |
Returns: ranking — target, measure, order, preset, weights, min_messages, message_kind, total, and 7 more; every field: tg commands info stats contacts top
Example: tg personal stats contacts top chat:"Book club" --limit 10
tg stats contacts evidence
bounded messages, answer pairs or retention members from an exact drilldown selection
tg stats contacts evidence <person> [options]| Argument | Obligatoriedad | What it is |
|---|---|---|
person | required | the exact native person id from the ranking row. |
| Option | What it does |
|---|---|
--selection <json> | the resolved ranking selection returned in drilldown. |
--component <name> | the exposed ranking component. |
--limit <n> | evidence rows, 1–100; 20 if not given. |
--cursor <cursor> | continue the same component and stored-evidence fingerprint. |
Returns: evidence — message, contribution, related, counters, person_ref, joined_at, cohort, checkpoints, and 2 more; every field: tg commands info stats contacts evidence
Example: tg personal stats contacts evidence 101 --selection "$selection" --component messages
tg stats chats
statistics about one chat
tg stats chats show
a group's or channel's numbers for a period: messages, active members, replies, reactions, questions answered, joins and leaves — counted from the local store; joins and leaves are asked of the messenger
tg stats chats show <chat> [options]| Argument | Obligatoriedad | What it is |
|---|---|---|
chat | required | a chat: its title or part of it, its id, @username, or me for Saved Messages. |
| Option | What it does |
|---|---|
--since-time <time> | ISO 8601, or 2h / 1d ago; 7 days ago if not given. |
--by <group> | also one row per calendar day or week (weeks start on Monday). |
--timezone <zone> | the IANA timezone for calendar days. |
Returns: chat stats — chat, since, until, complete, completeness, messages, senders, replies, and 10 more; every field: tg commands info stats chats show
Example: tg personal stats chats show "Book club"
tg stats chats newcomers
known-join members and their help within a join window
tg stats chats newcomers <chat> [options]| Argument | Obligatoriedad | What it is |
|---|---|---|
chat | required | a chat: its title or part of it, its id, @username, or me for Saved Messages. |
| Option | What it does |
|---|---|
--since-time <time> | from this ISO 8601 time, or 2h / 1d ago; 30d ago if not given. |
--until-time <time> | through this ISO 8601 time, or 2h / 1d ago. |
--within <duration> | the help window after a known newcomer join. |
--saved <name|id> | run a saved report of this kind; typed report options replace stored options. |
--timezone <zone> | the IANA timezone for calendar date boundaries. |
--limit <n> | report rows, 1–100; 20 if not given. |
--answerer <person> | stored name, alias, @username, ID or person:provider/account/id; ambiguous names require a choice; repeat for more. |
Returns: admin report — report, cutoff, total, summary, quality, rows; every field: tg commands info stats chats newcomers
Example: tg personal stats chats newcomers "Book club"
tg stats chats retention
joining cohorts and observed checkpoint membership from saved roster observations
tg stats chats retention <chat> [options]| Argument | Obligatoriedad | What it is |
|---|---|---|
chat | required | a chat: its title or part of it, its id, @username, or me for Saved Messages. |
| Option | What it does |
|---|---|
--since-time <time> | joining period starts at ISO 8601 or a relative time; last 90 days by default. |
--until-time <time> | joining period ends at this time; now by default. |
--checkpoints <durations> | up to 10 increasing joining ages, comma separated; 1d,7d,30d by default. |
--within <duration> | activity and early departure window after joining; 7d by default. |
--by <group> | group joining dates by calendar day or Monday week. One of: day, week. |
--timezone <zone> | IANA timezone for joining cohorts. |
--limit <n> | cohorts and member evidence, 1–100. |
Returns: retention — chat_ref, cutoff, since, until, checkpoints_ms, within_ms, by, timezone, and 5 more; every field: tg commands info stats chats retention
Example: tg personal stats chats retention "Book club"
tg stats chats official
what Telegram itself computed for a group or channel you administer: totals against the previous period, top people and every graph as JSON series; the messenger picks the period
tg stats chats official <chat>| Argument | Obligatoriedad | What it is |
|---|---|---|
chat | required | a chat: its title or part of it, its id, @username, or me for Saved Messages. |
Returns: official stats — chat_id, title, kind, since, until, totals, graphs, top, and 2 more; every field: tg commands info stats chats official
Example: tg personal stats chats official Team
tg stats tasks
task statistics
tg stats tasks show
tasks per chat, meeting or project: open now, and opened and closed in the period (created: in the query), with the median time to close and the mean age of the open ones
tg stats tasks show [query] [options]| Argument | Obligatoriedad | What it is |
|---|---|---|
query | optional | field:value terms that narrow the list — the fields are below. |
| Option | What it does |
|---|---|
--by <group> | chat (default) or meeting: this account's tasks; project: the owner's project tasks, every project. |
--chat <chat> | only this chat; a chat: its title or part of it, its id, @username, or me for Saved Messages. |
--type <type> | only this type: question, request, mention or promise. |
--timezone <zone> | the IANA timezone for calendar days in the period, such as created>=today. |
Returns: task — ref, id, title, kind, state, created_at, key, description, and 26 more; every field: tg commands info stats tasks show
Next usually: tg tasks show <task>, tg tasks related <task>, tg tasks update <task>
Example: tg personal stats tasks show --chat "Project room"
tg stats charts
a chart's data from a chat's statistics, and optionally a dark SVG or PNG image
Changes something on this computer only.
tg stats charts <chat> [options]| Argument | Obligatoriedad | What it is |
|---|---|---|
chat | required | a chat: its title or part of it, its id, @username, or me for Saved Messages. |
| Option | What it does |
|---|---|
--chart-kind <messages|active|membership> | what to draw: messages, active authors, or joins and leaves. Default: messages. |
--by <group> | one point per calendar day or week (weeks start on Monday). Default: day. |
--since-time <time> | ISO 8601, or 2h / 1d ago; 7 days ago if not given. |
--timezone <zone> | the IANA timezone for calendar days. |
--output <file> | write a dark image to a new .svg or .png file. |
Returns: chart — version, kind, title, x, series, unit, timezone, partial, and 2 more; every field: tg commands info stats charts
Example: tg personal stats charts "Book club" --output ./activity.svg
Exit codes
Branch on the code, not on the text: the text can change, the code does not.
| Code | When |
|---|---|
0 | it worked |
2 | validation_error |
3 | configuration_error |
4 | authentication_error |
5 | permission_error |
6 | not_found |
7 | confirmation_required |
8 | rate_limited |
9 | timeout |
10 | network_error |
11 | provider_error |
12 | provider_unavailable |
13 | invalid_response |
14 | outcome_unknown |
15 | conflict |
130 | cancelled |
1 | anything else |
0 and only 0 means the operation was done. 14 (outcome_unknown) means a message may
have gone: repeat it only with the same --operation-id, which Telegram uses to drop a second copy.