class Conversation

Represents a DM conversation on Bluesky.

Constructor

constructor(data, bot)

Parameters

data: ConversationData

Data used to construct the conversation.

bot: Bot

The active Bot instance.

Properties

id: string

The conversation's ID.

muted: boolean

Whether the bot account has this conversation muted.

unreadCount: number

The number of unread messages in the conversation.

members: Profile[]

The users that are members in this conversation.

Methods

getMessages(cursor?)

Fetch a list of messages in this conversation. This method returns 100 messages at a time, beginning from the latest message, alongside a cursor to fetch the next 100.

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, options?)

Send a message in the conversation.

Parameters

payload: Omit<ChatMessagePayload, "conversationId">

The message to send.

options?: BotSendMessageOptions

Additional options for sending the message.

Returns

Promise<ChatMessage>

The sent message.

leave()

Leave the conversation.

fromView(view, bot)

Constructs an instance from a ConvoView.

Parameters

bot: Bot