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