Advertisement
Guest User

Untitled

a guest
Dec 7th, 2016
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.34 KB | None | 0 0
  1. const SteamUser = require('steam-user');
  2. const SteamTotp = require('steam-totp');
  3. const SteamCommunity = require('steamcommunity');
  4. const TradeOfferManager = require('steam-tradeoffer-manager');
  5.  
  6. const client = new SteamUser();
  7. const community = new SteamCommunity();
  8. const manager = new TradeOfferManager({
  9. steam: client,
  10. community: community,
  11. language: 'en'
  12. });
  13.  
  14. const logOnOptions = {
  15. accountName: '.', //put your steam username here within the quotes
  16. password: '.', //put your steam password here within the quotes
  17. twoFactorCode: SteamTotp.generateAuthCode('.') //put your steam shared secret here within the quotes
  18. };
  19.  
  20. const admin = "76561198211091797"; //your steam id
  21.  
  22. client.logOn(logOnOptions);
  23.  
  24. client.on('loggedOn', () => {
  25. console.log('Logged into Steam with the account name of : ' + logOnOptions.accountName);
  26.  
  27. const tf2 = 440;
  28. const csgo = 730;
  29.  
  30. client.setPersona(SteamUser.Steam.EPersonaState.Online);
  31. client.gamesPlayed(tf2); //here you can put csgo or tf2
  32. });
  33.  
  34. client.on('webSession', (sessionid, cookies) => {
  35. manager.setCookies(cookies);
  36.  
  37. community.setCookies(cookies);
  38. community.startConfirmationChecker(10000, 'qCfcHZjdCXgfujdSMyok/1NzXGo='); //put your steam identity secret here within the quotes
  39.  
  40. console.log("Connected to steam with the session id of : " + sessionid);
  41. });
  42.  
  43. manager.on('newOffer', (offer) => {
  44.  
  45. console.log("New offer #" + offer.id + " from " + offer.partner);
  46.  
  47. if(offer.itemsToGive.length == 0 || offer.partner === admin){
  48. console.log("Offer is either a donation or trade from admin.");
  49. offer.accept((err, status) => {
  50. if (err) {
  51. console.log(err);
  52. } else {
  53. console.log('Donation accepted.');
  54. }
  55. });
  56. }
  57.  
  58. });
  59.  
  60. offer.accept((err, status) => {
  61. if (err) {
  62. console.log(err);
  63.  
  64. offer.accept((err, status) => {
  65. if (err) {
  66. console.log('Tried accepting again, but failed, aborting');
  67. console.log(err);
  68. } else {
  69. console.log('Donation accepted. (After second try)');
  70. }
  71. });
  72.  
  73. } else {
  74. console.log('Donation accepted.');
  75. }
  76. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement