Advertisement
youssefsoua

Untitled

Dec 1st, 2017
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const SteamUser = require('steam-user');
  2. const SteamTotp = require('steam-totp');
  3. const SteamCommunity = require('steamcommunity');
  4. const TradeOffermanagerBot = require('steam-tradeoffer-manager');
  5.  
  6. const config = require('./config.json');
  7.  
  8. const clientBot = new SteamUser();
  9.  
  10. const community = new SteamCommunity();
  11.  
  12. const managerBot = new TradeOffermanagerBot({
  13.     steam: clientBot,
  14.     community: community,
  15.     language: 'en',
  16.     "cancelTime": "720000"
  17. });
  18.  
  19. const logOnOptionsBot = {
  20.     accountName: config.accountName,
  21.     password: config.password,
  22.     twoFactorCode: SteamTotp.generateAuthCode(config.steam_shared_secret)
  23. };
  24.  
  25. clientBot.logOn(logOnOptionsBot);
  26.  
  27. clientBot.on('loggedOn', () => {
  28.     console.log('Bot logged into Steam');
  29.  
  30.     clientBot.setPersona(SteamUser.Steam.EPersonaState.Online);
  31.     clientBot.gamesPlayed("TEST");
  32. });
  33.  
  34. clientBot.on('webSession', function (sessionID, cookies) {
  35.     managerBot.setCookies(cookies, function (err) {
  36.         if (err) {
  37.             console.log(err);
  38.             process.exit(1);
  39.             return;
  40.         }
  41.     });
  42.  
  43.     community.setCookies(cookies);
  44.  
  45. });
  46.  
  47. community.on('sessionExpired', function (err) {
  48.     console.log('Session expired.');
  49.     if (err) {
  50.         if (err.message == "Not Logged In") {
  51.             console.log("Trying the error login.");
  52.             clientBot.webLogOn();
  53.             community.chatLogon();
  54.         } else {
  55.             console.log(err.message);
  56.         }
  57.     } else {
  58.         console.log('Trying to re-login.');
  59.         clientBot.webLogOn();
  60.     }
  61. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement