Add unpublishFeedGen script (#77)

Co-authored-by: Hailey <hailey@blueskyweb.xyz>
This commit is contained in:
L-tan 2024-11-01 00:50:32 +09:00 committed by GitHub
parent 7ae4f0e214
commit 437315b4cd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 40 additions and 0 deletions

View file

@ -8,6 +8,7 @@
"license": "MIT",
"scripts": {
"publishFeed": "ts-node scripts/publishFeedGen.ts",
"unpublishFeed": "ts-node scripts/unpublishFeedGen.ts",
"start": "ts-node src/index.ts",
"build": "tsc"
},

View file

@ -0,0 +1,39 @@
import dotenv from 'dotenv'
import { AtpAgent, BlobRef } from '@atproto/api'
import fs from 'fs/promises'
import { ids } from '../src/lexicon/lexicons'
const run = async () => {
dotenv.config()
// YOUR bluesky handle
// Ex: user.bsky.social
const handle = ''
// YOUR bluesky password, or preferably an App Password (found in your client settings)
// Ex: abcd-1234-efgh-5678
const password = ''
// A short name for the record that will show in urls
// Lowercase with no spaces.
// Ex: whats-hot
const recordName = ''
// -------------------------------------
// NO NEED TO TOUCH ANYTHING BELOW HERE
// -------------------------------------
// only update this if in a test environment
const agent = new AtpAgent({ service: 'https://bsky.social' })
await agent.login({ identifier: handle, password })
await agent.api.com.atproto.repo.deleteRecord({
repo: agent.session?.did ?? '',
collection: ids.AppBskyFeedGenerator,
rkey: recordName,
})
console.log('All done 🎉')
}
run()