Jump to content
McKay Development

Recommended Posts

Posted

Hello, could you look here? It's seems to be right, but it doesn't conferm trades automaticaly 

var SteamUser = require('steam-user');
var SteamCommunity = require('steamcommunity');
var SteamTotp = require('steam-totp');
var TradeOfferManager = require('../lib/index.js'); // use require('steam-tradeoffer-manager') in production
var fs = require('fs');

var client = new SteamUser();
var offers = new TradeOfferManager({
	"steam": client, // Polling every 30 seconds is fine since we get notifications from Steam
	"domain": "example.com", // Our domain is example.com
	"language": "en" // We want English item descriptions
});
var community = new SteamCommunity();


var logOnOptions = {
	"accountName": "*****",
	"password": "***",
	"twoFactorCode": SteamTotp.getAuthCode("****")
};

if (fs.existsSync('polldata.json')) {
	offers.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) {
	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);
	});

	var trade = offers.createOffer("76561197982243076");


	offers.loadInventory(570, 2, true, function(err, myItems) {
		if(err) {
			console.log(err);
			return;
		}

		trade.loadPartnerInventory(570, 2, function(err, theirItems) {
			if(err) {
				console.log(err);
				return;
			}

			trade.addMyItem(myItems[0]);
			//trade.addMyItem({"appid": "570","contextid": "2", "assetid": "994253688"  });
			trade.addTheirItem(theirItems[0]);
			trade.send(function(err, status) {
				if (err) {
					console.log("send" + err);
				} else {
					console.log("Offer #" + trade.id + " " + status)
				}
			});
		});

	});

	community.setCookies(cookies);
	community.startConfirmationChecker(30000, "identitySecret"); 
});

And could you say, how bot can get assetid of item because than I use "id" from http://steamcommunity.com/profiles/76561198106184535/inventory/570/2 it brings error(26)

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