embed command

This commit is contained in:
rhearmas 2019-12-13 11:15:11 -05:00
parent 5ad4482be4
commit 1def142b1d
2 changed files with 53 additions and 0 deletions

View file

@ -1,3 +1,5 @@
// This command has already been completed.
exports.run = (bot, msg, args) => {
if (args.length < 1) {
throw 'You must specify something to embed!';

51
commands/Utility/embed.js Normal file
View file

@ -0,0 +1,51 @@
exports.run = async (client, message, args, level) => {
if (!args[0]) {
return message.reply("you must specify some stuff to put into the embed.");
}
let parsed = bot.utils.parseArgs(args, ['f', 'ft:', 'd', 't:', 'c:', 'r', 'i:', 'a:', 'th:']);
let color = parsed.options.c;
if (parsed.options.r && msg.guild && msg.guild.members) {
let member = msg.guild.members.get(msg.author.id);
if (member) {
color = member.highestRole.hexColor;
}
}
if (color) {
if (!color.startsWith('#')) {
color = `#${color}`;
}
if (!/^#[a-fA-F0-9]{6}$/.test(color)) {
return message.reply(`color \`${color}\` is invalid. Please use valid hex format (\`#RRGGBB\`)`);
}
}
message.delete();
message.channel.send({
embed: bot.utils.embed(parsed.options.t || '', parsed.leftover.join(' '), [], {
footer: parsed.options.f || parsed.options.ft,
timestamp: parsed.options.d,
color,
image: parsed.options.i,
author: parsed.options.a,
thumbnail: parsed.options.th
})
});
};
exports.conf = {
enabled: true,
guildOnly: false,
aliases: [],
permLevel: "Admin"
};
exports.help = {
name: "embed",
category: "Utility",
description: "Send a message via embeds.",
usage: "embed [text]"
};