Advertisement
Guest User

Untitled

a guest
Feb 13th, 2017
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.55 KB | None | 0 0
  1. var config = require('./config.js');
  2.  
  3. var SteamUser = require('steam-user');
  4. var client = new SteamUser();
  5.  
  6. var SteamCommunity = require("SteamCommunity");
  7. var community = new SteamCommunity();
  8.  
  9. var SteamTotp = require('steam-totp');
  10. var mobilecode = SteamTotp.getAuthCode(config.sharedsecret);
  11.  
  12. var TradeOfferManager = require('steam-tradeoffer-manager');
  13. var manager = new TradeOfferManager({
  14. "steam": client,
  15. "domain": "http://localhost",
  16. "language": "en",
  17. "pollInterval": "5000"
  18. });
  19.  
  20. var login = {
  21. accountName: config.username,
  22. password: config.password,
  23. twoFactorCode: mobilecode
  24. };
  25.  
  26. client.logOn(login);
  27.  
  28. client.on('loggedOn', function(details) {
  29. client.getPersonas([client.steamID], function(personas) {
  30. console.log('Logged in as ' + client.steamID + ' (' + personas[client.steamID]["player_name"] + ')');
  31. console.log();
  32. });
  33. console.log();
  34. client.setPersona(1); // Shows the status as online. 0 = offline (It will still work though!) 1 = online
  35. setInterval(function() { client.webLogOn(); }, 1000 * 60); // Refreshes session every 10 minutes
  36. });
  37.  
  38. client.on('webSession', function(sessionID, cookies) {
  39. manager.setCookies(cookies, function(err) {
  40. if (err) { console.log("Couldn\'t set cookies! Error: " + err); }
  41. });
  42. community.setCookies(cookies);
  43. community.startConfirmationChecker(10000, config.identitysecret);
  44. });
  45.  
  46. // client.on('error', function(e) {
  47. // console.log(e);
  48. // process.exit(1);
  49. // });
  50.  
  51. client.gamesPlayed([730]);
  52. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement