edit
This commit is contained in:
17
src/index.js
17
src/index.js
@@ -1,3 +1,18 @@
|
||||
const { startAuthServer } = require("./twitch/authServer");
|
||||
const { connect } = require("./twitch/websocket");
|
||||
|
||||
connect();
|
||||
const auth = startAuthServer();
|
||||
|
||||
// wait until token exists before starting twitch
|
||||
const waitForToken = setInterval(() => {
|
||||
const token = auth.getToken();
|
||||
|
||||
if (token) {
|
||||
clearInterval(waitForToken);
|
||||
|
||||
process.env.APP_ACCESS_TOKEN = token;
|
||||
|
||||
console.log("🚀 Starting Twitch connection...");
|
||||
connect();
|
||||
}
|
||||
}, 1000);
|
||||
Reference in New Issue
Block a user