D
D
Dmitry Matvienko2016-04-14 14:30:48
Node.js
Dmitry Matvienko, 2016-04-14 14:30:48

How to start a steam bot?

Good afternoon. I am writing a steam bot that will receive what it is given and give back on an event.
Didn't work with steam before. node.js is new to me too.
I created a steam account, put money on it, installed a mobile application (steamGuard) on my phone.
Waited a month. All exchanges are allowed.
Now we need to start the bot.
node bot.js I run the bot.js
file with the following code:

/* START EDITING */
// Put your 64-bit SteamID here so the bot can accept your offers
var admin = 'мой SteamID 64-bit';
var logOnOptions = {
  account_name: 'мой логин',
  password: 'мой пароль'
};
var authCode = ''; // Code received by email
/* STOP EDITING */

var fs = require('fs');
var crypto = require('crypto');

var Steam = require('steam');
var SteamWebLogOn = require('steam-weblogon');
var getSteamAPIKey = require('steam-web-api-key');
var SteamTradeOffers = require('steam-tradeoffers');

var sentryFileName = 'sentry'; // steam guard data file name

try {
  logOnOptions.sha_sentryfile = getSHA1(fs.readFileSync(sentryFileName));
} catch (e) {
  if (authCode !== '') {
    logOnOptions.auth_code = authCode;
  }
}

// if we've saved a server list, use it
if (fs.existsSync('servers')) {
  Steam.servers = JSON.parse(fs.readFileSync('servers'));
}

var steamClient = new Steam.SteamClient();
var steamUser = new Steam.SteamUser(steamClient);
var steamFriends = new Steam.SteamFriends(steamClient);
var steamWebLogOn = new SteamWebLogOn(steamClient, steamUser);
var offers = new SteamTradeOffers();

steamClient.connect();
steamClient.on('connected', function() {
  steamUser.logOn(logOnOptions);
});

steamClient.on('logOnResponse', function(logonResp) {
  if (logonResp.eresult === Steam.EResult.OK) {
    console.log('Logged in!');
    steamFriends.setPersonaState(Steam.EPersonaState.Online);

    steamWebLogOn.webLogOn(function(sessionID, newCookie) {
      getSteamAPIKey({
        sessionID: sessionID,
        webCookie: newCookie
      }, function(err, APIKey) {
        offers.setup({
          sessionID: sessionID,
          webCookie: newCookie,
          APIKey: APIKey
        });
        handleOffers();
      });
    });
  }
});

function getSHA1 (bytes) {
  var shasum = crypto.createHash('sha1');
  shasum.end(bytes);
  return shasum.read();
}

And it gives me this error:
events.js:154
      throw er; // Unhandled 'error' event
      ^
Error: Disconnected
    at SteamClient._disconnected (/мой путь/node_modules/steam/lib/steam_client.js:186:24)
    at emitOne (events.js:90:13)
    at Connection.emit (events.js:182:7)
    at TCP._onclose (net.js:477:12)
мой@мой:~/мой путь$ node bot.js
events.js:154

As far as I understand, I should receive authCode by mail. But this does not happen, since I have the steamGuard application installed. This code should probably work with my ssfn file, but I don't know how.
I would be grateful for any hint. Thank you!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Kirill Petrov, 2016-04-15
@Fletcher_CT

To set up the operation of such a bot, it is best to take ready-made bot scripts from roulette sites as a basis.
They clearly show where and how the work of the bot is performed.
In this case, based on the error that you threw off, we can say that not all paths to the bot are configured. Where is he at all? On your computer or on a server? If it's on a server, have you added the steam authenticator to it?
Everything should be taken into account.
Therefore, I advise you to download the script of any roulette site using a bot and see how it works and what files it connects to.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question