Jump to content
McKay Development

Polling on multiple bots?


Recommended Posts

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
Link to comment
Share on other sites

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