forked from wonderingabout/gtp2ogs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gtp2ogs.js
executable file
·36 lines (27 loc) · 919 Bytes
/
gtp2ogs.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
35
36
#!/usr/bin/env node
// vim: tw=120 softtabstop=4 shiftwidth=4
'use strict';
// Remove api key from command line ASAP.
process.title = 'gtp2ogs';
// Do this before importing anything else in case the other modules use config.
const { getArgv } = require('./getArgv');
const argv = getArgv();
const config = require('./config');
config.updateFromArgv(argv);
process.title = `gtp2ogs ${config.bot_command.join(' ')}`;
const { console } = require('./console');
const io = require('socket.io-client');
const { Connection } = require('./connection');
process.on('uncaughtException', function (er) {
console.trace("ERROR: Uncaught exception");
console.error(`ERROR: ${er.stack}`);
if (!conn || !conn.socket) {
conn = getNewConnection();
} else {
//conn.connection_reset();
}
});
let conn = getNewConnection();
function getNewConnection() {
return new Connection(io, config);
}