Jump to content
McKay Development

Recommended Posts

Posted
//Logging ON


client.logOn(logOnOptions);

client.on('loggedOn', function (details) {
	if (details.eresult == SteamUser.EResult.OK) {
		client.getPersonas([client.steamID], function (personas) {
			console.log("== Logged in =============")
			console.log('== Name: ' + personas[client.steamID]["player_name"]);
			console.log('== ID64: ' + client.steamID);
			console.log("==========================");
			console.log("");
		});
		client.setPersona(5); //"5": "LookingToTrade" -- https://github.com/DoctorMcKay/node-steam-user/blob/master/enums/EPersonaState.js
		client.gamesPlayed('Accepting Junk and Making Friends');
	} else {
		console.log(details);
		//Do whatever u want to handle the error...
	}
});


client.on('webSession', (sessionid, cookies) => {
	manager.setCookies(cookies);
	community.setCookies(cookies);
});

As soon as the bot starts everythings works fine. After some minutes, every time an offer is received by the bot, I get the "Not Logged In" error.

I set up a cron (after reading a similar thread on this forum), like this:

//Session refresh every 15 minutes


cron.schedule('*/15 * * * *', () => {
	if (client.steamID) {
		client.webLogOn();
	} else {
		client.logOn(logOnOptions);
		console.log('Logged in again using cron');
	}
});

but the "not logged in" error still remains. I also read this topic where Admin says this but at this point I don't understand which session needs to be refreshed and how.

Also calling "sessionExpired" isn't helping because whenever an incoming trade offer gives me the error, bot doesn't try anymore to accept it, even after session is refreshed, so I have to restart it.

manager.on('newOffer', offer => {
	if (offer.partner.getSteamID64() === 'my_stemid_64') {
		offer.accept((err, status) => {
			if (err) {
				console.log(err);
			} else {
				console.log(`Accepted offer from owner. Status: ${status}.`);
			}
		});
	} else {

	if (offer.itemsToGive.length === 0) {

			offer.accept((err, status) => {
				if (err) {
					console.log(err);
				} else {
					console.log(`Donation accepted. Status: ${status}.`);
				}
			});

	} else {
			offer.decline(err => {
				if (err) {
					console.log(err);
				} else {
					console.log('Donation declined (wanted our items).');
				}
			});
	}
}
});

Any help would be appreciated.

 

 

 

Posted
This is an example log between different attempts with almost the same code as above:

 

 

[[20:48:09]] [LOG]    == Logged in =============

[[20:48:10]] [LOG]    == Name: BOT

[[20:48:10]] [LOG]    == ID64: 765611.................

[[20:48:10]] [LOG]    ==========================

[[20:48:10]] [LOG]

[[21:00:00]] [LOG]    Already logged in

[[21:06:05]] [LOG]    Error: Not Logged In

    at SteamCommunity.manager._community.httpRequestPost (D:\Portable\Birba\node_modules\steam-tradeoffer-manager\lib\classes\TradeOffer.js:483:25)
Posted

Tried once more after adding a new piece of code:

community.on('sessionExpired', function(err) {
	if (err) {
		console.log('Session Expired: ' + err);
	}
	
	if (client.steamID) {
		client.webLogOn();
		console.log('called weblogon: ' + client.steamID);
	} else {
		client.logOn(logOnOptions);
		console.log('called logon');
	}
});

and I got this error:

 

[[01:46:43]] [LOG]    Session Expired: Error: HTTP error 403
[[01:46:43]] [LOG]    called weblogon: 76........
[[01:46:43]] [LOG]    Error: Not Logged In
    at SteamCommunity.manager._community.httpRequestPost (D:\Portable\Birba\node_modules\steam-tradeoffer-manager\lib\classes\TradeOffer.js:483:25)
 
 
It repeats every time I send a new offer.
Posted

same problem my devloper told me its something of steam issue, what u can do right now is simply restart the whole bot eg when sessionexpired is thrown u can log out completly and login again completely then the bot will work for 15-20 mins and will repeat same if prob continues

Posted

i wouldnt understand whats going on, but you basically lose your web session very quickly, and have to add your own logic to retry your web calls after calling webLogOn again when the session expires. It will prolly be sorted in the new version.

  • 2 weeks later...
Posted (edited)

Unfortunately it's happening again.

 

[16:37:22] [LOG]
[16:37:22] [LOG]    Bot version: 1.3.2
[16:37:22] [LOG]    node.js version: v8.11.1
[16:37:24] [LOG]
[16:37:24] [LOG]    == Logged in =============
[16:37:24] [LOG]    == Name: ZED
[16:37:24] [LOG]    == ID64: 76561198
[16:37:24] [LOG]    ==========================
[16:37:24] [LOG]
[16:37:29] [LOG]    Accepted offer 3442372810 from owner. Status: pending.
[16:37:33] [LOG]    Offer 3442372810: Confirmed!
[17:00:00] [LOG]    Already logged in: 76561198
[17:00:00] [LOG]    Called weblogon from cron
[17:05:22] [LOG]    Session Expired: Error: HTTP error 403
[17:05:22] [LOG]    called weblogon: 76561198
[17:05:22] [LOG]    Error: Not Logged In
    at SteamCommunity.manager._community.httpRequestPost (/mnt/d/P
ortable/ZED/node_modules/steam-tradeoffer-manager/lib/classes/Trad
eOffer.js:483:25)
    at Request._callback (/mnt/d/Portable/ZED/node_modules/steamco
mmunity/components/http.js:67:15)
    at Request.self.callback (/mnt/d/Portable/ZED/node_modules/req
uest/request.js:185:22)
    at emitTwo (events.js:126:13)
    at Request.emit (events.js:214:7)
    at Request.<anonymous> (/mnt/d/Portable/ZED/node_modules/reque
st/request.js:1161:10)
    at emitOne (events.js:116:13)
    at Request.emit (events.js:211:7)
    at IncomingMessage.<anonymous> (/mnt/d/Portable/ZED/node_modul
es/request/request.js:1083:12)
    at Object.onceWrapper (events.js:313:30)
 
 
 
This thing is driving me crazy.
Edited by roughnecks
  • 1 year later...
  • 10 months later...

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