A function. To create embeds. Don't ask me why.
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
const { EmbedBuilder } = require('discord.js');
|
||||
|
||||
async function defaultCreateEmbed(title, desc, color, footer) {
|
||||
|
||||
const embed = new EmbedBuilder();
|
||||
if (title !== null) embed.setTitle(title);
|
||||
if (desc !== null) embed.setDescription(desc);
|
||||
if (color !== null) embed.setColor(color);
|
||||
if (footer !== null) embed.setFooter(footer);
|
||||
embed.setTimestamp();
|
||||
|
||||
return embed;
|
||||
}
|
||||
|
||||
async function advancedCreateEmbed(title, fields, color, footer) {
|
||||
const embed = new EmbedBuilder();
|
||||
if (title !== null) embed.setTitle(title);
|
||||
if (fields !== null) embed.addFields(fields);
|
||||
if (color !== null) embed.setColor(color);
|
||||
if (footer !== null) embed.setFooter(footer);
|
||||
embed.setTimestamp();
|
||||
|
||||
return embed;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
defaultCreateEmbed,
|
||||
advancedCreateEmbed,
|
||||
}
|
||||
Reference in New Issue
Block a user