rusty Posted July 29, 2016 Report Posted July 29, 2016 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); } }); }); } Quote
Dr. McKay Posted July 29, 2016 Report Posted July 29, 2016 Save the "steamguard" argument in the login callback, and supply it to future logins as a "steamguard" property in the object. Quote
rusty Posted July 30, 2016 Author Report Posted July 30, 2016 (edited) Yeah, I've gotten that far and it actually makes comments now, only issue I'm having is my comments[rand] doesn't actually work and I'm not sure why. Another issue I'm having is that I can't use setTimeout or setInterval to make sure the comment is posted, then it proceeds to the next login. EDIT: I've solved my issue, thanks! Edited July 30, 2016 by rusty Quote
Recommended Posts
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.