Jump to content
McKay Development

Comment Bot with node-steamcommunity


rusty

Recommended Posts

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

Link to comment
Share on other sites

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 by rusty
Link to comment
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...