Skip to content

EmbedBuilder

EmbedBuilder

It’s a class that creates a Discord embed.

Kind: global class

new EmbedBuilder([data])

It takes in an object, and then assigns the values of the object to the class properties.

ParamDescription
[data]The data to use for the embed.

embedBuilder.setTitle(title) ⇒

It sets the title of the book and returns the book object.

Kind: instance method of EmbedBuilder
Returns: The object itself.

ParamTypeDescription
titlestringThe title of the modal.

embedBuilder.setDescription(description) ⇒

The function sets the description of the object and returns the object.

Kind: instance method of EmbedBuilder
Returns: The object itself.

ParamTypeDescription
descriptionstringThe description of the field.

embedBuilder.setURL(url) ⇒

This function sets the url property of the object it is called on to the value of the argument passed in, and then returns the object it was called on.

Kind: instance method of EmbedBuilder
Returns: The object itself.

ParamTypeDescription
urlstringThe URL to send the request to.

embedBuilder.setTimestamp(timestamp) ⇒

It takes a timestamp and converts it to an ISO string.

Kind: instance method of EmbedBuilder
Returns: The object itself.

ParamDescription
timestampThe timestamp of the message.

embedBuilder.setColor(color) ⇒

This function sets the color of the object.

Kind: instance method of EmbedBuilder
Returns: The color of the object.

ParamDescription
colorThe color of the line.

embedBuilder.setFooter(footer) ⇒

The setFooter function takes a footer parameter and sets the footer property of the object to the footer parameter. It then returns the object

Kind: instance method of EmbedBuilder
Returns: The object itself.

ParamDescription
footerThe footer text.

embedBuilder.setImage(image) ⇒

It sets the image property of the object to the image parameter if the image parameter is not null, otherwise it sets the image property to undefined

Kind: instance method of EmbedBuilder
Returns: The object itself.

ParamDescription
imageThe image to display.

embedBuilder.setThumbnail(thumbnail) ⇒

It sets the thumbnail property of the object to the thumbnail parameter if it exists, otherwise it sets it to undefined

Kind: instance method of EmbedBuilder
Returns: The object itself.

ParamDescription
thumbnailThe thumbnail of the embed.

embedBuilder.setAuthor(author) ⇒

The function sets the author of the book and returns the book object.

Kind: instance method of EmbedBuilder
Returns: The object itself.

ParamDescription
authorThe author of the book.

embedBuilder.addFields(…fields) ⇒

It takes an array of objects, and pushes each object into another array

Kind: instance method of EmbedBuilder
Returns: The return value is the instance of the class.

ParamDescription
…fieldsArray<EmbedBuilderField>

embedBuilder.addField(nm, vl, il) ⇒

It adds a field to the embed

Kind: instance method of EmbedBuilder
Returns: The object itself.

ParamDescription
nmThe name of the field.
vlThe value of the field.
ilInline

embedBuilder.setFields(…fields) ⇒

It takes an array of objects, and then maps over each object, and then returns the mapped array

Kind: instance method of EmbedBuilder
Returns: The fields are being returned.

ParamDescription
…fieldsArray<EmbedBuilderField>

embedBuilder.toJSON() ⇒

It returns an object with the properties of the embed

Kind: instance method of EmbedBuilder
Returns: The return value is an object with the properties of the embed.

EmbedBuilder.transformFields(fields) ⇒

It takes an array of objects, and returns an array of objects with the same keys, but with the values transformed

Kind: static method of EmbedBuilder
Returns: The return value is an object with the properties name, value, and inline.

ParamDescription
fieldsThe fields to be added to the embed.