aboutsummaryrefslogtreecommitdiff
path: root/commands/eval.js
diff options
context:
space:
mode:
authorUnknown <Alee14498@gmail.com>2017-08-17 01:40:08 -0400
committerUnknown <Alee14498@gmail.com>2017-08-17 01:40:08 -0400
commit2a8c799d7a9ad46f398c5e2feb448140eecbc638 (patch)
tree60883532c86f70a713fc3af6a8584edeb044811b /commands/eval.js
parenta8d005f965dc66a05316db7bc723eaddbc5399ee (diff)
downloadAleeBot-2a8c799d7a9ad46f398c5e2feb448140eecbc638.tar.gz
AleeBot-2a8c799d7a9ad46f398c5e2feb448140eecbc638.tar.bz2
AleeBot-2a8c799d7a9ad46f398c5e2feb448140eecbc638.zip
Official 1.1.0 release!v1.1.0
Changelog: New command handler!
Diffstat (limited to 'commands/eval.js')
-rw-r--r--commands/eval.js59
1 files changed, 59 insertions, 0 deletions
diff --git a/commands/eval.js b/commands/eval.js
new file mode 100644
index 0000000..730def9
--- /dev/null
+++ b/commands/eval.js
@@ -0,0 +1,59 @@
+const Discord = require('discord.js');
+exports.run = (client, message, args, config) => {
+if(message.author.id !== config.ownerID) return;
+const clean = text => {
+ if (typeof(text) === "string")
+ return text.replace(/`/g, "`" + String.fromCharCode(8203)).replace(/@/g, "@" + String.fromCharCode(8203));
+ else
+ return text;
+}
+const argseval = message.content.split(" ").slice(1);
+ try {
+ var code = argseval.join(" ");
+ var evaled = eval(code);
+
+ if (typeof evaled !== "string")
+ evaled = require("util").inspect(evaled);
+ message.delete();
+
+ message.channel.send({
+ embed: {
+ color: 3191350,
+ author: {
+ name: "Eval is working!",
+ icon_url: message.author.displayAvatarURL
+ },
+ fields: [{
+ name: '**:inbox_tray: Input**',
+ value: `\`\`\`js\n${code}\n\`\`\``
+ },
+ {
+ name: '**:outbox_tray: Output**',
+ value: `\`\`\`js\n${clean(evaled)}\n\`\`\``
+ }
+ ],
+ }
+ })
+ } catch (err) {
+ message.delete();
+
+ message.channel.send({
+ embed: {
+ color: 3191350,
+ author: {
+ name: "Error",
+ icon_url: message.author.displayAvatarURL
+ },
+ fields: [{
+ name: '**Please check your code.**',
+ value: `\`\`\`xl\n${clean(err)}\n\`\`\``
+ },
+ {
+ name: '**Output**',
+ value: `\`\`\`js\n${clean(evaled)}\n\`\`\``
+ }
+ ],
+ }
+ })
+ }
+}