Added
- Every error says whether running the same command again can work:
error.retryableis
trueforRATE_LIMITED,NETWORK_ERROR, a media download that waited too long for
another tg process and atg apicall Telegram failed on its side (500 or -503),false
otherwise (#160). Nothing else in the error schema changes. RATE_LIMITEDcarries the suggestionWait <n>s, then run the same command again(for a
media download, "… to resume the download"), with the wait indetails.wait_secondsas
before, from every command:tg api,tg send,tg chats,tg contacts,tg user,
tg messagesandtg media download.ACCOUNT_NOT_FOUNDsuggeststg accounts listand the flag to pass the account to
(--account, or--idfortg accounts switch,removeandinfo).tg send --towith a
user ID Telegram refuses (PEER_ID_INVALID) suggests sending to the user's@usernameor
+phoneonce, so tg caches the user.nextin success answers: a list of{ command, why }besidedata, wherecommandis a
completetgcommand line that runs as written in a POSIX shell andwhysays what it does
(#160). A paged read that has more suggests its next page with the account and every filter
it was given:tg messages list(older pages, or newer ones after--after),
tg messages search,tg chats list,tg contacts list, andtg messages wait --chat,
which suggests waiting on from the last message it returned.tg chats searchwith no
result suggeststg chats list --fresh, then the same search, where before the command was
only inmessage. An answer with nothing to suggest has nonext, and every existing field
(message,nextBefore,nextAfter,hasMore,offset) is unchanged.--format pretty
prints the suggestions on stderr, so stdout stays the data's JSON;--quietprints nothing.
Changed
- The
datafields oftg chats listare declared once, in
src/commands/chats/list-output.ts: the command's types come from it, the field table in
docs/cli-commands.md is generated from it (bun run docs:outputs), and
an e2e test fails when the command prints a field the declaration doesn't have (#160, a trial
on one command). The output doesn't change. zod is a devDependency and doesn't ship.
Fixed
tg messages list,get,search,unread,waitandwatchshow the content of a rich
message: one whose content is page blocks (headings, tables, lists, quotations, code,
formulas, footnotes, media) instead of a text. It printed astext: null, so an agent saw an
empty message where a table or a whole report was sent, and search could not find it. Its
textis now the blocks in Telegram's rich Markdown (#headings, pipe tables,- [x]task
lists,$$…$$formulas,[^1]footnotes, HTML tags such as<details>where Markdown has
none), with a placeholder for media, maps and buttons ([photo: caption]).messageType
staystext. The text is cached, so search matches any word of it, a table cell's too.
Messages cached by older versions print it fromraw_jsonat once, and a background
migration (messages_rich_text) makes them searchable.