Skip to content

MessagePayload

classe · Source

Represents a message to be sent to the API.

Constructor

new MessagePayload(target: MessageTarget, options: MessageOptions | WebhookMessageOptions)

Parameters

NameTypeDescription
targetMessageTargetThe target for this message to be sent to
optionsMessageOptions | WebhookMessageOptionsOptions passed in from send

Properties

target

target: MessageTarget

The target for this message to be sent to Source

options

options: MessageOptions | WebhookMessageOptions

Options passed in from send Source

data

nullable

data: APIMessage

Data sendable to the API Source

files

nullable

files: Array<MessageFile>

Files sendable to the API Source

isWebhook

readonly

isWebhook: boolean

Whether or not the target is a Webhook or a WebhookClientSource

isUser

readonly

isUser: boolean

Whether or not the target is a UserSource

isMessage

readonly

isMessage: boolean

Whether or not the target is a MessageSource

isMessageManager

readonly

isMessageManager: boolean

Whether or not the target is a MessageManagerSource

isInteraction

readonly

isInteraction: boolean

Whether or not the target is an Interaction or an InteractionWebhookSource

Methods

makeContent

makeContent(): string

Makes the content of this message. Returns: stringSource

resolveData

resolveData(): MessagePayload

Resolves data. Returns: MessagePayloadSource

resolveFiles

async

async resolveFiles(): Promise<MessagePayload>

Resolves files. Returns: Promise<MessagePayload>Source

resolveFile

static · async

async resolveFile(fileLike: BufferResolvable | Stream | FileOptions | MessageAttachment): Promise<MessageFile>

Resolves a single file into an object sendable to the API. Parameters

NameTypeDescription
fileLikeBufferResolvable | Stream | FileOptions | MessageAttachmentSomething that could be resolved to a file

Returns: Promise<MessageFile>Source

create

static

create(target: MessageTarget, options: string | MessageOptions | WebhookMessageOptions, extra?: MessageOptions | WebhookMessageOptions): MessagePayload

Creates a MessagePayload from user-level arguments. Parameters

NameTypeDescription
targetMessageTargetTarget to send to
optionsstring | MessageOptions | WebhookMessageOptionsOptions or content to use
extra?MessageOptions | WebhookMessageOptionsExtra options to add onto specified options Default: {}.

Returns: MessagePayloadSource

Unofficial software. Not affiliated with or supported by Discord.