1
0
mirror of https://github.com/musix-org/musix-oss synced 2024-11-10 08:10:18 +00:00
musix-oss/commands/eval.js

30 lines
1.0 KiB
JavaScript
Raw Normal View History

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',
async execute(msg, args, client, Discord, prefix) {
const ytdl = require('ytdl-core');
const serverQueue = client.queue.get(msg.guild.id);
let data;
if (serverQueue) {
data = await Promise.resolve(ytdl.getInfo(serverQueue.songs[0].url));
}
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()
.setTitle('Evaluation Command')
.setColor(client.config.embedColor)
.setDescription(`Input: \`\`\`js\n${input.replace(/; /g, ';').replace(/;/g, ';\n')}\n\`\`\`\nOutput: \`\`\`\n${output}\n\`\`\``);
return msg.channel.send(embed);
},
};