Skip to content

Packages  ›  trotsky  ›  StepPostAuthor

StepPostAuthor class

Represents a step for retrieving the profile of the author of a specific post. Extends StepActor to reuse actor-related logic.

Signature:

typescript
export declare class StepPostAuthor<P = StepPost, C extends StepPostOutput = StepPostOutput, O extends StepPostAuthorOutput = StepPostAuthorOutput> extends StepActor<P, C, O>

Extends: StepActor<P, C, O>

Example 1

Get the author of a post:

ts
await Trotsky.init(agent)
  .post("at://did:plc:z72i7hdynmk6r22z27h6tvur/app.bsky.feed.post/3l6oveex3ii2l")
  .author()
  .tap((step) => {
    console.log(`Author: ${step.context.handle}`)
    console.log(`Followers: ${step.context.followersCount}`)
  })
  .run()

Example 2

Follow authors of interesting posts:

ts
await Trotsky.init(agent)
  .searchPosts({ q: "typescript" })
  .take(10)
  .each()
  .when((step) => step?.context?.likeCount > 15)
  .author()
  .follow()
  .wait(2000)
  .run()

Methods

Method

Modifiers

Description

apply()

Applies the step logic to retrieve the profile of the author of the post.