@japofc/baileys - v2.4.7
    Preparing search index...

    Class TypingIndicator

    Manages composing ("typing...") and recording ("recording...") presence indicators with per-JID timer tracking.

    const typing = createTypingIndicator(
    (jid, presence) => sock.sendPresenceUpdate(presence, jid)
    )

    // Simulate typing then send a message
    const result = await typing.simulateTyping(jid, 1500, () =>
    sock.sendMessage(jid, { text: 'Hello!' })
    )
    Index
    • Show typing for durationMs, run callback, then stop the indicator.

      Type Parameters

      • T

      Parameters

      • jid: string
      • durationMs: number
      • callback: () => T | Promise<T>

      Returns Promise<T>

      The return value of callback

      await typing.simulateTyping(jid, 2000, async () => {
      await sock.sendMessage(jid, { text: 'Here is your answer' })
      })
    • Show the "recording..." (audio/video) indicator for a JID.

      Parameters

      • jid: string
      • Optionaloptions: TypingOptions

      Returns Promise<void>

    • Show the "typing..." (composing) indicator for a JID.

      Parameters

      • jid: string
      • Optionaloptions: TypingOptions

      Returns Promise<void>

    • Stop any active composing/recording indicator for a JID.

      Parameters

      • jid: string

      Returns Promise<void>