aboutsummaryrefslogtreecommitdiff
path: root/aleebot.js
diff options
context:
space:
mode:
Diffstat (limited to 'aleebot.js')
-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);
});