Jump to content
McKay Development

Multiple bots (clients) in an array?


luftwaffe

Recommended Posts

I have x accounts for which I need to create a SteamUser client. I did some quick testing and found that the following code is not working. Any suggestions on why?

var initializeClients = function(data) {
  var steamuser = require('steam-user');
  var steamtotp = require('steam-totp');
  var steamtrader = require('steam-tradeoffer-manager');

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

  for (var index in data) {
    var account = data[index];

    client[index] = new steamuser();
    manager[index] = new TradeOfferManager({
      "steam": client[index],
      "domain": "example.com",
      "language": "en"
    });

    client[index].logOn({
      'accountName': account.username,
      'password': account.password,
      'twoFactorCode': totp.generateAuthCode(account.shasec)
    });
  };
};

//x minutes/hours later this function gets called

var clientLogOff = function(index) {
  client[index].logOff();
}

Thanks in advance for any input on this.

Link to comment
Share on other sites

Doesn't look like TradeOfferManager is defined.

 

In the future, please include any error messages and stack traces.

The code I posted was just to help explain what I wanted to do, it was a quick copy and paste from my working code which while not having the intended effect (read: doing anything) did not throw any errors - sorry for the lack of clarification.

 

I have by now figured out the problem, I completely forgot that SteamUser does not automatically set the EPersonaState to online upon loggingOn which is why the client[index].gamesPlayed('test') I used to test my code also didn't work.

 

This code now works shame on me for overseeing something obvious like that.

Edited by luftwaffe
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...