Jump to content
McKay Development

Not able to respond to offers because "not online"


Recommended Posts

So sometimes my bot is disconnected from steam, it reconnects and is shown as online and everything and then when a trade offer is sent to it, it outputs an error something along the lines "Error: Not Logged In". Unfortunately, I didn't save the error output. Hopefully, someone will know what I'm talking about, but I'll update this post when it happens again. My guess is that it has something to do with either steamcommunity or tradeoffermanager, probably the former.

How can I prevent it?

Link to comment
Share on other sites

So sometimes my bot is disconnected from steam, it reconnects and is shown as online and everything and then when a trade offer is sent to it, it outputs an error something along the lines "Error: Not Logged In". Unfortunately, I didn't save the error output. Hopefully, someone will know what I'm talking about, but I'll update this post when it happens again. My guess is that it has something to do with either steamcommunity or tradeoffermanager, probably the former.

 

How can I prevent it?

 

That means, tradeoffer-manager have invalid cookies, and you need to refresh cookies if that happened.

 

Use steamcommunity "sessionExpired" event to refresh tradeoffer-manager cookies

When you get "Error: Not Logged In", steamcommunity "sessionExpired" event will fired.

community.on("sessionExpired", function(err) {
   client.webLogOn(); //relogin to Steam or refresh tradeoffer-manager cookies
   //add your handling code here, for example: if (sendofferError == true){ //do stuff }
}

Edit: If you want to kill cookies for testing purposes, you can add this in your code:

setTimeout(function(){
	//for debugging purposes, kill cookies after 10 second
	console.log("rip cookies :(");
	community.setCookies(["steamLogin=1||invalid", "steamLoginSecure=1||invalid"]);
	manager.setCookies(["steamLogin=1||invalid", "steamLoginSecure=1||invalid"]);
}, 10000);
Edited by Vanilla
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...