From 38360d90ea219b2f837cc92db134d3808f4bbf2e Mon Sep 17 00:00:00 2001 From: M_Viper Date: Wed, 7 Feb 2024 14:42:27 +0000 Subject: [PATCH] Dateien nach "functions" hochladen --- functions/createEmbed.js | 43 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 functions/createEmbed.js diff --git a/functions/createEmbed.js b/functions/createEmbed.js new file mode 100644 index 0000000..efb3ba0 --- /dev/null +++ b/functions/createEmbed.js @@ -0,0 +1,43 @@ +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; + } +}; \ No newline at end of file