import type { AppBskyRichtextFacet, ChatBskyConvoDefs } from "@atcute/bluesky"; import type RichText from "@atcute/bluesky-richtext-builder"; import type { Bot, StrongRef } from "../../bot/Bot.js"; import { Facet } from "../post/Facet.js"; import { BaseChatMessage, type BaseChatMessageData } from "./BaseChatMessage.js"; /** * Data used to construct a ChatMessage class. * @see ChatMessage */ export interface ChatMessageData extends BaseChatMessageData { text: string; facets?: Array | undefined; embed?: StrongRef | undefined; } /** * Represents a message in a chat conversation. */ export declare class ChatMessage extends BaseChatMessage { /** The message's text. */ text: string; /** Annotations of text (mentions, URLs, hashtags, etc) */ facets?: Array; /** An embedded reference to a record. */ embed?: StrongRef; /** * @param data Data used to construct the message. * @param bot The active Bot instance. */ constructor({ text, facets, embed, ...props }: ChatMessageData, bot: Bot); /** * Constructs an instance from a MessageView. */ static fromView(view: ChatBskyConvoDefs.MessageView, bot: Bot, conversationId?: string): ChatMessage; } /** * Data that can be used to create a ChatMessage. */ export interface ChatMessagePayload { /** The ID of the conversation to send this message in. */ conversationId: string; /** The message text. Can be a string or a RichText instance containing facets. */ text: string | RichText; /** * A facet represents a range within the message's text that has special meaning * (e.g. mentions, links, tags). Prefer to use the {@link RichText} class to create * posts with facets. */ facets?: Array | undefined; /** A reference to a record to embed in the message. */ embed?: StrongRef | undefined; }