# RichEmbed

A super simple to use rich embed generator providing a fluent property chaining interface creating perfectly valid JSON embeds in norm with the Discord API specification. Examples using the full RichEmbed generator can be found here.

# Constructor

Instantiation: new RichEmbed(data);

Parameter Type Optional Default Description
data Object {} Embed data to assign to the RichEmbed upon instantiation

# Methods

# addBlankField([inline])

Add a blank field (name and value) to the Rich Embed using blank special chars.

Parameter Type Optional Default Description
inline Boolean false Whether this field should be inline or not
Returns: RichEmbed This Embed with the new changes applied.
Example:
const embed = new RichEmbed().addBlankField(true);

# addField(name, value [,inline])

Add a normal field (name and value) to the Rich Embed.

Parameter Type Optional Default Description
name String N/A The name (or title) of the field
value String N/A The value (text content) of the field
inline Boolean false Whether this field should be inline or not
Returns: RichEmbed This Embed with the new changes applied.
Example:
const embed = new RichEmbed().addField('Fruits', 'Banana, Pineapple, Strawberry', true);

# attachFile(attachment)

Attaches any file to the Rich Embed which then can be accessed via attachments://fileName.extension

Parameter Type Optional Default Description
attachment Object N/A The file that should be attached
attachment.file Buffer N/A A Buffer of the file's binary data
attachment.name String N/A The file name including extension
Returns: RichEmbed This Embed with the new changes applied.
Example:
const embed = new RichEmbed().attachFile({ file: someBuffer, name: 'myFile.png' });

# setAuthor(name [,icon, url])

Set the author (not to be confused with the title) of this Rich Embed.

Parameter Type Optional Default Description
name String N/A The name of the author
icon String N/A The image URL of the icon
url String N/A The author URL if clicked
Returns: RichEmbed This Embed with the new changes applied.
Example:
const embed = new RichEmbed().setAuthor('Google', 'https://google.com/logo.png', 'https://google.com');

# setColor(color)

Set the accent color of this Rich Embed.

Parameter Type Optional Default Description
color ColorResolvable 0x7F8C8D Any color that's resolvable by Chariot.js
Returns: RichEmbed This Embed with the new changes applied.
Example:
const embedOne = new RichEmbed().setColor(0xFF9185);
const embedTwo = new RichEmbed().setColor('ORANGE');

# setDescription(description)

Set the description text of this Rich Embed.

Parameter Type Optional Default Description
description String N/A The description of the Rich Embed
Returns: RichEmbed This Embed with the new changes applied.
Example:
const embed = new RichEmbed().setDescription('This is a description');

# setFooter(text [,icon])

Set the footer of this Rich Embed.

Parameter Type Optional Default Description
text String N/A The text of the Rich Embed footer
icon String N/A The icon URL of the Rich Embed footer
Returns: RichEmbed This Embed with the new changes applied.
Example:
const embed = new RichEmbed().setFooter('This is a footer', 'https://img.kirameki.one/lUkPTwbL.png');

# setImage(url)

Set the image of this Rich Embed.

Parameter Type Optional Default Description
url String N/A The URL for this Rich Embed image
Returns: RichEmbed This Embed with the new changes applied.
Example:
const embed = new RichEmbed().setImage('https://img.kirameki.one/lUkPTwbL.png');

# setThumbnail(url)

Set the thumbnail of this Rich Embed.

Parameter Type Optional Default Description
url String N/A The URL for this Rich Embed thumbnail
Returns: RichEmbed This Embed with the new changes applied.
Example:
const embed = new RichEmbed().setThumbnail('https://img.kirameki.one/lUkPTwbL.png');

# setTimestamp([time])

Set the timestamp of this Rich Embed. If no specific time is provided, the current time will be used.

Parameter Type Optional Default Description
time String or Number new Date() A time resolvable (UTC, epoch, etc ...)
Returns: RichEmbed This Embed with the new changes applied.
Example:
const embedUTC   = new RichEmbed().setTimestamp('2019-09-30T16:41:56Z');
const embedEpoch = new RichEmbed().setTImestamp(1569861716);

# setTitle(title)

Set the title (not to be confused with the author) of this Rich Embed.

Parameter Type Optional Default Description
title String N/A The title text for this Rich Embed
Returns: RichEmbed This Embed with the new changes applied.
Example:
const embed = new RichEmbed().setTitle('This is a title text');

# setUrl(url)

Set the URL (not to be confused with the author URL) of this Rich Embed.

Parameter Type Optional Default Description
url String N/A The URL for this Rich Embed
Returns: RichEmbed This Embed with the new changes applied.
Example:
const embed = new RichEmbed().setUrl('https://discordapp.com');