BetterEmbed & Embed Templates
Last updated
Last updated
BetterEmbed is a class from the discord.js-better-embed
library that I've made, you can see the code here.
This is a class for creating an Embed Object, but a bit simpler like this :
Templates are a good way of automating and simplifying your code. You can use them like this:
This can simplify your embeds declarations and let you have more automation. Like if you use the color
templates in your templates, if you change the template, every embed will have a different color without changing anything to them! So feel free to add as many templates as you need.
You can overwrite default templates but these are used in the advanced-command-handler
module so it could break things if you change them completely.
You can for example change the color
property of the color
template without any issue.
Name
Description
checkSize(field?)
Check the size of the Embed fields and return the ones that are too long.
You can also specify a field to check.
(In advanced-command-handler
before version 3.0, it returns an error if one field is too long.)
cutIfTooLong(field?)
Check the size of the Embed fields and cut the fields that are too long. You can also specify a field to check and cut if it has to.
setImageFromFile(link)
Set the image of the embed using a local file path.
setThumbnailFromFile(link)
Set the thumbnail of the embed using a local file path.
throwIfTooLong(field?)
Check the size of the Embed fields and throw an error if any is too long. You can also specify a field to check.