class Profile

A Bluesky user profile.

Constructor

constructor(data, bot)

Parameters

data: ProfileData

Profile data.

bot: Bot

The active Bot instance.

Properties

did: string

The user's DID.

handle: string

The user's handle.

displayName?: string

The user's display name.

description?: string

The user's profile description .

avatar?: string

The user's avatar URL.

The user's banner URL.

followerCount?: number

The number of followers the user has.

followingCount?: number

The number of users the user is following.

postsCount?: number

The number of posts the user has made.

labels: ComAtprotoLabelDefs.Label[]

Labels on the user's profile.

indexedAt?: Date

The time when the user's profile was indexed by the App View.

followUri?: string

The AT URI of the follow relationship between the bot and the user. Undefined if the bot is not following the user.

followedByUri?: string

The AT URI of the follow relationship between the bot and the user. Undefined if the user is not following the bot.

isMuted?: boolean

Whether the user is muted by the bot.

blockUri?: string

The AT URI of the block relationship between the bot and the user. Undefined if the user is not blocking the bot.

blockedBy?: boolean

Whether the bot is blocked by the user.

isLabeler?: boolean

Whether the user account is a labeler.

incomingChatPreference?: IncomingChatPreference

The user's preference for who can initiate a chat conversation.

Methods

follow()

Follow the user.

Returns

Promise<string>

The AT URI of the follow relationship.

unfollow()

Unfollow the user.

mute()

Mute the user.

unmute()

Unmute the user.

block()

Block the user.

Returns

Promise<string>

The AT URI of the block relationship.

unblock()

Unblock the user.

getPosts(options?)

Fetch the user's posts (up to 100 at a time, default 100).

Parameters

options: BotGetUserPostsOptions = {}

Optional configuration.

Returns

Promise<{ cursor: string | undefined; posts: Post[]; }>

The user's posts and a cursor for pagination.

getLikedPosts(options?)

Fetch the user's liked posts (up to 100 at a time, default 100).

Parameters

options: BotGetUserLikesOptions = {}

Optional configuration.

Returns

Promise<{ cursor: string | undefined; posts: Post[]; }>

The user's liked posts and a cursor for pagination.

getLists(options?)

Fetch the user's lists (up to 100 at a time, default 100).

Parameters

options: BotGetUserListsOptions = {}

Optional configuration.

Returns

Promise<{ cursor: string | undefined; lists: List[]; }>

The user's lists and a cursor for pagination.

getLabeler()

Fetch the labeler associated with the user, if there is any. Check the isLabeler property before calling this method!

Returns

Promise<Labeler>

The labeler associated with the user.

getConversation()

Get the DM conversation between the bot and this user.

getMessages(cursor?)

Fetch the message history between the bot and this user.

Parameters

cursor?: string

The cursor to begin fetching from.

Returns

Promise<{ cursor: string | undefined; messages: ChatMessage | DeletedChatMessage[]; }>

An array of messages and a cursor for pagination.

sendMessage(payload)

Send the user a direct message.

Parameters

payload: Omit<ChatMessagePayload, "conversationId">

The message to send.

labelAccount(labels, comment?)

Apply labels to the user's account. Note that this will label the user's profile and all posts they create! If you only want to label their profile, use the labelProfile method.

Parameters

labels: string[]

The labels to apply.

comment?: string

An optional comment to attach to the label.

negateAccountLabels(labels, comment?)

Negate labels previously applied to the user's account.

Parameters

labels: string[]

The labels to negate.

comment?: string

An optional comment to attach.

labelProfile(labels, comment?)

Apply labels to the user's profile only. If you wish to apply an account-level label that will also appear on all posts the user creates, use the labelAccount method. Note that you need a running Ozone instance to publish labels!

Parameters

labels: string[]

The labels to apply.

comment?: string

An optional comment to attach to the label.

negateProfileLabels(labels, comment?)

Negate labels previously applied to the user's profile.

Parameters

labels: string[]

The labels to negate.

comment?: string

An optional comment to attach.

fromView(view, bot)

Constructs an instance from a ProfileView.

Parameters

view: AppBskyActorDefs.ProfileView | AppBskyActorDefs.ProfileViewBasic

The ProfileView to construct from.

bot: Bot

The active Bot instance.

Returns

Profile