···
-
import { AppBskyActorDefs, Agent } from "@atproto/api";
-
import { DID, PRONOUNS, URIs } from "./constants.js";
export const label = async (
subject: string | AppBskyActorDefs.ProfileView,
const did = AppBskyActorDefs.isProfileView(subject) ? subject.did : subject;
const labels = await agent.com.atproto.label
-
.queryLabels({ sources: [DID], uriPatterns: [did] })
···
if (post?.includes("Like this post to delete")) {
-
.withProxy("atproto_labeler", DID)
-
.tools.ozone.moderation.emitEvent({
-
$type: "tools.ozone.moderation.defs#modEventLabel",
-
negateLabelVals: labels.data.labels.map((label) => label.val),
-
$type: "com.atproto.admin.defs#repoRef",
-
createdAt: new Date().toISOString(),
.then(() => console.log(`Deleted labels for ${did}`));
} else if (labels.data.labels.length < 4 && PRONOUNS[post]) {
-
.withProxy("atproto_labeler", DID)
-
.tools.ozone.moderation.emitEvent({
-
$type: "tools.ozone.moderation.defs#modEventLabel",
-
createLabelVals: [PRONOUNS[post]],
-
$type: "com.atproto.admin.defs#repoRef",
-
createdAt: new Date().toISOString(),
···
+
import { AppBskyActorDefs } from "@atproto/api";
+
import { DID, PRONOUNS, SIGNING_KEY, URIs } from "./constants.js";
+
import { LabelerServer } from "@skyware/labeler";
+
import { getAgent } from "./agent.js";
+
const server = new LabelerServer({ did: DID, signingKey: SIGNING_KEY });
+
const agent = await getAgent();
+
server.start(4001, (error, address) => {
+
console.log(`Labeler server listening on ${address}`);
export const label = async (
subject: string | AppBskyActorDefs.ProfileView,
const did = AppBskyActorDefs.isProfileView(subject) ? subject.did : subject;
const labels = await agent.com.atproto.label
+
.queryLabels({ sources: [server.did], uriPatterns: [did] })
···
if (post?.includes("Like this post to delete")) {
+
{ negate: labels.data.labels.map((label) => label.val) },
.then(() => console.log(`Deleted labels for ${did}`));
} else if (labels.data.labels.length < 4 && PRONOUNS[post]) {
+
cts: new Date().toISOString(),