aboutsummaryrefslogtreecommitdiff
path: root/commands/Owners Only
diff options
context:
space:
mode:
authorUnknown <jtsshieh@outlook.com>2018-03-13 17:23:15 -0400
committerUnknown <jtsshieh@outlook.com>2018-03-13 17:23:15 -0400
commita264d43540a4f819684c13b162e2697b5897a09d (patch)
treef7a67dd32b6c95b8530e6f0c62755dea2846c0b3 /commands/Owners Only
parent998cfc7af25aa6ad71cfa7ed617f98ffd3fc45a9 (diff)
downloadPokeBot-a264d43540a4f819684c13b162e2697b5897a09d.tar.gz
PokeBot-a264d43540a4f819684c13b162e2697b5897a09d.tar.bz2
PokeBot-a264d43540a4f819684c13b162e2697b5897a09d.zip
i doubt this'll make a difference
Diffstat (limited to 'commands/Owners Only')
-rw-r--r--commands/Owners Only/eval.js14
1 files changed, 8 insertions, 6 deletions
diff --git a/commands/Owners Only/eval.js b/commands/Owners Only/eval.js
index 8d5e67f..9db45bc 100644
--- a/commands/Owners Only/eval.js
+++ b/commands/Owners Only/eval.js
@@ -18,18 +18,20 @@
*
* *************************************/
+async function evaluate(code) {
+ const str = `var func = async function() {\n ${code}\n}.bind(this)\nfunc`;
+
+ const toExecute = eval(str);
+
+ return await toExecute();
+}
exports.run = async (bot, msg, args) => {
if (!['242775871059001344', '247221105515823104', '236279900728721409'].includes(msg.author.id)) return msg.reply('Nope! You need the person who created this bot to use this command.');
const { RichEmbed } = require('discord.js');
const code = args.join(' ');
try {
- const str = `var func = async function() {\n ${code}\n}.bind(this)\nfunc`;
-
- const toExecute = eval(str);
-
- const response = await toExecute();
-
+ const response = await evaluate(code);
const util = require('util');
const output = typeof response === 'string' || typeof response === 'number' ? response : util.inspect(response, { depth: 3 });