Constructor
Properties
readonly agent: RateLimitedAgent
The agent used to communicate with a Bluesky PDS.
profile: Profile
The bot account's Bluesky profile.
Methods
login(options)
Log in with an identifier and password.
Parameters
options: BotLoginOptions
The bot account's identifier and password.
getPosts(uris, options?)
Fetch up to 25 posts by their AT URIs.
Parameters
uris: string[]
The URIs of the posts to fetch.
options: BaseBotGetMethodOptions = {}
Optional configuration.
getProfile(didOrHandle, options?)
Fetch a profile by DID or handle.
Parameters
didOrHandle: string
The user's DID or handle.
options: BaseBotGetMethodOptions = {}
Optional configuration.
getProfiles(identifiers, options?)
Fetch up to 25 (default 25) profiles by their DIDs or handles.
Parameters
identifiers: string[]
The identifiers of the profiles to fetch.
options: BaseBotGetMethodOptions = {}
Optional configuration.
getFeedGenerator(uri, options?)
Fetch a feed generator by its AT URI.
Parameters
uri: string
The feed generator's AT URI.
options: BaseBotGetMethodOptions = {}
Optional configuration.
Returns
Promise<FeedGenerator>
getFeedGenerators(uris, options?)
Fetch a list of feed generators by their AT URIs.
Parameters
uris: string[]
The URIs of the feed generators to fetch.
options: BaseBotGetMethodOptions = {}
Optional configuration.
Returns
Promise<FeedGenerator[]>
getTimeline(options?)
Get the bot's home timeline.
Parameters
options: BotGetTimelineOptions = {}
Optional configuration.
getLabeler(did, options?)
Fetch a labeler by its account DID.
Parameters
did: string
The DID of the labeler to fetch.
options: BaseBotGetMethodOptions = {}
Optional configuration.
getLabelers(dids, options?)
Fetch a list of labelers by their account DIDs.
Parameters
dids: string[]
The DIDs of the labelers to fetch.
options: BaseBotGetMethodOptions = {}
Optional configuration.
getStarterPack(uri, options?)
Fetch a starter pack by its AT URI.
Parameters
uri: string
The starter pack's AT URI.
options: BaseBotGetMethodOptions = {}
Optional configuration.
Returns
Promise<StarterPack>
getStarterPacks(uris, options?)
Fetch a list of starter packs by their AT URIs.
Parameters
uris: string[]
The URIs of the starter packs to fetch.
options: BaseBotGetMethodOptions = {}
Optional configuration.
Returns
Promise<StarterPack[]>
getUserStarterPacks(did, options?)
Fetch a list of starter packs by their creator's DID.
Parameters
did: string
The creator's DID.
options: BotGetUserStarterPacksOptions = {}
Optional configuration.
Returns
Promise<StarterPack[]>
getConversationForMembers(members, options?)
Fetch a conversation containing 1-10 members. If a conversation doesn't exist, it will be created.
Parameters
members: string[]
The DIDs of the conversation members.
options: BaseBotGetMethodOptions = {}
Optional configuration.
Returns
Promise<Conversation>
getConversation(id, options?)
Fetch a conversation by its ID.
Parameters
id: string
The conversation's ID.
options: BaseBotGetMethodOptions = {}
Optional configuration.
Returns
Promise<Conversation>
listConversations(options?)
Fetch all conversations the bot is a member of.
Parameters
options: BotListConversationsOptions = {}
Optional configuration.
Returns
Promise<{ conversations: Conversation[]; cursor: string | undefined; }>
getConversationMessages(conversationId, options?)
Fetch the message history for a conversation.
Parameters
conversationId: string
The ID of the conversation to fetch messages for.
options: BotGetConversationMessagesOptions = {}
Optional configuration.
Returns
Promise<{ cursor: string | undefined; messages: ChatMessage | DeletedChatMessage[]; }>
An array of messages and a cursor for pagination.
like(reference)
Like a post or feed generator.
Parameters
reference: StrongRef
The post or feed generator to like.
unlike(uri)
Delete a like.
Parameters
uri: string
The liked record's AT URI or the like record's AT URI.
deleteRepost(uri)
Delete a repost.
Parameters
uri: string
The post's AT URI or the repost record's AT URI.
unfollow(didOrUri)
Delete a follow.
Parameters
didOrUri: string
The user's DID or the follow record's AT URI.
unblock(didOrUri)
Delete a block.
Parameters
didOrUri: string
The user's DID or the block record's AT URI.
sendMessage(payload, options?)
Send a message in a DM conversation.
Parameters
payload: ChatMessagePayload
The message payload.
options: BotSendMessageOptions = {}
Optional configuration.
sendMessages(payload, options?)
Send up to 100 private messages at once.
Parameters
payload: ChatMessagePayload[]
The messages payload.
options: BotSendMessageOptions = {}
Optional configuration.
label(options)
Label a user or record. Note that you need a running labeler server on this DID to publish labels!
See also: - @skyware/labeler | Getting Started to run a minimal labeler server. - Self-hosting Ozone for a full web UI and report handling.Parameters
options: BotLabelRecordOptions
Information on the label to apply.
negateLabels(options)
Negate labels previously applied to a record by the bot.
Parameters
options: BotLabelRecordOptions
Information on the record to negate labels on.
addLabeler(did)
Subscribe to a labeler while this Bot instance exists.
Parameters
did: string
The labeler's DID.
removeLabeler(did)
Unsubscribe the current Bot instance from a labeler.
Parameters
did: string
The labeler's DID.
setChatPreference(preference)
Set the bot's preference for who can initiate a new chat conversation. This does not affect existing conversations.
Parameters
preference: IncomingChatPreference
The new preference.
createRecord(nsid, record, rkey?)
Create a record.
Parameters
nsid: NSID
The collection's NSID.
record: Omit<Records[NSID], "$type" | "createdAt">
The record to create.
rkey?: string
The rkey to use.
putRecord(nsid, record, rkey)
Put a record in place of an existing record.
Parameters
nsid: string
The collection's NSID.
record: object
The record to put.
rkey: string
The rkey to use.
updatePreferences(callback)
Update private user preferences for the bot account.
Parameters
callback: (preferences: "@atcute/client/lexicons".AppBskyActorDefs.Preferences) => "@atcute/client/lexicons".AppBskyActorDefs.Preferences
A callback function that receives the current preferences and returns the updated preferences.
on(event, listener)
Emitted when the bot begins listening for events.
Parameters
event: "open"
listener: () => void
Returns
this
on(event, listener)
Emitted when an error occurs while listening for events.
Parameters
event: "error"
listener: (error: unknown) => void
Returns
this
on(event, listener)
Emitted when the bot stops listening for events.
Parameters
event: "close"
listener: () => void
Returns
this
on(event, listener)
Emitted when one of the bot's posts is reposted.
Parameters
event: "repost"
Returns
this
on(event, listener)
Emitted when one of the bot's posts is liked.
Parameters
event: "like"
listener: (event: { subject: FeedGenerator | Labeler | Post; uri: string; user: Profile; }) => void
A callback function that receives the subject that was liked, the user who liked it, and the like's AT URI.
Returns
this
on(event, listener)
Emitted when the bot is followed.
Parameters
event: "follow"
listener: (event: { uri: string; user: Profile; }) => void
A callback function that receives the user who followed the bot and the follow's AT URI.
Returns
this
on(event, listener)
Emitted when the bot receives a message in a DM conversation.
Parameters
event: "message"
listener: (message: ChatMessage) => void
A callback function that receives the message.
Returns
this
addListener(event, listener)
Alias for
.emitter.on(eventName, listener)
Parameters
event: "open"
listener: () => void
Returns
this
addListener(event, listener)
Alias for
.emitter.on(eventName, listener)
Parameters
event: "error"
listener: (error: unknown) => void
Returns
this
addListener(event, listener)
Alias for
.emitter.on(eventName, listener)
Parameters
event: "close"
listener: () => void
Returns
this
off(event, listener)
Remove an event listener.
Parameters
event: string
The event to remove the listener for.
listener: (args: any[]) => void
The listener callback to remove.
Returns
this
removeListener(event, listener)
Alias for Bot#off.