Pronouns labels on Bluesky

move agent to main

Changed files
+7 -7
src
+2 -4
src/label.ts
···
-
import { did, getAgent } from "./agent.js";
+
import { did } from "./agent.js";
import { AppBskyFeedPost, BskyAgent } from "@atproto/api";
import { PRONOUNS } from "./constants.js";
···
});
};
-
export const label = async (subject: string, uri: string) => {
-
const agent = await getAgent();
-
+
export const label = async (agent: BskyAgent, subject: string, uri: string) => {
const repo = await agent
.withProxy("atproto_labeler", did)
.api.tools.ozone.moderation.getRepo({ did: subject });
+5 -3
src/main.ts
···
import { AppBskyFeedLike } from "@atproto/api";
import { Firehose } from "@skyware/firehose";
-
import { did } from "./agent.js";
+
import { did, getAgent } from "./agent.js";
import { label } from "./label.js";
const subscribe = async () => {
+
const agent = await getAgent();
+
const firehose = new Firehose();
firehose.on("commit", (commit) => {
for (const op of commit.ops) {
···
if (AppBskyFeedLike.isRecord(op.record)) {
if (op.record.subject.uri.includes(did)) {
if (op.record.subject.uri.includes("app.bsky.feed.post")) {
-
label(commit.repo, op.record.subject.uri).catch((err) =>
-
console.error(err.message),
+
label(agent, commit.repo, op.record.subject.uri).catch((err) =>
+
console.error(err),
);
}
}