aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlee14 <Alee14498@gmail.com>2017-08-12 14:02:47 -0400
committerGitHub <noreply@github.com>2017-08-12 14:02:47 -0400
commit73ed3ef4d363f29f5833ccd3696e3841d66570cd (patch)
treecc1fcf7e78ac7e1a0a75069360cf2d5e1b196899
parent13f26221abdc5ace7f4c3264b681b03b1fdaea8a (diff)
downloadAleeBot-73ed3ef4d363f29f5833ccd3696e3841d66570cd.tar.gz
AleeBot-73ed3ef4d363f29f5833ccd3696e3841d66570cd.tar.bz2
AleeBot-73ed3ef4d363f29f5833ccd3696e3841d66570cd.zip
Eval Command
-rw-r--r--aleebot.js23
1 files changed, 21 insertions, 2 deletions
diff --git a/aleebot.js b/aleebot.js
index b6a25e0..05334d8 100644
--- a/aleebot.js
+++ b/aleebot.js
@@ -266,12 +266,31 @@ commandProcessed = true;
return;
message.channel.sendMessage(args.join(" "));
message.delete();
-
}
-
+ if(command === 'eval'){
+ if(message.author.id !== config.ownerID) return;
+ try {
+ const code = args.join(" ");
+ let evaled = eval(code);
+
+ if (typeof evaled !== "string")
+ evaled = require("util").inspect(evaled);
+
+ message.channel.send(clean(evaled), {code:"xl"});
+ } catch (err) {
+ message.channel.send(`\`ERROR\` \`\`\`xl\n${clean(err)}\n\`\`\``);
+ }
+ }
});
+const clean = text => {
+ if (typeof(text) === "string")
+ return text.replace(/`/g, "`" + String.fromCharCode(8203)).replace(/@/g, "@" + String.fromCharCode(8203));
+ else
+ return text;
+}
+
process.on('unhandledRejection', function(err, p) {
console.log("[ERROR | UNCAUGHT PROMISE] " + err.stack);
});