Jump to content
McKay Development

How can i trigger sessionExpired every 15 mins?


Riya

Recommended Posts

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 2

it was suggested in forum

we 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 by Riya
Link to comment
Share on other sites

Alternative 2

it was suggested in forum

we 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.

Link to comment
Share on other sites

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 by Riya
Link to comment
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...