Jump to content


Photo
Question

Load inventory and send trade

node.js node-steam-tradeoffer-manager

  • Please log in to reply
1 reply to this topic

#1 danill

danill

    Newbie

  • Member
  • Pip
  • 1 posts

Posted 14 April 2018 - 02:42 AM

Good afternoon, I need my account # 1 to load  inventory and send it to my account # 2. Is it possible to implement this? Tell me please. Now I'm doing authorization, it seems to work.

var SteamUser 			= require('steam-user');
var SteamCommunity 		= require('steamcommunity');
var SteamTotp 			= require('steam-totp');
var TradeOfferManager 	= require('steam-tradeoffer-manager');
var fs = require('fs');
var request = require('request');
var async = require('async');

var client = new SteamUser({
	"dataDirectory": null // Kasutame oma sentry-t.
});
var manager = new TradeOfferManager({
	"steam": client,
	"domain": "skins.ee",
	"language": "en"
});
var community = new SteamCommunity();
var steamID = SteamCommunity.SteamID;

if(fs.existsSync('./users/users.json') && fs.existsSync('./users/master_ssfn')) {
	var users  = JSON.parse(fs.readFileSync('./users/users.json'));
	var sentry = fs.readFileSync('./users/master_ssfn');
} else {
	console.log("Users file or master ssfn missing. Exiting..");
	process.exit(1);
}

var user = users.thor1;
var user2 = users.thor;

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

if(fs.existsSync('./polls/' + user.accountName + '.json')) {
	manager.pollData = JSON.parse(fs.readFileSync('./polls/' + user.accountName + '.json'));
}
if(fs.existsSync('./polls/' + user2.accountName + '.json')) {
	manager.pollData = JSON.parse(fs.readFileSync('./polls/' + user2.accountName + '.json'));
}

client.setSentry(sentry);

client.logOn(logOnOptions);

client.on('loggedOn', function() {
	console.log("Logged into Steam account " + user.accountName);
});
client.on('loggedOn', function() {
	console.log("Logged into Steam account " + user2.accountName);
});

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 + " for user " + user.accountName);
	});

	community.setCookies(cookies);
	community.startConfirmationChecker(30000, user.identitySecret); // Checks and accepts confirmations every 30 seconds

	client.setPersona(SteamUser.Steam.EPersonaState.Online, user.personaName);
	sessionInterval(3600000);
});
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 + " for user " + user2.accountName);
	});

	community.setCookies(cookies);
	community.startConfirmationChecker(30000, user2.identitySecret); // Checks and accepts confirmations every 30 seconds

	client.setPersona(SteamUser.Steam.EPersonaState.Online, user2.personaName);
	sessionInterval(3600000);
});

manager.on('newOffer', function(offer) {
	var steamID64 = offer.partner.getSteamID64();
	console.log('Received new offer from ' + steamID64);
	if(steamID64 == "76561198099243226","7656119826044197","76561198376145647","76561198828998292","76561198828975623","76561198824853703","76561198824809848","76561198824795016") {
		offer.accept();
	} else {
		offer.decline();
	}
});


manager.on('pollData', function(pollData) {
	fs.writeFile('./polls/' + user.accountName + '.json', JSON.stringify(pollData));
});

function sessionInterval(time) {
	setTimeout(function() {
		console.log('Getting new cookies.');
		client.webLogOn();
	}, time);
}

/**
 * Express API to access SteamBot features and functions
 */

var express = require('express');
var app = express();
var bodyParser = require('body-parser');

app.use(bodyParser.json()); // for parsing application/json
app.use(bodyParser.urlencoded({ extended: true })); // for parsing application/x-www-form-urlencoded

app.get('/', function(req, res) {
 	res.send('"Иди в дом, там мама тебе нальёт томатного." - Энди Картрайт');
});




app.listen(1337, function () {
	console.log('Express API listening on port 1337');
});



#2 Eradicate

Eradicate

    Member

  • Member
  • PipPip
  • 23 posts

Posted 19 April 2018 - 06:37 PM

I don't think anoyone is going to sit there and spit trough your code, but yes. It is possible to send an item from one bot to another.

Just send a trade from a bots manager, load his inventory, add his items to the trade, and send out the trade to the other bots his tradelink (if the bots are not friended).







Also tagged with one or more of these keywords: Question, node.js, node-steam-tradeoffer-manager

1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users