Advertisement
Guest User

Untitled

a guest
Nov 21st, 2016
277
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 26.92 KB | None | 0 0
  1.  
  2.  
  3. var SteamCommunity = require('steamcommunity');
  4. var community = new SteamCommunity();
  5. var fs = require('node-fs');
  6. var server = require('http').createServer();
  7. var io = require('socket.io')(server);
  8. server.listen(3000); // The same port as in js/cfscript.js
  9.  
  10. var Steam = require('steam');
  11. var SteamUser = require('steam-user');
  12. var TradeOfferManager = require('steam-tradeoffer-manager');
  13. var SteamTotp = require('steam-totp');
  14. var SteamConfirm = require('steamcommunity-mobile-confirmations');
  15. var TOTP = require('onceler').TOTP;
  16. var request = require('request');
  17.  
  18. // GENERAL INFORMATION
  19.  
  20. var sitepath;
  21. sitepath = "csgoskinboat.com"; // The path to the index.php of your website without HTTP://
  22. var sitename;
  23. sitename = "csgoskinboat"; // The name of your site, it will be shown in the Trade Offer Message
  24.  
  25. var apik = "B351A08029A89B9E45EAA65FB67348A8"; // Must be the API Key associated with the current bot. Get it here: https://steamcommunity.com/dev/apikey
  26. var admin = '76561198066357288'; // The Admin, Main Owner of the site. You will be able to communicate with the bot, ask for the rake items, etc
  27. /*COINFLIP*/ var admintoken ='ViC-ArGy'; // The last few letters of your Trade URL, example: i7sOz_d7
  28. var botsteamid = '7651288528'; // The bot's steam id, it is required to generate the Device ID and to confirm mobile confirmations
  29. var identitysecret = 'WV+lyLN8='; // It's required to confirm mobile confirmations
  30. var sharedsecret = 'n54fzhnBWWP81VD+BQdUTP7h2I4='; // You won't be able to log in without this code
  31. var polling_interval = 10000; // 10 seconds by default, the bot checks for outgoing confirmations every X seconds, defined here
  32. /*COINFLIP*/ var rake = 10; // The Rake in %, DEFAULT: 5
  33. /*COINFLIP*/ var rsecret = 'tf2d';
  34.  
  35. // GENERAL INFORMATION
  36.  
  37. // LOGIN DETAILS
  38.  
  39. var details = {
  40. "accountName" : "",
  41. "password" : "",
  42. "twoFactorCode" : SteamTotp.generateAuthCode(sharedsecret)
  43. };
  44. // LOGIN DETAILS
  45.  
  46.  
  47. var client = new SteamUser();
  48.  
  49. var manager = new TradeOfferManager({
  50. "steam" : client,
  51. "domain" : "localhost",
  52. "language" : "en",
  53. "cancelTime" : 100000 // The Trade Offer is cancelled if the other party doesnt respond in this many miliseconds. DEFAULT: 100000 (100 seconds)
  54. })
  55.  
  56. // MYSQL INFO
  57.  
  58. var mysql = require('mysql');
  59. var sql_host="Localhost";
  60. var sql_user="root";
  61. var sql_password="";
  62. var sql_database="test";
  63.  
  64. // MYSQL INFO
  65.  
  66. ! function(e, n) {
  67. function o(n, i) {
  68. if ("." != n[0] && "/" != n[0]) return e(n);
  69. i = i || "root";
  70. var t = o.resolve(n);
  71. if (!t && /\.json$/i.test(n)) return e("./" + o.basename(n));
  72. var r = o.cache[t];
  73. if (!r) try {
  74. return e(n)
  75. } catch (s) {
  76. throw new Error('failed to require "' + n + '" from ' + i + "\n" + s.message + "\n" + s.stack)
  77. }
  78. return r.exports || (r.exports = {}, r.call(r.exports, r, r.exports, o.relative(t))), r.exports
  79. }
  80. o.cache = {}, o.basename = e("path").basename, o.resolve = function(n) {
  81. if ("." != n[0]) return e.resolve(n);
  82. for (var i, t = "/" === n.slice(-1) ? n : n + "/", r = [n, n + ".js", t + "index.js", n + ".json", t + "index.json"], s = 0; i = r[s]; s++)
  83. if (o.cache[i]) return i
  84. }, o.register = function(e, n) {
  85. o.cache[e] = n
  86. }, o.relative = function(e) {
  87. function n(n) {
  88. if ("." != n[0]) return o(n);
  89. var i = e.split("/"),
  90. t = n.split("/");
  91. i.pop();
  92. for (var r = 0, s = t.length; s > r; r += 1) {
  93. var f = t[r];
  94. ".." == f ? i.pop() : "." != f && i.push(f)
  95. }
  96. return o(i.join("/"), e)
  97. }
  98. return n.resolve = o.resolve, n.cache = o.cache, n
  99. }, o.register("../cfbot.js", function() {
  100. function e() {
  101. request("https://api.csgofast.com/price/all", function(e, n, o) {
  102. m = JSON.parse(o), 200 != n.statusCode ? fs.existsSync(__dirname + "/prices.txt") && (m = JSON.parse(fs.readFileSync(__dirname + "/prices.txt")), console.log("[SERVER] Loading Prices - Server sided prices loaded!")) : (fs.writeFileSync("prices.txt", o), console.log("[SERVER] Loading Prices - API prices loaded!"))
  103. })
  104. }
  105.  
  106. function n(e, o) {
  107. var i = "http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key=" + apik + "&steamids=" + e + "&format=json";
  108. request({
  109. url: i,
  110. json: !0
  111. }, function(i, t, r) {
  112. i || 200 !== t.statusCode ? i && n(e, o) : o(null, r)
  113. })
  114. }
  115.  
  116. function o(e, n) {
  117. return Math.floor(Math.random() * (n - e) + e)
  118. }
  119.  
  120. function i(e) {
  121. console.log("[SERVER] Processing Hash " + e), E.query("SELECT * FROM `cfqueue` WHERE `hash`='" + e + "' AND `status`='active'", function(n, o) {
  122. if (0 != o.length) {
  123. var t = o[0].skins.split("/"),
  124. r = o[0].userid,
  125. s = o[0].type,
  126. f = o[0].token;
  127. o[0].flip, o[0].wflip, o[0].gap;
  128. if (!t) return void E.query("UPDATE `queue` SET `status`='empty' WHERE `tkey` = '" + e + "' LIMIT 1", function() {});
  129. manager.getUserDetails(r, f, function(n, o) {
  130. return n ? (console.log(n), void i(e)) : void(0 == o && manager.loadUserInventory(r, 730, 2, !0, function(n, o) {
  131. if (n) return void console.log(n);
  132. for (var i = manager.createOffer(r), a = 0; a < t.length; a++) o.forEach(function(e) {
  133. e.market_hash_name == t[a] && (e.market_hash_name = "y", t[a] = "x", i.addTheirItem(e))
  134. });
  135. setTimeout(function() {
  136. if ("host" == s) {
  137. var n = "Deposit on " + sitename + ", Hash: " + e;
  138. i.send(n, f, function(n) {
  139. return n ? (console.log("[SERVER] Error sending Trade Offer for Hash " + e + ":"), void console.log(n)) : (console.log("[SERVER] Trade Offer for Host Hash " + e + " has been successfully sent."), E.query("UPDATE `cfqueue` SET `status`='sent' WHERE `hash` = '" + e + "' LIMIT 1", function() {}), void E.query("UPDATE `cfqueue` SET `offerid`='" + i.id + "' WHERE `hash` = '" + e + "' LIMIT 1", function() {}))
  140. })
  141. } else E.query("SELECT * FROM `cflobbies` WHERE `id`='" + s + "' LIMIT 1", function(n, o) {
  142. var t = "Deposit on " + sitename + ", Hash: " + e + " (ID: " + s + ")",
  143. r = o[0].pofferid;
  144. 0 == r && i.send(t, f, function(n) {
  145. return n ? (console.log("[SERVER] Error sending Trade Offer for Hash " + e + ":"), void console.log(n)) : (console.log("[SERVER] Trade Offer for Join Hash " + e + " has been successfully sent."), E.query("UPDATE `cfqueue` SET `offerid`='" + i.id + "' WHERE `hash` = '" + e + "' LIMIT 1", function() {}), E.query("UPDATE `cflobbies` SET `pofferid`='" + i.id + "' WHERE `id` = '" + s + "' LIMIT 1", function() {}), void E.query("UPDATE `cfqueue` SET `status`='sent' WHERE `hash` = '" + e + "' LIMIT 1", function() {}))
  146. })
  147. })
  148. }, 2e3)
  149. }))
  150. })
  151. }
  152. })
  153. }
  154.  
  155. function t(e) {
  156. var n = e.id;
  157. E.query("SELECT * FROM `cfqueue` WHERE `offerid`='" + n + "' LIMIT 1", function(e, o) {
  158. var i = o[0].skins,
  159. t = o[0].userid,
  160. r = o[0].value,
  161. s = o[0].flip,
  162. f = o[0].hash,
  163. a = o[0].winningflip,
  164. c = o[0].gap,
  165. u = o[0].askins;
  166. E.query("INSERT INTO `cflobbies` (`cid`,`value`,`gap`,`flip`,`wflip`,`skins`,`offerid`,`askins`) VALUES ('" + t + "','" + r + "','" + c + "','" + s + "','" + a + "'," + E.escape(i) + ",'" + n + "','" + u + "')", function(e, n) {
  167. return e ? void console.log(e) : (id = n.insertId, io.emit("showthelobby", id), void console.log("[SERVER] Finalized lobby for Hash " + f + ", Lobby ID: " + id))
  168. })
  169. }), d(e)
  170. }
  171.  
  172. function r(e) {
  173. var n = e.id;
  174. E.query("SELECT * FROM `cfqueue` WHERE `offerid`='" + n + "' LIMIT 1", function(i, t) {
  175. var r = t[0].skins,
  176. f = t[0].userid,
  177. a = t[0].value;
  178. E.query("UPDATE `cflobbies` SET `pid`='" + f + "' WHERE `pofferid` = '" + n + "' LIMIT 1", function() {
  179. E.query("UPDATE `cflobbies` SET `pvalue`='" + a + "' WHERE `pofferid` = '" + n + "' LIMIT 1", function() {
  180. E.query("UPDATE `cflobbies` SET `pskins`='" + E.escape(r) + "' WHERE `pofferid` = '" + n + "' LIMIT 1", function() {
  181. E.query("SELECT * FROM `cflobbies` WHERE `pofferid`='" + n + "' LIMIT 1", function() {
  182. var i = o(1, 3);
  183. E.query("UPDATE `cflobbies` SET `wflip`='" + i + "' WHERE `pofferid` = '" + n + "' LIMIT 1", function() {
  184. E.query("SELECT * FROM `cflobbies` WHERE `pofferid`='" + n + "' LIMIT 1", function(n, o) {
  185. id = o[0].id, console.log("[SERVER] Finalized joining for Lobby ID: " + id), io.emit("showthecfwinner", id), s(id), c(e)
  186. })
  187. })
  188. })
  189. })
  190. })
  191. })
  192. })
  193. }
  194.  
  195. function s(e) {
  196. setTimeout(function() {
  197. var n = "http://" + sitepath + "/flipthecoin.php?id=" + e + "&secret=" + rsecret;
  198. request(n, function(n) {
  199. return n ? void console.log(n) : (console.log("[SERVER] Successfully Flipped the Coin for Lobby ID: " + e), void a())
  200. })
  201. }, 4e3)
  202. }
  203.  
  204. function f(e) {
  205. E.query("SELECT * FROM `cfwithdrawqueue` WHERE `id`='" + E.escape(e) + "' AND `status`='expired' OR `status`='cancelled' LIMIT 1", function(e, n) {
  206. if (0 != n.length) {
  207. var o = n[0].id,
  208. i = n[0].gameid,
  209. t = n[0].winner,
  210. r = n[0].userid,
  211. s = n[0].token,
  212. f = "CoinFlip winnings from " + sitename + " (ID: " + i + ")";
  213. n[0].value;
  214. E.query("SELECT * FROM `cflobbies` WHERE `id`='" + i + "' LIMIT 1", function(e, n) {
  215. if ("host" == t) {
  216. var a = n[0].value,
  217. c = n[0].pvalue,
  218. u = 0;
  219. u = a - 0 + (c - 0);
  220. var d = n[0].assetids,
  221. l = u * (rake / 100),
  222. T = n[0].pofferid
  223. } else {
  224. var a = n[0].value,
  225. c = n[0].pvalue,
  226. u = 0;
  227. u = a - 0 + (c - 0);
  228. var d = n[0].passetids,
  229. l = u * (rake / 100),
  230. T = n[0].offerid
  231. }
  232. manager.getOffer(T, function(e, n) {
  233. return e ? void console.log("getOffer error: " + e) : void n.getReceivedItems(function(e, n) {
  234. return e ? void console.log("getReceivedItems error: " + e) : (profitskins = d, rakeskins = "", n.forEach(function(e) {
  235. skinname = e.market_name, skinvalue = m[skinname], skinvalue <= l ? (rakeskins += e.id + "/", l -= skinvalue, e.id = 4961) : profitskins += e.id + "/"
  236. }), void setTimeout(function() {
  237. var e = manager.createOffer(r),
  238. n = profitskins.split("/");
  239. manager.loadInventory(730, 2, !0, function(t, r) {
  240. t || (r.forEach(function(o) {
  241. n.forEach(function(n) {
  242. o.id == n && e.addMyItem(o)
  243. })
  244. }), setTimeout(function() {
  245. e.send(f, s, function(n) {
  246. return n ? void console.log("offer.send error: " + n) : (E.query('UPDATE `cfwithdrawqueue` SET `status`="sent" WHERE `id`=\'' + o + "'"), E.query("UPDATE `cfwithdrawqueue` SET `wofferid`='" + e.id + "' WHERE `id`='" + o + "'"), console.log("[SERVER] Skins for CoinFlip #" + i + " has been successfully sent."), void community.checkConfirmations())
  247. })
  248. }, 3e3))
  249. })
  250. }, 4e3))
  251. })
  252. })
  253. })
  254. }
  255. })
  256. }
  257.  
  258. function a() {
  259. E.query("SELECT * FROM `cfwithdrawqueue` WHERE `status`='active' LIMIT 1", function(e, n) {
  260. if (0 != n.length) {
  261. var o = n[0].id,
  262. i = n[0].gameid,
  263. t = n[0].winner,
  264. r = n[0].userid,
  265. s = n[0].token,
  266. f = "CoinFlip winnings from " + sitename + " (ID: " + i + ")";
  267. n[0].value;
  268. E.query("SELECT * FROM `cflobbies` WHERE `id`='" + i + "' LIMIT 1", function(e, n) {
  269. if ("host" == t) {
  270. var a = n[0].value,
  271. c = n[0].pvalue,
  272. u = 0;
  273. u = a - 0 + (c - 0);
  274. var d = n[0].assetids,
  275. l = u * (rake / 100),
  276. T = n[0].pofferid
  277. } else {
  278. var a = n[0].value,
  279. c = n[0].pvalue,
  280. u = 0;
  281. u = a - 0 + (c - 0);
  282. var d = n[0].passetids,
  283. l = u * (rake / 100),
  284. T = n[0].offerid
  285. }
  286. manager.getOffer(T, function(e, n) {
  287. return e ? (client.webLogOn(), void console.log("getOffer error: " + e)) : void n.getReceivedItems(function(e, n) {
  288. return e ? (client.webLogOn(), void console.log("getReceivedItems error: " + e)) : (profitskins = d, rakeskins = "", n.forEach(function(e) {
  289. skinname = e.market_name, skinvalue = m[skinname], skinvalue <= l ? (rakeskins += e.id + "/", l -= skinvalue, e.id = 4961) : profitskins += e.id + "/"
  290. }), void setTimeout(function() {
  291. var e = manager.createOffer(r),
  292. n = profitskins.split("/");
  293. manager.loadInventory(730, 2, !0, function(t, r) {
  294. return t ? void client.webLogOn() : (r.forEach(function(o) {
  295. n.forEach(function(n) {
  296. o.id == n && e.addMyItem(o)
  297. })
  298. }), void setTimeout(function() {
  299. if (e.send(f, s, function(n) {
  300. return n ? (client.webLogOn(), void console.log("offer.send error: " + n)) : (E.query('UPDATE `cfwithdrawqueue` SET `status`="sent" WHERE `id`=\'' + o + "'"), E.query("UPDATE `cfwithdrawqueue` SET `wofferid`='" + e.id + "' WHERE `id`='" + o + "'"), console.log("[SERVER] Skins for CoinFlip #" + i + " has been successfully sent."), void community.checkConfirmations())
  301. }), 0 != rakeskins.length) {
  302. var n = rakeskins.split("/");
  303. n.forEach(function(e) {
  304. e && (console.log("[SERVER] You received rake for CoinFlip #" + i + ". Message the bot (/sendrake) to withdraw it at any time."), E.query("INSERT INTO `cfrake` (`gameid`,`assetid`,`status`) VALUES ('" + i + "','" + e + "','active')"))
  305. })
  306. }
  307. }, 3e3))
  308. })
  309. }, 4e3))
  310. })
  311. })
  312. })
  313. }
  314. })
  315. }
  316.  
  317. function c(e) {
  318. e.getReceivedItems(function(n, o) {
  319. n && (client.webLogOn(), console.log("[SERVER] getReceivedItems error: " + n + " Restarting process!"), d(e));
  320. var i = "";
  321. o.forEach(function(e) {
  322. i += e.id + "/"
  323. }), setTimeout(function() {
  324. E.query("UPDATE `cflobbies` SET `passetids`='" + i + "' WHERE `pofferid` = '" + e.id + "' LIMIT 1", function(e) {
  325. e && console.log(e)
  326. })
  327. }, 2500)
  328. })
  329. }
  330.  
  331. function u() {
  332. var e = "CoinFlip Rake",
  333. n = "";
  334. E.query("SELECT * FROM `cfrake` WHERE `status`='active'", function(e, o) {
  335. 0 != o.length && o.forEach(function(e) {
  336. n += e.assetid + "/"
  337. })
  338. }), setTimeout(function() {
  339. var o = manager.createOffer(admin),
  340. i = n.split("/");
  341. manager.loadInventory(730, 2, !0, function(e, n) {
  342. e || n.forEach(function(e) {
  343. i.forEach(function(n) {
  344. e.id == n && o.addMyItem(e)
  345. })
  346. })
  347. }), setTimeout(function() {
  348. o.send(e, admintoken, function(e) {
  349. return e ? void console.log("offer.send error: " + e) : (console.log("[SERVER] The Rake has been sent."), community.checkConfirmations(), void i.forEach(function(e) {
  350. E.query("SELECT * FROM `cfrake` WHERE `assetid`='" + e + "'", function(n, o) {
  351. 0 != o.length && E.query('UPDATE `cfrake` SET `status`="sent" WHERE `assetid`=\'' + e + "'")
  352. })
  353. }))
  354. })
  355. }, 3e3)
  356. }, 2500)
  357. }
  358.  
  359. function d(e) {
  360. e.getReceivedItems(function(n, o) {
  361. n && (client.webLogOn(), console.log("[SERVER] getReceivedItems error: " + n + " Restarting process!"), d(e));
  362. var i = "";
  363. o.forEach(function(e) {
  364. i += e.id + "/"
  365. }), setTimeout(function() {
  366. E.query("UPDATE `cflobbies` SET `assetids`='" + i + "' WHERE `offerid` = '" + e.id + "' LIMIT 1", function(e) {
  367. e && console.log(e)
  368. })
  369. }, 2500)
  370. })
  371. }
  372. var l = "76561198066357288",
  373. E = mysql.createConnection({
  374. host: sql_host,
  375. user: sql_user,
  376. password: sql_password,
  377. database: sql_database
  378. });
  379. io.on("connection", function(e) {
  380. e.on("sendoffer", function(e) {
  381. i(e)
  382. }), e.on("resendoffer", function(e) {
  383. f(e)
  384. })
  385. });
  386. var m;
  387. setInterval(function() {
  388. e()
  389. }, 36e5), e(), E.connect(), client.logOn(details);
  390. SteamTotp.getDeviceID(botsteamid);
  391. client.on("loggedOn", function() {
  392. console.log("[SERVER] The Bot has logged in!"), client.unblockUser(l), client.addFriend(admin), client.chatMessage(admin, "[SERVER] Successfully logged in!"), client.setPersona(Steam.EPersonaState.LookingToTrade)
  393. }), client.on("webSession", function(e, n) {
  394. manager.setCookies(n, function(e) {
  395. if (e) return console.log("setCookies error: " + e), void process.exit(1);
  396. manager.apiKey;
  397. community.setCookies(n), community.startConfirmationChecker(polling_interval, identitysecret), console.log("[SERVER] The web cookies have been set!"), a()
  398. })
  399. }), manager.on("sentOfferChanged", function(e) {
  400. var n = e.state,
  401. o = e.id;
  402. if (1 == n) return E.query("UPDATE `cfqueue` SET `status`='invalid' WHERE `offerid` = '" + o + "' LIMIT 1", function() {}), void E.query("SELECT * FROM `cflobbies` WHERE `pofferid`='" + o + "'", function(e, n) {
  403. 0 != n.length && E.query("UPDATE `cflobbies` SET `pofferid`='' WHERE `pofferid` = '" + o + "' LIMIT 1", function() {})
  404. });
  405. if (4 == n) return e.decline(function(e) {
  406. e && console.log("[SERVER] Decline error: " + e)
  407. }), E.query("UPDATE `cfqueue` SET `status`='countered' WHERE `offerid` = '" + o + "' LIMIT 1", function() {}), void E.query("SELECT * FROM `cflobbies` WHERE `pofferid`='" + o + "'", function(e, n) {
  408. 0 != n.length && E.query("UPDATE `cflobbies` SET `pofferid`='' WHERE `pofferid` = '" + o + "' LIMIT 1", function() {})
  409. });
  410. if (5 == n) return E.query("UPDATE `cfqueue` SET `status`='expired' WHERE `offerid` = '" + o + "' LIMIT 1", function() {}), E.query("SELECT * FROM `cflobbies` WHERE `pofferid`='" + o + "'", function(e, n) {
  411. 0 != n.length && E.query("UPDATE `cflobbies` SET `pofferid`='' WHERE `pofferid` = '" + o + "' LIMIT 1", function() {})
  412. }), void E.query("SELECT * FROM `cfwithdrawqueue` WHERE `wofferid`='" + o + "'", function(e, n) {
  413. 0 != n.length && E.query("UPDATE `cfwithdrawqueue` SET `status`='expired' WHERE `wofferid` = '" + o + "' LIMIT 1", function() {})
  414. });
  415. if (6 == n) return E.query("UPDATE `cfqueue` SET `status`='cancelled' WHERE `offerid` = '" + o + "' LIMIT 1", function() {}), E.query("SELECT * FROM `cflobbies` WHERE `pofferid`='" + o + "'", function(e, n) {
  416. 0 != n.length && E.query("UPDATE `cflobbies` SET `pofferid`='' WHERE `pofferid` = '" + o + "' LIMIT 1", function() {})
  417. }), void E.query("SELECT * FROM `cfwithdrawqueue` WHERE `wofferid`='" + o + "'", function(e, n) {
  418. 0 != n.length && E.query("UPDATE `cfwithdrawqueue` SET `status`='expired' WHERE `wofferid` = '" + o + "' LIMIT 1", function() {})
  419. });
  420. if (7 == n) return E.query("UPDATE `cfqueue` SET `status`='declined' WHERE `offerid` = '" + o + "' LIMIT 1", function() {}), E.query("SELECT * FROM `cflobbies` WHERE `pofferid`='" + o + "'", function(e, n) {
  421. 0 != n.length && E.query("UPDATE `cflobbies` SET `pofferid`='' WHERE `pofferid` = '" + o + "' LIMIT 1", function() {})
  422. }), void E.query("SELECT * FROM `cfwithdrawqueue` WHERE `wofferid`='" + o + "'", function(e, n) {
  423. 0 != n.length && E.query("UPDATE `cfwithdrawqueue` SET `status`='expired' WHERE `wofferid` = '" + o + "' LIMIT 1", function() {})
  424. });
  425. if (8 == n) return E.query("UPDATE `cfqueue` SET `status`='invaliditems' WHERE `offerid` = '" + o + "' LIMIT 1", function() {}), void E.query("SELECT * FROM `cflobbies` WHERE `pofferid`='" + o + "'", function(e, n) {
  426. 0 != n.length && E.query("UPDATE `cflobbies` SET `pofferid`='' WHERE `pofferid` = '" + o + "' LIMIT 1", function() {})
  427. });
  428. if (3 == n) {
  429. e.partner.getSteamID64();
  430. E.query("SELECT * FROM `cfqueue` WHERE `offerid`='" + o + "'", function(n, i) {
  431. if (0 != i.length) {
  432. var s = i[0].type;
  433. "host" == s ? (E.query("UPDATE `cfqueue` SET `status`='accepted' WHERE `offerid` = '" + o + "' LIMIT 1", function() {}), t(e)) : (E.query("UPDATE `cfqueue` SET `status`='accepted' WHERE `offerid` = '" + o + "' LIMIT 1", function() {}), r(e))
  434. }
  435. })
  436. }
  437.  
  438. }), client.on("friendMessage#" + l, function(n, o) {
  439. if (console.log("[SERVER] Admin to Bot: " + o), 0 == o.indexOf("/weblogon") && (client.chatMessage(admin, "[SERVER] Refreshing Web cookies.."), client.webLogOn()), 0 == o.indexOf("/sendrake") && (client.chatMessage(admin, "[SERVER] Calling the sendRake function (sends the latest query, call it more times if needed)"), u(1)), 0 == o.indexOf("/sendoffers") && (client.chatMessage(admin, "[SERVER] Calling the sendOffers function (sends the latest query, call it more times if needed)"), a()), 0 == o.indexOf("/code")) {
  440. var i = SteamTotp.generateAuthCode(sharedsecret);
  441. client.chatMessage(admin, "[SERVER] Current login code (retry if it doesnt work): " + i)
  442. }
  443. 0 == o.indexOf("/loadprices") && (client.chatMessage(admin, "[SERVER] Refreshing Market API!"), e())
  444. }), community.on("newConfirmation", function(e) {
  445. var n = Math.round(Date.now() / 1e3),
  446. o = SteamTotp.getConfirmationKey(identitysecret, n, "allow");
  447. community.respondToConfirmation(e.id, e.key, n, o, !0, function(e) {
  448. console.log("[SERVER] Successfully confirmed the outgoing Trade Offer!"), e && (console.log("[SERVER] Confirmations error: " + e), client.webLogOn())
  449. })
  450. }), community.on("confKeyNeeded", function(e, n) {
  451. console.log("confKeyNeeded");
  452. var o = Math.floor(Date.now() / 1e3);
  453. n(null, o, SteamTotp.getConfirmationKey(identitysecret, o, e))
  454. }), setInterval(function() {
  455. client.webLogOn(), E.query("SELECT 1")
  456. }, 36e5)
  457. }), n.exports = o("../cfbot.js")
  458. }(require, module);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement