discord_bot/functions/createEmbed.js

43 lines
1.0 KiB
JavaScript
Raw Normal View History

2024-02-07 14:42:27 +00:00
const { MessageEmbed } = require("discord.js");
let mainColor = "#fff000"
let failColor = "0xeb3452";
let successColor = "0x34eb86";
module.exports = (type, description, ...otherArgs) => {
const embed = new MessageEmbed()
.setColor(
mainColor
// type === "success"
// ? successColor
// : type === "fail"
// ? failColor
// : type === "main"
// ? mainColor
// : null
)
.setDescription(
`${
type === "erfolgreich"
? "<:aneoTick:837567483422179358>"
: type === "Fehler"
? "<:aneoError:837566696818343956>"
: ""
} ${description}`
);
if (typeof otherArgs !== "undefined") {
if (typeof otherArgs[0] === "object") {
let user = otherArgs[0];
if (user.username) {
embed.setAuthor(
user.username,
user.displayAvatarURL({ dynamic: true })
);
}
}
if (typeof otherArgs[1] === "string") {
embed.setFooter(otherArgs[1]);
}
return embed;
}
};