bsky follow audit script
1import { AtpAgent } from "@atproto/api";
2import { BSKY_APP_PASSWORD, BSKY_USERNAME, PDS_URL } from "./constants";
3
4const agent = new AtpAgent({
5 service: PDS_URL,
6});
7
8await agent.login({
9 identifier: BSKY_USERNAME,
10 password: BSKY_APP_PASSWORD,
11});
12
13const file = Bun.file("follows.json");
14
15const unfollows = (await file.json()) as {
16 did: string;
17 lastPost: number;
18 uri: string;
19}[];
20
21for (const [index, unfollow] of unfollows.entries()) {
22 if (unfollow.lastPost === -1 || unfollow.uri === "") {
23 // will figure something out later for this
24 continue;
25 }
26
27 console.clear();
28 console.info(
29 `unfollowing ${unfollow.did} [${index + 1} / ${unfollows.length}]`,
30 );
31 await agent.deleteFollow(unfollow.uri);
32}