mirror of
https://github.com/tiennm99/tiennm99bot.git
synced 2026-10-11 03:13:46 +00:00
chore(sticker): drop the retired per-user pack records at startup
The module stores nothing: /addsticker takes its pack from STICKER_PACK_NAME and the set owner from OWNER_ID, and the factory ignores the collection it is handed. Everything still in the sticker collection is therefore unreachable by any code path — pack documents keyed by owner ID, "slug:" name reservations and "pending-delete:" confirmations, all orphaned when the per-user commands were removed. InitStore lists and deletes them once per database, guarded by a systemstate marker in the same shape as the stock and stats migrations. It aborts without writing the marker so a partial run retries on the next boot, and deletes are idempotent. A collection that is already empty is the normal case on a fresh deploy and on the memory backend. This permanently removes data. Back up the sticker collection before the first deploy that carries it.
This commit is contained in:
1 parent
be91d2eb41
commit
b903d14fc2
4 files changed
+262
No files matched your search
@@ -4,6 +4,15 @@
|
||||
bot contributes to. It is the whole of the `sticker` module — one command, no
|
||||
storage, and no per-user packs.
|
||||
|
||||
**The module stores nothing.** Its factory ignores the collection it is handed:
|
||||
the pack comes from the environment and the set owner from `OWNER_ID`, so there
|
||||
is nothing per-user to key. A one-time startup cleanup
|
||||
(`migration:sticker-drop-legacy-packs-v1`) removes the records the retired
|
||||
per-user pack commands left in the `sticker` collection — pack documents keyed
|
||||
by owner ID, `slug:` name reservations, and `pending-delete:` confirmations.
|
||||
It is marker-guarded, so it scans once per database and never touches anything
|
||||
written afterwards.
|
||||
|
||||
| Command | Parameters | Reply to | What it does |
|
||||
|---|---|---|---|
|
||||
| `/addsticker` | `[emoji...]` | sticker, photo, or image document | Adds it to the shared pack and replies with the link |
|
||||
|
||||
Reference in new issue
Block a user