better-tg-cli 0.20.0 → 0.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +56 -6
- package/README.ru.md +165 -0
- package/SKILL.md +2 -1
- package/dist/telegram.mjs +1 -1
- package/package.json +2 -1
- package/reference.md +28 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "better-tg-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.22.0",
|
|
4
4
|
"description": "Unofficial agent-friendly Telegram client for the command line (MTProto, layer 229)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/telegram.mjs",
|
|
@@ -47,6 +47,7 @@
|
|
|
47
47
|
"teleproto": "^1.229.0",
|
|
48
48
|
"tsx": "^4.23.15",
|
|
49
49
|
"typescript": "npm:@typescript/typescript6@^6.0.2",
|
|
50
|
+
"uqr": "^0.1.3",
|
|
50
51
|
"vitest": "^5.0.2"
|
|
51
52
|
},
|
|
52
53
|
"engines": {
|
package/reference.md
CHANGED
|
@@ -102,6 +102,27 @@ Buttons that need 2FA take `--password`. `--no-wait` skips waiting for the bot's
|
|
|
102
102
|
- `sync --resume` is incremental. Checkpoints are per chat ID in `DIR/.sync-meta.json`. A resumed
|
|
103
103
|
run fetches everything after the checkpoint and ignores the default `--days` window.
|
|
104
104
|
|
|
105
|
+
## MCP server (`telegram mcp`)
|
|
106
|
+
|
|
107
|
+
- **Tools:**
|
|
108
|
+
- `telegram_help {grep?}`;
|
|
109
|
+
- `telegram_read {args}`, marked `readOnlyHint`;
|
|
110
|
+
- `telegram_write {args, stdin?}`, marked `destructiveHint`.
|
|
111
|
+
|
|
112
|
+
`args` is the CLI argv with the command first, for example `["read","@x","-n","20"]`. `stdin`
|
|
113
|
+
fills a `-` text argument.
|
|
114
|
+
- **What runs where:**
|
|
115
|
+
- Read tool: only the read commands.
|
|
116
|
+
- Write tool: everything that changes the account or writes local files (`download`, `sync`,
|
|
117
|
+
`avatar`).
|
|
118
|
+
- Never over MCP: `auth`, `logout`, `transfer-owner`, `update`, and changing `write-access`.
|
|
119
|
+
Showing its status is allowed.
|
|
120
|
+
- **Safety:** the read tool runs with `TG_READ_ONLY=1`, which blocks every guarded write even if a
|
|
121
|
+
command were misclassified.
|
|
122
|
+
- **Execution:** each call is a separate CLI process with no stdin. Calls run one at a time, time
|
|
123
|
+
out after 120 s, and output is capped at 100 KB. `watch` needs `-t` or `-n`.
|
|
124
|
+
- **Protocol:** MCP 2025-11-25 with the `initialize` handshake. Newer clients fall back to it.
|
|
125
|
+
|
|
105
126
|
## Chat identifiers
|
|
106
127
|
|
|
107
128
|
`me` / `self` / `saved` / `Saved Messages` / `Избранное` → your Saved Messages. A numeric ID must
|
|
@@ -116,8 +137,9 @@ matches titles.
|
|
|
116
137
|
## Troubleshooting
|
|
117
138
|
|
|
118
139
|
- `Not configured`: the user must log in themselves with `telegram auth` (their own keys from
|
|
119
|
-
my.telegram.org) or `telegram auth --invite` (a token from the maintainer). It is interactive
|
|
120
|
-
it
|
|
140
|
+
my.telegram.org) or `telegram auth --invite` (a token from the maintainer). It is interactive,
|
|
141
|
+
so never run it for them. `--qr` logs in by scanning a QR code in the Telegram app instead of
|
|
142
|
+
typing a code (`TG_QR_INVERT=1` for light terminals).
|
|
121
143
|
|
|
122
144
|
- `command not found: telegram`: run `brew install thevilfer/tap/better-tg-cli` or `npm install -g better-tg-cli`, or build this folder (`npm install && npm run build && npm install -g .`, needs Bun)
|
|
123
145
|
`telegram update` upgrades an existing install (brew, npm or git checkout); `update --check` only reports.
|
|
@@ -125,6 +147,10 @@ matches titles.
|
|
|
125
147
|
as `(no text)`.
|
|
126
148
|
- `Write access is disabled`: the account is read-only on purpose, or a `--for` window expired. Ask
|
|
127
149
|
the user, then run `telegram write-access on --for 1h`; they confirm it in a dialog.
|
|
150
|
+
- `FLOOD_WAIT` (rate limit): waits of up to 60 s are retried automatically, and stderr says
|
|
151
|
+
`Telegram rate limit on <method>: waiting Ns`. Longer waits fail with the wait in the error
|
|
152
|
+
message. `TG_FLOOD_WAIT_MAX=<seconds>` changes the limit: `0` fails fast, a larger value suits
|
|
153
|
+
long `sync` runs. Don't retry in a loop, because Telegram extends the ban.
|
|
128
154
|
- `CHANNELS_TOO_MUCH` on `join`: the account hit Telegram's channel limit, so leave some first.
|
|
129
155
|
- `Could not find the input entity`: the ID is not in your dialogs. Use `@username` or open the
|
|
130
156
|
chat first.
|