2020-02-05 20:02:53 +00:00
|
|
|
module.exports = {
|
|
|
|
name: 'eval',
|
|
|
|
alias: 'e',
|
2020-02-24 18:41:40 +00:00
|
|
|
usage: '<code>',
|
2020-02-05 20:02:53 +00:00
|
|
|
description: 'Evaluation command. DEV ONLY!',
|
|
|
|
onlyDev: true,
|
|
|
|
permission: 'dev',
|
|
|
|
category: 'util',
|
2020-03-14 16:38:02 +00:00
|
|
|
async execute(msg, args, client, Discord, prefix, command) {
|
2020-02-05 20:02:53 +00:00
|
|
|
const ytdl = require('ytdl-core');
|
2020-03-14 16:38:02 +00:00
|
|
|
const queue = client.queue.get(msg.guild.id);
|
2020-02-05 20:02:53 +00:00
|
|
|
let data;
|
2020-03-14 16:38:02 +00:00
|
|
|
if (queue) {
|
|
|
|
data = await Promise.resolve(ytdl.getInfo(queue.songs[0].url));
|
2020-02-05 20:02:53 +00:00
|
|
|
}
|
|
|
|
const input = msg.content.slice(prefix.length + 4);
|
|
|
|
let output;
|
|
|
|
try {
|
|
|
|
output = await eval(input);
|
|
|
|
} catch (error) {
|
|
|
|
output = error.toString();
|
|
|
|
}
|
|
|
|
const embed = new Discord.MessageEmbed()
|
2020-03-12 21:07:44 +00:00
|
|
|
.setTitle(client.messages.evalTitle)
|
2020-02-05 20:02:53 +00:00
|
|
|
.setColor(client.config.embedColor)
|
|
|
|
.setDescription(`Input: \`\`\`js\n${input.replace(/; /g, ';').replace(/;/g, ';\n')}\n\`\`\`\nOutput: \`\`\`\n${output}\n\`\`\``);
|
|
|
|
return msg.channel.send(embed);
|
|
|
|
},
|
|
|
|
};
|