Extended by
Implements
Constructors
Constructor
Parameters
Returns
MockProvider
Properties
id
Implementation of
IProvider.id
capabilities
Implementation of
IProvider.capabilities
selfId
Implementation of
IProvider.selfId
outbox
journal
send with the ref it returned. Bounded by maxJournal.
edits
streaming 'edit'/'draft' or supports.edit).
drafts
streaming: 'draft' or supports.drafts).
deleted
streaming not 'none' or supports.delete).
acks
interactionId
opts?
opts.text?
opts.defer?
textFormatFor?
Parameters
Returns
TextFormat | undefined
Implementation of
IProvider.textFormatFor
maxJournal
starts
start() calls so far.
stops
stop() calls so far.
Methods
editMessage()
undefined) unless enabled — see MockProviderOptions.supports.
Parameters
Returns
Promise<SendResult<unknown>>
Implementation of
IProvider.editMessage
acknowledgeInteraction()
Parameters
Returns
Promise<void>
Implementation of
IProvider.acknowledgeInteraction
deleteMessage()
undefined) unless enabled — see MockProviderOptions.supports.
Parameters
Returns
Promise<void>
Implementation of
IProvider.deleteMessage
sendDraft()
undefined) unless enabled — see MockProviderOptions.supports.
Parameters
Returns
Promise<void>
Implementation of
IProvider.sendDraft
stopDraft()
Returns
boolean
start()
Returns
Promise<void>
Implementation of
IProvider.start
stop()
Returns
Promise<void>
Implementation of
IProvider.stop
send()
Parameters
Returns
Promise<SendResult<unknown>>
Implementation of
IProvider.send
onEvent()
Parameters
Returns
() =>void
Implementation of
IProvider.onEvent
downloadMedia()
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>>
Implementation of
IProvider.downloadMedia
clearJournal()
seq counter keeps growing; outbox is untouched).
Returns
void
incoming()
Parameters
Returns
void
incomingMedia()
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
incomingLocation()
type: 'location', ctx.sharedLocation). The body is
the place name, else the address, else '' — as the real providers set it.
Parameters
Returns
void
interaction()
kind defaults to 'button').
Parameters
Returns
void
reaction()
bot.on('reaction'), 'reaction' hooks). to is
the reacted message; the sender defaults to from (the chat), as in a DM.
Parameters
Returns
void
call()
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