How to use the steam-user.prototype function in steam-user

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 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) {
github Nicklason / tf2-automatic / lib / client.js View on Github external
const SteamUser = require('steam-user');

const log = require('lib/logger');

const generateAuthCode = require('utils/generateAuthCode');

const loginAttempts = require('app/login-attempts');
const handlerManager = require('app/handler-manager');

const client = new SteamUser();

const chatMessage = SteamUser.prototype.chatMessage;

let sessionReplaceCount = 0;

setInterval(function () {
    sessionReplaceCount = 0;
}, 60 * 1000);

SteamUser.prototype.chatMessage = function (steamID, message) {
    chatMessage.call(client, steamID, message);

    const steamID64 = typeof steamID === 'string' ? steamID : steamID.getSteamID64();

    const friend = require('handler/friends').getFriend(steamID);

    if (friend === null) {
        log.info('Message sent to ' + steamID64 + ': ' + message);
github Nicklason / tf2-automatic / lib / client.js View on Github external
const generateAuthCode = require('utils/generateAuthCode');

const loginAttempts = require('app/login-attempts');
const handlerManager = require('app/handler-manager');

const client = new SteamUser();

const chatMessage = SteamUser.prototype.chatMessage;

let sessionReplaceCount = 0;

setInterval(function () {
    sessionReplaceCount = 0;
}, 60 * 1000);

SteamUser.prototype.chatMessage = function (steamID, message) {
    chatMessage.call(client, steamID, message);

    const steamID64 = typeof steamID === 'string' ? steamID : steamID.getSteamID64();

    const friend = require('handler/friends').getFriend(steamID);

    if (friend === null) {
        log.info('Message sent to ' + steamID64 + ': ' + message);
    } else {
        log.info('Message sent to ' + friend.player_name + ' (' + steamID64 + '): ' + message);
    }
};

let hasCookies = false;
let consecutiveSteamGuardCodesWrong = 0;