diff options
| author | Alee14 <Alee14498@gmail.com> | 2017-08-12 14:02:47 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-08-12 14:02:47 -0400 |
| commit | 73ed3ef4d363f29f5833ccd3696e3841d66570cd (patch) | |
| tree | cc1fcf7e78ac7e1a0a75069360cf2d5e1b196899 /aleebot.js | |
| parent | 13f26221abdc5ace7f4c3264b681b03b1fdaea8a (diff) | |
| download | AleeBot-73ed3ef4d363f29f5833ccd3696e3841d66570cd.tar.gz AleeBot-73ed3ef4d363f29f5833ccd3696e3841d66570cd.tar.bz2 AleeBot-73ed3ef4d363f29f5833ccd3696e3841d66570cd.zip | |
Eval Command
Diffstat (limited to 'aleebot.js')
| -rw-r--r-- | aleebot.js | 23 |
1 files changed, 21 insertions, 2 deletions
@@ -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); }); |
