Skip to main content

Class: MessageBuilder

discord.js-utilities/src.MessageBuilder

A message builder class, it implements the {@link MessageOptions} interface.

Implements

Constructors

constructor

new MessageBuilder(options?)

Parameters

NameType
options?MessageBuilderResolvable

Defined in

projects/utilities/packages/discord.js-utilities/src/lib/builders/MessageBuilder.ts:45

Properties

allowedMentions

Optional allowedMentions: MessageMentionOptions

Which mentions should be parsed from the message content.

Implementation of

MessageOptions.allowedMentions

Defined in

projects/utilities/packages/discord.js-utilities/src/lib/builders/MessageBuilder.ts:37


content

Optional content: null | 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

MessageOptions.content

Defined in

projects/utilities/packages/discord.js-utilities/src/lib/builders/MessageBuilder.ts:26


embeds

Optional embeds: (MessageEmbed | MessageEmbedOptions | 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

MessageOptions.embeds

Defined in

projects/utilities/packages/discord.js-utilities/src/lib/builders/MessageBuilder.ts:32


files

Optional files: (FileOptions | BufferResolvable | Stream | MessageAttachment)[]

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

MessageOptions.files

Defined in

projects/utilities/packages/discord.js-utilities/src/lib/builders/MessageBuilder.ts:43


nonce

Optional nonce: string | number

The nonce for the message.

default ''

Implementation of

MessageOptions.nonce

Defined in

projects/utilities/packages/discord.js-utilities/src/lib/builders/MessageBuilder.ts:20


tts

Optional tts: boolean

Whether or not the message should be spoken aloud.

default false

Implementation of

MessageOptions.tts

Defined in

projects/utilities/packages/discord.js-utilities/src/lib/builders/MessageBuilder.ts:14


defaults

Static defaults: MessageBuilderResolvable = {}

The default values for all MessageBuilder instances.

Defined in

projects/utilities/packages/discord.js-utilities/src/lib/builders/MessageBuilder.ts:139

Methods

addFile

addFile(file): MessageBuilder

Adds a new value for the MessageBuilder.files field array.

Parameters

NameTypeDescription
fileFileOptions | BufferResolvable | Stream | MessageAttachmentThe file to add to the MessageBuilder.files field array.

Returns

MessageBuilder

Defined in

projects/utilities/packages/discord.js-utilities/src/lib/builders/MessageBuilder.ts:111


setAllowedMentions

setAllowedMentions(allowedMentions?): MessageBuilder

Sets the value for the MessageBuilder.allowedMentions field.

Parameters

NameTypeDescription
allowedMentions?MessageMentionOptionsWhich mentions should be parsed from the message content.

Returns

MessageBuilder

Defined in

projects/utilities/packages/discord.js-utilities/src/lib/builders/MessageBuilder.ts:102


setContent

setContent(content?): MessageBuilder

Sets the value for the MessageBuilder.content field.

Parameters

NameTypeDescription
content?stringThe content for the message. If set to undefined and the builder is used to edit, the content will not be replaced.

Returns

MessageBuilder

Defined in

projects/utilities/packages/discord.js-utilities/src/lib/builders/MessageBuilder.ts:77


setEmbeds

setEmbeds(embeds?): MessageBuilder

Sets the value for the {@link MessageBuilder.embed} field.

remark When providing more than 10 embeds, the array will automatically be sliced down to the first 10.

Parameters

NameTypeDescription
embeds?(MessageEmbed | MessageEmbedOptions | 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

MessageBuilder

Defined in

projects/utilities/packages/discord.js-utilities/src/lib/builders/MessageBuilder.ts:88


setFile

setFile(file): MessageBuilder

Sets a single value for the MessageBuilder.files field array.

Parameters

NameTypeDescription
fileFileOptions | BufferResolvable | Stream | MessageAttachmentThe file to send with the message. This should not be set when editing a message, as Discord does not support editing file attachments.

Returns

MessageBuilder

Defined in

projects/utilities/packages/discord.js-utilities/src/lib/builders/MessageBuilder.ts:121


setFiles

setFiles(files?): MessageBuilder

Sets the value for the MessageBuilder.files field.

Parameters

NameTypeDescription
files?(FileOptions | BufferResolvable | Stream | MessageAttachment)[]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

MessageBuilder

Defined in

projects/utilities/packages/discord.js-utilities/src/lib/builders/MessageBuilder.ts:131


setNonce

setNonce(nonce?): MessageBuilder

Sets the value for the MessageBuilder.nonce field.

Parameters

NameTypeDescription
nonce?stringThe nonce for the message.

Returns

MessageBuilder

Defined in

projects/utilities/packages/discord.js-utilities/src/lib/builders/MessageBuilder.ts:67


setTTS

setTTS(tts?): MessageBuilder

Sets the value for the MessageBuilder.tts field.

Parameters

NameTypeDescription
tts?booleanWhether or not the message should be spoken aloud.

Returns

MessageBuilder

Defined in

projects/utilities/packages/discord.js-utilities/src/lib/builders/MessageBuilder.ts:58