2020-04-20 03:02:10 +00:00
|
|
|
// Copyright 2020 Emily J. / mudkipscience. Subject to the AGPLv3 license.
|
|
|
|
|
2020-04-03 06:26:16 +00:00
|
|
|
/* eslint-disable no-eval */
|
|
|
|
|
|
|
|
exports.conf = {
|
|
|
|
enabled: true,
|
|
|
|
guildOnly: false,
|
|
|
|
aliases: [],
|
|
|
|
permLevel: 'Developer',
|
|
|
|
requiredPerms: []
|
|
|
|
}
|
|
|
|
|
|
|
|
exports.help = {
|
|
|
|
name: 'eval',
|
2020-04-12 09:15:31 +00:00
|
|
|
category: 'Developer',
|
2020-04-03 06:26:16 +00:00
|
|
|
description: 'Evaluates arbitrary javascript.',
|
2020-04-06 09:36:32 +00:00
|
|
|
usage: 'eval [code]',
|
2020-04-12 09:15:31 +00:00
|
|
|
parameters: '`[code] - Javascript code you want to execute.'
|
2020-04-03 06:26:16 +00:00
|
|
|
}
|
|
|
|
|
2020-04-06 05:54:45 +00:00
|
|
|
exports.run = async (client, message, args, level, data) => {
|
2020-04-03 06:26:16 +00:00
|
|
|
const hastebin = require('hastebin-gen')
|
|
|
|
const code = args.join(' ')
|
|
|
|
try {
|
|
|
|
const evaled = eval(code)
|
|
|
|
const clean = await client.clean(client, evaled)
|
|
|
|
|
|
|
|
if (clean.length > 2000) {
|
|
|
|
hastebin(clean, { extension: 'txt' }).then(haste => {
|
|
|
|
return message.channel.send('`OUTPUT`\n' + haste)
|
|
|
|
}).catch(error => {
|
|
|
|
client.logger.error(error)
|
|
|
|
})
|
|
|
|
|
|
|
|
return
|
|
|
|
}
|
|
|
|
message.channel.send(`\`OUTPUT\` \`\`\`js\n${await clean}\n\`\`\``)
|
|
|
|
} catch (err) {
|
|
|
|
const errclean = await client.clean(client, err)
|
|
|
|
if (errclean.length > 2000) {
|
|
|
|
hastebin(errclean, { extension: 'txt' }).then(haste => {
|
|
|
|
return message.channel.send('`ERROR`\n' + haste)
|
|
|
|
}).catch(error => {
|
|
|
|
client.logger.error(error)
|
|
|
|
})
|
|
|
|
|
|
|
|
return
|
|
|
|
}
|
2020-04-11 09:30:51 +00:00
|
|
|
message.author.send(`\`ERROR\` \`\`\`xl\n${await errclean}\n\`\`\``)
|
|
|
|
message.react('⚠️')
|
2020-04-03 06:26:16 +00:00
|
|
|
}
|
|
|
|
}
|