diff options
| author | Alee14 <Alee14498@gmail.com> | 2017-08-17 01:40:44 -0400 |
|---|---|---|
| committer | Alee14 <Alee14498@gmail.com> | 2017-08-17 01:40:44 -0400 |
| commit | f5cc8827db7135f9e5a48203ddb826823585eed4 (patch) | |
| tree | 60883532c86f70a713fc3af6a8584edeb044811b /commands/eval.js | |
| parent | a8d005f965dc66a05316db7bc723eaddbc5399ee (diff) | |
| parent | 2a8c799d7a9ad46f398c5e2feb448140eecbc638 (diff) | |
| download | AleeBot-f5cc8827db7135f9e5a48203ddb826823585eed4.tar.gz AleeBot-f5cc8827db7135f9e5a48203ddb826823585eed4.tar.bz2 AleeBot-f5cc8827db7135f9e5a48203ddb826823585eed4.zip | |
Merge branch 'beta'
Diffstat (limited to 'commands/eval.js')
| -rw-r--r-- | commands/eval.js | 59 |
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\`\`\`` + } + ], + } + }) + } +} |
