File size: 1,545 Bytes
3c7e34b
 
 
 
 
 
 
 
 
 
 
 
79b4bed
3c7e34b
 
 
 
 
 
 
 
79b4bed
3c7e34b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
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 };