Skip to content

Packages  ›  trotsky  ›  StepPostRepost

StepPostRepost class

Represents a step for reposting a specific post.

Signature:

typescript
export declare class StepPostRepost<P = StepPost, C extends StepPostOutput = StepPostOutput, O extends StepPostRepostOutput = StepPostRepostOutput> extends Step<P, C, O>

Extends: Step<P, C, O>

Example 1

Repost a specific post:

ts
await Trotsky.init(agent)
  .post("at://did:plc:z72i7hdynmk6r22z27h6tvur/app.bsky.feed.post/3l6oveex3ii2l")
  .repost()
  .run()

Example 2

Repost popular posts from search:

ts
await Trotsky.init(agent)
  .searchPosts({ q: "typescript tips" })
  .take(5)
  .each()
  .when((step) => step?.context?.likeCount > 20)
  .repost()
  .wait(2000)
  .run()

Methods

Method

Modifiers

Description

apply()

Applies the step logic to repost the post provided in the context. The resulting URI and CID of the repost are stored in the output.