Riya Posted December 28, 2018 Report Posted December 28, 2018 (edited) my bot is getting web session expired and i use community.on('sessionExpired', function(err) { if (err) { console.log('sessionExpired: '+err); } if (client.steamID) { client.webLogOn(); } else { client.logOn(logon_details); } });this code is triggered when the user of bot tried to make the bot start a trade offer.what is a simple way for me to trigger session expired like every 15 mins if the session has expired?Ans- A simple http request every 15 mins using node-cron to trigger it. (i am not a coder so if u could show it to me thanks!) Right now the user of bot triggers it then has to wait 1-2 mins then the bot webLogon() and then sends trade offer Alternative 2it was suggested in forumwe can use direct cronschedule that does webLogOn() every 15 min , and whenever that error fires I also do a webLogOn(). but idk what will happen if i try to webLogON() if the session hasnt been expired yet thats y i wanted to set up Alternative 1 Edited December 28, 2018 by Riya Quote
Dr. McKay Posted December 28, 2018 Report Posted December 28, 2018 Alternative 2it was suggested in forumwe can use direct cronschedule that does webLogOn() every 15 min , and whenever that error fires I also do a webLogOn(). but idk what will happen if i try to webLogON() if the session hasnt been expired yet thats y i wanted to set up Alternative 1 There is absolutely nothing wrong with doing this. I'd recommend that you do it this way, although maybe 15 minutes is too quick. Try 30 minutes and if you still have trouble, lower it to 15. Quote
Riya Posted December 28, 2018 Author Report Posted December 28, 2018 (edited) thanks i ll post if this works out for me! require('console-stamp')(console, '[HH:MM:ss.l]'); var cron = require('node-cron'); cron.schedule('*/30 * * * *', () => { client.webLogOn() console.log('weblogged in after 30 mins using cron') }); Edited December 28, 2018 by Riya 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.