Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2018
1,211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.14 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 config = require('./config.json');
  7. var botSID;
  8.  
  9. const client = new SteamUser();
  10. const community = new SteamCommunity();
  11. const manager = new TradeOfferManager ({
  12. steam: client,
  13. community: community,
  14. language: 'en'
  15. });
  16. const logOnOptions = {
  17. accountName: config.username,
  18. password: config.password,
  19. twoFactorCode: SteamTotp.generateAuthCode(config.sharedSecret)
  20. };
  21.  
  22. client.logOn(logOnOptions);
  23.  
  24. client.on('loggedOn', () => {
  25. console.log('succesfully logged on.');
  26. client.setPersona(SteamUser.Steam.EPersonaState.Online);
  27. client.gamesPlayed(["Hogjuulelt hiigdej bn", 570]);
  28. botSID = client.steamID.toString();
  29. });
  30.  
  31. client.on("friendMessage", function(steamID, message) {
  32. console.log(steamID + " is messaging me. Message: " + message);
  33. if (message == "hi") {
  34. client.chatTyping(steamID);
  35. client.chatMessage(steamID, "Sain. Sain baina uu?");
  36. }else if (message == "info") {
  37. client.chatMessage(steamID, "Ene bol mongolchuudiin bie bieniigee scam-dah buyu luivardahiig bagasagahiin tuld hiigdsen automat bot yum. Tovchoor middlemanii uurgiig guitsetgene.");
  38. client.chatMessage(steamID, "Aldsan hun arvan tamtai gegcheer arvan tamiig medersen hunii huvid enehuu bot-g hiisen ba neg ch gesen hund tus boloosoi gej husej baina.");
  39. client.chatMessage(steamID, "Admin minii bie ymarvaa neg ashig haraagui bolno.");
  40. client.chatMessage(steamID, "Uilchilgeenii talaar delgerenguig 'service' commandaas avna uu...Bayarlalaa.");
  41. client.chatMessage(steamID, "Hundetgesen, Tvman99");
  42. }else if (message == "service") {
  43. client.chatMessage(steamID, "ANHAARUULGA: BOT HEZEE CH TANIIG ADD HIIHGUI!!! Herev adilhan zuragtai, nertei friend request irvel blocklooroi.");
  44. client.chatMessage(steamID, "Trade hiih gej baigaa 2 hun 2-uulaa bot-toi naiz baih shaardlagatai. Bot-nii steam profile link-g 'botlink' commandaas avna uu.");
  45. client.chatMessage(steamID, "Uilchilgeenii zaavar...Turshiltiin shatand orsnii daraa bichigdene.");
  46. client.chatMessage(steamID, "Uilchilgeenii tolbor: UNEGUI!");
  47. client.chatMessage(steamID, "Donation/Handiv ogj bolno. 'donation' commandaas...");
  48. }else if (message == "donation") {
  49. client.chatMessage(steamID, "Yunii turuund hodolmoriig mine unelj handiv ogoh gej baigaa tand tuiliin ih talarhaj baigaagaa ilerhiileh ni zuitei bolov uu.");
  50. client.chatMessage(steamID, "MASH IH BAYARLALAA");
  51. client.chatMessage(steamID, "Ta daraah linkeer orj handivaa ogno uu!");
  52. client.chatMessage(steamID, "https://steamcommunity.com/tradeoffer/new/?partner=165896716&token=KJurf_1N");
  53. }else if (message == "fb") {
  54. client.chatMessage(steamID, "Adminii facebook: https://www.facebook.com/tvman99");
  55. }else if (message == "steam") {
  56. client.chatMessage(steamID, "Adminii steam: https://steamcommunity.com/id/tvman99/");
  57. }else if (message == "contact") {
  58. client.chatMessage(steamID, "Ta admintai facebook bolon steam-r holboo barih bolomjtoi.");
  59. client.chatMessage(steamID, "Adminii facebook-g 'fb', steam-g 'steam' commandiig ashiglaj harna uu.");
  60. }else if (message == "botlink") {
  61. client.chatMessage(steamID, "Enehuu botnii profile link: https://steamcommunity.com/profiles/"+ botSID +"/");
  62. client.chatMessage(steamID, "Ta linkiig trade hiih nogoo hundee ogsnoor nogoo hun tani botiig naizaaraa nemeh bolomjtoi bolno.");
  63. }else if (message == "help") {
  64. client.chatMessage(steamID, "'hi', 'help', 'fb', 'steam', 'contact', 'botlink', 'info', 'service', 'donation' zereg commanduud baigaa.");
  65. }else if(steamID != config.ownerID) {
  66. client.chatMessage(steamID, "'help' commandiig ashiglaj commanduudiin jagsaaltiig harna uu!");
  67. }
  68. });
  69.  
  70. client.on('friendRelationship', function(steamID, relationship) {
  71. if (relationship == SteamUser.Steam.EFriendRelationship.Friend) {
  72. console.log("I am now friends with " + steamID.getSteamID64());
  73. client.chatMessage(steamID, "Hi! :)");
  74. client.chatMessage(steamID, "Ene bot hogjuuleltiin shatandaa yavj baigaa bolno!");
  75. }
  76. else if (relationship == SteamUser.Steam.EFriendRelationship.RequestRecipient) {
  77. console.log(steamID + " added me");
  78. // Add the user.
  79. addFriend(steamID);
  80. }
  81. });
  82.  
  83. // This is emitted when we have our friendslist after logon.
  84. client.on("friendsList", function() {
  85. // Loop all users that we have relations with.
  86. // Ignored, blocked etc...
  87. for (var steamid64 in client.myFriends) {
  88. // This is the relation we have with the user.
  89. var relationship = client.myFriends[steamid64];
  90. // Check if they send us a friend request
  91. // I am pretty sure that this will also be true if the bot send the user a friend request, but you can just ignore that for now.
  92. if (relationship == SteamUser.Steam.EFriendRelationship.RequestRecipient) {
  93. // Add them back.
  94. addFriend(steamid64);
  95. }
  96. }
  97. });
  98. function addFriend(steamID) {
  99. client.addFriend(steamID);
  100. }
  101.  
  102. client.on('webSession', (sessionid, cookies) => {
  103. manager.setCookies(cookies);
  104.  
  105. community.setCookies(cookies);
  106. community.startConfirmationChecker(20000, config.identitySecret);
  107. });
  108.  
  109. function acceptOffer(offer) {
  110. offer.accept((err) => {
  111. community.checkConfirmations();
  112. console.log("We Accepted an offer");
  113. if (err) console.log("There was an error accepting the offer.");
  114. });
  115. }
  116.  
  117. function declineOffer(offer) {
  118. offer.decline((err) => {
  119. console.log("We Declined an offer");
  120. if (err) console.log("There was an error declining the offer.");
  121. });
  122. }
  123.  
  124. function processOffer(offer) {
  125. if (offer.isGlitched() || offer.state === 11) {
  126. console.log("Offer was glitched, declining.");
  127. declineOffer(offer);
  128. } else if (offer.partner.getSteamID64() === config.ownerID) {
  129. console.log("Offer was sent from admin, accepting.");
  130. acceptOffer(offer);
  131. } else {
  132. console.log("Offer was sent from stranger, declining.");
  133. declineOffer(offer);
  134. }
  135. }
  136.  
  137. client.setOption("promptSteamGuardCode", false);
  138.  
  139. manager.on('newOffer', (offer) => {
  140. processOffer(offer);
  141. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement