Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import { BskyAgent } from '@atproto/api';
- import { argv } from 'node:process';
- const agent = new BskyAgent({ service: 'https://bsky.social' });
- await agent.login({
- identifier: argv[2],
- password: argv[3],
- });
- let cursor = undefined;
- const followers = [];
- do {
- const data = await agent.getFollowers({ actor: agent.session.did, cursor, limit: 100 });
- cursor = data.data.cursor;
- followers.push(...data.data.followers);
- } while (cursor);
- const facets = followers.map(v => { return {
- $type: 'app.bsky.richtext.facet',
- index: { byteStart: 0, byteEnd: 0 },
- features: [{
- '$type': 'app.bsky.richtext.facet#mention',
- did: v.did,
- }],
- } });
- const text = '...';
- await agent.post({
- text,
- facets,
- langs: ['en'],
- createdAt: new Date().toISOString(),
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement