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

    Class Poll

    Chainable poll builder wrapping the socket's own sendMessage({ poll }) path. Per-option images and hand-built quiz hashes are deliberately NOT supported (see the .js docblock) — quiz mode defers to the socket's tested logic.

    Hierarchy (View Summary)

    Index
    MAX_NAME_LENGTH: number

    WhatsApp caps the poll question at 255 characters.

    MAX_OPTION_LENGTH: number

    WhatsApp caps each option at 100 characters.

    MAX_OPTIONS: number

    WhatsApp caps a poll at 12 options.

    • Rejects duplicates (votes are keyed by option text) and enforces MAX_OPTIONS.

      Parameters

      • name: string

      Returns this

    • Requires a name + at least 2 unique options; runs assertValid() first.

      Returns { poll: Record<string, any> }

    • Remove one option by exact text (clears the quiz answer if it pointed at it).

      Parameters

      • name: string

      Returns this

    • Build and send via the socket's sendMessage().

      Parameters

      • jid: string
      • Optionaloptions: Record<string, any>

      Returns Promise<any>

    • Parameters

      • OptionalisAnnouncement: boolean

      Returns this

    • Throws on an unparseable date instead of shipping endTime: NaN.

      Parameters

      • date: string | number | Date

      Returns this

    • Pin the 32-byte poll messageSecret (otherwise the socket mints a random one).

      Parameters

      • secret: Uint8Array

      Returns this

    • Parameters

      • OptionalcanSelectMultiple: boolean

      Returns this

    • Replace every option at once; rolls back on error.

      Parameters

      • names: string[]

      Returns this

    • Quiz mode — must match one of the added options exactly.

      Parameters

      • correctOptionName: string

      Returns this

    • Alias of build().

      Returns { poll: Record<string, any> }

    • Every problem with the current state; empty when safe to send.

      Returns string[]