-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathconfigure.js
executable file
·53 lines (41 loc) · 1.25 KB
/
configure.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
const WickrIOBotAPI = require('wickrio-bot-api');
const util = require('util')
require("dotenv").config({
path: `.env.configure`
})
var wickrIOConfigure;
process.stdin.resume(); //so the program will not close instantly
function exitHandler(options, err) {
try {
if (err) {
process.kill(process.pid);
process.exit();
}
if (options.exit) {
process.exit();
} else if (options.pid) {
process.kill(process.pid);
}
} catch (err) {
console.log(err);
}
}
//catches ctrl+c and stop.sh events
process.on('SIGINT', exitHandler.bind(null, {exit: true}));
//catches "kill pid" (for example: nodemon restart)
process.on('SIGUSR1', exitHandler.bind(null, {pid: true}));
process.on('SIGUSR2', exitHandler.bind(null, {pid: true}));
//catches uncaught exceptions
process.on('uncaughtException', exitHandler.bind(null, {
exit: true,
reason: 'uncaughtException'
}));
main();
async function main()
{
const tokens = require('./configTokens.json')
var fullName = process.cwd() + "/processes.json";
wickrIOConfigure = new WickrIOBotAPI.WickrIOConfigure(tokens.tokens, fullName, tokens.supportAdministrators, tokens.supportVerification);
await wickrIOConfigure.configureYourBot(tokens.integration);
process.exit();
}