BaileysEx.Message.Receipt (baileys_ex v0.1.0-alpha.8)

Copy Markdown View Source

Receipt node construction and receipt-event parsing.

Summary

Functions

Constructs a receipt node (delivery, read, played, etc.) for the given message IDs.

Parses incoming receipt nodes and generates runtime update events.

Aggregates message keys and sends read receipts according to privacy settings.

Builds and sends a receipt node using the provided sender function.

Types

receipt_type()

@type receipt_type() ::
  :delivered
  | :read
  | :read_self
  | :played
  | :sender
  | :retry
  | :hist_sync
  | :peer_msg

Functions

build_receipt_node(jid, participant, list, type, opts \\ [])

@spec build_receipt_node(
  String.t(),
  String.t() | nil,
  [String.t()],
  receipt_type(),
  keyword()
) ::
  BaileysEx.BinaryNode.t()

Constructs a receipt node (delivery, read, played, etc.) for the given message IDs.

process_receipt(node, event_emitter)

@spec process_receipt(BaileysEx.BinaryNode.t(), GenServer.server()) :: :ok

Parses incoming receipt nodes and generates runtime update events.

read_messages(sender, keys, privacy_settings, opts \\ [])

@spec read_messages(
  (BaileysEx.BinaryNode.t() -> :ok | {:error, term()}),
  [map()],
  map(),
  keyword()
) ::
  :ok | {:error, term()}

Aggregates message keys and sends read receipts according to privacy settings.

send_receipt(sender, jid, participant, ids, type, opts \\ [])

@spec send_receipt(
  (BaileysEx.BinaryNode.t() -> :ok | {:error, term()}),
  String.t(),
  String.t() | nil,
  [String.t()],
  receipt_type(),
  keyword()
) :: :ok | {:error, term()}

Builds and sends a receipt node using the provided sender function.