Class: MessageBuilder
A message builder class, it implements the MessageCreateOptions interface.
Implements
Constructors
new MessageBuilder()
new MessageBuilder(
options?:MessageBuilderResolvable):MessageBuilder
Parameters
| Parameter | Type |
|---|---|
options? | MessageBuilderResolvable |
Returns
Defined in
projects/utilities/packages/discord.js-utilities/src/lib/builders/MessageBuilder.ts:53
Properties
allowedMentions?
optionalallowedMentions: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:45
components?
optionalcomponents: readonly (APIActionRowComponent<APIMessageActionRowComponent> |JSONEncodable<APIActionRowComponent<APIMessageActionRowComponent>> |ActionRowData<MessageActionRowComponentBuilder|MessageActionRowComponentData>)[]
The components for the message. If set to undefined and the builder is used to edit, the components will not be replaced.
Implementation of
MessageCreateOptions.components
Defined in
projects/utilities/packages/discord.js-utilities/src/lib/builders/MessageBuilder.ts:40
content?
optionalcontent: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:29
embeds?
optionalembeds: readonly (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:35
files?
optionalfiles: readonly (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:51
nonce?
optionalnonce: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:23
tts?
optionaltts: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:17
defaults
staticdefaults:MessageBuilderResolvable={}
The default values for all MessageBuilder instances.
Defined in
projects/utilities/packages/discord.js-utilities/src/lib/builders/MessageBuilder.ts:158
Methods
addFile()
addFile(
file:Stream|Attachment|BufferResolvable|AttachmentBuilder|AttachmentPayload|JSONEncodable<APIAttachment>):this
Adds a new value for the MessageBuilder.files field array.
Parameters
| Parameter | Type | Description |
|---|---|---|
file | Stream | Attachment | BufferResolvable | AttachmentBuilder | AttachmentPayload | JSONEncodable<APIAttachment> | The file to add to the MessageBuilder.files field array. |
Returns
this
Defined in
projects/utilities/packages/discord.js-utilities/src/lib/builders/MessageBuilder.ts:130
setAllowedMentions()
setAllowedMentions(
allowedMentions?:MessageMentionOptions):this
Sets the value for the MessageBuilder.allowedMentions field.
Parameters
| Parameter | Type | Description |
|---|---|---|
allowedMentions? | MessageMentionOptions | Which mentions should be parsed from the message content. |
Returns
this
Defined in
projects/utilities/packages/discord.js-utilities/src/lib/builders/MessageBuilder.ts:121
setComponents()
setComponents(
components?: readonly (APIActionRowComponent<APIMessageActionRowComponent> |JSONEncodable<APIActionRowComponent<APIMessageActionRowComponent>> |ActionRowData<MessageActionRowComponentBuilder|MessageActionRowComponentData>)[]):this
Sets the value for the MessageBuilder.components field.
Parameters
| Parameter | Type | Description |
|---|---|---|
components? | readonly (APIActionRowComponent<APIMessageActionRowComponent> | JSONEncodable<APIActionRowComponent<APIMessageActionRowComponent>> | ActionRowData<MessageActionRowComponentBuilder | MessageActionRowComponentData>)[] | The components for the message. If set to undefined and the builder is used to edit, the components will not be replaced. |
Returns
this
Defined in
projects/utilities/packages/discord.js-utilities/src/lib/builders/MessageBuilder.ts:112
setContent()
setContent(
content?:string):this
Sets the value for the MessageBuilder.content field.
Parameters
| Parameter | 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
this
Defined in
projects/utilities/packages/discord.js-utilities/src/lib/builders/MessageBuilder.ts:86
setEmbeds()
setEmbeds(
embeds?: readonly (APIEmbed|JSONEncodable<APIEmbed>)[]):this
Sets the value for the MessageBuilder.embed field.
Parameters
| Parameter | Type | Description |
|---|---|---|
embeds? | readonly (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
this
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:97
setFile()
setFile(
file:Stream|Attachment|BufferResolvable|AttachmentBuilder|AttachmentPayload|JSONEncodable<APIAttachment>):this
Sets a single value for the MessageBuilder.files field array.
Parameters
| Parameter | 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
this
Defined in
projects/utilities/packages/discord.js-utilities/src/lib/builders/MessageBuilder.ts:140
setFiles()
setFiles(
files?: (Stream|Attachment|BufferResolvable|AttachmentBuilder|AttachmentPayload|JSONEncodable<APIAttachment>)[]):this
Sets the value for the MessageBuilder.files field.
Parameters
| Parameter | 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
this
Defined in
projects/utilities/packages/discord.js-utilities/src/lib/builders/MessageBuilder.ts:150
setNonce()
setNonce(
nonce?:string):this
Sets the value for the MessageBuilder.nonce field.
Parameters
| Parameter | Type | Description |
|---|---|---|
nonce? | string | The nonce for the message. |
Returns
this
Defined in
projects/utilities/packages/discord.js-utilities/src/lib/builders/MessageBuilder.ts:76
setTTS()
setTTS(
tts?:boolean):this
Sets the value for the MessageBuilder.tts field.
Parameters
| Parameter | Type | Description |
|---|---|---|
tts? | boolean | Whether or not the message should be spoken aloud. |
Returns
this
Defined in
projects/utilities/packages/discord.js-utilities/src/lib/builders/MessageBuilder.ts:67