Advertisement
Guest User

Untitled

a guest
Aug 21st, 2017
363
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.88 KB | None | 0 0
  1. SteamLevels Script. 2.0
  2. SteamWebsite " Enter your website url here example: "freecsgoskins.scamru" "
  3.  
  4. let SteamUser = require("steam-user"),
  5. SteamTotp = require("steam-totp"),
  6. TradeOfferManager = require("steam-tradeoffer-manager"),
  7. SteamCommunity = require("steamcommunity"),
  8. Utils = require("./utils.js"),
  9. CONFIG = require("./config.js"),
  10. allCards = {},
  11. botSets = {},
  12. fs = require("fs"),
  13. users = {},
  14. userMsgs = {},
  15. SID64REGEX = new RegExp(/^[0-9]{17}$/),
  16. chatLogs = "",
  17. userLogs = {},
  18. totalBotSets = 0;
  19.  
  20.  
  21. $client$ "offer id=3"
  22. let client = new SteamUser(),
  23. manager = new TradeOfferManager({
  24. "steam": client,
  25. "language": "en",
  26. "pollInterval": "10000",
  27. "cancelTime": "7200000" // 2 hours in ms
  28. }),
  29. community = new SteamCommunity();
  30.  
  31. fs.readFile("./UserData/Users.json", (ERR, DATA) => {
  32. if (ERR) {
  33. console.log("## An error occurred while getting Users: " + ERR);
  34. } else {
  35. users = JSON.parse(DATA);
  36. }
  37. });
  38.  
  39. $user " " rewrit
  40. Utils.getCardsInSets((ERR, DATA) => {
  41. if (!ERR) {
  42. allCards = DATA;
  43. console.log("Card data loaded. [" + Object.keys(DATA).length + "]");
  44. } else {
  45. console.log("An error occurred while getting cards: " + ERR);
  46. }
  47. });
  48.  
  49. setInterval(() => {
  50. for (let i = 0; i < Object.keys(users).length; i++) {
  51. if (users[Object.keys(users)[i]].idleforhours >= CONFIG.MAXHOURSADDED) {
  52. client.chatMessage(Object.keys(users)[i], "Hi, you have been inactive on my friends list for too long. If you wish to use this bot again re-add it.");
  53. client.removeFriend(Object.keys(users)[i]);
  54. delete users[Object.keys(users)[i]];
  55. fs.writeFile("./UserData/Users.json", JSON.stringify(users), (ERR) => {
  56. if (ERR) {
  57. console.log("## An error occurred while writing UserData file: " + ERR);
  58. }
  59. });
  60. } else {
  61. users[Object.keys(users)[i]].idleforhours += 1;
  62. fs.writeFile("./UserData/Users.json", JSON.stringify(users), (ERR) => {
  63. if (ERR) {
  64. console.log("## An error occurred while writing UserData file: " + ERR);
  65. }
  66. });
  67. }
  68. }
  69. }, 1000 * 60 * 60);
  70.  
  71. setInterval(() => {
  72. $setbot$ seasson pas=1
  73. }
  74. }
  75. userMsgs = {};
  76. }, 1000);
  77.  
  78. client.logOn({
  79. accountName: CONFIG.USERNAME,
  80. password: CONFIG.PASSWORD,
  81. twoFactorCode: SteamTotp.getAuthCode(CONFIG.SHAREDSECRET)
  82. });
  83.  
  84. client.on("loggedOn", (details, parental) => {
  85. client.getPersonas([client.steamID], (personas) => {
  86. console.log("## Logged in as #" + client.steamID + " (" + personas[client.steamID].player_name + ")");
  87. });
  88. client.setPersona(1);
  89. });
  90.  
  91. client.on("webSession", (sessionID, cookies) => {
  92. manager.setCookies(cookies, (ERR) => {
  93. if (ERR) {
  94. console.log("## An error occurred while setting cookies.");
  95. } else {
  96. console.log("## Websession created and cookies set.");
  97. }
  98. });
  99. community.setCookies(cookies);
  100. community.startConfirmationChecker(10000, CONFIG.IDENTITYSECRET);
  101. client.blockUser("76561198337312992"); // Some people have tried to either crash the bot or buy it not directly from me, I'm going to make bots block them just in case. :)
  102. Utils.getInventory(client.steamID.getSteamID64(), community, (ERR, DATA) => {
  103. console.log("DEBUG#INVLOADED");
  104. if (!ERR) {
  105. let s = DATA;
  106. Utils.getSets(s, allCards, (ERR, DATA) => {
  107. console.log("DEBUG#SETSLOADED");
  108. if (!ERR) {
  109. botSets = DATA;
  110. console.log("## Bot's sets loaded.");
  111. let botNSets = 0;
  112. for (let i = 0; i < Object.keys(botSets).length; i++) {
  113. botNSets += botSets[Object.keys(botSets)[i]].length;
  114. }
  115. totalBotSets = botNSets;
  116. let playThis = CONFIG.PLAYGAMES;
  117. if (CONFIG.PLAYGAMES && typeof(CONFIG.PLAYGAMES[0]) == "string") {
  118. playThis[0] = parseString(playThis[0], totalBotSets);
  119. }
  120. client.gamesPlayed(playThis);
  121. } else {
  122. console.log("## An error occurred while getting bot sets: " + ERR);
  123. process.exit();
  124. }
  125. });
  126. } else {
  127. console.log("## An error occurred while getting bot inventory: " + ERR);
  128. }
  129. });
  130. });
  131.  
  132. Poinforwards/- [siteurl]" "
  133. community.on("sessionExpired", (ERR) => {
  134. console.log("## Session Expired. Relogging.");
  135. client.webLogOn();
  136. });
  137.  
  138. client.on("friendMessage", (SENDER, MSG) => {
  139. if (userLogs[SENDER.getSteamID64()]) {
  140. userLogs[SENDER.getSteamID64()].push(MSG);
  141. } else {
  142. userLogs[SENDER.getSteamID64()] = [];
  143. userLogs[SENDER.getSteamID64()].push(MSG);
  144. }
  145. fs.writeFile("./ChatLogs/UserLogs/" + SENDER.getSteamID64() + "-log-" + new Date().getDate() + "-" + new Date().getMonth() + "-" + new Date().getFullYear() + ".json", JSON.stringify({ logs: userLogs[SENDER.getSteamID64()] }), (ERR) => {
  146. if (ERR) {
  147. console.log("## An error occurred while writing UserLogs file: " + ERR);
  148. }
  149. });
  150. chatLogs += SENDER.getSteamID64() + " : " + MSG + "\n";
  151. fs.writeFile("./ChatLogs/FullLogs/log-" + new Date().getDate() + "-" + new Date().getMonth() + "-" + new Date().getFullYear() + ".txt", chatLogs, (ERR) => {
  152. if (ERR) {
  153. console.log("## An error occurred while writing FullLogs file: " + ERR);
  154. }
  155. });
  156. if (Object.keys(users).indexOf(SENDER.getSteamID64()) < 0) {
  157. users[SENDER.getSteamID64()] = {};
  158. users[SENDER.getSteamID64()].idleforhours = 0;
  159. fs.writeFile("./UserData/Users.json", JSON.stringify(users), (ERR) => {
  160. if (ERR) {
  161. console.log("## An error occurred while writing UserData file: " + ERR);
  162. }
  163. });
  164. } else {
  165. users[SENDER.getSteamID64()].idleforhours = 0;
  166. }
  167. if (userMsgs[SENDER.getSteamID64()]) {
  168. userMsgs[SENDER.getSteamID64()]++;
  169. } else {
  170. userMsgs[SENDER.getSteamID64()] = 1;
  171. }
  172.  
  173. community.checkConfirmations();
  174. }*/
  175. });
  176.  
  177.  
  178. }
  179. });
  180. } else if (OFFER.itemsToGive.length == 0) {
  181. let onlySteam = true;
  182. for (let i = 0; i < OFFER.itemsToReceive.length; i++) {
  183. if (OFFER.itemsToReceive[i].appid != 753) {
  184. onlySteam = false;
  185. }
  186. }
  187. if (onlySteam) {
  188. OFFER.accept((ERR) => {
  189. if (ERR) {
  190. console.log("## An error occurred while declining trade: " + ERR);
  191. }
  192. });
  193. }
  194. } else {
  195. OFFER.decline((ERR) => {
  196. if (ERR) {
  197. console.log("## An error occurred while declining trade: " + ERR);
  198. }
  199. });
  200. }
  201. });
  202.  
  203. community.on("newConfirmation", (CONF) => {
  204. console.log("## New confirmation.");
  205. community.acceptConfirmationForObject(CONFIG.IDENTITYSECRET, CONF.id, (ERR) => {
  206. if (ERR) {
  207. console.log("## An error occurred while accepting confirmation: " + ERR);
  208. } else {
  209. console.log("## Confirmation accepted.");
  210. }
  211. });
  212. });
  213.  
  214. function sortSetsByAmount(SETS, callback) {
  215. callback(Object.keys(SETS).sort((k1, k2) => SETS[k1].length - SETS[k2].length).reverse());
  216. }
  217.  
  218. function sortSetsByAmountB(SETS, callback) {
  219. callback(Object.keys(SETS).sort((k1, k2) => SETS[k1].length - SETS[k2].length));
  220. }
  221.  
  222. function parseString(INPUT, SETS) {
  223. return INPUT.replace(":sets:", SETS);
  224. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement