N4d!r Posted July 23, 2016 Report Posted July 23, 2016 (edited) Hello,im using this code to check the status of my sent offer ! can you help ? manager.getOffer({id:'1413390722'}, function(err, offer){ if(err){throw err;} console.log(offer); }); i get this as err : Error: No API-Key set (yet) at TradeOfferManager._apiCall.callback [as _apiCall] (C:\Bot\node_modules\st eam-tradeoffer-manager\lib\webapi.js:9:12) at TradeOfferManager.getOffer.callback._apiCall [as getOffer] (C:\Bot\node_m odules\steam-tradeoffer-manager\lib\classes\TradeOffer.js:31:7) at SteamUser.<anonymous> (C:\Bot\all.js:124:13) at emitTwo (events.js:87:13) at SteamUser.emit (events.js:172:7) at IncomingMessage.<anonymous> (C:\Bot\node_modules\steam-user\components\we b.js:73:9) at emitOne (events.js:77:13) at IncomingMessage.emit (events.js:169:7) at IncomingMessage.Readable.read (_stream_readable.js:368:10) at flow (_stream_readable.js:759:26) Edited July 23, 2016 by N4d!r Quote
Dr. McKay Posted July 23, 2016 Report Posted July 23, 2016 Please read the documentation. You need to call setCookies and wait for the callback before you try to do anything else, and that is invalid input for getOffer. N4d!r 1 Quote
N4d!r Posted July 23, 2016 Author Report Posted July 23, 2016 Please read the documentation. You need to call setCookies and wait for the callback before you try to do anything else, and that is invalid input for getOffer. sir please,im lost .. this is my first time trying to use node codes.if you just give me an example about how this getOffer works it will help me so much please. Quote
Dr. McKay Posted July 23, 2016 Report Posted July 23, 2016 There are some general examples in the GitHub repo: https://github.com/DoctorMcKay/node-steam-tradeoffer-manager/tree/master/examples Quote
N4d!r Posted July 24, 2016 Author Report Posted July 24, 2016 (edited) There are some general examples in the GitHub repo: https://github.com/DoctorMcKay/node-steam-tradeoffer-manager/tree/master/examples i copied the example and added getOffer to it and i still get this error and this is the full JS file : /** * STOREHOUSE - node-steam * * Uses node-steam-user for notifications and accepts all incoming trade offers, * node-steamcommunity for confirming trades, * node-steam-totp to generate 2FA codes */ var SteamUser = require('steam-user'); var SteamCommunity = require('steamcommunity'); var SteamTotp = require('steam-totp'); var TradeOfferManager = require('steam-tradeoffer-manager'); // use require('steam-tradeoffer-manager') in production var fs = require('fs'); var client = new SteamUser(); var manager = new TradeOfferManager({ "steam": client, // Polling every 30 seconds is fine since we get notifications from Steam "domain": "localhost", // Our domain is example.com "language": "en" // We want English item descriptions }); var community = new SteamCommunity(); // Steam logon options var logOnOptions = { "accountName": "xxxxxxx", "password": "xxxxxx", "twoFactorCode": SteamTotp.getAuthCode("xxxxxxxx") }; if (fs.existsSync('polldata.json')) { manager.pollData = JSON.parse(fs.readFileSync('polldata.json')); } client.logOn(logOnOptions); client.on('loggedOn', function() { console.log("Logged into Steam"); }); client.on('webSession', function(sessionID, cookies) { manager.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: " + manager.apiKey); }); community.setCookies(cookies); community.startConfirmationChecker(30000, "xxxxxxxx"); // Checks and accepts confirmations every 30 seconds }); manager.getOffer({"tradeofferid": 1414463195}, function(err, offer){ if(err){ console.log(err); } console.log(offer); }); manager.on('pollData', function(pollData) { fs.writeFile('polldata.json', JSON.stringify(pollData)); }); Edited July 24, 2016 by Dr. McKay Don't post API keys Quote
Dr. McKay Posted July 24, 2016 Report Posted July 24, 2016 Please don't post your API keys. You need to wait until the callback of setCookies to try to call getOffer. And again, your input to getOffer is incorrect. 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.