Hi,
I'm trying to get free to play games into the bots I made and I can't seem to get it to work.
Here is my code:
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.requestFreeLicense([386360,730,570,230410,291480,440,1085660,238960,552990,236390,601510,8500,223750,444090,9900,291550,203770,444200,386180,453480,218230,200210,339610,227940,761890], function(err, grantedPackages, grantedAppIDs)
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;
After I'm trying to run the bot it says:
C:\Users\Idan\Desktop\Stuff\Idle>CD /D "C:\Users\Idan\Desktop\Stuff\Idle\"
C:\Users\Idan\Desktop\Stuff\Idle>node IdlerConfig.js
C:\Users\Idan\Desktop\Stuff\Idle\steamClient.js:17
bot.games = config.games;
^^^
SyntaxError: Unexpected identifier
[90m at wrapSafe (internal/modules/cjs/loader.js:1055:16)[39m
[90m at Module._compile (internal/modules/cjs/loader.js:1103:27)[39m
[90m at Object.Module._extensions..js (internal/modules/cjs/loader.js:1159:10)[39m
[90m at Module.load (internal/modules/cjs/loader.js:988:32)[39m
[90m at Function.Module._load (internal/modules/cjs/loader.js:896:14)[39m
[90m at Module.require (internal/modules/cjs/loader.js:1028:19)[39m
[90m at require (internal/modules/cjs/helpers.js:72:18)[39m
at Object.<anonymous> (C:\Users\Idan\Desktop\Stuff\Idle\IdlerConfig.js:1:27)
[90m at Module._compile (internal/modules/cjs/loader.js:1139:30)[39m
[90m at Object.Module._extensions..js (internal/modules/cjs/loader.js:1159:10)[39m
C:\Users\Idan\Desktop\Stuff\Idle>pause
Press any key to continue . . .