Mr_wall1122 Posted July 31, 2017 Report Posted July 31, 2017 (edited) hello i am having a weird issue when i login in for the first time using email authentication my "loggedOn" function gets called twice, but if i was to login again with the same details it would be back to normal, and it works normally if i was to sign in using my account with mobile authentication, any suggestions please help my full code is: const TradeOfferManager = require('steam-tradeoffer-manager'); const SteamCommunity = require('steamcommunity'); const SteamUser = require('steam-user'); var colors = require('colors/safe'); let date = require('date-and-time'); var prompt = require('prompt'); const chalk = require('chalk'); var sleep = require('sleep'); require('console-stamp')(console, '[HH:MM:ss]'); const RedStyle = chalk.red; const YellowStyle = chalk.yellow; const GreenStyle = chalk.green; const client = new SteamUser(); const community = new SteamCommunity(); const manager = new TradeOfferManager ({ steam: client, community: community, language: 'en' }); //Welcome MESSAGE! console.log(GreenStyle('-------------------------------------------')); console.log(GreenStyle(' Welcome To My Group Invite Blocker ')); console.log(GreenStyle('-------------------------------------------')); console.log(GreenStyle(' ')); console.log(YellowStyle('-------------------------------------------')); console.log(YellowStyle(' Made By Ben Wall ')); console.log(YellowStyle('-------------------------------------------')); console.log(YellowStyle(' ')); console.log(RedStyle('-------------------------------------------')); console.log(RedStyle('NOTE: IF YOU LOGIN USING STEAM EMAIL ')); console.log(RedStyle('AUTHENTICATOR ENTER THE CODE AND THEN ')); console.log(RedStyle('SIMPLY RESTART AND RE-LOGIN TO THE BOT ')); console.log(RedStyle('DUE TO A UNKNOWN PROBLEM THAT IM WORKING ')); console.log(RedStyle('ON, NOW YOU WONT NEED THE CODE AS IT ONLY ')); console.log(RedStyle('REQUIRES CODE UPON FIRST LOGIN, IF YOU USE ')); console.log(RedStyle('MOBILE TO AUTHENTICATE THEN YOU ARE FINE TO')); console.log(RedStyle('USE IT AS INTENDED, JUST MORE STEPS FOR THE')); console.log(RedStyle('EMAIL AUTHENTICATOR GUYS ')); console.log(RedStyle('-------------------------------------------')); var schema = { properties: { Account_Name: { description: colors.green('Account Name'), }, Password: { description: GreenStyle('Password'), hidden: true, replace: '*' }, } }; prompt.start(); prompt.get(schema, function (err, result) { const logOnOptions = { accountName: result.Account_Name, password: result.Password }; //logon using credentials that you typed in client.logOn(logOnOptions); client.setOption("promptSteamGuardCode", false); client.setOption("autoRelogin", true); var mobile = { properties: { Steam: { description: GreenStyle('Steam Mobile Code') }, } }; var email = { properties: { SteamE: { description: GreenStyle('Steam Email Code (PLEASE RESTART BOT AFTER)') }, } }; //Checks if you are using Mobile authenticator or email Code client.on('steamGuard', function(domain, callback) { if(domain == null){ prompt.start(); prompt.get(mobile, function (err, result) { var code = result.Steam; callback(code); }); }else{ prompt.start(); prompt.get(email, function (err, result) { var code = result.SteamE; callback(code); }); } }); }); let now = new Date(); //this is what happens when succesfully logged on client.on('loggedOn', () => { client.on("accountInfo", function(name, country) { console.log(GreenStyle(' ')); console.log(GreenStyle('-------------------------------------------')); console.log(GreenStyle('Group Invite Blocker 3000 ')); console.log(GreenStyle('-------------------------------------------')); console.log(GreenStyle("Your Country: " + country)); console.log(GreenStyle('The Time Upon Logon: ' + date.format(now, 'HH:mm:ss'))); console.log(GreenStyle('Succesfully logged in as: ' + name)); console.log(GreenStyle('-------------------------------------------')); console.log(GreenStyle(' ')); client.setPersona(SteamUser.Steam.EPersonaState.Online); }); }); //READ THIS: IMPORTANT //IF YOU DO NOT HAVE FAMILY PIN ENABLED DELETE THE NUMBERS //EXAMPLE: //WITHOUT FAMILY VIEW PIN: //manager.setCookies(cookies); //community.setCookies(cookies); //WITH FAMILY VIEW PIN: //manager.setCookies(cookies, 1234); //community.setCookies(cookies, 1234); client.on('webSession', function(sessionID, cookies) { console.log(GreenStyle("Got Web Session! (this is good)")); manager.setCookies(cookies, 4265); community.setCookies(cookies, 4265); }); //This is the code which blocks group invites automatically client.on('groupRelationship', function (steamID, relationship) { if (relationship == SteamUser.Steam.EClanRelationship.Invited){ client.respondToGroupInvite(steamID, false); console.log("Declined Steam Group Invite"); } }); Edited July 31, 2017 by Mr_wall1122 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.