BaileysEx.Feature.Profile (baileys_ex v0.1.0-alpha.7)

Copy Markdown View Source

Profile management functions aligned with Baileys chats.ts.

Summary

Functions

Fetch profile status text for one or more JIDs via USync.

Fetch the business profile for a given JID.

Fetch the profile-picture URL for a user or group.

Remove the profile picture for yourself or a group.

Update the display name via the Baileys pushNameSetting app-state patch.

Update the profile picture for yourself or a group.

Update the profile status text for the current account.

Types

picture_type()

@type picture_type() :: :preview | :image

Functions

fetch_status(queryable, jids, opts \\ [])

@spec fetch_status(term(), [String.t()], keyword()) ::
  {:ok, [map()]} | {:error, term()}

Fetch profile status text for one or more JIDs via USync.

get_business_profile(queryable, jid, opts \\ [])

@spec get_business_profile(term(), String.t(), keyword()) ::
  {:ok, map() | nil} | {:error, term()}

Fetch the business profile for a given JID.

picture_url(queryable, jid, type \\ :preview, opts \\ [])

@spec picture_url(term(), String.t(), picture_type(), keyword()) ::
  {:ok, String.t() | nil} | {:error, term()}

Fetch the profile-picture URL for a user or group.

remove_picture(queryable, jid, opts \\ [])

@spec remove_picture(term(), String.t(), keyword()) ::
  {:ok, BaileysEx.BinaryNode.t()} | {:error, term()}

Remove the profile picture for yourself or a group.

update_name(conn, name)

@spec update_name(term(), String.t()) :: {:ok, map()} | {:error, term()}

Update the display name via the Baileys pushNameSetting app-state patch.

update_picture(queryable, jid, image_data, dimensions \\ nil, opts \\ [])

@spec update_picture(term(), String.t(), term(), map() | nil, keyword()) ::
  {:ok, BaileysEx.BinaryNode.t()} | {:error, term()}

Update the profile picture for yourself or a group.

Mirrors Baileys updateProfilePicture. The image bytes are obtained from opts[:picture_generator] when supplied. Without a generator, the function returns an explicit dependency error rather than silently inventing a local transform.

update_status(queryable, status, opts \\ [])

@spec update_status(term(), String.t(), keyword()) ::
  {:ok, BaileysEx.BinaryNode.t()} | {:error, term()}

Update the profile status text for the current account.