@botmesh/core - v2.0.0-alpha.2
    Preparing search index...

    Class CrashableProvider

    A MockProvider whose sends hang once crash() was called (or once backend crashed).

    Hierarchy (View Summary)

    Index
    id: "mock" = 'mock'

    Stable transport tag (e.g. 'baileys', 'telegram') — used to namespace conversation keys if one Bot ever runs multiple providers concurrently.

    capabilities: ProviderCapabilities
    selfId: string | null = null

    The bot's own user id once connected (for group mention matching). Optional.

    outbox: MockOutgoing[] = []
    journal: MockJournalEntry[] = []

    Chronological journal of inbound messages/interactions (as emitted, before any chaos wrapper) and of every send with the ref it returned. Bounded by maxJournal.

    edits: MockEdit[] = []

    Edits recorded by editMessage (enabled by streaming 'edit'/'draft' or supports.edit).

    drafts: MockDraft[] = []

    Draft previews recorded by sendDraft (enabled by streaming: 'draft' or supports.drafts).

    deleted: MessageRef[] = []

    Messages deleted through deleteMessage (enabled by streaming not 'none' or supports.delete).

    acks: { interactionId: string; opts?: { text?: string; defer?: boolean } }[] = []

    Interaction acks recorded by acknowledgeInteraction, in order.

    textFormatFor?: (chatId: string) => TextFormat | undefined

    Per-chat text format — present only when MockProviderOptions.textFormatFor is given.

    maxJournal: number
    starts: number = 0

    start() calls so far.

    stops: number = 0

    stop() calls so far.

    • Records the ack in acks (button/callback interactions).

      Parameters

      • interactionId: string
      • Optionalopts: { text?: string; defer?: boolean }

      Returns Promise<void>

    • Bytes of a simulated media: a copy of the bytes behind the ref (incomingMedia, chat.sendMedia); an empty buffer for a legacy token: null ref (incoming(text, { type: 'image' })). A { url } token without bytes rejects with MediaUnavailableError — the mock never touches the network.

      Parameters

      Returns Promise<Buffer<ArrayBufferLike>>

    • Simulate an inbound media message (type: kind, body = caption). source bytes are what downloadMedia returns; { url } alone is metadata only, and the download then rejects with MediaUnavailableError.

      Parameters

      Returns void

    • Simulate a reaction to a message (bot.on('reaction'), 'reaction' hooks). to is the reacted message; the sender defaults to from (the chat), as in a DM.

      Parameters

      • emoji: string
      • opts: { to: MessageRef; from?: string; sender?: string; removed?: boolean }

      Returns void

    • Simulate an inbound call notification (what bot.on('call') and the CALL trigger receive). Reuse the same id to emit later updates of one call. For a group call pass chatId (the group) and isGroup: true; from is the caller.

      Parameters

      Returns void

    • Stop delivering sends: every later send hangs forever.

      Returns void