Jump to content
McKay Development

Recommended Posts

Posted (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 by N4d!r
Posted

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.

Posted (edited)

 

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 by Dr. McKay
Don't post API keys

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