Download src/utils/embeds.js from APRKDEV/wsb-bot: direct link, hf CLI and curl.
- Browser
- Download file 1.55 kB
-
https://huggingface.co/spaces/APRKDEV/wsb-bot/resolve/c8f3880098432483b23491dd763585274d00f8c8/src/utils/embeds.js
- Command line
-
hf download hf://spaces/APRKDEV/wsb-bot@c8f3880098432483b23491dd763585274d00f8c8/src/utils/embeds.js
-
curl -L -o embeds.js https://huggingface.co/spaces/APRKDEV/wsb-bot/resolve/c8f3880098432483b23491dd763585274d00f8c8/src/utils/embeds.js
1.55 kB
| 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 }; | |