knightrider/src/bot/commands/moderation/embed.js
2021-08-25 01:01:46 +01:00

30 lines
No EOL
1.6 KiB
JavaScript

module.exports = {
name: 'embed',
description: "embed command for mods and admins",
execute(message, args, Discord, currentServer, messageUser, client) {
if (currentServer.staff.includes(message.author.id) || message.member.roles.cache.find(r => server.staffRoles.includes(r.name))) {
if (!args[1]) return message.reply(`you at leas need to supply a title if you stuck do ${currentServer.prefix}help embed`);
if (!message.content.includes('[')) return message.reply(`something is wrong with that if youre stuck do ${currentServer.prefix}help embed`);
let mcontent = message.content;
let titleStart = mcontent.indexOf('[');
let titleEnd = mcontent.indexOf(']');
let title = mcontent.substr(titleStart + 1, titleEnd - titleStart - 1);
let descStart = mcontent.indexOf('[', titleStart + 1);
let descEnd = mcontent.indexOf(']', titleEnd + 1);
let description = mcontent.substr(descStart + 1, descEnd - descStart - 1);
let colorstart = mcontent.indexOf('[', descStart + 1);
let colorend = mcontent.indexOf(']', descEnd + 1);
let color = mcontent.substr(colorstart + 1, colorend - colorstart - 1);
let custome_embed = new Discord.MessageEmbed().setAuthor(`${message.member.displayName}`, `${message.author.displayAvatarURL()}`).setTitle(title).setDescription(description).setColor(color);
message.channel.send(custome_embed);
} else {
return message.reply("you cant do that only staff can").catch(e => console.log(e));
};
}
}