lad Posted June 3, 2017 Report Posted June 3, 2017 Hey everyone, I'll first give you a background story so you get an idea of what I'm trying to do. I'm interested in adding 100 accounts in one steam group all done by a bot.I succesfully made myself a bot that creates a random generated username and password saved in a .txt file on my Desktop. What I want to do now is either make it so when I create a Steam Account it will automatically join the group OR I make a bot that scrapes all the username:password logins from that .txt file and logs in on them and joins my group.I think the first option is way easier, that's why I tried it; const SteamUser = require("steam-user"); const SteamCommunity = require("steamcommunity"); const client = new SteamUser(); const community = new SteamCommunity(); var colors = require("colors"); var fs = require("fs"); var groupID64 = "103582791458129100"; var Username = "username" + String(Math.trunc(Math.random() * 1000000)); var Password = "password" + String(Math.trunc(Math.random() * 1000000)); const SteamID = require("steamid"); const groupID = new SteamID(groupID64); client.logOn(); client.on("loggedOn", () => { console.log("Logged into Steam".cyan); client.createAccount(Username, Password, "[email protected]", function(result){ if (result === 1) { fs.appendFile("Desktop/text.txt", Username + ":" + Password + "\n", function(err) { if(err) { console.log(err); } else { console.log(Username + ":" + Password + " - Saved.".green); client.logOff(); // NOT WORKING? console.log("Logging off Steam".red); const logOnOptions = { accountName: Username, password: Password }; client.logOn(logOnOptions); client.on("loggedOn", () => { console.log("Logged into Steam".green); client.gamesPlayed("BOT Testing"); community.getSteamGroup(groupID, function(err, group) { group.join(function(err) { if (err) console.log('error', err); }); }); }); //process.exit(1) } }); } else { console.log("ERROR: ".red + result); process.exit(1) } }); }); This outputs: Logged into Steam username625656:password356952 - Saved. Logging off Steam C:\Users\Admin\node_modules\steam-user\components\logon.js:11 throw new Error("Already logged on, cannot log on again"); ^ Error: Already logged on, cannot log on again at SteamUser.logOn (C:\Users\Admin\node_modules\steam-user\components\logon.js:11:9) at C:\Users\Admin\account-maker.js:33:13 at FSReqWrap.oncomplete (fs.js:123:15) My guess is that my client.logOff(); doesn't work. Is there a way to fix this? Regardslad Quote
Dr. McKay Posted June 4, 2017 Report Posted June 4, 2017 You need to wait for the disconnected event to know that you're logged off. You can't log back on using the same object until then. My suggestion is to just create a new SteamUser object for each login. lad 1 Quote
lad Posted June 4, 2017 Author Report Posted June 4, 2017 I'm not quite sure where to put my new object, this is what I did: const SteamUser = require("steam-user"); const SteamCommunity = require("steamcommunity"); const client = new SteamUser(); const community = new SteamCommunity(); var colors = require("colors"); var fs = require("fs"); var groupID64 = "103582791458129100"; var Username = "username" + String(Math.trunc(Math.random() * 1000000)); var Password = "password" + String(Math.trunc(Math.random() * 1000000)); const SteamID = require("steamid"); const groupID = new SteamID(groupID64); client.logOn(); client.on("loggedOn", () => { console.log("Logged into Steam".cyan); client.createAccount(Username, Password, "[email protected]", function(result){ if (result === 1) { fs.appendFile("Desktop/group-tester.txt", Username + ":" + Password + "\n", function(err) { if(err) { console.log(err); } else { console.log(Username + ":" + Password + " - Saved.".green); client.logOff(); // NOT WORKING? console.log("Logging off Steam".red); const Client = new SteamUser(); const logOnOptions = { accountName: Username, password: Password }; Client.logOn(logOnOptions); Client.on("loggedOn", () => { console.log("User logged into Steam".green); Client.gamesPlayed("BOT Testing"); community.getSteamGroup(groupID, function(err, group) { group.join(function(err) { if (err) console.log('error', err); }); }); }); //process.exit(1) } }); } else { console.log("ERROR: ".red + result); process.exit(1) } }); }); client.on("webSession", (sessionid, cookies) => { community.setCookies(cookies); }); Outputs: Logged into Steam username475041:password576382 - Saved. Logging off Steam User logged into Steam error Error: Not Logged In at SteamCommunity._checkHttpError (C:\Users\Admin\node_modules\steamcommunity\components\http.js:95:9) at Request._callback (C:\Users\Admin\node_modules\steamcommunity\components\http.js:50:61) at Request.self.callback (C:\Users\Admin\node_modules\request\request.js:188:22) at emitTwo (events.js:106:13) at Request.emit (events.js:191:7) at Request.<anonymous> (C:\Users\Admin\node_modules\request\request.js:1171:10) at emitOne (events.js:96:13) at Request.emit (events.js:188:7) at IncomingMessage.<anonymous> (C:\Users\Admin\node_modules\request\request.js:1091:12) at IncomingMessage.g (events.js:292:16) My guess now is that the community module doesn't register that I'm logged in. Quote
Dr. McKay Posted June 5, 2017 Report Posted June 5, 2017 You need to call community.setCookies inside of SteamUser's webSession event in order to get steamcommunity to use a login session. lad 1 Quote
lad Posted June 5, 2017 Author Report Posted June 5, 2017 Oh thanks, it's working now.Sometimes it says not logged in and sometimes it does. Now when my bots join my group, they don't count as members. I think that's because they don't have an avatar. Is that correct? http://steamcommunity.com/groups/bulkbogan/memberslistxml/?xml=1Here you can see that my group has 57 members with an avatar?</avatarFull><memberCount>57</memberCount> And here you can see that my group has 64 members in total?</groupDetails><memberCount>64</memberCount> Is there a way to show my bots in the group members count? Quote
Dr. McKay Posted June 5, 2017 Report Posted June 5, 2017 It may not have anything to do with an avatar, but I couldn't tell you why there's a discrepancy. Quote
lad Posted June 7, 2017 Author Report Posted June 7, 2017 (edited) Is it possible this is due to the fact that the accounts I create just don't have their community profile enabled yet?If so, is there a way to enable them through the account making process? Regards EDIT: setupProfile([callback])I'm gonna try this right now. EDIT2: I don't know where to put it and what to call the callback. Edited June 7, 2017 by lad Quote
lad Posted June 8, 2017 Author Report Posted June 8, 2017 (edited) So I want to understand what I'm doing wrong so I put this little bot together. const SteamUser = require("steam-user"); const SteamCommunity = require("steamcommunity"); const client = new SteamUser(); const community = new SteamCommunity(); var Username = "username"; var Password = "password"; const logOnOptions = { accountName: Username, password: Password }; client.logOn(logOnOptions); client.on("loggedOn", () => { console.log("Logged into Steam".green); community.setupProfile(function(err) { if (err) { console.log("Error: ", err); process.exit(1) } if (!err) { console.log("setupProfile success!".cyan); client.logOff(); console.log("Loggin off...".yellow); process.exit(1) } }); }); client.on("webSession", (sessionid, cookies) => { community.setCookies(cookies); }); Giving me this error: C:\Users\Admin>node setupprofile.js undefined Error: Error: Not Logged In at SteamCommunity._checkHttpError (C:\Users\Admin\node_modules\steamcommunity\components\http.js:95:9) at Request._callback (C:\Users\Admin\node_modules\steamcommunity\components\http.js:50:61) at Request.self.callback (C:\Users\Admin\node_modules\request\request.js:188:22) at emitTwo (events.js:106:13) at Request.emit (events.js:191:7) at Request.<anonymous> (C:\Users\Admin\node_modules\request\request.js:1171:10) at emitOne (events.js:96:13) at Request.emit (events.js:188:7) at IncomingMessage.<anonymous> (C:\Users\Admin\node_modules\request\request.js:1091:12) at IncomingMessage.g (events.js:292:16) I also don't understand where the undefined is coming from. If this is going to work I'm just going to be creating accounts and then sign in to all of them at once, setup their community profiles and make them join the group.I've attempted to create this and I think I'm really close to finishing it. I'm already able to login to these accounts but the "Not Logged In" error keeps coming back in every program I've written... Regards Edited June 8, 2017 by lad Quote
Dr. McKay Posted June 8, 2017 Report Posted June 8, 2017 The undefined is coming from this line: console.log("Logged into Steam".green); because green is not a standard property of strings (it's provided by some module). You're getting Not Logged In because you're trying to do web-based stuff before webSession is emitted and subsequently setCookies is called. The earliest safe time to do web-based stuff is right below where you call setCookies. Quote
lad Posted June 11, 2017 Author Report Posted June 11, 2017 Oh I see, working now.I tried setting up a account with a verified email, no success in showing the user in the group. Adding a avatar won't help aswell.I'm still wondering how this works. Maybe it has something to do with the restrictions a account has. I was also wondering if I can Rate and Favorite artwork using a bot.Is this possible usingy your `node-steamcommunity` module? Quote
Dr. McKay Posted June 12, 2017 Report Posted June 12, 2017 No, bot voting is not something I will support. lad 1 Quote
Revadike Posted June 15, 2017 Report Posted June 15, 2017 Oh I see, working now. I tried setting up a account with a verified email, no success in showing the user in the group. Adding a avatar won't help aswell. I'm still wondering how this works. Maybe it has something to do with the restrictions a account has. I was also wondering if I can Rate and Favorite artwork using a bot. Is this possible usingy your `node-steamcommunity` module?Just simulate the network request using https://github.com/DoctorMcKay/node-steamcommunity/wiki/HTTP-Hooks 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.