feat: přidán --init mode, --dry-run, filtr created_at

This commit is contained in:
2026-04-04 14:48:57 +02:00
parent 3f8e184499
commit 64731e6b90
2 changed files with 23 additions and 1 deletions
+22
View File
@@ -86,8 +86,30 @@ def save_welcomed(welcomed):
parser = argparse.ArgumentParser()
parser.add_argument("--dry-run", action="store_true", help="Pouze vypíše co by se stalo, nic neodesílá")
parser.add_argument("--init", action="store_true", help="Stáhne všechny existující účty a uloží jejich ID do welcomed.json bez odesílání tootů")
args = parser.parse_args()
# --- --init: označit všechny existující účty jako uvítané ---
if args.init:
all_ids = set()
max_id = None
while True:
params = "limit=80"
if max_id is not None:
params += f"&max_id={max_id}"
page = api_get(f"/api/v1/admin/accounts?{params}", ADMIN_TOKEN)
if not page:
break
for account in page:
all_ids.add(account["id"])
max_id = page[-1]["id"]
print(f"[INIT] Načteno celkem {len(all_ids)} účtů...", end="\r")
print()
save_welcomed(all_ids)
print(f"[INIT] Hotovo uloženo {len(all_ids)} ID do welcomed.json")
raise SystemExit(0)
# --- Hlavní logika ---
accounts = api_get("/api/v1/admin/accounts?order=newest&limit=20", ADMIN_TOKEN)