Jump to content
McKay Development

Help with hour booster workflow


HypeLevels

Recommended Posts

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)
        })
    })
})

 

Edited by HypeLevels
code change
Link to comment
Share on other sites

That would simplify the code a lot, thanks! But I don’t see how that could help with handling errors, as soon as a game starts being played elsewhere my connection with steam closes and I don’t get the playingState event when the user closes the game 😕 perhaps setup some sort of from event that logs the user in each 10 minutes to check if he is done playing could work! The issue is when they have mobile steam guard, in that case remberPassword doesn’t seem to work making it prompt me for the steam guard code every time I reconnect (which isn’t nice as this is gonna run on a vps)

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