Botters Posted June 15, 2016 Report Posted June 15, 2016 Hey there, I made a quick code to send a trade offer but the error i got is HTTP error 401 and i don't know how to fix it. The bot is not a limited account. ... var offers = new TradeOfferManager({ steam: client, language: "en", pollInterval: 10000, domain: 'localhost', cancelTime: 300000 }); var code = SteamTotp.generateAuthCode(config.shared_secret); var login_details = { "accountName": config.username, "password": config.password, "twoFactorCode": code }; community.login(login_details, function(err, sessionID, cookies, steamguard) { if (err) { console.log("Steam login fail: " + err.message); process.exit(1); } console.log("Logged into Steam"); offers.setCookies(cookies, function(err) { if (err) { console.log(err); process.exit(1); // Fatal error since we couldn't get our API key return; } console.log("Got API key: " + offers.apiKey); }); community.startConfirmationChecker(10000, config.identity_secret); }); client.on('webSession', function (sessionID, cookies) { offers.setCookies(cookies, function (err){ if (err) { console.log('Unable to set trade offer cookies: '+err); process.exit(1); } console.log("Trade offer cookies set. Got API Key: "+offers.apiKey); }); }); var offer = offers.createOffer("xxx"); offer.addTheirItem({"appid": 753, "contextid": 6, "assetid": "1768042517"}); offer.send("", "xxx", function(err, status) { if (err) { console.log(err); } else { console.log("Offer #" + offer.id + " " + status); } }); Quote
Dr. McKay Posted June 15, 2016 Report Posted June 15, 2016 1. Why are you logging in twice?2. You can't send the offer until you're logged in. Please research how asynchronous JavaScript works if you don't understand this. 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.