-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.js
35 lines (30 loc) · 972 Bytes
/
server.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
30
31
32
33
34
const ScriptServer = require('scriptserver'),
colors = require('colors'),
config = require('./config.js'),
colorsConsole = require('./js/console.js'),
querystring = require('querystring'),
http = require('http');
const server = new ScriptServer();
colors.setTheme(config.color);
server.on('console', function (str) {
colorsConsole(str)
const chat = str.match(/<\[(.*)\](.*)>(.*)/);
if (chat) {
var req = http.request(config.tuling, function (res) {
res.setEncoding('utf8');
res.on('data', function (chunk) {
var text = JSON.parse(chunk).text
server.send(`bc ` + text)
});
});
req.write(
querystring.stringify({
key: '2f33e9e0d89391a29c595283995aa9a1',
info: chat[3],
userid: chat[2]
})
);
req.end();
}
});
server.start(config.jar, config.javaConfig);