-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.mjs
36 lines (31 loc) · 945 Bytes
/
index.mjs
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
import { config as dotEnvSetup } from "dotenv"
import { setupCatchExit } from "catch-exit"
import { initializeDiscord } from "./discord/index.mjs"
import { initOBSRemote } from "./obs/index.mjs"
import { initTwitch } from "./twitch/index.mjs"
import { initWS } from "./server/index.mjs"
import { startDNScheck } from "./dns/index.mjs"
dotEnvSetup()
setupCatchExit()
async function startOBS() {
try {
await initOBSRemote()
} catch (err) {
console.error("Couldn't connect to OBS", err)
setTimeout(startOBS, 1000)
}
}
async function startDiscord() {
try {
await initializeDiscord()
} catch (err) {
console.error("Couldn't connect to Discord", err)
setTimeout(startDiscord, 1000)
}
}
await initWS()
startDNScheck();
await Promise.all([await startOBS(), !(process.env.DISCORD_DISABLE === "true") && await startDiscord()])
if (process.env.TWITCH_CLIENT) {
initTwitch()
}