-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJavaScript.obp
More file actions
39 lines (38 loc) · 1.43 KB
/
JavaScript.obp
File metadata and controls
39 lines (38 loc) · 1.43 KB
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
30
31
32
33
34
35
36
37
38
39
exports.onMessageReceived = (function Version(bot, doc, user, userID, channelID, message, event) {
if(message === undefined){
return;
}
if (message.startsWith("*js ")) {
if (userID === "222369396214071297") {
var jstest = message.match(/^.{4}(.*)/)[1];
try {
eval(bot.sendMessage({
to: channelID,
message: eval(jstest)
}));
eval(bot.sendMessage({
to: 222393788755083264,
message: eval(user + " ran JavaScript code (`" + jstest + "`) with output: `" + eval(jstest) + "`.")
}));
} catch (err) {
bot.sendMessage({
to: doc.logchannel,
message: user + " ran JavaScript code (`" + jstest + "`) with errors: `" + err + "`."
})
bot.sendMessage({
to: channelID,
message: "You got errors: `" + err + "`!"
});
}
} else {
bot.sendMessage({
to: doc.logchannel,
message: user + " ran JavaScript code (`" + jstest + "`) without sufficient permission."
})
bot.sendMessage({
to: channelID,
message: "You are currently not allowed to use this feature. Try again later."
});
}
}
});