Advertisement
Guest User

csgo network v2 coinflip bot

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