A function. To create embeds. Don't ask me why.

This commit is contained in:
Kwafuri
2024-02-12 23:30:24 +00:00
parent d5a6c39647
commit eedaa2c626
+29
View File
@@ -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,
}