Pronouns labels on Bluesky
1import { AppBskyFeedLike } from "@atproto/api";
2import { Firehose } from "@skyware/firehose";
3import { did, getAgent } from "./agent.js";
4import { label } from "./label.js";
5
6const subscribe = async () => {
7 const agent = await getAgent();
8
9 const firehose = new Firehose();
10 firehose.on("commit", (commit) => {
11 for (const op of commit.ops) {
12 if (op.action === "delete") continue;
13 if (AppBskyFeedLike.isRecord(op.record)) {
14 if (op.record.subject.uri.includes(did)) {
15 if (op.record.subject.uri.includes("app.bsky.feed.post")) {
16 label(agent, commit.repo, op.record.subject.uri).catch((err) =>
17 console.error(err),
18 );
19 }
20 }
21 }
22 }
23 });
24
25 firehose.start();
26};
27
28subscribe();