Jump to content
McKay Development

steam-user error


Cyber
 Share

Recommended Posts

const SteamUser = require('steam-user');
const SteamTotp = require('steam-totp');
const log = require('../utils/logger');

/* Import Config User */
const config = require('../../config/default.json');

const initClient = (client) => {
    try {
        client.logOn({
            accountName: config.UserID,
            password: config.UserPass,
            twoFactorCode: SteamTotp.generateAuthCode(config.SharedSecret),
            identity_secret: config.IdentitySecret,
            shared_secret: config.SharedSecret,
            rememberPassword: true
        })
    } catch (err) {
        log.error(err);
    }
};


const restart = (client) => {
    log.warn('Restarting..')
    if (!client.steamID) {
        init(client)
    } else {
        client.relog();
    }
}

function webLogin(client) {
    log.warn('Sessions expired.. Relogging..');
    try {
        client.webLogOn();
    } catch (e) {
        log.error(e);
    }
}

const checkClient = (client, community) => {
    setInterval(() => {
        community.loggedIn((err, loggedIn) => {
            if (err) {
                log.error(err);
                if (
                    err.message.indexOf('Socket hang up') > -1 ||
                    err.message.indexOf('ESOCKETTIMEDOUT') > -1
                ) {
                    webLogin(client);
                } else {
                    restart(client);
                }
            } else if (!loggedIn) {
                webLogin(client);
            } else {
                client.requestRichPresence(SteamUser.EPersonaState.Online);
                client.gamesPlayed(['Under Maintenance', 730])
            }
        });
    }, 1000 * 60 * 15);
};

module.exports = {
    initClient,
    restart,
    webLogin,
    checkClient
}

so

Link to comment
Share on other sites

I used a limited account "a new account of mine" and it simply appears that I went online and I'm already logged out and this error appears'' ERROR An error occurred while setting cookies.''

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

×
×
  • Create New...