Pronouns labels on Bluesky

fix error and stuff idk

+74 -128
package-lock.json
···
"": {
"dependencies": {
"@atproto/api": "^0.12.23",
-
"@skyware/firehose": "^0.1.5",
"dotenv": "^16.4.5"
},
"devDependencies": {
···
"tlds": "^1.234.0"
}
},
"node_modules/@atproto/common-web": {
"version": "0.3.0",
"resolved": "https://registry.npmjs.org/@atproto/common-web/-/common-web-0.3.0.tgz",
···
"zod": "^3.21.4"
}
},
"node_modules/@atproto/lexicon": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/@atproto/lexicon/-/lexicon-0.4.0.tgz",
···
"zod": "^3.21.4"
}
},
-
"node_modules/@atproto/repo/node_modules/@atproto/common": {
-
"version": "0.3.4",
-
"resolved": "https://registry.npmjs.org/@atproto/common/-/common-0.3.4.tgz",
-
"integrity": "sha512-qjOHcyeHjGRJseYbdnl+0PViDlMRN9GR0/1ToGKAmXh0voz4LbBWU1FwtGF7CvTlbom9MZYhu21lF5pD5RqBwQ==",
-
"license": "MIT",
-
"dependencies": {
-
"@atproto/common-web": "^0.2.4",
-
"@ipld/dag-cbor": "^7.0.3",
-
"cbor-x": "^1.5.1",
-
"iso-datestring-validator": "^2.2.2",
-
"multiformats": "^9.9.0",
-
"pino": "^8.15.0",
-
"zod": "3.21.4"
-
}
-
},
"node_modules/@atproto/repo/node_modules/@atproto/common-web": {
"version": "0.2.4",
"resolved": "https://registry.npmjs.org/@atproto/common-web/-/common-web-0.2.4.tgz",
···
"zod": "^3.21.4"
}
},
-
"node_modules/@atproto/repo/node_modules/@atproto/crypto": {
-
"version": "0.3.0",
-
"resolved": "https://registry.npmjs.org/@atproto/crypto/-/crypto-0.3.0.tgz",
-
"integrity": "sha512-bhcxRTL4fgRY2YX/St0x4o0oDUp18QIPD7ek+7v8UKA0HpsCGQYbo8w9d9hUvwwty5X5p00cYF2tbggUWaPy7A==",
-
"license": "MIT",
-
"dependencies": {
-
"@noble/curves": "^1.1.0",
-
"@noble/hashes": "^1.3.1",
-
"uint8arrays": "3.0.0"
-
}
-
},
-
"node_modules/@atproto/repo/node_modules/@atproto/identity": {
-
"version": "0.3.3",
-
"resolved": "https://registry.npmjs.org/@atproto/identity/-/identity-0.3.3.tgz",
-
"integrity": "sha512-i5d3eOnXQAXuOrjdm4NcveIBJxdEywYJQ4d74/JOgy27bGdNVFgh9FdZAsOseQRkLv4r7mr0I0C6OlSA2BQIxA==",
-
"license": "MIT",
-
"dependencies": {
-
"@atproto/common-web": "^0.2.4",
-
"@atproto/crypto": "^0.3.0",
-
"axios": "^0.27.2"
-
}
-
},
"node_modules/@atproto/repo/node_modules/@atproto/lexicon": {
"version": "0.3.3",
"resolved": "https://registry.npmjs.org/@atproto/lexicon/-/lexicon-0.3.3.tgz",
···
"@atproto/common-web": "^0.2.4"
}
},
-
"node_modules/@atproto/repo/node_modules/zod": {
-
"version": "3.21.4",
-
"resolved": "https://registry.npmjs.org/zod/-/zod-3.21.4.tgz",
-
"integrity": "sha512-m46AKbrzKVzOzs/DZgVnG5H55N1sv1M8qZU3A8RIKbs3mrACDNeIOeilDymVb2HdmP8uwshOCF4uJ8uM9rCqJw==",
-
"license": "MIT",
-
"funding": {
-
"url": "https://github.com/sponsors/colinhacks"
-
}
-
},
"node_modules/@atproto/syntax": {
"version": "0.3.0",
"resolved": "https://registry.npmjs.org/@atproto/syntax/-/syntax-0.3.0.tgz",
···
"zod": "^3.21.4"
}
},
-
"node_modules/@atproto/xrpc-server/node_modules/@atproto/common": {
-
"version": "0.3.4",
-
"resolved": "https://registry.npmjs.org/@atproto/common/-/common-0.3.4.tgz",
-
"integrity": "sha512-qjOHcyeHjGRJseYbdnl+0PViDlMRN9GR0/1ToGKAmXh0voz4LbBWU1FwtGF7CvTlbom9MZYhu21lF5pD5RqBwQ==",
-
"license": "MIT",
-
"dependencies": {
-
"@atproto/common-web": "^0.2.4",
-
"@ipld/dag-cbor": "^7.0.3",
-
"cbor-x": "^1.5.1",
-
"iso-datestring-validator": "^2.2.2",
-
"multiformats": "^9.9.0",
-
"pino": "^8.15.0",
-
"zod": "3.21.4"
-
}
-
},
"node_modules/@atproto/xrpc-server/node_modules/@atproto/common-web": {
"version": "0.2.4",
"resolved": "https://registry.npmjs.org/@atproto/common-web/-/common-web-0.2.4.tgz",
···
"zod": "^3.21.4"
}
},
-
"node_modules/@atproto/xrpc-server/node_modules/@atproto/crypto": {
-
"version": "0.3.0",
-
"resolved": "https://registry.npmjs.org/@atproto/crypto/-/crypto-0.3.0.tgz",
-
"integrity": "sha512-bhcxRTL4fgRY2YX/St0x4o0oDUp18QIPD7ek+7v8UKA0HpsCGQYbo8w9d9hUvwwty5X5p00cYF2tbggUWaPy7A==",
-
"license": "MIT",
-
"dependencies": {
-
"@noble/curves": "^1.1.0",
-
"@noble/hashes": "^1.3.1",
-
"uint8arrays": "3.0.0"
-
}
-
},
"node_modules/@atproto/xrpc-server/node_modules/@atproto/lexicon": {
"version": "0.3.3",
"resolved": "https://registry.npmjs.org/@atproto/lexicon/-/lexicon-0.3.3.tgz",
···
"@atproto/common-web": "^0.2.4"
}
},
-
"node_modules/@atproto/xrpc-server/node_modules/zod": {
-
"version": "3.21.4",
-
"resolved": "https://registry.npmjs.org/zod/-/zod-3.21.4.tgz",
-
"integrity": "sha512-m46AKbrzKVzOzs/DZgVnG5H55N1sv1M8qZU3A8RIKbs3mrACDNeIOeilDymVb2HdmP8uwshOCF4uJ8uM9rCqJw==",
-
"license": "MIT",
-
"funding": {
-
"url": "https://github.com/sponsors/colinhacks"
-
}
-
},
"node_modules/@cbor-extract/cbor-extract-darwin-arm64": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/@cbor-extract/cbor-extract-darwin-arm64/-/cbor-extract-darwin-arm64-2.2.0.tgz",
···
}
},
"node_modules/@skyware/firehose": {
-
"version": "0.1.5",
-
"resolved": "https://registry.npmjs.org/@skyware/firehose/-/firehose-0.1.5.tgz",
-
"integrity": "sha512-ggO2xHERcTxnICRGHuha0vad9fQbmzvraRPhSoi7ysnIzSGUMiQVz/c6HrON2svVMZBoeMzTtu9jjRyhio+ckA==",
"license": "MPL-2.0",
"dependencies": {
"@atproto/repo": "^0.3.7",
···
"dependencies": {
"base64-js": "^1.3.1",
"ieee754": "^1.2.1"
-
}
-
},
-
"node_modules/bufferutil": {
-
"version": "4.0.8",
-
"resolved": "https://registry.npmjs.org/bufferutil/-/bufferutil-4.0.8.tgz",
-
"integrity": "sha512-4T53u4PdgsXqKaIctwF8ifXlRTTmEPJ8iEPWFdGZvcf7sbwYo6FKFEX9eNNAnzFZ7EzJAQ3CJeOtCRA4rDp7Pw==",
-
"hasInstallScript": true,
-
"license": "MIT",
-
"optional": true,
-
"peer": true,
-
"dependencies": {
-
"node-gyp-build": "^4.3.0"
-
},
-
"engines": {
-
"node": ">=6.14.2"
}
},
"node_modules/bytes": {
···
"node": ">= 0.6"
}
},
-
"node_modules/node-gyp-build": {
-
"version": "4.8.1",
-
"resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.8.1.tgz",
-
"integrity": "sha512-OSs33Z9yWr148JZcbZd5WiAXhh/n9z8TxQcdMhIOlpN9AhWpLfvVFO73+m77bBABQMaY9XSvIa+qk0jlI7Gcaw==",
-
"license": "MIT",
-
"optional": true,
-
"peer": true,
-
"bin": {
-
"node-gyp-build": "bin.js",
-
"node-gyp-build-optional": "optional.js",
-
"node-gyp-build-test": "build-test.js"
-
}
-
},
"node_modules/node-gyp-build-optional-packages": {
"version": "5.1.1",
"resolved": "https://registry.npmjs.org/node-gyp-build-optional-packages/-/node-gyp-build-optional-packages-5.1.1.tgz",
···
"license": "MIT",
"engines": {
"node": ">= 0.8"
-
}
-
},
-
"node_modules/utf-8-validate": {
-
"version": "6.0.4",
-
"resolved": "https://registry.npmjs.org/utf-8-validate/-/utf-8-validate-6.0.4.tgz",
-
"integrity": "sha512-xu9GQDeFp+eZ6LnCywXN/zBancWvOpUMzgjLPSjy4BRHSmTelvn2E0DG0o1sTiw5hkCKBHo8rwSKncfRfv2EEQ==",
-
"hasInstallScript": true,
-
"license": "MIT",
-
"optional": true,
-
"peer": true,
-
"dependencies": {
-
"node-gyp-build": "^4.3.0"
-
},
-
"engines": {
-
"node": ">=6.14.2"
}
},
"node_modules/utils-merge": {
···
"": {
"dependencies": {
"@atproto/api": "^0.12.23",
+
"@skyware/firehose": "^0.2.0",
"dotenv": "^16.4.5"
},
"devDependencies": {
···
"tlds": "^1.234.0"
}
},
+
"node_modules/@atproto/common": {
+
"version": "0.3.4",
+
"resolved": "https://registry.npmjs.org/@atproto/common/-/common-0.3.4.tgz",
+
"integrity": "sha512-qjOHcyeHjGRJseYbdnl+0PViDlMRN9GR0/1ToGKAmXh0voz4LbBWU1FwtGF7CvTlbom9MZYhu21lF5pD5RqBwQ==",
+
"license": "MIT",
+
"dependencies": {
+
"@atproto/common-web": "^0.2.4",
+
"@ipld/dag-cbor": "^7.0.3",
+
"cbor-x": "^1.5.1",
+
"iso-datestring-validator": "^2.2.2",
+
"multiformats": "^9.9.0",
+
"pino": "^8.15.0",
+
"zod": "3.21.4"
+
}
+
},
"node_modules/@atproto/common-web": {
"version": "0.3.0",
"resolved": "https://registry.npmjs.org/@atproto/common-web/-/common-web-0.3.0.tgz",
···
"zod": "^3.21.4"
}
},
+
"node_modules/@atproto/common/node_modules/@atproto/common-web": {
+
"version": "0.2.4",
+
"resolved": "https://registry.npmjs.org/@atproto/common-web/-/common-web-0.2.4.tgz",
+
"integrity": "sha512-6+DOhQcTklFmeiSkZRx6iFeqi4OFtGl4yEDGATk00q4tEcPoPvyOBtYHN6+G9lrfJIfx5RfmggamvXlJv1PxxA==",
+
"license": "MIT",
+
"dependencies": {
+
"graphemer": "^1.4.0",
+
"multiformats": "^9.9.0",
+
"uint8arrays": "3.0.0",
+
"zod": "^3.21.4"
+
}
+
},
+
"node_modules/@atproto/common/node_modules/zod": {
+
"version": "3.21.4",
+
"resolved": "https://registry.npmjs.org/zod/-/zod-3.21.4.tgz",
+
"integrity": "sha512-m46AKbrzKVzOzs/DZgVnG5H55N1sv1M8qZU3A8RIKbs3mrACDNeIOeilDymVb2HdmP8uwshOCF4uJ8uM9rCqJw==",
+
"license": "MIT",
+
"funding": {
+
"url": "https://github.com/sponsors/colinhacks"
+
}
+
},
+
"node_modules/@atproto/crypto": {
+
"version": "0.3.0",
+
"resolved": "https://registry.npmjs.org/@atproto/crypto/-/crypto-0.3.0.tgz",
+
"integrity": "sha512-bhcxRTL4fgRY2YX/St0x4o0oDUp18QIPD7ek+7v8UKA0HpsCGQYbo8w9d9hUvwwty5X5p00cYF2tbggUWaPy7A==",
+
"license": "MIT",
+
"dependencies": {
+
"@noble/curves": "^1.1.0",
+
"@noble/hashes": "^1.3.1",
+
"uint8arrays": "3.0.0"
+
}
+
},
+
"node_modules/@atproto/identity": {
+
"version": "0.3.3",
+
"resolved": "https://registry.npmjs.org/@atproto/identity/-/identity-0.3.3.tgz",
+
"integrity": "sha512-i5d3eOnXQAXuOrjdm4NcveIBJxdEywYJQ4d74/JOgy27bGdNVFgh9FdZAsOseQRkLv4r7mr0I0C6OlSA2BQIxA==",
+
"license": "MIT",
+
"dependencies": {
+
"@atproto/common-web": "^0.2.4",
+
"@atproto/crypto": "^0.3.0",
+
"axios": "^0.27.2"
+
}
+
},
+
"node_modules/@atproto/identity/node_modules/@atproto/common-web": {
+
"version": "0.2.4",
+
"resolved": "https://registry.npmjs.org/@atproto/common-web/-/common-web-0.2.4.tgz",
+
"integrity": "sha512-6+DOhQcTklFmeiSkZRx6iFeqi4OFtGl4yEDGATk00q4tEcPoPvyOBtYHN6+G9lrfJIfx5RfmggamvXlJv1PxxA==",
+
"license": "MIT",
+
"dependencies": {
+
"graphemer": "^1.4.0",
+
"multiformats": "^9.9.0",
+
"uint8arrays": "3.0.0",
+
"zod": "^3.21.4"
+
}
+
},
"node_modules/@atproto/lexicon": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/@atproto/lexicon/-/lexicon-0.4.0.tgz",
···
"zod": "^3.21.4"
}
},
"node_modules/@atproto/repo/node_modules/@atproto/common-web": {
"version": "0.2.4",
"resolved": "https://registry.npmjs.org/@atproto/common-web/-/common-web-0.2.4.tgz",
···
"zod": "^3.21.4"
}
},
"node_modules/@atproto/repo/node_modules/@atproto/lexicon": {
"version": "0.3.3",
"resolved": "https://registry.npmjs.org/@atproto/lexicon/-/lexicon-0.3.3.tgz",
···
"@atproto/common-web": "^0.2.4"
}
},
"node_modules/@atproto/syntax": {
"version": "0.3.0",
"resolved": "https://registry.npmjs.org/@atproto/syntax/-/syntax-0.3.0.tgz",
···
"zod": "^3.21.4"
}
},
"node_modules/@atproto/xrpc-server/node_modules/@atproto/common-web": {
"version": "0.2.4",
"resolved": "https://registry.npmjs.org/@atproto/common-web/-/common-web-0.2.4.tgz",
···
"zod": "^3.21.4"
}
},
"node_modules/@atproto/xrpc-server/node_modules/@atproto/lexicon": {
"version": "0.3.3",
"resolved": "https://registry.npmjs.org/@atproto/lexicon/-/lexicon-0.3.3.tgz",
···
"@atproto/common-web": "^0.2.4"
}
},
"node_modules/@cbor-extract/cbor-extract-darwin-arm64": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/@cbor-extract/cbor-extract-darwin-arm64/-/cbor-extract-darwin-arm64-2.2.0.tgz",
···
}
},
"node_modules/@skyware/firehose": {
+
"version": "0.2.0",
+
"resolved": "https://registry.npmjs.org/@skyware/firehose/-/firehose-0.2.0.tgz",
+
"integrity": "sha512-N3Z8PDb05JpQSTPMfe8mcAbE1zrFoPXLlhPKFio3Wyu+64ZW6g54htrOCX3S4CG7x7TYfWXc4au+hCny3F+1Mw==",
"license": "MPL-2.0",
"dependencies": {
"@atproto/repo": "^0.3.7",
···
"dependencies": {
"base64-js": "^1.3.1",
"ieee754": "^1.2.1"
}
},
"node_modules/bytes": {
···
"node": ">= 0.6"
}
},
"node_modules/node-gyp-build-optional-packages": {
"version": "5.1.1",
"resolved": "https://registry.npmjs.org/node-gyp-build-optional-packages/-/node-gyp-build-optional-packages-5.1.1.tgz",
···
"license": "MIT",
"engines": {
"node": ">= 0.8"
}
},
"node_modules/utils-merge": {
+1 -1
package.json
···
},
"dependencies": {
"@atproto/api": "^0.12.23",
-
"@skyware/firehose": "^0.1.5",
"dotenv": "^16.4.5"
}
}
···
},
"dependencies": {
"@atproto/api": "^0.12.23",
+
"@skyware/firehose": "^0.2.0",
"dotenv": "^16.4.5"
}
}
+5
src/agent.ts
···
service: process.env.BSKY_SERVICE ?? "https://bsky.social",
});
return agent;
};
···
service: process.env.BSKY_SERVICE ?? "https://bsky.social",
});
+
await agent.login({
+
identifier: process.env.BSKY_IDENTIFIER!,
+
password: process.env.BSKY_PASSWORD!,
+
});
+
return agent;
};
+1 -1
src/label.ts
···
const post = URIs[uri];
-
if (repo.data.labels && post.includes("Like this post to delete")) {
await agent
.withProxy("atproto_labeler", DID)
.api.tools.ozone.moderation.emitEvent({
···
const post = URIs[uri];
+
if (repo.data.labels && (post ?? "").includes("Like this post to delete")) {
await agent
.withProxy("atproto_labeler", DID)
.api.tools.ozone.moderation.emitEvent({
+4 -4
src/main.ts
···
const subscribe = async () => {
const agent = await getAgent();
-
//const firehose = new Firehose("wss://bsky.network", { cursor: "759324067" });
-
const firehose = new Firehose();
firehose.on("commit", (commit) => {
for (const op of commit.ops) {
if (op.action === "delete") continue;
if (AppBskyFeedLike.isRecord(op.record)) {
-
if (op.record.subject.uri.includes(DID)) {
-
if (op.record.subject.uri.includes("app.bsky.feed.post")) {
label(agent, commit.repo, op.record.subject.uri).catch((err) =>
console.error(err),
);
···
const subscribe = async () => {
const agent = await getAgent();
+
// add firehose cursor save
+
const firehose = new Firehose({ cursor: "759165458" });
firehose.on("commit", (commit) => {
for (const op of commit.ops) {
if (op.action === "delete") continue;
if (AppBskyFeedLike.isRecord(op.record)) {
+
if ((op.record.subject.uri ?? "").includes(DID)) {
+
if ((op.record.subject.uri ?? "").includes("app.bsky.feed.post")) {
label(agent, commit.repo, op.record.subject.uri).catch((err) =>
console.error(err),
);