Skip to content
This repository was archived by the owner on Aug 10, 2024. It is now read-only.

Commit 2ce0be0

Browse files
committed
deleteFeedGenerator.ts
1 parent 0208d7c commit 2ce0be0

File tree

2 files changed

+35
-1
lines changed

2 files changed

+35
-1
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import dotenv from 'dotenv'
2+
import { AtpAgent, BlobRef } from '@atproto/api'
3+
4+
const run = async () => {
5+
dotenv.config()
6+
let config = require("./config.json");
7+
const handle = `${process.env.BLUESKY_HANDLE}`
8+
const password = `${process.env.BLUESKY_APP_PASSWORD}`
9+
const recordName = `${process.env.RECORD_NAME}`
10+
11+
// only update this if in a test environment
12+
const agent = new AtpAgent({ service: 'https://bsky.social' })
13+
await agent.login({ identifier: handle, password })
14+
15+
try {
16+
await agent.api.app.bsky.feed.describeFeedGenerator()
17+
} catch (err) {
18+
throw new Error(
19+
'The bluesky server is not ready to accept published custom feeds yet',
20+
)
21+
}
22+
23+
let record = {
24+
repo: agent.session?.did ?? '',
25+
collection: 'app.bsky.feed.generator',
26+
rkey: recordName,
27+
}
28+
let recordJSON = JSON.stringify(record, null, 2);
29+
console.log(`Deleting record ${recordJSON}`)
30+
let response = await agent.api.com.atproto.repo.deleteRecord(record);
31+
console.log(`Result ${response}`)
32+
}
33+
34+
run()

feed-generator/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"license": "MIT",
1010
"scripts": {
1111
"publishFeedGenerator": "ts-node publishFeedGenerator.ts",
12-
"deleteFeed": "ts-node deleteFeed.ts"
12+
"deleteFeedGenerator": "ts-node deleteFeedGenerator.ts"
1313
},
1414
"dependencies": {
1515
"@atproto/api": "^0.3.7",

0 commit comments

Comments
 (0)