Class: MessageBuilder
@sapphire/discord.js-utilities.MessageBuilder
A message builder class, it implements the MessageCreateOptions interface.
Implements
Constructors
constructor
• new MessageBuilder(options?
)
Parameters
Name | Type |
---|---|
options? | MessageBuilderResolvable |
Defined in
projects/utilities/packages/discord.js-utilities/src/lib/builders/MessageBuilder.ts:47
Properties
allowedMentions
• Optional
allowedMentions: MessageMentionOptions
Which mentions should be parsed from the message content.
Implementation of
MessageCreateOptions.allowedMentions
Defined in
projects/utilities/packages/discord.js-utilities/src/lib/builders/MessageBuilder.ts:39
content
• Optional
content: string
The content for the message. If set to undefined and the builder is used to edit, the content will not be replaced.
Implementation of
MessageCreateOptions.content
Defined in
projects/utilities/packages/discord.js-utilities/src/lib/builders/MessageBuilder.ts:28
embeds
• Optional
embeds: (APIEmbed
| JSONEncodable
<APIEmbed
>)[]
The embeds for the message. If set to undefined and the builder is used to edit, the embed will not be replaced.
Remark
There is a maximum of 10 embeds in 1 message
Implementation of
MessageCreateOptions.embeds
Defined in
projects/utilities/packages/discord.js-utilities/src/lib/builders/MessageBuilder.ts:34
files
• Optional
files: (Stream
| Attachment
| BufferResolvable
| AttachmentBuilder
| AttachmentPayload
| JSONEncodable
<APIAttachment
>)[]
Files to send with the message. This should not be set when editing a message, as Discord does not support editing file attachments.
Implementation of
MessageCreateOptions.files
Defined in
projects/utilities/packages/discord.js-utilities/src/lib/builders/MessageBuilder.ts:45
nonce
• Optional
nonce: string
| number
The nonce for the message.
Default
''
Implementation of
MessageCreateOptions.nonce
Defined in
projects/utilities/packages/discord.js-utilities/src/lib/builders/MessageBuilder.ts:22
tts
• Optional
tts: boolean
Whether or not the message should be spoken aloud.
Default
false
Implementation of
MessageCreateOptions.tts
Defined in
projects/utilities/packages/discord.js-utilities/src/lib/builders/MessageBuilder.ts:16
defaults
▪ Static
defaults: MessageBuilderResolvable
= {}
The default values for all MessageBuilder instances.
Defined in
projects/utilities/packages/discord.js-utilities/src/lib/builders/MessageBuilder.ts:141
Methods
addFile
▸ addFile(file
): MessageBuilder
Adds a new value for the files field array.
Parameters
Name | Type | Description |
---|---|---|
file | Stream | Attachment | BufferResolvable | AttachmentBuilder | AttachmentPayload | JSONEncodable <APIAttachment > | The file to add to the files field array. |
Returns
Defined in
projects/utilities/packages/discord.js-utilities/src/lib/builders/MessageBuilder.ts:113
setAllowedMentions
▸ setAllowedMentions(allowedMentions?
): MessageBuilder
Sets the value for the allowedMentions field.
Parameters
Name | Type | Description |
---|---|---|
allowedMentions? | MessageMentionOptions | Which mentions should be parsed from the message content. |
Returns
Defined in
projects/utilities/packages/discord.js-utilities/src/lib/builders/MessageBuilder.ts:104
setContent
▸ setContent(content?
): MessageBuilder
Sets the value for the content field.
Parameters
Name | Type | Description |
---|---|---|
content? | string | The content for the message. If set to undefined and the builder is used to edit, the content will not be replaced. |
Returns
Defined in
projects/utilities/packages/discord.js-utilities/src/lib/builders/MessageBuilder.ts:79
setEmbeds
▸ setEmbeds(embeds?
): MessageBuilder
Sets the value for the MessageBuilder.embed field.
Parameters
Name | Type | Description |
---|---|---|
embeds? | (APIEmbed | JSONEncodable <APIEmbed >)[] | The embeds for the message. If set to undefined and the builder is used to edit, the embed will not be replaced. There is a maximum of 10 embeds per message |
Returns
Remark
When providing more than 10 embeds, the array will automatically be sliced down to the first 10.
Defined in
projects/utilities/packages/discord.js-utilities/src/lib/builders/MessageBuilder.ts:90
setFile
▸ setFile(file
): MessageBuilder
Sets a single value for the files field array.
Parameters
Name | Type | Description |
---|---|---|
file | Stream | Attachment | BufferResolvable | AttachmentBuilder | AttachmentPayload | JSONEncodable <APIAttachment > | The file to send with the message. This should not be set when editing a message, as Discord does not support editing file attachments. |
Returns
Defined in
projects/utilities/packages/discord.js-utilities/src/lib/builders/MessageBuilder.ts:123
setFiles
▸ setFiles(files?
): MessageBuilder
Sets the value for the files field.
Parameters
Name | Type | Description |
---|---|---|
files? | (Stream | Attachment | BufferResolvable | AttachmentBuilder | AttachmentPayload | JSONEncodable <APIAttachment >)[] | The files to send with the message. This should not be set when editing a message, as Discord does not support editing file attachments. |
Returns
Defined in
projects/utilities/packages/discord.js-utilities/src/lib/builders/MessageBuilder.ts:133
setNonce
▸ setNonce(nonce?
): MessageBuilder
Sets the value for the nonce field.
Parameters
Name | Type | Description |
---|---|---|
nonce? | string | The nonce for the message. |
Returns
Defined in
projects/utilities/packages/discord.js-utilities/src/lib/builders/MessageBuilder.ts:69
setTTS
▸ setTTS(tts?
): MessageBuilder
Sets the value for the tts field.
Parameters
Name | Type | Description |
---|---|---|
tts? | boolean | Whether or not the message should be spoken aloud. |
Returns
Defined in
projects/utilities/packages/discord.js-utilities/src/lib/builders/MessageBuilder.ts:60