Jump to content
McKay Development

Need some help about checking Steam level


TextDynasty

Recommended Posts

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);
})
Link to comment
Share on other sites

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

Link to comment
Share on other sites

 

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);
    })
});
Link to comment
Share on other sites

  • 1 month later...

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