Packages › trotsky › StepActors
StepActors class
An abstract class that extends StepBuilderList to handle a list of actor profiles. It defines a collection of steps dealing with actor entries (StepActorsEntry), which can be appended via the each() method.
Signature:
typescript
export declare class StepActors<P = StepBuilder, C = null, O extends StepActorsOutput = StepActorsOutput> extends StepBuilderList<P, C, O>Extends: StepBuilderList<P, C, O>
Example 1
Get profiles for multiple actors:
ts
await Trotsky.init(agent)
.actors(["alice.bsky.social", "bob.bsky.social", "carol.bsky.social"])
.each()
.tap((step) => {
console.log(`${step.context.handle}: ${step.context.followersCount} followers`)
})
.run()Example 2
Follow multiple accounts:
ts
const friends = ["alice.bsky.social", "bob.bsky.social"]
await Trotsky.init(agent)
.actors(friends)
.each()
.follow()
.wait(2000)
.run()Constructors
Constructor | Modifiers | Description |
|---|---|---|
Initializes a new StepActors instance. |
Methods
Method | Modifiers | Description |
|---|---|---|
Applies the step by resolving the actor parameter and fetching the actors' profiles. Sets the profile data as the output of this step. | ||
Clones the current step and returns a new instance with the same parameters. | ||
Appends a new StepActorsEntry instance to the step list and returns the newly created entry. |