Jump to content


Photo

Polling on multiple bots?

node.js node-steam-tradeoffer-manager

  • Please log in to reply
No replies to this topic

#1 Eradicate

Eradicate

    Member

  • Member
  • PipPip
  • 23 posts

Posted 09 January 2018 - 05:46 PM

I'm using the following code but the 'newOffer' event is never being called and according to the docs this only works if polling is enabled, which should be.

 

What am I doing wrong?

 

var steamuser = require('steam-user');
var steamtotp = require('steam-totp');
var trademanager = require('steam-tradeoffer-manager');
var SteamCommunity = require('steamcommunity');

var data = [
	{
		username:'',
		password:'',
		shasec:'/XqviM=',
		shacon:'++3t4fpJI='
	},
	{
		username:'',
		password:'',
		shasec:'=',
		shacon:'+P+kKyvfYk='
	}
]; 

var client = [];
var manager = [];
var community = [];

var initializeClients = function(data) {
	for (var index in data) {
		initializeClient(index);
	};
};
 
var initializeClient = function(index) {
  	var account = data[index];
  	
   	community[index] = new SteamCommunity();
	client[index] = new steamuser();
	manager[index] = new trademanager({
		"steam": client[index],
		"community": community[index],
		"language": "en"
	});

	console.log('[Account] [', account.username,'] is logging on');
	client[index].logOn({
		'accountName': account.username,
		'password': account.password,
		'twoFactorCode': steamtotp.generateAuthCode(account.shasec)
	});

	client[index].on('loggedOn', function() {
		console.log('[Account] Success!');
	});

	client[index].on('webSession', (sessionid, cookies) => {
		manager[index].setCookies(cookies, function(err){
			console.log('API Key retrieved');
		});

		community[index].setCookies(cookies);
		community[index].startConfirmationChecker(15000, account.shacon);	

		console.log('webSession ID: ' + sessionid);
	});

	client[index].on('newOffer', function(offer, oldState) {
		console.log('[Account] [', account.username,'] has a newly received offer!');
	});
};


initializeClients(data);

Edit: I removed the second setCookies as it was not needed, also added an error check on setCookies but it does not throw any errors.


Edited by Eradicate, 09 January 2018 - 06:22 PM.

  • RamoSterious likes this





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

3 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users


    Bing (2)