diff --git a/tradebot.js b/tradebot.js index 5a6166c..ade8a5c 100644 --- a/tradebot.js +++ b/tradebot.js @@ -67,6 +67,8 @@ function calculate(offer) { return seconds > 0; } +let exit_counter = 0; + function setupClient() { const config = require("./auth_data/auth.json") ///////////////////////////////////////////////////////////////// @@ -115,8 +117,15 @@ function setupClient() { ///////////watchdog///////////// setInterval(() => { - if (!client.steamID) {} + if (!client.steamID) { + exit_counter++; + if (exit_counter >= 5) { + console.log(consoleTime(), "Connect is dead"); + process.exit(2); + } + } else { + exit_counter = 0; if (process.env.ALIVE_PUSH) { const inst = axios.create({httpsAgent: new https.Agent({rejectUnauthorized: false})}) inst.get(process.env.ALIVE_PUSH).then(() => {}).catch(() => {})