daily pastebin goal
61%
SHARE
TWEET

Untitled

a guest Jun 8th, 2017 94 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const SteamUser = require('steam-user');
  2. const TradeOfferManager = require('steam-tradeoffer-manager');
  3. const SteamTotp = require('steam-totp');
  4. const SteamCommunity = require('steamcommunity');
  5. const config = require('./config.json');
  6. const winston = require('winston');
  7.  
  8. const community = new SteamCommunity();
  9. const client = new SteamUser();
  10. const manager = new TradeOfferManager({
  11.     steam: client,
  12.     domain: 'example.com',
  13.     language: 'en',
  14.     pollInterval: 4000
  15. });
  16.  
  17. winston.add(winston.transports.File, {
  18.     filename: 'activaty.log'
  19. });
  20. winston.remove(winston.transports.Console);
  21.  
  22. const logOnOptions = {
  23.     accountName: config.username,
  24.     password: config.password,
  25.     twoFactorCode: SteamTotp.generateAuthCode(config.sharedSecret)
  26. };
  27.  
  28. client.logOn(logOnOptions);
  29.  
  30. client.on('loggedOn', function(details) {
  31.     console.log(`Logged into Steam as ${client.steamID.getSteam3RenderedID()}`); //online then play tf2
  32.     client.setPersona(SteamUser.Steam.EPersonaState.Online);
  33.     client.gamesPlayed([440])
  34. });
  35.  
  36. client.on('webSession', function(sessionID, cookies) {
  37.     manager.setCookies(cookies, function(err) {
  38.         if (err) return console.log(err);
  39.         console.log(`Got API key: ${manager.apiKey}`);
  40.     });
  41.     community.setCookies(cookies);
  42. });
  43.  
  44. function acceptOffer(offer) {
  45.     offer.accept((err) => {
  46.         if (err) winston.info(`Unable to accept offer: ${err.message}`);
  47.     });
  48. }
  49.  
  50. manager.on('newOffer', (offer) => {
  51.     if (offer.itemsToGive.length === 0) {
  52.             acceptOffer(offer);
  53.             }
  54.         });
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top