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.