| const { EmbedBuilder } = require('discord.js'); |
| const { Colors } = require('../config'); |
|
|
| |
| |
| |
| 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 }; |
|
|