Advertisement
Saevitus

help plz

Jan 3rd, 2017
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const steam = require('steam');
  2. const rl = require('readline-sync');
  3. const steamClient = new steam.SteamClient();
  4. const steamUser = new steam.SteamUser(steamClient);
  5.  
  6. var firstLogin = true;
  7. var firstConnect = true;
  8. var code;
  9. steamClient.connect();
  10. steamClient.on("connected", () =>
  11. {
  12.     if (firstConnect)
  13.     {
  14.         console.log("first connection");
  15.         firstConnect = false;
  16.     }else
  17.         console.log("second connection");
  18.    
  19.     if (firstLogin)
  20.     {
  21.         console.log("it's the first login");
  22.         steamUser.logOn(
  23.         {
  24.             account_name: "username",
  25.             password: "password"
  26.         });
  27.         firstLogin = false;
  28.     } else
  29.     {
  30.         console.log("second login hit");
  31.         steamUser.logOn(
  32.         {
  33.             account_name: "username",
  34.             password: "password",
  35.             auth_code: code
  36.         });
  37.     }
  38.    
  39.     steamClient.on("logOnResponse", (response) =>
  40.         {
  41.             if (response.EResult == steam.EResult.OK)
  42.             {
  43.                 console.log("Logged on!");
  44.             }else
  45.                 console.log("Log On Response: ", response.EResult);
  46.         });
  47.    
  48. });
  49.    
  50. steamClient.on("error", (error) =>
  51. {
  52.     if (error.eresult == steam.EResultAccountLogonDenied)
  53.     {
  54.         code = rl.question("Steam Auth Code: ");
  55.         steamClient.connect();
  56.     }  
  57. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement