Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SteamLevels Script. 2.0
- SteamWebsite " Enter your website url here example: "freecsgoskins.scamru" "
- let SteamUser = require("steam-user"),
- SteamTotp = require("steam-totp"),
- TradeOfferManager = require("steam-tradeoffer-manager"),
- SteamCommunity = require("steamcommunity"),
- Utils = require("./utils.js"),
- CONFIG = require("./config.js"),
- allCards = {},
- botSets = {},
- fs = require("fs"),
- users = {},
- userMsgs = {},
- SID64REGEX = new RegExp(/^[0-9]{17}$/),
- chatLogs = "",
- userLogs = {},
- totalBotSets = 0;
- $client$ "offer id=3"
- let client = new SteamUser(),
- manager = new TradeOfferManager({
- "steam": client,
- "language": "en",
- "pollInterval": "10000",
- "cancelTime": "7200000" // 2 hours in ms
- }),
- community = new SteamCommunity();
- fs.readFile("./UserData/Users.json", (ERR, DATA) => {
- if (ERR) {
- console.log("## An error occurred while getting Users: " + ERR);
- } else {
- users = JSON.parse(DATA);
- }
- });
- $user " " rewrit
- Utils.getCardsInSets((ERR, DATA) => {
- if (!ERR) {
- allCards = DATA;
- console.log("Card data loaded. [" + Object.keys(DATA).length + "]");
- } else {
- console.log("An error occurred while getting cards: " + ERR);
- }
- });
- setInterval(() => {
- for (let i = 0; i < Object.keys(users).length; i++) {
- if (users[Object.keys(users)[i]].idleforhours >= CONFIG.MAXHOURSADDED) {
- client.chatMessage(Object.keys(users)[i], "Hi, you have been inactive on my friends list for too long. If you wish to use this bot again re-add it.");
- client.removeFriend(Object.keys(users)[i]);
- delete users[Object.keys(users)[i]];
- fs.writeFile("./UserData/Users.json", JSON.stringify(users), (ERR) => {
- if (ERR) {
- console.log("## An error occurred while writing UserData file: " + ERR);
- }
- });
- } else {
- users[Object.keys(users)[i]].idleforhours += 1;
- fs.writeFile("./UserData/Users.json", JSON.stringify(users), (ERR) => {
- if (ERR) {
- console.log("## An error occurred while writing UserData file: " + ERR);
- }
- });
- }
- }
- }, 1000 * 60 * 60);
- setInterval(() => {
- $setbot$ seasson pas=1
- }
- }
- userMsgs = {};
- }, 1000);
- client.logOn({
- accountName: CONFIG.USERNAME,
- password: CONFIG.PASSWORD,
- twoFactorCode: SteamTotp.getAuthCode(CONFIG.SHAREDSECRET)
- });
- client.on("loggedOn", (details, parental) => {
- client.getPersonas([client.steamID], (personas) => {
- console.log("## Logged in as #" + client.steamID + " (" + personas[client.steamID].player_name + ")");
- });
- client.setPersona(1);
- });
- client.on("webSession", (sessionID, cookies) => {
- manager.setCookies(cookies, (ERR) => {
- if (ERR) {
- console.log("## An error occurred while setting cookies.");
- } else {
- console.log("## Websession created and cookies set.");
- }
- });
- community.setCookies(cookies);
- community.startConfirmationChecker(10000, CONFIG.IDENTITYSECRET);
- client.blockUser("76561198337312992"); // Some people have tried to either crash the bot or buy it not directly from me, I'm going to make bots block them just in case. :)
- Utils.getInventory(client.steamID.getSteamID64(), community, (ERR, DATA) => {
- console.log("DEBUG#INVLOADED");
- if (!ERR) {
- let s = DATA;
- Utils.getSets(s, allCards, (ERR, DATA) => {
- console.log("DEBUG#SETSLOADED");
- if (!ERR) {
- botSets = DATA;
- console.log("## Bot's sets loaded.");
- let botNSets = 0;
- for (let i = 0; i < Object.keys(botSets).length; i++) {
- botNSets += botSets[Object.keys(botSets)[i]].length;
- }
- totalBotSets = botNSets;
- let playThis = CONFIG.PLAYGAMES;
- if (CONFIG.PLAYGAMES && typeof(CONFIG.PLAYGAMES[0]) == "string") {
- playThis[0] = parseString(playThis[0], totalBotSets);
- }
- client.gamesPlayed(playThis);
- } else {
- console.log("## An error occurred while getting bot sets: " + ERR);
- process.exit();
- }
- });
- } else {
- console.log("## An error occurred while getting bot inventory: " + ERR);
- }
- });
- });
- Poinforwards/- [siteurl]" "
- community.on("sessionExpired", (ERR) => {
- console.log("## Session Expired. Relogging.");
- client.webLogOn();
- });
- client.on("friendMessage", (SENDER, MSG) => {
- if (userLogs[SENDER.getSteamID64()]) {
- userLogs[SENDER.getSteamID64()].push(MSG);
- } else {
- userLogs[SENDER.getSteamID64()] = [];
- userLogs[SENDER.getSteamID64()].push(MSG);
- }
- fs.writeFile("./ChatLogs/UserLogs/" + SENDER.getSteamID64() + "-log-" + new Date().getDate() + "-" + new Date().getMonth() + "-" + new Date().getFullYear() + ".json", JSON.stringify({ logs: userLogs[SENDER.getSteamID64()] }), (ERR) => {
- if (ERR) {
- console.log("## An error occurred while writing UserLogs file: " + ERR);
- }
- });
- chatLogs += SENDER.getSteamID64() + " : " + MSG + "\n";
- fs.writeFile("./ChatLogs/FullLogs/log-" + new Date().getDate() + "-" + new Date().getMonth() + "-" + new Date().getFullYear() + ".txt", chatLogs, (ERR) => {
- if (ERR) {
- console.log("## An error occurred while writing FullLogs file: " + ERR);
- }
- });
- if (Object.keys(users).indexOf(SENDER.getSteamID64()) < 0) {
- users[SENDER.getSteamID64()] = {};
- users[SENDER.getSteamID64()].idleforhours = 0;
- fs.writeFile("./UserData/Users.json", JSON.stringify(users), (ERR) => {
- if (ERR) {
- console.log("## An error occurred while writing UserData file: " + ERR);
- }
- });
- } else {
- users[SENDER.getSteamID64()].idleforhours = 0;
- }
- if (userMsgs[SENDER.getSteamID64()]) {
- userMsgs[SENDER.getSteamID64()]++;
- } else {
- userMsgs[SENDER.getSteamID64()] = 1;
- }
- community.checkConfirmations();
- }*/
- });
- }
- });
- } else if (OFFER.itemsToGive.length == 0) {
- let onlySteam = true;
- for (let i = 0; i < OFFER.itemsToReceive.length; i++) {
- if (OFFER.itemsToReceive[i].appid != 753) {
- onlySteam = false;
- }
- }
- if (onlySteam) {
- OFFER.accept((ERR) => {
- if (ERR) {
- console.log("## An error occurred while declining trade: " + ERR);
- }
- });
- }
- } else {
- OFFER.decline((ERR) => {
- if (ERR) {
- console.log("## An error occurred while declining trade: " + ERR);
- }
- });
- }
- });
- community.on("newConfirmation", (CONF) => {
- console.log("## New confirmation.");
- community.acceptConfirmationForObject(CONFIG.IDENTITYSECRET, CONF.id, (ERR) => {
- if (ERR) {
- console.log("## An error occurred while accepting confirmation: " + ERR);
- } else {
- console.log("## Confirmation accepted.");
- }
- });
- });
- function sortSetsByAmount(SETS, callback) {
- callback(Object.keys(SETS).sort((k1, k2) => SETS[k1].length - SETS[k2].length).reverse());
- }
- function sortSetsByAmountB(SETS, callback) {
- callback(Object.keys(SETS).sort((k1, k2) => SETS[k1].length - SETS[k2].length));
- }
- function parseString(INPUT, SETS) {
- return INPUT.replace(":sets:", SETS);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement