From 437315b4cd8cfefb76c5cab9e8c8bcfc21690892 Mon Sep 17 00:00:00 2001 From: L-tan <3786294+dolciss@users.noreply.github.com> Date: Fri, 1 Nov 2024 00:50:32 +0900 Subject: [PATCH] Add unpublishFeedGen script (#77) Co-authored-by: Hailey --- package.json | 1 + scripts/unpublishFeedGen.ts | 39 +++++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 scripts/unpublishFeedGen.ts diff --git a/package.json b/package.json index e41ecb7..620753d 100644 --- a/package.json +++ b/package.json @@ -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" }, diff --git a/scripts/unpublishFeedGen.ts b/scripts/unpublishFeedGen.ts new file mode 100644 index 0000000..87a6bc7 --- /dev/null +++ b/scripts/unpublishFeedGen.ts @@ -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()