Added
- An agent skill,
skills/telegram-sync-cli/SKILL.md: when to usetg, finding chats and
messages, counting and reading whole chats with onetg sqlquery and checking that the
cache covers the chat, confirming beforetg send, the error schema and the exit codes.
Install it withbunx skills add neoromantic/telegram-sync-clior
tg skill install --dir <skills dir>, which writes the same file fromtgitself. A test
runs every command in its examples against made-up data and checks the answers of its SQL. tg skill validatereports the account record the next command uses without--account
(account,accounts_total):activeAccountinconfig.json, else the active account,
else the only one. It also reports whether a live process holdsdaemon.pid
(daemon: { status, pid }). Neither checks that the session is authorized or online. No
account, several and none active, or an invalidconfig.jsonis an issue. Each value is
read on its own: one that can't be read isnull(accounts_total) orunknown
(daemon.status), with the reason, and the others stay accurate.tg send --markdownand--htmlsend rich messages such as headings and tables on
supported accounts. The result includesformat. File captions stay plain text.
Changed
-
tgstarts about five times faster for every command that answers from the cache, and for
--helpand--version: it loads the Telegram client library only when a command calls
Telegram (0.1 s of CPU instead of 0.5 s on a source install). -
A group (basic group or supergroup) adds new messages to the cache only while you take part
in it: you sent an ordinary message there in the last 90 days. Reading a group doesn't count.
The rule holds in everytg chats syncmode and intg messages list/get,--fresh
included (which still return Telegram's page). Messages already cached stay; private chats
and channels are unchanged. After each dialog pass the daemon asks Telegram once per group
for your newest message of the last 90 days, at the lowest priority. Your next message in a
group, from any device or withtg send, turns it back on; the messages of the pause aren't
fetched later.tg chats listandtg chats syncshow such a group withsyncEnabled: false,
the reasongroup_participation_requiredorgroup_participation_unknownand
lastOwnMessageAt, andtg statusleaves it out of the chats with sync on and of the history
progress. See docs/sync-strategy.md. -
Breaking:
tg skillinstalls only the Markdown skill. tg 0.14.0 and older wrote
<dataDir>/skill.jsonthere and ignored--dir. Now:tg skill manifestis removed;tg skill installneeds--dir, the agent's skills directory, and rejects an empty one;- it writes
<dir>/telegram-sync-cli/SKILL.mdinstead of<dataDir>/skill.json,
replacing a file already there, local edits included, and refusing a symbolic link for
telegram-sync-cliorSKILL.md(the skills directory itself may be one); - its JSON drops
data.manifestand keepspath,bytesandoverwritten.
Replace
tg skill installwith:tg skill install --dir ~/.claude/skills -
Breaking:
tg skill validatereports a missing account as an issue, so before
tg auth loginit printsvalid: false, still with exit 0. tg 0.14.0 and older checked only
the credentials and the data directory. -
Breaking:
src/db/index.tsno longer exportsdb, the opendata.dbconnection. Code
that imports it from the package source callsgetDataDb(), which opensdata.dbon first
use.
Fixed
tg skill installandtg skill validatework with a corruptdata.db, which stopped every
command with a SQLite stack trace before it started:data.dbnow opens when a command first
reads an account. Install writes the skill, and validate names the file as an issue.- A command acts on the chat and account it checked against
allowedChats: the check pins the account and hands its resolved chat to the command, so a
switch of the active account or a second lookup in between can't move it (#217). - A flag a command doesn't declare (
--acount 2) and a value after a boolean flag
(--silent false, which ran as--silent) areINVALID_ARGSinstead of being ignored (#217). - A Telegram call that succeeded is no longer reported as failed when tg can't write it to its
localapi_activitylog, so a retry doesn't repeat a send (#217). - The npm package declares
long, which tg imports directly. Until now it only arrived
through@mtcute/core, so an install that doesn't hoist transitive dependencies could fail
to start. tg auth login --phoneworks for a user who already has an account under another phone,
such as theuser:<id>account of a QR login or a number they have since changed (#213).
The phone moves to that account, which keeps its cache. Until now the login failed with
UNIQUE constraint failed: accounts.phoneand left a second account behind.- A login of a user who already has an account under another phone or a QR login gives that
account the new session. Until now the account kept its old session, so after the old
session was ended in Telegram the login succeeded but the account stayed signed out.