Igaresha Posted February 9, 2018 Report Posted February 9, 2018 (edited) Hello guys. I've got a problem which i cant decide by myself..First problem was that my bot was going offline with no reason, but i decided itAnd now i got the second problem: After few hours (sometimes days) bot asking for steam guard code. In console it looks like: "Steam Guard Code:".Guys, need your help Thanks.Code: const config = require("./config.js"); const Config = require('config-js'); const SteamUser = require('steam-user'); const SteamTotp = require('steam-totp'); const SteamCommunity = require('steamcommunity'); const TradeofferManager = require('steam-tradeoffer-manager'); const client = new SteamUser(); const community = new SteamCommunity(); const manager = new TradeofferManager({ steam: client, community: community, language: 'en' // Может быть любой язык }); // Log in to account with config.js const logOnOptions = { "accountName": config.steam.username, "password": config.steam.password, "twoFactorCode": SteamTotp.generateAuthCode(config.steam.twoFactorCode) }; client.logOn(logOnOptions); // After success login client.on('loggedOn', () => { console.log('Bot succesfully authorized!'); client.setPersona(SteamUser.Steam.EPersonaState.Online, config.steam.botname); console.log('Bot status changed to "Online"'); }); // Thats how i solve problem with going offline community.on('sessionExpired', function(err) { if (err) { console.log('sessionExpired: '+err); } community.stopConfirmationChecker(); if (client.steamID) { client.webLogOn(); } else { client.logOn(logOnOptions); } }); // Thats my way to solve second problem, but it didnt help. client.on("steamGuard", function(domain, callback, lastCodeWrong) { if(lastCodeWrong) { console.log("Last code wrong, try again!"); setTimeout(function() { callback(SteamTotp.getAuthCode(config.steam.twoFactorCode)); }, 30000); } }); Edited February 9, 2018 by Igaresha Quote
Vanilla Posted February 9, 2018 Report Posted February 9, 2018 (edited) Correct me if I'm wrong, but isn't it should supposed to be like this? community.on('sessionExpired', function(err) { if (err) { console.log('sessionExpired: '+err); client.webLogOn(); } community.stopConfirmationChecker(); }); Also, another way to bypass Steam Guard Code is using loginKey Edited February 9, 2018 by Vanilla McMuffinDK and Igaresha 2 Quote
Dr. McKay Posted February 9, 2018 Report Posted February 9, 2018 If you want the steamGuard event to work, you need to set the promptSteamGuardCode option to false. Igaresha 1 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.