this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

move agent to main

+7 -7
+2 -4
src/label.ts
··· 1 - import { did, getAgent } from "./agent.js"; 1 + import { did } from "./agent.js"; 2 2 import { AppBskyFeedPost, BskyAgent } from "@atproto/api"; 3 3 import { PRONOUNS } from "./constants.js"; 4 4 ··· 15 15 }); 16 16 }; 17 17 18 - export const label = async (subject: string, uri: string) => { 19 - const agent = await getAgent(); 20 - 18 + export const label = async (agent: BskyAgent, subject: string, uri: string) => { 21 19 const repo = await agent 22 20 .withProxy("atproto_labeler", did) 23 21 .api.tools.ozone.moderation.getRepo({ did: subject });
+5 -3
src/main.ts
··· 1 1 import { AppBskyFeedLike } from "@atproto/api"; 2 2 import { Firehose } from "@skyware/firehose"; 3 - import { did } from "./agent.js"; 3 + import { did, getAgent } from "./agent.js"; 4 4 import { label } from "./label.js"; 5 5 6 6 const subscribe = async () => { 7 + const agent = await getAgent(); 8 + 7 9 const firehose = new Firehose(); 8 10 firehose.on("commit", (commit) => { 9 11 for (const op of commit.ops) { ··· 11 13 if (AppBskyFeedLike.isRecord(op.record)) { 12 14 if (op.record.subject.uri.includes(did)) { 13 15 if (op.record.subject.uri.includes("app.bsky.feed.post")) { 14 - label(commit.repo, op.record.subject.uri).catch((err) => 15 - console.error(err.message), 16 + label(agent, commit.repo, op.record.subject.uri).catch((err) => 17 + console.error(err), 16 18 ); 17 19 } 18 20 }