diff --git a/.gitignore b/.gitignore index fd64e04..7a7fd2d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ /auth_data/ /package-lock.json /Facti13.SteamTradeBot.JS.v1.iml +/node_modules \ No newline at end of file diff --git a/tradebot.js b/tradebot.js index 5aaff92..8212b7d 100644 --- a/tradebot.js +++ b/tradebot.js @@ -7,6 +7,9 @@ var trade_checker = new trade_checker_imp(); const VERSION = require("./version"); var SteamTradeOfferManager = require('steam-tradeoffer-manager'); +const axios = require("axios"); +const https = require('https'); + const consoleTime = () => { return (new Date()).toLocaleString(); } @@ -106,7 +109,20 @@ function setupClient() { console.log(consoleTime(), 'connection error\n'); console.log(consoleTime(), error); + //client.relog(); }); + + ///////////watchdog///////////// + setInterval(() => { + if (!client.steamID) {} + else { + if (process.env.ALIVE_PUSH) { + const inst = axios.create({httpsAgent: new https.Agent({rejectUnauthorized: false})}) + inst.get(process.env.ALIVE_PUSH).then(() => {}).catch(() => {}) + } + } + }, 60 * 1000); + //////////////////////////////////////////////////////////////////// manager.on('newOffer', function(offer) { console.log(consoleTime(), `[${offer.id}] Incoming trade from ${offer.partner.getSteamID64()}`);