Jump to content


Photo

Need some help about checking Steam level

node.js node-steam-user

Best Answer TextDynasty , 27 January 2019 - 11:20 PM

 

I edited it a bit

const SteamUser = require('steam-user');
const SteamTotp = require('steam-totp');

const config = require('./config');

var client = new SteamUser();

const logOnOptions = {
    accountName: config.accountName,
    password: config.password,
    twoFactorCode: SteamTotp.generateAuthCode(config.shared_secret)
};
client.logOn(logOnOptions);
client.on('loggedOn', () => {
    var steamid = '76561198302774496';
    client.setPersona(1);
    console.log('LogOn');
    
    client.getSteamLevels([steamid], function(requests){
        var level = requests.steamid;
        console.log(level); //console.log(requests); works fine but I want it to show the level of the steamid only
    })
});

Solved

const SteamUser = require('steam-user');
const SteamTotp = require('steam-totp');

const config = require('./config');

var client = new SteamUser();
var steamid = ''; //SteamID64 you want to check

const logOnOptions = {
    accountName: config.accountName,
    password: config.password,
    twoFactorCode: SteamTotp.generateAuthCode(config.shared_secret)
};
client.logOn(logOnOptions);

client.on('loggedOn', () => {
    client.setPersona(1);
    console.log('LogOn');
    client.getSteamLevels([steamid], function(requests){
        var level = requests[steamid];
        console.log(level);
    })
});
Go to the full post


  • Please log in to reply
6 replies to this topic

#1 TextDynasty

TextDynasty

    Advanced Member

  • Member
  • PipPipPip
  • 139 posts

Posted 26 January 2019 - 04:42 AM

So I planned to write a script for the bot to have a background check.

const SteamUser = require('steam-user');

var client = new SteamUser();

var steamid = '76561198302774496';

client.getSteamLevels([steamid], function(results){
    console.log(results);
})

However, it didn't show the results to the console.



#2 Dr. McKay

Dr. McKay

    Developer

  • Administrator
  • 2,111 posts

Posted 26 January 2019 - 05:23 AM

It doesn't look like you ever logged on.



#3 TextDynasty

TextDynasty

    Advanced Member

  • Member
  • PipPipPip
  • 139 posts

Posted 26 January 2019 - 07:55 PM

It doesn't look like you ever logged on.

Oh yeah I forgot to log in. But after login, there's still nothing in the console.

const SteamUser = require('steam-user');
const SteamTotp = require('steam-totp');

const config = require('./config');

var client = new SteamUser();

const logOnOptions = {
    accountName: config.accountName,
    password: config.password,
    twoFactorCode: SteamTotp.generateAuthCode(config.shared_secret)
};
client.logOn(logOnOptions);

client.getSteamLevels(['76561198302774496'], function(results){
    console.log(results);
})


#4 Dr. McKay

Dr. McKay

    Developer

  • Administrator
  • 2,111 posts

Posted 27 January 2019 - 12:07 AM

You seem to not have an understanding of how async JavaScript code works. Just because logOn was called doesn't mean you're actually logged on. You need to wait for the loggedOn event.



#5 TextDynasty

TextDynasty

    Advanced Member

  • Member
  • PipPipPip
  • 139 posts

Posted 27 January 2019 - 05:04 AM

You seem to not have an understanding of how async JavaScript code works. Just because logOn was called doesn't mean you're actually logged on. You need to wait for the loggedOn event.

I edited it a bit

const SteamUser = require('steam-user');
const SteamTotp = require('steam-totp');

const config = require('./config');

var client = new SteamUser();

const logOnOptions = {
    accountName: config.accountName,
    password: config.password,
    twoFactorCode: SteamTotp.generateAuthCode(config.shared_secret)
};
client.logOn(logOnOptions);
client.on('loggedOn', () => {
    var steamid = '76561198302774496';
    client.setPersona(1);
    console.log('LogOn');
    
    client.getSteamLevels([steamid], function(requests){
        var level = requests.steamid;
        console.log(level); //console.log(requests); works fine but I want it to show the level of the steamid only
    })
});



#6 TextDynasty

TextDynasty

    Advanced Member

  • Member
  • PipPipPip
  • 139 posts

Posted 27 January 2019 - 11:20 PM   Best Answer

 

I edited it a bit

const SteamUser = require('steam-user');
const SteamTotp = require('steam-totp');

const config = require('./config');

var client = new SteamUser();

const logOnOptions = {
    accountName: config.accountName,
    password: config.password,
    twoFactorCode: SteamTotp.generateAuthCode(config.shared_secret)
};
client.logOn(logOnOptions);
client.on('loggedOn', () => {
    var steamid = '76561198302774496';
    client.setPersona(1);
    console.log('LogOn');
    
    client.getSteamLevels([steamid], function(requests){
        var level = requests.steamid;
        console.log(level); //console.log(requests); works fine but I want it to show the level of the steamid only
    })
});

Solved

const SteamUser = require('steam-user');
const SteamTotp = require('steam-totp');

const config = require('./config');

var client = new SteamUser();
var steamid = ''; //SteamID64 you want to check

const logOnOptions = {
    accountName: config.accountName,
    password: config.password,
    twoFactorCode: SteamTotp.generateAuthCode(config.shared_secret)
};
client.logOn(logOnOptions);

client.on('loggedOn', () => {
    client.setPersona(1);
    console.log('LogOn');
    client.getSteamLevels([steamid], function(requests){
        var level = requests[steamid];
        console.log(level);
    })
});


#7 PonyExpress

PonyExpress

    Member

  • Member
  • PipPip
  • 28 posts

Posted 05 March 2019 - 01:28 AM

How many users can I check at once?

 

Can I, for example, get the levels of all users on my friends list or it is not recommended?







Also tagged with one or more of these keywords: node.js, node-steam-user

3 user(s) are reading this topic

0 members, 3 guests, 0 anonymous users