import type { ComAtprotoLabelDefs } from "@atcute/atproto"; import type { AppBskyActorDefs, ChatBskyActorDefs } from "@atcute/bluesky"; import type { Did, ResourceUri } from "@atcute/lexicons"; import type { ToolsOzoneModerationDefs } from "@atcute/ozone"; import type { Bot, BotGetUserLikesOptions, BotGetUserListsOptions, BotGetUserPostsOptions, BotGetUserStarterPacksOptions } from "../bot/Bot.js"; import type { ChatMessagePayload } from "./chat/ChatMessage.js"; import type { Conversation } from "./chat/Conversation.js"; import type { List } from "./List.js"; import type { Post } from "./post/Post.js"; /** * Data used to construct a Profile class. */ export interface ProfileData { /** The user's DID. */ did: string; /** The user's handle. */ handle: string; /** The user's display name. */ displayName?: string | undefined; /** The user's profile description. */ description?: string | undefined; /** The user's avatar URL. */ avatar?: string | undefined; /** The user's banner URL. */ banner?: string | undefined; /** The number of followers the user has. */ followerCount?: number | undefined; /** The number of users the user is following. */ followingCount?: number | undefined; /** The number of posts the user has made. */ postsCount?: number | undefined; /** Labels on the user's profile. */ labels?: Array | undefined; /** The time when the user's profile was indexed by the AppView. */ indexedAt?: Date | undefined; /** The AT URI of the follow relationship between the bot and the user. */ followUri?: string | undefined; /** The AT URI of the follow relationship between the bot and the user. */ followedByUri?: string | undefined; /** Whether the user is muted by the bot. */ isMuted?: boolean | undefined; /** The AT URI of the block relationship between the bot and the user. */ blockUri?: string | undefined; /** Whether the bot is blocked by the user. */ isBlockedBy?: boolean | undefined; /** Whether the user account is a labeler. */ isLabeler?: boolean | undefined; /** The user's preference for who can initiate a chat conversation. */ incomingChatPreference?: IncomingChatPreference | undefined; } /** * A Bluesky user profile. */ export declare class Profile { protected bot: Bot; /** The user's DID. */ did: Did; /** The user's handle. */ handle: string; /** The user's display name. */ displayName?: string; /** The user's profile description . */ description?: string; /** The user's avatar URL. */ avatar?: string; /** The user's banner URL. */ banner?: string; /** The number of followers the user has. */ followerCount?: number; /** The number of users the user is following. */ followingCount?: number; /** The number of posts the user has made. */ postsCount?: number; /** Labels on the user's profile. */ labels: Array; /** The time when the user's profile was indexed by the AppView. */ indexedAt?: Date; /** * The AT URI of the follow relationship between the bot and the user. * Undefined if the bot is not following the user. */ followUri?: ResourceUri; /** * The AT URI of the follow relationship between the bot and the user. * Undefined if the user is not following the bot. */ followedByUri?: ResourceUri; /** Whether the user is muted by the bot. */ isMuted?: boolean; /** * The AT URI of the block relationship between the bot and the user. * Undefined if the user is not blocking the bot. */ blockUri?: ResourceUri; /** Whether the bot is blocked by the user. */ blockedBy?: boolean; /** Whether the user account is a labeler. */ isLabeler?: boolean; /** The user's preference for who can initiate a chat conversation. */ incomingChatPreference?: IncomingChatPreference; /** The DM conversation between the bot and this user. */ private conversation?; /** Whether the bot is following the user. */ get isFollowing(): boolean; /** Whether the user is following the bot */ get followedBy(): boolean; /** Whether the bot is blocking the user */ get isBlocking(): boolean; /** Whether the user is being followed and is following the bot */ get isMutual(): boolean; /** * @param data Profile data. * @param bot The active Bot instance. */ constructor({ did, handle, displayName, description, avatar, banner, followerCount, followingCount, postsCount, labels, indexedAt, followUri, followedByUri, isMuted, blockUri, isBlockedBy, isLabeler, incomingChatPreference }: ProfileData, bot: Bot); /** * Follow the user. * @returns The AT URI of the follow relationship. */ follow(): Promise; /** * Unfollow the user. */ unfollow(): Promise; /** * Mute the user. */ mute(): Promise; /** * Unmute the user. */ unmute(): Promise; /** * Block the user. * @returns The AT URI of the block relationship. */ block(): Promise; /** * Unblock the user. */ unblock(): Promise; /** * Fetch the user's posts (up to 100 at a time, default 100). * @param options Optional configuration. * @returns The user's posts and a cursor for pagination. */ getPosts(options?: BotGetUserPostsOptions): Promise<{ cursor?: string; posts: Array; }>; /** * Iterate over the user's posts. */ iteratePosts(options?: BotGetUserPostsOptions): AsyncIterableIterator; /** * Fetch the user's liked posts (up to 100 at a time, default 100). * @param options Optional configuration. * @returns The user's liked posts and a cursor for pagination. */ getLikedPosts(options?: BotGetUserLikesOptions): Promise<{ cursor?: string; posts: Array; }>; /** * Iterate over the user's liked posts. */ iterateLikedPosts(options?: BotGetUserLikesOptions): AsyncIterableIterator; /** * Fetch the user's lists (up to 100 at a time, default 100). * @param options Optional configuration. * @returns The user's lists and a cursor for pagination. */ getLists(options?: BotGetUserListsOptions): Promise<{ cursor?: string; lists: Array; }>; /** * Iterate over the user's lists. */ iterateLists(options?: BotGetUserListsOptions): AsyncIterableIterator; /** * Fetch the user's starter packs (up to 25 at a time, default 25). * @returns The user's starter packs. */ getStarterPacks(options?: BotGetUserStarterPacksOptions): Promise; /** * Fetch the labeler associated with the user, if there is any. * Check the {@link isLabeler} property before calling this method! * @returns The labeler associated with the user. */ getLabeler(): Promise; /** * Get the DM conversation between the bot and this user. */ getConversation(): Promise; /** * Fetch the message history between the bot and this user. * @param cursor The cursor to begin fetching from. * @returns An array of messages and a cursor for pagination. */ getMessages(cursor?: string | undefined): Promise<{ cursor?: string; messages: Array; }>; /** * Send the user a direct message. * @param payload The message to send. */ sendMessage(payload: Omit): Promise; /** * 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 {@link labelProfile} method. * @param labels The labels to apply. * @param comment An optional comment to attach to the label. */ labelAccount(labels: Array, comment?: string): Promise; /** * Negate labels previously applied to the user's account. * @param labels The labels to negate. * @param comment An optional comment to attach. */ negateAccountLabels(labels: Array, comment?: string): Promise; /** * 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 {@link labelAccount} method. Note that you need a running Ozone instance to publish labels! * @param labels The labels to apply. * @param comment An optional comment to attach to the label. */ labelProfile(labels: Array, comment?: string): Promise; /** * Negate labels previously applied to the user's profile. * @param labels The labels to negate. * @param comment An optional comment to attach. */ negateProfileLabels(labels: Array, comment?: string): Promise; /** * Constructs an instance from a ProfileView. * @param view The ProfileView to construct from. * @param bot The active Bot instance. */ static fromView(view: ChatBskyActorDefs.ProfileViewBasic | AppBskyActorDefs.ProfileViewDetailed | AppBskyActorDefs.ProfileView | AppBskyActorDefs.ProfileViewBasic, bot: Bot): Profile; } /** * A user's preference for who can initiate a chat conversation. * @enum */ export declare const IncomingChatPreference: { /** Receive messages from everyone. */ readonly All: "all"; /** Receive messages from nobody. */ readonly None: "none"; /** Receive messages from users the user follows. */ readonly Following: "following"; }; export type IncomingChatPreference = typeof IncomingChatPreference[keyof typeof IncomingChatPreference];