How to use steam-user - 10 common examples

To help you get started, we’ve selected a few steam-user examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github zyfworks / steam-key / steam.js View on Github external
let SteamUser = require('steam-user');

module.exports = SteamUser;

SteamUser.prototype.setWebSocket = function (webSocket) {
    this.webSocket = webSocket;
};


/**
 * overrides _steamGuardPrompt method to support WebSocket
 * @param domain
 * @param lastCodeWrong
 * @param {steamGuardCallback} callback
 */
SteamUser.prototype._steamGuardPrompt = function (domain, lastCodeWrong, callback) {
    if (this.options.promptSteamGuardCode) {
        this.authCode = null;
        try {
            this.webSocket.send(JSON.stringify({action: 'authCode'}));
        } catch (err) {
            // TODO
        }

        this.once('inputAuthCode', code => callback(code));
    } else {
        this.emit('steamGuard', domain, callback, lastCodeWrong);
    }
};

/**
 * @callback steamGuardCallback
github Nicklason / tf2-automatic / app / handler / index.js View on Github external
exports.onLogin = function () {
    if (exports.isReady()) {
        // We have relogged, set game and online
        this.gamesPlayed(package.name);
        this.setPersona(SteamUser.EPersonaState.Online);
    }
};
github Nicklason / tf2-automatic / app.js View on Github external
function loginResponse (err) {
                if (err) {
                    if (!lastLoginFailed && err.eresult !== SteamUser.EFriendRelationship.RateLimitExceeded && err.eresult !== SteamUser.EFriendRelationship.InvalidPassword) {
                        lastLoginFailed = true;
                        // Try and sign in without login key
                        log.warn('Failed to sign in to Steam, retrying without login key...');
                        login(null, loginResponse);
                    } else {
                        log.warn('Failed to sign in to Steam');
                        handler.onLoginFailure(err);
                    }
                    return;
                }

                checkAccountLimitations(function (err) {
                    if (err) {
                        throw err;
                    }
github antigravities / Steamcord / index.js View on Github external
steam.on("loggedOn", () => {
	steam.setPersona(Steam.EPersonaState.Online);
	console.log("Logged on to Steam.");
	ensureCommunityLoggedIn(() => {});
});
github frk1 / steamhourboostv2 / src / steamaccount.js View on Github external
.then(() => {
        this.client.setPersona(SteamUser.EPersonaState.Offline)
        this.client.gamesPlayed(this.games !== null ? this.games : [10, 730])
        return console.log(`${this.logheader()} Starting to boost games!`)
      })
      .catch(err => console.error(`${this.logheader()} ${err}`))
github MitchDizzle / ChatLogger.JS / src / chatlogger.js View on Github external
client.on('loggedOn', function(details) {
	console.log("Logged into Steam as " + client.steamID.getSteam3RenderedID());
    client.setPersona(SteamUser.EPersonaState.Invisible);
});
github frk1 / steamhourboostv2 / lib / steamaccount.js View on Github external
.then(() => {
        this.client.setPersona(SteamUser.EPersonaState.Offline)
        this.client.gamesPlayed(this.games !== null ? this.games : [10, 730])
        return console.log(`${this.logheader()} Starting to boost games!`)
      })
      .catch(err => console.error(`${this.logheader()} ${err}`))
github Revadike / steam-free-packages / requestFreeApps.js View on Github external
client.on("loggedOn", function(response) {
            console.log("Logged into Steam as " + client.steamID.getSteam3RenderedID());
            client.setPersona(SteamUser.EPersonaState.Online);
        });
        client.on("error", function(error) {
github Atosito / Steam-Trade-Bot-TF2- / app.js View on Github external
client.on('loggedOn', () => {
    client.setPersona(SteamUser.Steam.EPersonaState.LookingToTrade, config.botName);
    client.gamesPlayed(440);
    console.log(colours.bgGreen(config.botName) + ' is online and looking for trade.'.green);

});
client.on('webSession', (sessionid, cookies) => {
github frk1 / steamhourboostv2 / src / steamaccount.js View on Github external
constructor(name, password, sentry, secret, games, indent = 0) {
    super()
    this.name = name
    this.password = password
    this.sentry = sentry
    this.secret = secret
    this.games = games
    this.indent = indent
    const options = {
      promptSteamGuardCode: false,
      dataDirectory: null
    }
    this.client = new SteamUser(null, options)
    if (this.sentry) this.client.setSentry(Buffer.from(this.sentry, "base64"))

    this.client.on("error", err => this.emit("clientError", err))
    this.client.on("steamGuard", () => this.emit("clientSteamGuard"))
    this.client.once("steamGuard", () => (this.steamGuardRequested = true))
  }