Advertisement
KaraCostanza

Untitled

Dec 15th, 2017
687
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.52 KB | None | 0 0
  1. const SteamUser = require('steam-user')
  2. const TradeOfferManager = require('steam-tradeoffer-manager');
  3. const SteamCommunity = require('steamcommunity');
  4. const SteamTotp = require('steam-totp');
  5. const fs = require('fs');
  6. const request = require('request');
  7.  
  8. const community = new SteamCommunity();
  9. const client = new SteamUser();
  10. const manager = new TradeOfferManager({
  11. steam: client,
  12. domain: 'Profit.gg',
  13. language: 'en'
  14. });
  15.  
  16. //Things to edit below here
  17.  
  18. const editables = {
  19. accountInfo:{
  20. sharedSecret: 'aIqcagFaSXaebGlrN/zK3gjlUWE=', //Shared secret .MA file from the desktop auth
  21. identitySecret: 'r0kIcnhi3xA8Prek/dj5kbANzxc=', //Identity secret from .ma file
  22. userName: 'USERNAME', //Username to login WITH
  23. password: 'PASSWORD', //Password to login WITH
  24. adminID: ['76561198381836066'], //AdminID, will be used to accept/send messages from/to adminID can have multiple admins Owner needs to be in both
  25. ownerID: '76561198381836066', //Decided to be lazy and do it this way, this will make sure you receive updates on the bot only 1 owner
  26. botName: "Snow", //What you want your bot name to show as on steam-user
  27. game: 'R.I.P MY VAC. BOT SAYING', //What game you are playing
  28. },
  29. Messages:{
  30. donation: 'Thank you for the donation!', //Message sent to user when a donation is received.
  31. declinedMsg: 'Sorry cannot accept this trade since you requested one of my items.',
  32. acceptedFriend: 'Thanks for adding me, to get started just send me a trade with the items you want to donate.', //Message for new friends
  33. newDonation: 'I have received a new donation, please withdraw it from my account by sending me a trade.', //Message for new donations
  34. unknown: 'Error: Unknown command, type !commands if you want to see the list of commands.' //Message for unknown commands
  35. },
  36. commands:{
  37. '!help': 'To donate items send the item(s) to me, for me to accept I cannot be giving anything.',
  38. '!creator': 'Steam: Snow',
  39. '!commands': '!help, !creator, !owner, !aboutkara',
  40. '!owner': 'Here Is The Owner Of This Bot -> http://steamcommunity.com/id/costanzacsgo.',
  41. '!aboutkara': ':)',
  42. '!age': 'Ask Her :)',
  43. '!link': 'http://steamcommunity.com/id/costanzacsgo',
  44. '!rank': ':)',
  45. '!country': 'United Kingdom , She Is A Great British',
  46. '!birthday': "11-Sep-2001",
  47. '!living in': 'Top Secret. You Can Ask Her(Kara) :D',
  48. '!gender': 'Female'
  49. }
  50. };
  51. /*
  52. const logOnOptions = {
  53. accountName: editables.accountInfo.userName,
  54. password: editables.accountInfo.password,
  55. twoFactorCode: SteamTotp.generateAuthCode(editables.accountInfo.sharedSecret)
  56. };
  57.  
  58. client.logOn(logOnOptions);
  59.  
  60. client.on('loggedOn', () => {
  61. console.log("You are logged in as: " + editables.accountInfo.botName);
  62.  
  63. client.setPersona(SteamUser.Steam.EPersonaState.Online, editables.accountInfo.botName);
  64. client.gamesPlayed(editables.accountInfo.game);
  65. })
  66.  
  67. client.on("friendMessage", function(steamID, message){
  68. if(message == "!aboutkara"){
  69. client.chatMessage(steamID, "!age");
  70. client.chatMessage(steamID, "!link");
  71. client.chatMessage(steamID, "!rank");
  72. client.chatMessage(steamID, "!gender");
  73. client.chatMessage(steamID, "!country");
  74. client.chatMessage(steamID, "!birthday");
  75. client.chatMessage(steamID, "!living in");
  76. }
  77. });
  78.  
  79. client.on("friendMessage", function(steamID, message){
  80. if(message == "!rank"){
  81. client.chatMessage(steamID, "Skills Rank:The Global Elite.");
  82. client.chatMessage(steamID, "Current Rank:Legendary Eagle Master.");
  83. }
  84. });
  85.  
  86. client.on('webSession', (sessionid, cookies) => {
  87. manager.setCookies(cookies);
  88.  
  89. community.setCookies(cookies);
  90. community.startConfirmationChecker(10000, editables.accountInfo.identitySecret);
  91. });
  92.  
  93. function isInArray(value, array) {
  94. return array.indexOf(value) > -1;
  95. }
  96.  
  97. client.on('friendRelationship', (steamid, relationship) => {
  98. if(relationship == 2){
  99. client.addFriend(steamid);
  100. client.chatMessage(steamid, editables.Messages.acceptedFriend);
  101. }
  102. });
  103.  
  104. client.on('friendMessage', (steamid, message) => {
  105. console.log('New message from: ' +steamid + ' Saying: ' +message);
  106. console.log(editables.commands[message]);
  107. if(editables.commands[message]){
  108. client.chatMessage(steamid, editables.commands[message]);
  109. }
  110. else{
  111. client.chatMessage(steamid, editables.Messages.unknown);
  112. }
  113.  
  114. });
  115.  
  116. function accept(offer){
  117. offer.accept((err) => {
  118. if(err) console.log('Unable to accept offer: ${err.message}');
  119. community.checkConfirmations();
  120. });
  121. }
  122.  
  123. function decline(offer){
  124. offer.decline((err) => {
  125. if(err) return console.log('Unable to decline offer: ${err.message}');
  126. });
  127. }
  128.  
  129. manager.on('newOffer', (offer) =>{
  130. const partnerID = offer.partner.getSteamID64();
  131. console.log('New offer: ' + offer.id + ' from: ' + partnerID);
  132.  
  133. if(isInArray(partnerID, editables.accountInfo.adminID)){
  134. console.log('Accepting offer from admin!');
  135. client.chatMessage(editables.accountInfo.ownerID, 'New admin offer from: ' + partnerID);
  136. accept(offer);
  137. } else if(!offer.itemsToGive.length) {
  138. console.log('New donation from: ' + partnerID);
  139. client.chatMessage(partnerID, editables.Messages.donation);
  140. client.chatMessage(editables.accountInfo.ownerID, editables.Messages.newDonation);
  141. accept(offer);
  142. }
  143. else {
  144. console.log('Declining offer from: ' + partnerID);
  145. client.chatMessage(partnerID, editables.Messages.declinedMsg);
  146. decline(offer);
  147. }
  148. });
  149. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement