wsb-bot / src /utils /embeds.js
APRK01
fix: add image support to createEmbed utility
79b4bed
const { EmbedBuilder } = require('discord.js');
const { Colors } = require('../config');
/**
* Build a themed embed with consistent WSB branding.
*/
function createEmbed({
title = null,
description = null,
color = Colors.PRIMARY,
fields = [],
thumbnail = null,
image = null,
footer = 'WSB β€” Wyvern Softworks Bot',
timestamp = true,
} = {}) {
const embed = new EmbedBuilder().setColor(color);
if (title) embed.setTitle(title);
if (description) embed.setDescription(description);
if (thumbnail) embed.setThumbnail(thumbnail);
if (image) embed.setImage(image);
if (fields.length) embed.addFields(fields);
if (footer) embed.setFooter({ text: footer });
if (timestamp) embed.setTimestamp();
return embed;
}
function successEmbed(title, description) {
return createEmbed({ title: `βœ… ${title}`, description, color: Colors.SUCCESS });
}
function errorEmbed(title, description) {
return createEmbed({ title: `❌ ${title}`, description, color: Colors.ACCENT });
}
function infoEmbed(title, description) {
return createEmbed({ title: `ℹ️ ${title}`, description, color: Colors.INFO });
}
function warnEmbed(title, description) {
return createEmbed({ title: `⚠️ ${title}`, description, color: Colors.WARNING });
}
function logEmbed({ title, description, color = Colors.MUTED, fields = [] }) {
return createEmbed({ title, description, color, fields });
}
module.exports = { createEmbed, successEmbed, errorEmbed, infoEmbed, warnEmbed, logEmbed };