Jump to content
McKay Development
TextDynasty

Need some help about checking Steam level

Recommended Posts

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.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
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
    })
});

Share this post


Link to post
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);
    })
});

Share this post


Link to post
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...

×
×
  • Create New...