Skip to content

Instantly share code, notes, and snippets.

@mozzius
Created March 7, 2025 11:26
Show Gist options
  • Save mozzius/45785e5661259f0ca53c4dd6add714a3 to your computer and use it in GitHub Desktop.
Save mozzius/45785e5661259f0ca53c4dd6add714a3 to your computer and use it in GitHub Desktop.
Update atproto labeller declaration
import { AppBskyLabelerService, AtpAgent } from "@atproto/api";
const agent = new AtpAgent({
service: "https://bsky.social",
});
async function main() {
await agent.login({
identifier: "<username>",
password: "<password>",
});
const record = await agent.com.atproto.repo.getRecord({
repo: agent.session!.did,
rkey: 'self',
collection: 'app.bsky.labeler.service'
});
const value = record.data.value as AppBskyLabelerService.Record
await agent.app.bsky.labeler.service.delete({
repo: agent.session!.did,
rkey: 'self'
})
await agent.app.bsky.labeler.service.create({
repo: agent.session!.did,
rkey: 'self'
}, {
$type: 'app.bsky.labeler.service',
policies: value.policies,
subjectTypes: ['record'],
subjectCollections: ['app.bsky.feed.post'],
reasonTypes: [ 'com.atproto.moderation.defs#reasonSpam', ],
createdAt: new Date().toISOString()
} satisfies AppBskyLabelerService.Record)
console.log('Updated ✨')
}
main().catch(console.error);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment