-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplugin.js
29 lines (25 loc) · 877 Bytes
/
plugin.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
const TennuEval = {
requires: ["admin"],
init: function(client, imports) {
const requiresAdmin = imports.admin.requiresAdmin;
const checkAdmin = imports.admin.checkAdmin;
function evalIntoResponse (toEval) {
return ("<< " + eval(toEval)).split("\n");
}
return {
handlers: {
"privmsg": function (privmsg) {
if (/^\>\>/.test(privmsg.message)) {
return checkAdmin(privmsg, function () {
return evalIntoResponse(privmsg.message.slice(2));
});
}
},
"!eval": requiresAdmin(function (command) {
return evalIntoResponse(command.args.join(" "));
})
}
};
}
};
module.exports = TennuEval;