Skip to content

Packages  ›  trotsky  ›  StepActorFollowers

StepActorFollowers class

Represents a step for retrieving an actor's followers using the Bluesky API. Supports paginated retrieval of followers.

Signature:

typescript
export declare class StepActorFollowers<P = StepActor, C extends StepActorOutput = StepActorOutput, O extends StepActorFollowersOutput = StepActorFollowersOutput> extends StepActors<P, C, O>

Extends: StepActors<P, C, O>

Example 1

Get and iterate through an actor's followers:

ts
await Trotsky.init(agent)
  .actor("bsky.app")
  .followers()
  .each()
  .tap((step) => {
    console.log(`Follower: ${step.context.handle}`)
  })
  .run()

Example 2

Follow back all your followers:

ts
await Trotsky.init(agent)
  .actor("myhandle.bsky.social")
  .followers()
  .each()
  .when((step) => !step?.context?.viewer?.following)
  .follow()
  .wait(2000)
  .run()

Methods

Method

Modifiers

Description

applyPagination()

Applies pagination to retrieve followers and sets the output. Fetches paginated results using the agent and appends them to the output.