class Post

extends PostReference

Represents a post on Bluesky.

Constructor

constructor(data, bot)

Parameters

data: PostData

Post data.

bot: Bot

The active Bot instance.

Properties

uri: string

The post's AT URI.

cid: string

The post's CID.

replyRef?: ReplyRef

A reference to the post's parent and root post.

text: string

The post text.

author: Profile

The post's author.

facets?: Facet[]

A facet represents a range within the post's text that has special meaning (e.g. mentions, links, tags).

See also: Links, mentions, and rich text | Bluesky

langs?: string[]

A list of two-letter language codes that the post is written in.

embed?: PostEmbed

The embed attached to the post, if there is any.

labels?: ComAtprotoLabelDefs.Label[]

The labels attached to the post, if there are any.

tags?: string[]

Additional non-inline tags attached to the post.

threadgate?: Threadgate

The threadgate attached to the post, if there is any.

root?: Post

The root post of this post's thread.

parent?: Post

The post's parent.

children?: Post[]

The post's children.

createdAt: Date

The time the post was created.

indexedAt?: Date

The time the post was indexed by the App View.

likeUri?: string

The post's like URI, if the bot has liked the post.

repostUri?: string

The post's repost URI, if the bot has reposted the post.

likeCount?: number

The post's like count.

repostCount?: number

The post's repost count.

replyCount?: number

The post's reply count.

Methods

reply(payload, options?)

Reply to the post.

Parameters

payload: PostPayload

The post payload.

options: BotPostOptions = {}

Optional configuration.

Returns

Promise<PostReference>

A reference to the created post.

quote(payload, options?)

Create a new post with this post quoted.

Parameters

payload: PostPayload

The post payload.

options: BotPostOptions = {}

Optional configuration.

Returns

Promise<PostReference>

A reference to the created post.

like()

Like the post.

unlike()

Unlike the post.

repost()

Repost the post.

deleteRepost()

If this post has been reposted, delete the repost.

delete()

Delete the post.

fetch(options?)

Refetch the post.

Parameters

options: BotGetPostOptions = {}

Optional configuration.

Returns

Promise<Post>

fetchRoot(options?)

Fetch the root post of the thread.

Parameters

options: PostFetchRootOptions = {}

Optional configuration.

Returns

Promise<Post | null>

fetchParent(options?)

Fetch the parent post.

Parameters

options: PostFetchParentOptions = {}

Optional configuration.

Returns

Promise<Post | null>

fetchChildren(options?)

Fetch the children of the post.

Parameters

options: PostFetchChildrenOptions = {}

Optional configuration.

Returns

Promise<Post[]>

getLikeCount()

Fetch the post's current like count.

Returns

Promise<number | null>

getRepostCount()

Fetch the post's current repost count.

Returns

Promise<number | null>

getReplyCount()

Fetch the post's current reply count.

Returns

Promise<number | null>

getLikes(cursor?)

Fetch a list of users who liked this post. This method returns 100 likes at a time, alongside a cursor to fetch the next 100.

Parameters

cursor?: string

The cursor to begin fetching from.

Returns

Promise<{ cursor: string | undefined; likes: Profile[]; }>

getReposts(cursor?)

Fetch a list of users who reposted this post. This method returns 100 users at a time, alongside a cursor to fetch the next 100.

Parameters

cursor?: string

The cursor to begin fetching from.

Returns

Promise<{ cursor: string | undefined; reposts: Profile[]; }>

fromView(view, bot)

Constructs an instance from a PostView.

Parameters

bot: Bot

Returns

Post

fromThreadView(view, bot)

Constructs an instance from a ThreadViewPost.

Returns

Post