From 4d01e80019f5b9eeb607c485f7f0cf6bade7f907 Mon Sep 17 00:00:00 2001 From: gsd Date: Wed, 8 Apr 2026 11:43:41 +0300 Subject: [PATCH] dead watchdog --- tradebot.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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(() => {})