diff options
| author | Danilo M. <danix@danix.xyz> | 2026-07-31 09:00:21 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-07-31 09:00:21 +0200 |
| commit | 2a52cb81744a55251dfd05cc1b2c4ee8dd311ebe (patch) | |
| tree | fa6e795cef14eb0df14950ed934f3a266cd108bb /README.md | |
| parent | bc909d9886e0c679fec1589734199de8873f9469 (diff) | |
| download | tg_backup-2a52cb81744a55251dfd05cc1b2c4ee8dd311ebe.tar.gz tg_backup-2a52cb81744a55251dfd05cc1b2c4ee8dd311ebe.zip | |
feat: refuse to back up a different chat into an existing archive dir
last_id is a high-water mark for one specific chat. Applied as min_id to
a different one it silently skips that chat's history and the run still
reports success. Compare the requested target against the one saved in
state.json and exit before any network work when they differ.
The comparison is textual, ignoring case and a leading @; resolving a
username to its numeric ID would need a logged-in client, so switching
between the two forms of the same chat also refuses. --force-target
overrides and keeps the existing resume position.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -66,7 +66,9 @@ Update it later with just the directory: tg_backup.py --archive-dir ~/backups/examplegroup ``` -The target is recorded in the archive directory on the first run, so repeat runs do not need it. Passing `--target` again still overrides what was saved. Point a directory at a different chat and the resume position carries over, which will skip that chat's history; use a fresh directory instead. +The target is recorded in the archive directory on the first run, so repeat runs do not need it. Passing the same `--target` again is fine; the `@` and letter case do not have to match. + +Passing a *different* one is refused, because the directory's resume position belongs to the old chat and would skip the new chat's history. Use one directory per chat. If a chat genuinely changed handle or ID, `--force-target` accepts the new target and keeps the resume position. Switching between a chat's `@username` and its numeric ID also trips this, as the two cannot be compared without resolving them first. ### Options @@ -75,6 +77,7 @@ The target is recorded in the archive directory on the first run, so repeat runs | `--target` | first run only | Chat to back up: `@username`, numeric ID, t.me link, or `me`. Reused from the archive directory afterwards | | `--archive-dir` | `./tg_archive` | Where media and resume state are written; created if missing | | `--list-chats` | | Print your dialogs with IDs and usernames, then exit | +| `--force-target` | | Accept a `--target` that differs from the one saved in the archive directory | | `--self-check` | | Run internal assertions and exit. No network, no login | Use one archive directory per chat. Prefer absolute paths: the default is relative to the current directory, so running from elsewhere silently starts a second archive. |
