VAAANEQ Posted February 22, 2017 Report Posted February 22, 2017 Hello. I have problem with something like Steam CommendBot. I can not save accounts :/ 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); } }); }); } I tried to use database.json SteamCommunity = require 'Steamcommunity' jsonfile = require 'jsonfile' jsonfile.spaces = 2 try database = jsonfile.readFileSync 'database.json' catch e database = {} secret = null inquirer.prompt [ {name: 'username', message: 'Username:'} {name: 'password', message: 'Password:', type: 'password'} ] .then ({username, password}) -> database[username] = {} client = new SteamUser client.setOption 'promptSteamGuardCode', false client.setOption 'dataDirectory', null client.logOn accountName: username, password: password, client.on 'steamGuard', (domain, callback) -> if domain inquirer.prompt [name: 'code', message: "Steam guard code (#{domain}):"] .then ({code}) -> callback code else inquirer.prompt [name: 'secret', message: 'Two-factor shared secret:'] .then ({secret}) -> SteamTotp.generateAuthCode secret, (err, code) -> database[username].secret = secret callback code client.on 'sentry', (sentry) -> database[username].sentry = sentry.toString('base64') jsonfile.writeFileSync 'database.json', database client.on 'LoggedOn', (Details) -> database[username].password = password process.exit 1 I don't know even how to paste it. Anyway if it always same code then every node bot.js I have to add new account ;/ 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.