Constructor
new APIMessage(target, options)
Parameters:
Name | Type | Description |
---|---|---|
target |
MessageTarget | The target for this message to be sent to |
options |
MessageOptions | WebhookMessageOptions | Options passed in from send |
- Source:
Members
(nullable) data :Object
Data sendable to the API
Type:
- Object
- Source:
(nullable) files :Array.<Object>
Files sendable to the API
Type:
- Array.<Object>
- Source:
(readonly) isMessage :boolean
Whether or not the target is a message
Type:
- boolean
- Source:
(readonly) isUser :boolean
Whether or not the target is a user
Type:
- boolean
- Source:
(readonly) isWebhook :boolean
Whether or not the target is a webhook
Type:
- boolean
- Source:
options :MessageOptions|WebhookMessageOptions
Options passed in from send
Type:
- Source:
target :MessageTarget
The target for this message to be sent to
Type:
- Source:
Methods
(static) create(target, contentopt, optionsopt, extraopt) → {MessageOptions|WebhookMessageOptions}
Creates an `APIMessage` from user-level arguments.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
target |
MessageTarget | Target to send to | ||
content |
StringResolvable |
<optional> |
Content to send | |
options |
MessageOptions | WebhookMessageOptions | MessageAdditions |
<optional> |
{} | Options to use |
extra |
MessageOptions | WebhookMessageOptions |
<optional> |
{} | Extra options to add onto transformed options |
- Source:
Returns:
(static) partitionMessageAdditions(items) → {Array.<Array.<MessageEmbed>, Array.<MessageAttachment>>}
Partitions embeds and attachments.
Parameters:
Name | Type | Description |
---|---|---|
items |
Array.<(MessageEmbed|MessageAttachment)> | Items to partition |
- Source:
Returns:
- Type
- Array.<Array.<MessageEmbed>, Array.<MessageAttachment>>
(static) resolveFile(fileLike) → {Object}
Resolves a single file into an object sendable to the API.
Parameters:
Name | Type | Description |
---|---|---|
fileLike |
BufferResolvable | Stream | FileOptions | MessageAttachment | Something that could be resolved to a file |
- Source:
Returns:
- Type
- Object
(static) transformOptions(contentopt, optionsopt, extraopt, isWebhookopt) → {MessageOptions|WebhookMessageOptions}
Transforms the user-level arguments into a final options object. Passing a transformed options object alone into
this method will keep it the same, allowing for the reuse of the final options object.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
content |
StringResolvable |
<optional> |
Content to send | |
options |
MessageOptions | WebhookMessageOptions | MessageAdditions |
<optional> |
{} | Options to use |
extra |
MessageOptions | WebhookMessageOptions |
<optional> |
{} | Extra options to add onto transformed options |
isWebhook |
boolean |
<optional> |
false | Whether or not to use WebhookMessageOptions as the result |
- Source:
Returns:
makeContent() → {string|Array.<string>}
Makes the content of this message.
- Source:
Returns:
- Type
- string | Array.<string>
resolveData() → {APIMessage}
Resolves data.
- Source:
Returns:
- Type
- APIMessage
resolveFiles() → {Promise.<APIMessage>}
Resolves files.
- Source:
Returns:
- Type
- Promise.<APIMessage>
split() → {Array.<APIMessage>}
Converts this APIMessage into an array of APIMessages for each split content
- Source:
Returns:
- Type
- Array.<APIMessage>