I've been working on getting a bot that uses multiple accounts to add comments to a profile, it works sort of like the report bots that have been released recently. My only issue is that when you have Steam Guard disabled, you can't make comments through the API. If anyone could show me how to use the cookies correctly so I don't have to repeatedly use Steam Guard codes that would be great. Here is my code:
var SteamCommunity = require('steamcommunity');
var ReadLine = require('readline');
var fs = require('fs');
var SteamID = require("steamid");
var banshee = 'steamid64';
var comments = ['a', 'b', 'c', 'd', 'e'];
var rand = Math.floor(Math.random() * comments.length);
var concat = comments[rand];
var community = new SteamCommunity();
var steamID = new SteamID(banshee);
var rl = ReadLine.createInterface({
"input": process.stdin,
"output": process.stdout
});
rl.question("Username: ", function(accountName) {
rl.question("Password: ", function(password) {
doLogin(accountName, password);
});
});
function doLogin(accountName, password, authCode, captcha) {
community.login({
"accountName": accountName,
"password": password,
"authCode": authCode,
"captcha": captcha
}, function(err, sessionID, cookies, steamguard) {
if(err) {
if(err.message == 'SteamGuard') {
console.log("An email has been sent to your address at " + err.emaildomain);
rl.question("Steam Guard Code: ", function(code) {
doLogin(accountName, password, code);
});
return;
}
if(err.message == 'CAPTCHA') {
console.log(err.captchaurl);
rl.question("CAPTCHA: ", function(captchaInput) {
doLogin(accountName, password, null, captchaInput);
});
return;
}
console.log(err);
process.exit();
return;
}
console.log("Logged on!");
community.getSteamUser(steamID, function(err, user) {
if(err) console.log(err);
else {
user.comment(concat, function(err) {
if(err) console.log(err);
});
console.log("Comment posted!");
setTimeout(function() {
process.exit();
}, 2000);
}
});
});
}