Skip to content

Packages  ›  trotsky  ›  StepPostUnrepost

StepPostUnrepost class

Represents a step for unreposting (removing repost) a specific post.

Signature:

typescript
export declare class StepPostUnrepost<P = StepPost, C extends StepPostOutput = StepPostOutput, O = null> extends Step<P, C, O>

Extends: Step<P, C, O>

Example 1

Unrepost a specific post:

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

Example 2

Unrepost posts from search results:

ts
await Trotsky.init(agent)
  .searchPosts({ q: "typescript" })
  .take(10)
  .each()
  .when((step) => step?.context?.viewer?.repost)
  .unrepost()
  .wait(2000)
  .run()

Methods

Method

Modifiers

Description

apply()

Applies the step logic to unrepost the post provided in the context. Only unreposts if the user has previously reposted the post.