Simplifying embed usage

Hi, I'm wondering if there is a way to not repeat the full embed builder every time I need an embed ? I already thought about a function in another class but I dont know how it should looks like
9 Replies
d.js toolkit
d.js toolkit15mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button! - Marked as resolved by OP
d.js docs
d.js docs15mo ago
method (static) EmbedBuilder.from() Creates a new embed builder from JSON data
Cykz
CykzOP15mo ago
oh great do you have an example code using it ?
ShompiFlen
ShompiFlen15mo ago
EmbedBuilder.from(theOtherEmbedHere) Its going to depend on what your objective is though, if you want to like "recycle" other embeds then that works, but you could give more insight to what you need
Cykz
CykzOP15mo ago
I need to have a common template with color, title, thumbnail,footer... I just want to edit the text without having 10-20 lines dedicated to an embed
ShompiFlen
ShompiFlen15mo ago
yea you can create a template on a separate file, export that embed and then just set the properties you want to change
Cykz
CykzOP15mo ago
and if I only need to replace a value in description or in a field ? I mean I just want to replace a word in a sentence already wrote in json But idk how
d.js docs
d.js docs15mo ago
mdn String.prototype.replace() The replace() method of String values returns a new string with one, some, or all matches of a pattern replaced by a replacement. The pattern can be a string or a RegExp, and the replacement can be a string or a function called for each match. If pattern is a string, only the first occurrence will be replaced. The original string is left unchanged.
Cykz
CykzOP15mo ago
Tysm ShompiFlen & Qjuh <:PES3_HoldHeart:760839325033693224>
Want results from more Discord servers?
Add your server