Mister 0 Posted March 30 Report Share Posted March 30 (edited) Hey, I've been working on a steam bot and randomly when the bot disconnects and tries to reconnect it doesn't work. Even after I get loggedOn event if I run community.loggedIn I get false. Do I need to redeclare TradeOfferManager and SteamCommunity objects after SteamUser relogin? This is my reconnect code: setInterval(() => { this.community.loggedIn((err, loggedIn) => { if (err) { if (err.message === 'HTTP error 502') return if (err.message === 'HTTP error 500') return return console.log('[Check] error.', err) } if (loggedIn) return if (_self.makeSureLoggedOff) { _self.makeSureLoggedOff = false console.log('[Steam] Bot ' + _self.accountName + " didn't fix it self, forcing relog...") try { _self.client.relog() } catch (err) { if (err.message === 'Cannot relog if not already connected') { console.log('[Relog] Bot ' + _self.accountName + " wasn't connected so we are trying to login.") return _self.client.logOn() } console.log('[Relog] ' + _self.accountName + ' error: ' + err) } return } console.log('[Steam] Auto catcher found a steam account (' + _self.accountName + ') with login problems, waiting to see if it will fix it self') _self.makeSureLoggedOff = true }) }, 10000) Forgot to also ask, "webSession" event is emmited after every "relog" and "logOn"? Edited March 30 by Mister Quote Link to post Share on other sites
Dr. McKay 367 Posted March 31 Report Share Posted March 31 You shouldn't be using relog when your web session expires. Just call webLogOn and webSession will get emitted again. Quote Link to post Share on other sites
Mister 0 Posted March 31 Author Report Share Posted March 31 (edited) So for example if steam goes down on tuesday for maintenance I just need to keep trying to call webLogOn? I don't need to login again? If so when would re-login be necessary Thank you for your time so far Edited March 31 by Mister Quote Link to post Share on other sites
Dr. McKay 367 Posted March 31 Report Share Posted March 31 steam-user will automatically reconnect when it can if Steam goes down. Once it reconnects it will automatically renegotiate its web session. It will still be necessary to refresh your web session with webLogOn from time to time, but not as a response to Steam outages. Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.