Jump to content
McKay Development

Recommended Posts

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 by Mister
Link to post
Share on other sites
  • Mister changed the title to Re-login problem
Posted (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 by Mister
Link to post
Share on other sites

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.

Link to post
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...