klonaway Posted April 10, 2017 Report Posted April 10, 2017 Hi Doc, hi everybody, I have been trying to code a simple game idler for CS:GO, and I dug into Steam-card-farmer's code to customize it as simply as possible. So far, the code I have is : // Reload every hour through an external "forever" call setTimeout(function () { process.exit(0); }, 1000*3600*1); // Requires var SteamUser = require('steam-user') var SteamTOTP = require('steam-totp'); // Instance var client = new SteamUser(); // Secret personal data : klonaway var accountName = "myAccount"; var password = "myPassword"; var sharedSecret = "mySharedSecret"; var identitySecret = "myIdentitySecret"; // Preparing log on options var logOnOptions = { 'accountName': accountName, 'password': password, 'twoFactorCode': SteamTOTP.generateAuthCode(sharedSecret) }; // Sign into Steam client.logOn(logOnOptions); client.on('loggedOn', function(details) { console.log("Successfully logged on Steam as " + accountName); client.webLogOn(); client.once('webSession', function(sessionID, cookies) { client.gamesPlayed({ "game_id": 730, }); }); });From the console, it seems to work fine, but I cant't get any of the thousands of card drops awaiting to actually drop. Any insight into what I must have missed ? Thanks a lot for any hint and happy botting ! Quote
Dr. McKay Posted April 10, 2017 Report Posted April 10, 2017 A few things:There's no need to wait for webSessions to tell Steam you're running a gameYou can use client.gamesPlayed([730]); which is a bit simpler and allows steam-user to add some additional data when helpfulYou might want to set yourself as online (setPersona) so you can see on your Steam profile whether you're actually in-game or notCard drops can take a while. How long did you wait? Quote
klonaway Posted April 20, 2017 Author Report Posted April 20, 2017 (edited) Thanks Doc ! I implemented your advice, and now everything is working smoothly !For anyone willing to run a very simple idling bot, here is the code I use so far : // Reload every 2 hours setTimeout(function () { process.exit(0); }, 1000*3600*2); // Requires var SteamUser = require('steam-user') var SteamTOTP = require('steam-totp'); // Instance var client = new SteamUser(); // Secret personal data : klonaway var accountName = "yourAccount"; var password = "yourPassword"; var sharedSecret = "yourSharedSecret"; var identitySecret = "yourIdentitySecret"; // Preparing log on options var logOnOptions = { 'accountName': accountName, 'password': password, 'twoFactorCode': SteamTOTP.generateAuthCode(sharedSecret) }; // Sign into Steam client.logOn(logOnOptions); client.on('loggedOn', function(details) { console.log("Successfully logged on Steam as " + accountName); client.webLogOn(); client.setPersona(1); client.gamesPlayed([730]); }); The bot exits programmatically every 2 hours, and the "forever" javascript file below reloads it when it dies. I use this dirty trick with all my Steam bots to ensure the bot works almost permanently, despite the many Steam bugs and oddities ;-) var forever = require('forever-monitor'); var child = new (forever.Monitor)('./idlerLKS.js', { max: 100000, silent: false }); child.on('exit', function () { console.log('Forever has programmatically exited after 100000 restarts'); }); child.start(); Hope it helps someone.Happy botting ! Edited April 22, 2017 by klonaway Quote
chrion Posted June 12, 2017 Report Posted June 12, 2017 Sweet share Does anyone know how easy this is to host on a server instead and hook up to a front end ? Quote
VAAANEQ Posted June 16, 2017 Report Posted June 16, 2017 nice code! You should add @client.setPersona SteamUser.EPersonaState.Online/Offline option! 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.