mantelis123 Posted June 16, 2017 Report Posted June 16, 2017 (edited) Hello, I own a trade bot. This evening I have noticed that my bot began to behave strangely. It starts disconnecting from Steam and changes its status to offline. Logs are totally clean. No errors. Also, I am using a function "webLogOn" to destroy expired session and re-create it. Do you have any suggestions? Edited June 16, 2017 by mantelis123 Quote
Vanilla Posted June 17, 2017 Report Posted June 17, 2017 Hello, I own a trade bot. This evening I have noticed that my bot began to behave strangely. It starts disconnecting from Steam and changes its status to offline. Logs are totally clean. No errors. Also, I am using a function "webLogOn" to destroy expired session and re-create it. Do you have any suggestions?Do you have 'disconnected' event (from steam-user)?It should show the reason why you get disconnected Quote
mantelis123 Posted June 17, 2017 Author Report Posted June 17, 2017 (edited) Do you have 'disconnected' event (from steam-user)?It should show the reason why you get disconnectedI currently don't have this event because I tough that steam-community event "sessionExpired" would be enough. When this event fires, I call steam-user client.webLogOn(), but this night I've noticed that when "sessionExpired" event gets called, it starts reconnecting, but doesn't fully reconnect: http://prntscr.com/fktl8y In this case my bot turns offline again and I have to restart it. I will try to add "disconnected" event, but what function exactly should I write there? Delete and re-create the session (client.webLogOn()) or totally log off from steam user and login again? Edited June 17, 2017 by mantelis123 Quote
Vanilla Posted June 17, 2017 Report Posted June 17, 2017 I currently don't have this event because I tough that steam-community event "sessionExpired" would be enough. When this event fires, I call steam-user client.webLogOn(), but this night I've noticed that when "sessionExpired" event gets called, it starts reconnecting, but doesn't fully reconnect: http://prntscr.com/fktl8y In this case my bot turns offline again and I have to restart it. I will try to add "disconnected" event, but what function exactly should I write there? Delete and re-create the session (client.webLogOn()) or totally log off from steam user and login again? Something like this: community.on("sessionExpired", function(err) { //client.webLogOn and stuff }); client.on('disconnected', function (eresult) { console.log("Disconnected from Steam. Reason '"+SteamUser.EResult[eresult]+" ["+eresult+"]'"); //do your magic }); node-steamcommunity 'sessionExpired' event will fires if your cookies is dead (but still connected to Steam)node-steam-user 'disconnected' event will fires if your bot for some reason can't connect to Steam server. For example, try log in your bot using your code with 'disconnected' event code above, and after that turn off your internet connection.The log will say something like: "Disconnected from Steam. Reason 'NoConnection [3]'" Quote
mantelis123 Posted June 17, 2017 Author Report Posted June 17, 2017 (edited) Something like this: community.on("sessionExpired", function(err) { //client.webLogOn and stuff }); client.on('disconnected', function (eresult) { console.log("Disconnected from Steam. Reason '"+SteamUser.EResult[eresult]+" ["+eresult+"]'"); //do your magic }); node-steamcommunity 'sessionExpired' event will fires if your cookies is dead (but still connected to Steam)node-steam-user 'disconnected' event will fires if your bot for some reason can't connect to Steam server. For example, try log in your bot using your code with 'disconnected' event code above, and after that turn off your internet connection.The log will say something like: "Disconnected from Steam. Reason 'NoConnection [3]'" I started the bot, turned off my wifi and after 30 seconds turned it on again. Then the bot connected to Steam immediately, there was no need to call "login" function in "disconnected" event because I have found in steam-user documentation that bot automatically logs in when it is disconnected from Steam: http://prntscr.com/fkv1ojBut the problem is that when my bot goes offline, it doesn't log in back again and starts spamming "Session expired. Reconnecting...", but never fully reconnects: http://prntscr.com/fktl8y client.on('disconnected', function(eresult, msg) { console.log('Disconnected.'); if (typeof eresult !== 'undefined') { console.log('EResult: ' + eresult); } if (typeof msg !== 'undefined') { console.log('Message: ' + msg); } }); community.on('sessionExpired', function(err) { console.log('Session expired. Reconnecting...'); client.webLogOn(); }); Edited June 17, 2017 by mantelis123 Quote
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.