Jump to content


Photo
Question

Setting costum String as current playing

node.js node-steam-user

  • Please log in to reply
1 reply to this topic

#1 Karbust

Karbust

    Newbie

  • Member
  • Pip
  • 1 posts

Posted 16 April 2019 - 05:49 AM

Hello,
 
I'm trying to set a config on a bot I found on the internet.
 
I'm trying to set the name of the current game that I'm playing to something like "Boosting Hours" or any string. Also tried to set to Snooze like this:

bot.setPersona(SteamUser.EPersonaState.Snooze);

and didn't work...
 
This is the bot:
 
IdlerConfig.js

    var steamClientFactory = require('./steamClient.js');
    var configsArray = [];
    var config;
    var botArray = [];
    
    config = {};
    config.username = 'nick1';
    config.password = 'pass1';
    config.sharedSecret = ''; //Shared Secret(for 2FA only) https://github.com/Jessecar96/SteamDesktopAuthenticator/releases
    config.games = [730,440,570]
    configsArray.push(config);
	
    config = {};
    config.username = 'nick2';
    config.password = 'pass2';
    config.sharedSecret = ''; //Shared Secret(for 2FA only) https://github.com/Jessecar96/SteamDesktopAuthenticator/releases
    config.games = [730,440,570]
    configsArray.push(config);
	
	
	
    console.log('Number of configurations set up: ' + configsArray.length);
     
    for	(index = 0; index < configsArray.length; index++) {
    	var config = configsArray[index];
		
		var bot = steamClientFactory.buildBot(config);
		bot.doLogin();
		botArray.push(bot);
    }
     
    console.log('Running ' + botArray.length + ' bots.');

steamClient.js

var SteamUser = require('steam-user');
var SteamTotp = require('steam-totp');
var botFactory = {};
 
botFactory.buildBot = function (config)
{	
	var bot = new SteamUser({
        promptSteamGuardCode: false,
		dataDirectory: "./sentry",
		singleSentryfile: false
    });
	
	bot.username = config.username;
	bot.password = config.password;
	bot.sharedSecret = config.sharedSecret;
	bot.games = config.games;
	bot.messageReceived = {};
	
	bot.on('loggedOn', function(details) {
		console.log("[" + this.username + "] Logged into Steam as " + bot.steamID.getSteam3RenderedID());
		bot.setPersona(SteamUser.EPersonaState.Online);
		bot.gamesPlayed(this.games);
	});
 
	bot.on('error', function(e) {
		console.log("[" + this.username + "] " + e);
		setTimeout(function() {bot.doLogin();}, 30*60*1000);
	});
 
	bot.doLogin = function ()
	{
		this.logOn({ 
			"accountName": this.username,
			"password": this.password
		});
	}
	
	bot.on('steamGuard', function(domain, callback) {
		if ( !this.sharedSecret ) {
			var readlineSync = require('readline-sync');
			var authCode = readlineSync.question("[" + this.username + "] " + 'Steam Guard' + (!domain ? ' App' : '') + ' Code: ');
			callback(authCode);	
		} 
		else {
			var authCode = SteamTotp.generateAuthCode( this.sharedSecret );
			console.log("[" + this.username + "] Generated Auth Code: " + authCode);
			callback(authCode);	
		}
		
	});
	
	bot.on("friendMessage", function(steamID, message) {
		console.log("[" + this.username + "] Message from " + steamID+ ": " + message);
		if ( !this.messageReceived[steamID] ) {
			bot.chatMessage(steamID, "[Automated Message] I am currently idle. I will respond when I am next available.");
			this.messageReceived[steamID] = true;
		}
	});
	
	
	bot.on('vacBans', function(numBans, appids) {
		if(numBans > 0) {
			console.log( "[" + this.username + "] " + numBans + " VAC ban" + (numBans == 1 ? '' : 's') + "." + 
						(appids.length == 0 ? '' : " In apps: " + appids.join(', ')) );
		}
	});
	
	bot.on('accountLimitations', function(limited, communityBanned, locked, canInviteFriends) {
		var limitations = [];
 
		if(limited) {
			limitations.push('LIMITED');
		}
 
		if(communityBanned) {
			limitations.push('COMMUNITY BANNED');
		}
 
		if(locked) {
			limitations.push('LOCKED');
		}
 
		if(limitations.length !== 0) {
			console.log("[" + this.username + "] Limitations: " + limitations.join(', ') + ".");
		}
	});
	
	return bot;
}
 
module.exports = botFactory;

Can anyone help me?
 
Thank you all



#2 Dr. McKay

Dr. McKay

    Developer

  • Administrator
  • 2,070 posts

Posted 16 April 2019 - 02:34 PM

Setting snooze worked fine for me. If you're not in-game, you will appear as "Away" in the newest Steam client, with a "ZZZ" icon. If you're in-game, just the "ZZZ" icon will appear.

 

If you want a custom in-game string, make the string the first entry in your array that you pass to gamesPlayed.







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

1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users