tchosniper Posted December 12, 2016 Report Share Posted December 12, 2016 Hello, this is my code var offer = manager.createOffer(row.trade_url); offer.addTheirItem({"appid": 730, "contextid": 2, "assetid": row.assetid}); offer.send(function(err, status) { if (err) { console.log("[ERROR] Sending offer - " + err); } else { console.log("Offer #" + offer.id + " " + status); } console.log(status); }); Everything works, but can I check If he have mobile authentificator on? Quote Link to comment Share on other sites More sharing options...
tchosniper Posted December 12, 2016 Author Report Share Posted December 12, 2016 And If is possible check offer status from offer.id? Quote Link to comment Share on other sites More sharing options...
Dr. McKay Posted December 12, 2016 Report Share Posted December 12, 2016 getUserDetails will tell you whether or not a trade would go into escrow. Quote Link to comment Share on other sites More sharing options...
tchosniper Posted December 13, 2016 Author Report Share Posted December 13, 2016 (edited) getUserDetails will tell you whether or not a trade would go into escrow.Thanks, but that is only 1 answer. You probably dont understand what I mean. This is my block of code repeat(20000, function() { //TRADE REQUEST objConn.query('SELECT * from trade_request', function(err, rows, fields) { if (!err){ if (rows.length > 0) { var time = new Date().toISOString().replace(/T/, ' ').replace(/\..+/, ''); console.log("[" + time + "] " + "[INFO] There is " + rows.length + " new requests (TRADE)"); for (var i = 0; i < rows.length; i++) { var row = rows[i]; if (row.type == 1) { var time = new Date().toISOString().replace(/T/, ' ').replace(/\..+/, ''); console.log("[" + time + "] " + "[INFO] New deposit request from " + row.steamID + " (request id: " + row.ID + ")"); if(row.status == 1) { //send offer var offer = manager.createOffer(row.trade_url); offer.addTheirItem({"appid": 730, "contextid": 2, "assetid": row.assetid}); offer.send(function(err, status) { if (err) { console.log("[ERROR] Sending offer - " + err); } else { console.log("Offer #" + offer.id + " " + status); //SET STATUS = 2 objConn.query('UPDATE trade_request SET status=2 WHERE ID='+row.ID, function(err, rows, fields) { if (!err){ console.log("[INFO] Trade request for " + row.ID + " updated to: 2."); } else { console.log("[INFO] Error updating status " + err); } }); } console.log(status); }); } } else if (row.status == 2) { //check sent offer } else { //del request } } The bot check MySQL table If there is some new deposit request. In status 1, the bot will check if he have mobile authentificator, send offer and update status for deposit status to 2 and also in console I'll see 'sent' + Offer.id. And I want to ask If there is any option to check the status after like manager.checkOfferStatus(Offer.id) ? Edited December 13, 2016 by tchosniper Quote Link to comment Share on other sites More sharing options...
Dr. McKay Posted December 13, 2016 Report Share Posted December 13, 2016 If you're sending a trade, there's no way to check escrow status after you send it, until the user accepts it and it either goes into escrow or it doesn't. You need to use getUserDetails to know beforehand. Quote Link to comment Share on other sites More sharing options...
tchosniper Posted December 13, 2016 Author Report Share Posted December 13, 2016 About escrow, is this code right? Because I'm getting always 0 offer.getUserDetails(function (err, them) { if(!err) { console.log(them['escrowDays']); And I think you dont understand to my question (Its maybe because my english) but I'm need to check from offer.id if the offer is sent/confirmed/declined/(changed - counter offer) Quote Link to comment Share on other sites More sharing options...
Dr. McKay Posted December 13, 2016 Report Share Posted December 13, 2016 Yes, that's correct. You can determine when an offer changes state with the sentOfferChanged event. Quote Link to comment Share on other sites More sharing options...
tchosniper Posted December 13, 2016 Author Report Share Posted December 13, 2016 Yes, that's correct. You can determine when an offer changes state with the sentOfferChanged event.Oh, thanks. But If its correct why I get 0, If the trade will be holded for 1 day? (=I had authentificator, but I removed it and now I again activate so I'm need wait 7 days to instant trades, but why I getting 0 If I should get 1?) Quote Link to comment Share on other sites More sharing options...
Dr. McKay Posted December 13, 2016 Report Share Posted December 13, 2016 You need to check the escrowDays property of both them and me. Read the documentation, please. I spent a lot of time on it. Quote Link to comment Share on other sites More sharing options...
tchosniper Posted December 15, 2016 Author Report Share Posted December 15, 2016 Thanks, but If I fix something, I must get new error.. And now I think that is not in documentation (Atleast I didn't found it) offer.getUserDetails(function (err, them, me, escrowDays) { if(!err) { console.log("[INFO] Trade escrow(buddy): " + them['escrowDays'] + ", me: " + me['escrowDays']); // more code } else { console.log("[ERROR] Error - loading user data. " + err); if(err == "Error: Not Logged In") { console.log("[INFO] Reason: not login, trying relog"); client.logOn({ "accountName": config.username, "password": config.password }); } } }); From this code, I was getting "[ERROR] Error - loading user data. Error: Not Logged In" so I tried add code to login client.logOn({ "accountName": config.username, "password": config.password }); But after I get this in console: /root/node_modules/steam-user/components/logon.js:11 throw new Error("Already logged on, cannot log on again"); ^ Error: Already logged on, cannot log on again at SteamUser.logOn (/root/node_modules/steam-user/components/logon.js:11:9) at /root/bot2/ust.js:246:56 at Object.exports.makeAnError (/root/node_modules/steam-tradeoffer-manager/lib/helpers.js:33:4) at manager._community.httpRequestGet (/root/node_modules/steam-tradeoffer-manager/lib/classes/TradeOffer.js:801:12) at SteamCommunity._checkCommunityError (/root/node_modules/steamcommunity/components/http.js:129:3) at Request._callback (/root/node_modules/steamcommunity/components/http.js:51:88) at Request.self.callback (/root/node_modules/request/request.js:186:22) at emitTwo (events.js:106:13) at Request.emit (events.js:191:7) at Request.<anonymous> (/root/node_modules/request/request.js:1081:10) So I'm dont understand to "Error: Not Logged In" Quote Link to comment Share on other sites More sharing options...
tchosniper Posted December 15, 2016 Author Report Share Posted December 15, 2016 And the code work perfectly, but after +- 30-60 minutes I will get this error Quote Link to comment Share on other sites More sharing options...
Dr. McKay Posted December 16, 2016 Report Share Posted December 16, 2016 You're logged into the Steam client, but your web session (which is separate) has expired. In this case, call webLogOn on your SteamUser. Quote Link to comment Share on other sites More sharing options...
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.