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

26 lines
1.0 KiB
JavaScript
Raw Normal View History

module.exports = {
name: 'eval',
description: 'Evaluation command',
alias: 'eval',
cooldown: 5,
2019-10-10 13:43:04 +00:00
async execute(message, args, client, Discord, prefix) {
2019-10-12 10:43:09 +00:00
const ytdl = require('ytdl-core');
const serverQueue = client.queue.get(message.guild.id);
2019-10-12 14:40:00 +00:00
if (serverQueue) {
let data = await Promise.resolve(ytdl.getInfo(serverQueue.songs[0].url));
}
if (message.author.id !== client.global.devId) return message.channel.send(':x: You are not allowed to do that!');
2019-10-10 13:43:04 +00:00
const input = message.content.slice(prefix.length + 4);
let output;
try {
output = await eval(input);
} catch (error) {
output = error.toString();
}
2019-10-10 13:43:04 +00:00
const embed = new Discord.RichEmbed()
.setTitle('Evaluation Command')
.setColor('#b50002')
.setDescription(`Input: \`\`\`js\n${input.replace(/; /g, ';').replace(/;/g, ';\n')}\n\`\`\`\nOutput: \`\`\`\n${output}\n\`\`\``);
return message.channel.send(embed);
},
};