Skip to content

Packages  ›  trotsky  ›  StepActorUnfollow

StepActorUnfollow class

Represents step that unfollows the current actor (if followed).

Signature:

typescript
export declare class StepActorUnfollow<P = StepActor, C extends StepActorOutput = StepActorOutput, O = null> extends Step<P, C, O>

Extends: Step<P, C, O>

Example 1

Unfollow a specific actor:

ts
await Trotsky.init(agent)
  .actor("user.bsky.social")
  .unfollow()
  .run()

Example 2

Unfollow accounts that don't follow you back:

ts
await Trotsky.init(agent)
  .actor("myhandle.bsky.social")
  .followings()
  .each()
  .when((step) => !step?.context?.viewer?.followedBy)
  .tap((step) => console.log(`Unfollowing: ${step.context.handle}`))
  .unfollow()
  .wait(2000)
  .run()

Methods

Method

Modifiers

Description

apply()

Applies the unfollow logic: 1. Retrieves the current actor's relationship with the specified context actor. 2. Checks if the current actor is indeed following the specified context actor. 3. If so, calls the API to remove the follow relationship.