Hey! To avoid having to pay for a simple hour booster I decided to write my own, the issue is that the flow I am following wont work due to how errors are handled.
To start off I am logging the user in and starting the games which works just fine, the issue is when a user joins a game on his own machine, LogInElsewhere is thrown and the steam connection is closed, making the playingState event not get triggered anymore. to avoid that I am listening to the error event and logging in the user again, which also won't work as I will get in a login loop that will eventually rate limit me.
Another issue I had is with logging in multiple accounts, I have the accounts in JSON array format and using forEach, the expected behavior is get logged on the first and second account but what happens is that the first account gets logged in and the second one doesn't... Down below there is full code of my experiment. Any help is appreciated.
const SteamUser = require('steam-user');
const inquirer = require('inquirer');
const accounts = require("./accounts.json")
let promise = Promise.resolve()
accounts.forEach(account => {
promise = promise.then(function () {
const user = new SteamUser()
user.logOn({
accountName: account.username,
password: account.password,
rememberPassword: true
})
user.on("steamGuard", function (domain, callback) {
inquirer
.prompt([
{
name: "steamGuard",
message: `Please input your steamGuard code for ${account.username}: `,
type: 'input'
}
])
.then((code) => {
callback(code.steamGuard)
})
})
user.on("playingState", function (blocked, playingApp) {
if (blocked) console.log(`Started playing somewhere (blocked: ${blocked}) Awaiting until disconnect`)
})
user.on("error", function (err) {
console.log(`An error happened when trying to hour boost ${account.username}: ${err.message}`)
})
user.on("loggedOn", function () {
console.log(`Successfully logged on - ${account.username}`)
user.setPersona(1)
user.gamesPlayed(730)
})
})
})