richer-embed

An extension of RichEmbed class from discord.js

Usage no npm install needed!

<script type="module">
  import richerEmbed from 'https://cdn.skypack.dev/richer-embed';
</script>

README

richer-embed

An extension of Discord.js's RichEmbed class, with more functionality such as setting local images as embed.image and embed.thumbnail and personalizing the embed with a User's profile picture and name. Made for farazkaleemmalik/phoenixwright, a bot made with Discord.js.

RicherEmbed

Kind: global class

new RicherEmbed(channelObj, options)

Returns: RicherEmbed - Returns itself

Param Type Description
channelObj Channel | User Discord.js Channel instance for which the embed is being created
options Object Additional properties to add to embed. An existing embed can also be inserted to turn it into a RicherEmbed instance (may be buggy).

richerEmbed.personalise(authorObj) ⇒ RicherEmbed

Personalises the embed for a User by changing the title and the thumbnail

Kind: instance method of RicherEmbed
Returns: RicherEmbed - Returns itself

Param Type Description
authorObj User User to personalise

richerEmbed.setLocalThumbnail(pathName) ⇒ RicherEmbed

Attaches a local image as a thumbnail for the embed

Kind: instance method of RicherEmbed
Returns: RicherEmbed - Returns itself

Param Type Description
pathName String Path to image. Relative paths are relative to entry file

richerEmbed.setLocalImage(pathName) ⇒ RicherEmbed

Attaches a local image as the main image for the embed

Kind: instance method of RicherEmbed
Returns: RicherEmbed - Returns itself

Param Type Description
pathName String Path to image. Relative paths are relative to entry file

richerEmbed.setContent(title, content) ⇒ RicherEmbed

Sets content for the embed

Kind: instance method of RicherEmbed
Returns: RicherEmbed - Returns itself

Param Type Description
title String Title of embed
content String Content of embed, to be set embed.description

richerEmbed.replace(messageToReplace)

Replaces a message with this embed

Kind: instance method of RicherEmbed

Param Type Description
messageToReplace Message The message to replace. Note that this overrides the message channel previously set of the new provided is in a different channel

richerEmbed.send() ⇒ Promise(Message)

Send the message to the channel in embed.channel

Kind: instance method of RicherEmbed

richerEmbed.chat(authorObj, command, imageUrl) ⇒ RicherEmbed

Turns the embed into a chat embed, to be used by a bot command

Kind: instance method of RicherEmbed
Returns: RicherEmbed - Returns itself

Param Type Description
authorObj User Author of chat command
command String Exact command in the form of "commandName parameters more_parameters". The first word is excluded from the embed's content.
imageUrl String Url of main image