├── NOTICE ├── queryIds_blum.json ├── queryIds_dotcoin.json ├── queryIds_major.json ├── queryIds_pocketfi.json ├── queryIds_timefarm.json ├── queryIds_tomarket.json ├── queryIds_rockyrabbit.json ├── .env-pocketfi-example ├── START.bat ├── .github └── images │ └── hero.png ├── .env-timefarm-example ├── utils ├── sleep.js ├── filterBots.js ├── _isArray.js ├── runOnce.js ├── proxies.js ├── parser.js ├── config.js ├── TldLogger.js ├── tappers.js ├── logger.js ├── luncher.js ├── register.js └── devices.js ├── .env-tomarket-example ├── bots ├── Dotcoin │ └── bot │ │ ├── utils │ │ └── boost.js │ │ ├── config │ │ ├── app.js │ │ └── config.js │ │ └── core │ │ ├── header.js │ │ └── api.js ├── Major │ └── bot │ │ ├── config │ │ ├── app.js │ │ └── config.js │ │ ├── core │ │ ├── header.js │ │ ├── api.js │ │ └── nonSessionTapper.js │ │ └── utils │ │ ├── taskFilter.js │ │ └── fetchers.js ├── PocketFi │ └── bot │ │ ├── config │ │ ├── app.js │ │ └── config.js │ │ └── core │ │ ├── header.js │ │ ├── api.js │ │ ├── nonSessionTapper.js │ │ └── tapper.js ├── ToMarket │ └── bot │ │ ├── config │ │ ├── app.js │ │ └── config.js │ │ └── core │ │ ├── header.js │ │ └── api.js ├── TimeFarm │ └── bot │ │ ├── config │ │ ├── app.js │ │ └── config.js │ │ └── core │ │ ├── header.js │ │ ├── api.js │ │ └── nonSessionTapper.js ├── RockyRabbit │ └── bot │ │ ├── config │ │ ├── app.js │ │ └── config.js │ │ ├── core │ │ ├── header.js │ │ └── api.js │ │ ├── helpers │ │ └── filterArray.js │ │ └── scripts │ │ ├── upgradeNoConditionCards.js │ │ └── upgradeTabCardsBuying.js └── Blum │ └── bot │ ├── config │ ├── app.js │ └── config.js │ └── core │ ├── header.js │ └── nonSessionTapper.js ├── .env-major-example ├── .env-blum-example ├── docker-compose.yml ├── .env-dotcoin-example ├── .env-general-example ├── Dockerfile ├── .gitignore ├── .env-rockyrabbit-example ├── index.js ├── package.json ├── INSTALL.bat ├── AddQueryId.md ├── install.sh ├── LICENSE └── README.md /NOTICE: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /queryIds_blum.json: -------------------------------------------------------------------------------- 1 | { 2 | "account": "query_id" 3 | } 4 | -------------------------------------------------------------------------------- /queryIds_dotcoin.json: -------------------------------------------------------------------------------- 1 | { 2 | "account": "query_id" 3 | } 4 | -------------------------------------------------------------------------------- /queryIds_major.json: -------------------------------------------------------------------------------- 1 | { 2 | "account": "query_id" 3 | } 4 | -------------------------------------------------------------------------------- /queryIds_pocketfi.json: -------------------------------------------------------------------------------- 1 | { 2 | "account": "query_id" 3 | } 4 | -------------------------------------------------------------------------------- /queryIds_timefarm.json: -------------------------------------------------------------------------------- 1 | { 2 | "account": "query_id" 3 | } 4 | -------------------------------------------------------------------------------- /queryIds_tomarket.json: -------------------------------------------------------------------------------- 1 | { 2 | "account": "query_id" 3 | } 4 | -------------------------------------------------------------------------------- /queryIds_rockyrabbit.json: -------------------------------------------------------------------------------- 1 | { 2 | "account": "query_id" 3 | } 4 | -------------------------------------------------------------------------------- /.env-pocketfi-example: -------------------------------------------------------------------------------- 1 | AUTO_MINE= 2 | 3 | SLEEP_BETWEEN_REQUESTS= 4 | -------------------------------------------------------------------------------- /START.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | echo Starting the bot... 3 | node index.js 4 | pause -------------------------------------------------------------------------------- /.github/images/hero.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Freddywhest/DropWizard/HEAD/.github/images/hero.png -------------------------------------------------------------------------------- /.env-timefarm-example: -------------------------------------------------------------------------------- 1 | CLAIM_FRIENDS_REWARD= 2 | 3 | AUTO_FARMING= 4 | 5 | AUTO_DAILY_QUIZ= 6 | 7 | SLEEP_BETWEEN_REQUESTS= -------------------------------------------------------------------------------- /utils/sleep.js: -------------------------------------------------------------------------------- 1 | function sleep(seconds) { 2 | return new Promise((resolve) => setTimeout(resolve, seconds * 1000)); 3 | } 4 | 5 | module.exports = sleep; 6 | -------------------------------------------------------------------------------- /utils/filterBots.js: -------------------------------------------------------------------------------- 1 | function filterBots(b) { 2 | return Object.fromEntries( 3 | Object.entries(b).filter(([key, value]) => value.use === true) 4 | ); 5 | } 6 | 7 | module.exports = filterBots; 8 | -------------------------------------------------------------------------------- /.env-tomarket-example: -------------------------------------------------------------------------------- 1 | AUTO_PLAY_GAME= 2 | 3 | # integer value in seconds 4 | SLEEP_BETWEEN_TAP= 5 | 6 | AUTO_CLAIM_DAILY_REWARD= 7 | 8 | AUTO_CLAIM_COMBO= 9 | 10 | AUTO_CLAIM_STARTS= 11 | 12 | AUTO_FARM= -------------------------------------------------------------------------------- /bots/Dotcoin/bot/utils/boost.js: -------------------------------------------------------------------------------- 1 | const UpgradableBoostType = Object.freeze({ 2 | ATTEMPTS: "add_attempts", 3 | MULTITAPS: "add_multitap", 4 | }); 5 | 6 | module.exports = { 7 | UpgradableBoostType, 8 | }; 9 | -------------------------------------------------------------------------------- /.env-major-example: -------------------------------------------------------------------------------- 1 | AUTO_PLAY_ROULETTE= 2 | 3 | AUTO_PLAY_HOLD_TO_EARN= 4 | 5 | AUTO_PLAY_SWIPE_COIN= 6 | 7 | AUTO_CLAIM_TASKS= 8 | 9 | CLAIM_DAILY_REWARDS= 10 | 11 | # integer value in seconds 12 | SLEEP_BETWEEN_REQUESTS= -------------------------------------------------------------------------------- /.env-blum-example: -------------------------------------------------------------------------------- 1 | CLAIM_DAILY_REWARD= 2 | 3 | CLAIM_FRIENDS_REWARD= 4 | 5 | AUTO_PLAY_GAMES= 6 | 7 | AUTO_START_FARMING= 8 | 9 | AUTO_CLAIM_FARMING_REWARD= 10 | 11 | # integer value in seconds 12 | 13 | SLEEP_BETWEEN_TAP= 14 | 15 | AUTO_JOIN_TRIBE= 16 | 17 | CLAIM_TASKS_REWARD= 18 | -------------------------------------------------------------------------------- /utils/_isArray.js: -------------------------------------------------------------------------------- 1 | function _isArray(obj) { 2 | if (Array.isArray(obj) && obj.length > 0) { 3 | return true; 4 | } 5 | 6 | try { 7 | const parsedObj = JSON.parse(obj); 8 | return Array.isArray(parsedObj) && parsedObj.length > 0; 9 | } catch (e) { 10 | return false; 11 | } 12 | } 13 | 14 | module.exports = _isArray; 15 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: "3.8" 2 | services: 3 | bot: 4 | container_name: "DropWizard-[All-In-One-Bot]" 5 | build: 6 | context: . 7 | stop_signal: SIGINT 8 | restart: unless-stopped 9 | command: "node index.js" 10 | volumes: 11 | - .:/app 12 | - ./sessions:/app/sessions 13 | env_file: 14 | - .env 15 | -------------------------------------------------------------------------------- /.env-dotcoin-example: -------------------------------------------------------------------------------- 1 | AUTO_UPGRADE_MULTITAP= 2 | MAX_MULTITAP_LEVEL= 3 | 4 | AUTO_UPGRADE_ATTEMPTS= 5 | MAX_ATTEMPTS= 6 | 7 | AUTO_CLAIM_TASKS= 8 | AUTO_PLAY_SPIN_TO_EARN= 9 | MIN_DTC_TO_STOP_SPIN_TO_EARN= 10 | 11 | # integer value in seconds 12 | SLEEP_BETWEEN_TAP= 13 | 14 | AUTO_CLAIM_TASKS= 15 | 16 | # Min 1, Max 20000 17 | RANDOM_TAPS_COUNT=[1000,20000] -------------------------------------------------------------------------------- /bots/Major/bot/config/app.js: -------------------------------------------------------------------------------- 1 | const app = { 2 | version: "1.0.0", 3 | apiUrl: "https://major.glados.app", 4 | peer: "major", 5 | bot: "major", 6 | webviewUrl: "https://major.glados.app/", 7 | origin: "https://major.glados.app/", 8 | referer: "https://major.glados.app/", 9 | majorChannel: "starsmajor", 10 | }; 11 | 12 | module.exports = app; 13 | -------------------------------------------------------------------------------- /.env-general-example: -------------------------------------------------------------------------------- 1 | API_ID= 2 | API_HASH= 3 | 4 | BLUM= 5 | DOTCOIN= 6 | MAJOR= 7 | ROCKYRABBIT= 8 | TIMEFARM= 9 | TOMARKET= 10 | POCKETFI= 11 | 12 | USE_QUERY_ID_BLUM= 13 | USE_QUERY_ID_TOMARKET= 14 | USE_QUERY_ID_ROCKYRABBIT= 15 | USE_QUERY_ID_TIMEFARM= 16 | USE_QUERY_ID_DOTCOIN= 17 | USE_QUERY_ID_MAJOR= 18 | USE_QUERY_ID_POCKETFI= 19 | 20 | USE_PROXY_FROM_FILE= -------------------------------------------------------------------------------- /bots/Dotcoin/bot/config/app.js: -------------------------------------------------------------------------------- 1 | const app = { 2 | version: "1.0.0", 3 | apiUrl: "https://api.dotcoin.bot", 4 | host: "api.dotcoin.bot", 5 | peer: "dotcoin_bot", 6 | bot: "dotcoin_bot", 7 | webviewUrl: "https://dot.dapplab.xyz/", 8 | origin: "https://dot.dapplab.xyz", 9 | referer: "https://dot.dapplab.xyz/", 10 | }; 11 | 12 | module.exports = app; 13 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:18-alpine 2 | 3 | # Set the working directory 4 | WORKDIR /app 5 | 6 | # Copy package.json and package-lock.json (if available) 7 | COPY package*.json ./ 8 | 9 | # Install dependencies 10 | RUN npm install 11 | 12 | # Copy the rest of the application code 13 | COPY . . 14 | 15 | # Command to run the application 16 | CMD ["node", "index.js"] 17 | -------------------------------------------------------------------------------- /bots/PocketFi/bot/config/app.js: -------------------------------------------------------------------------------- 1 | const app = { 2 | version: "1.0.0", 3 | apiUrl: "https://gm.pocketfi.org", 4 | peer: "pocketfi_bot", 5 | bot: "pocketfi_bot", 6 | webviewUrl: "https://pocketfi.app/", 7 | origin: "https://pocketfi.app/", 8 | referer: "https://pocketfi.app/", 9 | startParam: "https://rubot.pocketfi.org", 10 | }; 11 | 12 | module.exports = app; 13 | -------------------------------------------------------------------------------- /bots/ToMarket/bot/config/app.js: -------------------------------------------------------------------------------- 1 | const app = { 2 | version: "1.0.0", 3 | apiUrl: "https://api-web.tomarket.ai", 4 | host: "api-web.tomarket.ai", 5 | peer: "Tomarket_ai_bot", 6 | bot: "Tomarket_ai_bot", 7 | webviewUrl: "https://mini-app.tomarket.ai/", 8 | origin: "https://mini-app.tomarket.ai", 9 | referer: "https://mini-app.tomarket.ai/", 10 | }; 11 | 12 | module.exports = app; 13 | -------------------------------------------------------------------------------- /bots/TimeFarm/bot/config/app.js: -------------------------------------------------------------------------------- 1 | const app = { 2 | version: "1.0.0", 3 | apiUrl: "https://tg-bot-tap.laborx.io", 4 | peer: "TimeFarmCryptoBot", 5 | bot: "TimeFarmCryptoBot", 6 | webviewUrl: "https://timefarm.app", 7 | origin: "https://timefarm.app", 8 | referer: "https://timefarm.app", 9 | quiz: "https://rockyrabbitcombos.ribedo.org/data.json", 10 | }; 11 | 12 | module.exports = app; 13 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore specific file 2 | session_user_agents.json 3 | 4 | simulate_device.json 5 | 6 | # Ignore the sessions folder 7 | sessions/ 8 | 9 | # Ignore any file or folder that ends with .session 10 | *.session 11 | *.session/ 12 | 13 | # Ignore node_modules folder 14 | node_modules/ 15 | 16 | # Ignore specific .env files 17 | .env-general 18 | .env-blum 19 | .env-tomarket 20 | .env-rockyrabbit 21 | .env-major 22 | .env-dotcoin 23 | .env-timefarm 24 | .env-pocketfi 25 | 26 | cache/ 27 | tmp/ -------------------------------------------------------------------------------- /.env-rockyrabbit-example: -------------------------------------------------------------------------------- 1 | AUTO_PLAY_ENIGMA= 2 | 3 | AUTO_PLAY_COMBO= 4 | AUTO_CLAIM_REWARD= 5 | AUTO_CLAIM_EASTER_EGG= 6 | AUTO_COMPLETE_TASKS= 7 | 8 | AUTO_UPGRADE_TAP= 9 | MAX_TAP_LEVEL= 10 | 11 | AUTO_HOURLY_LIMIT= 12 | MAX_HOURLY_LIMIT_LEVEL= 13 | 14 | AUTO_UPGRADE_ENERGY_LIMIT= 15 | MAX_ENERGY_LIMIT_LEVEL= 16 | 17 | APPLY_DAILY_FULL_ENERGY= 18 | 19 | AUTO_UPGRADE_CARD= 20 | MAX_CARD_LEVEL= 21 | MAX_CARD_PRICE= 22 | 23 | RANDOM_TAPS_COUNT= 24 | 25 | SLEEP_BETWEEN_TAP= 26 | 27 | MIN_AVAILABLE_ENERGY= 28 | SLEEP_EMPTY_ENERGY= -------------------------------------------------------------------------------- /bots/PocketFi/bot/core/header.js: -------------------------------------------------------------------------------- 1 | const app = require("../config/app"); 2 | 3 | const headers = { 4 | "content-type": "application/json", 5 | accept: "*/*", 6 | "sec-fetch-site": "cross-site", 7 | "accept-encoding": "gzip, deflate", 8 | "accept-language": "en-US,en;q=0.9", 9 | "sec-fetch-mode": "cors", 10 | origin: app.origin, 11 | "user-agent": 12 | "Mozilla/5.0 (iPhone; CPU iPhone OS 17_5_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148", 13 | "sec-fetch-dest": "empty", 14 | }; 15 | 16 | module.exports = headers; 17 | -------------------------------------------------------------------------------- /bots/TimeFarm/bot/core/header.js: -------------------------------------------------------------------------------- 1 | const app = require("../config/app"); 2 | 3 | const headers = { 4 | "content-type": "application/json", 5 | accept: "*/*", 6 | "sec-fetch-site": "cross-site", 7 | "accept-encoding": "gzip, deflate", 8 | "accept-language": "en-US,en;q=0.9", 9 | "sec-fetch-mode": "cors", 10 | origin: app.origin, 11 | "user-agent": 12 | "Mozilla/5.0 (iPhone; CPU iPhone OS 17_5_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148", 13 | "sec-fetch-dest": "empty", 14 | }; 15 | 16 | module.exports = headers; 17 | -------------------------------------------------------------------------------- /utils/runOnce.js: -------------------------------------------------------------------------------- 1 | function runOnce(fn) { 2 | let hasRun = false; 3 | 4 | return function (...args) { 5 | if (!hasRun) { 6 | hasRun = true; 7 | return fn(...args); 8 | } 9 | }; 10 | } 11 | 12 | function runOnceAsync(fn) { 13 | let hasRun = false; 14 | 15 | return async function (...args) { 16 | if (!hasRun) { 17 | hasRun = true; 18 | await fn(...args); // Run the provided async code once 19 | } 20 | // On subsequent calls, do nothing and return nothing 21 | }; 22 | } 23 | 24 | module.exports = { runOnce, runOnceAsync }; 25 | -------------------------------------------------------------------------------- /bots/RockyRabbit/bot/config/app.js: -------------------------------------------------------------------------------- 1 | const app = { 2 | version: "1.0.0", 3 | apiUrl: "https://api.rockyrabbit.io", 4 | host: "api.rockyrabbit.io", 5 | peer: "rocky_rabbit_bot", 6 | bot: "rocky_rabbit_bot", 7 | webviewUrl: "https://play.rockyrabbit.io/", 8 | origin: "https://play.rockyrabbit.io", 9 | referer: "https://play.rockyrabbit.io/", 10 | comboApi: "https://freddywhest.github.io/rocky-rabbit-combos/data.json", 11 | comboHost: "freddywhest.github.io", 12 | rockyRabitChannel: "rockyrabbitio", 13 | timezone: "Africa/Accra", 14 | }; 15 | 16 | module.exports = app; 17 | -------------------------------------------------------------------------------- /bots/Blum/bot/config/app.js: -------------------------------------------------------------------------------- 1 | const app = { 2 | version: "1.0.0", 3 | gatewayApiUrl: "https://user-domain.blum.codes", 4 | tribeApiUrl: "https://tribe-domain.blum.codes", 5 | gameApiUrl: "https://game-domain.blum.codes", 6 | earnApiUrl: "https://earn-domain.blum.codes", 7 | gatewayHost: "gateway.blum.codes", 8 | gameHost: "game-domain.blum.codes", 9 | peer: "BlumCryptoBot", 10 | bot: "BlumCryptoBot", 11 | webviewUrl: "https://telegram.blum.codes/", 12 | origin: "https://telegram.blum.codes", 13 | referer: "https://telegram.blum.codes/", 14 | }; 15 | 16 | module.exports = app; 17 | -------------------------------------------------------------------------------- /bots/Major/bot/core/header.js: -------------------------------------------------------------------------------- 1 | const app = require("../config/app"); 2 | 3 | const headers = { 4 | "content-type": "application/json", 5 | accept: "*/*", 6 | "sec-fetch-site": "cross-site", 7 | "accept-encoding": "gzip, deflate", 8 | "accept-language": "en-US,en;q=0.9", 9 | "sec-fetch-mode": "cors", 10 | origin: app.origin, 11 | "user-agent": 12 | "Mozilla/5.0 (iPhone; CPU iPhone OS 17_5_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148", 13 | "sec-fetch-dest": "empty", 14 | " X-Requested-With": "org.telegram.messenger.web", 15 | }; 16 | 17 | module.exports = headers; 18 | -------------------------------------------------------------------------------- /bots/ToMarket/bot/core/header.js: -------------------------------------------------------------------------------- 1 | const app = require("../config/app"); 2 | 3 | const headers = { 4 | "content-type": "application/json", 5 | accept: "application/json, text/plain, */*", 6 | "sec-fetch-site": "same-site", 7 | "accept-encoding": "gzip, deflate", 8 | "accept-language": "en-US,en;q=0.9", 9 | "sec-fetch-mode": "cors", 10 | origin: app.origin, 11 | "user-agent": 12 | "Mozilla/5.0 (iPhone; CPU iPhone OS 17_5_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148", 13 | referer: app.referer, 14 | "sec-fetch-dest": "empty", 15 | }; 16 | 17 | module.exports = headers; 18 | -------------------------------------------------------------------------------- /bots/Blum/bot/core/header.js: -------------------------------------------------------------------------------- 1 | const app = require("../config/app"); 2 | 3 | const headers = { 4 | "content-type": "application/json", 5 | accept: "*/*", 6 | "sec-fetch-site": "cross-site", 7 | "accept-encoding": "gzip, deflate", 8 | "accept-language": "en-US,en;q=0.9", 9 | "sec-fetch-mode": "cors", 10 | origin: app.origin, 11 | "user-agent": 12 | "Mozilla/5.0 (iPhone; CPU iPhone OS 17_5_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148", 13 | "sec-fetch-dest": "empty", 14 | "x-requested-with": "org.telegram.messenger.web", 15 | priority: "u=1, i", 16 | }; 17 | 18 | module.exports = headers; 19 | -------------------------------------------------------------------------------- /bots/Major/bot/utils/taskFilter.js: -------------------------------------------------------------------------------- 1 | var _ = require("lodash"); 2 | function taskFilter(tasks, query_name) { 3 | if (_.isEmpty(tasks)) return []; 4 | return tasks.filter((task) => { 5 | if (typeof query_name == "string") { 6 | return ( 7 | task.type.toLowerCase() === query_name.toLowerCase() && 8 | task?.is_completed == false 9 | ); 10 | } else if (Array.isArray(query_name)) { 11 | return ( 12 | query_name.includes(task.type.toLowerCase()) && 13 | task?.is_completed == false 14 | ); 15 | } else { 16 | return []; 17 | } 18 | }); 19 | } 20 | 21 | module.exports = taskFilter; 22 | -------------------------------------------------------------------------------- /bots/Dotcoin/bot/core/header.js: -------------------------------------------------------------------------------- 1 | const app = require("../config/app"); 2 | 3 | const headers = { 4 | "content-type": "application/json", 5 | accept: "*/*", 6 | "sec-fetch-site": "cross-site", 7 | "accept-encoding": "gzip, deflate", 8 | "accept-language": "en-US,en;q=0.9", 9 | "sec-fetch-mode": "cors", 10 | origin: app.origin, 11 | "user-agent": 12 | "Mozilla/5.0 (iPhone; CPU iPhone OS 17_5_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148", 13 | referer: app.referer, 14 | "sec-fetch-dest": "empty", 15 | "x-requested-with": "org.telegram.messenger.web", 16 | priority: "u=1, i", 17 | }; 18 | 19 | module.exports = headers; 20 | -------------------------------------------------------------------------------- /bots/RockyRabbit/bot/core/header.js: -------------------------------------------------------------------------------- 1 | const app = require("../config/app"); 2 | 3 | const headers = { 4 | "content-type": "application/json", 5 | accept: "application/json, text/plain, */*", 6 | "sec-fetch-site": "same-site", 7 | "accept-encoding": "gzip, deflate", 8 | "accept-language": "en-US,en;q=0.9", 9 | "sec-fetch-mode": "cors", 10 | origin: app.origin, 11 | "user-agent": 12 | "Mozilla/5.0 (iPhone; CPU iPhone OS 17_5_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148", 13 | referer: app.referer, 14 | "sec-fetch-dest": "empty", 15 | "X-Requested-With": "org.telegram.messenger.web", 16 | priority: "u=1, i", 17 | "sec-ch-ua-mobile": "?1", 18 | "sec-ch-ua": 19 | '"Chromium";v="124", "Android WebView";v="124", "Not-A.Brand";v="99"', 20 | }; 21 | 22 | module.exports = headers; 23 | -------------------------------------------------------------------------------- /bots/PocketFi/bot/config/config.js: -------------------------------------------------------------------------------- 1 | require("dotenv").config({ path: ".env-pocketfi" }); 2 | const _isArray = require("../../../../utils/_isArray"); 3 | const generalSetting = require("../../../../utils/config"); 4 | const settings = { 5 | AUTO_MINE: process.env.AUTO_MINE 6 | ? process.env.AUTO_MINE.toLowerCase() === "true" 7 | : true, 8 | 9 | SLEEP_BETWEEN_REQUESTS: 10 | process.env.SLEEP_BETWEEN_REQUESTS && 11 | _isArray(process.env.SLEEP_BETWEEN_REQUESTS) 12 | ? JSON.parse(process.env.SLEEP_BETWEEN_REQUESTS) 13 | : process.env.SLEEP_BETWEEN_REQUESTS && 14 | /^\d+$/.test(process.env.SLEEP_BETWEEN_REQUESTS) 15 | ? parseInt(process.env.SLEEP_BETWEEN_REQUESTS) 16 | : 150, 17 | 18 | USE_PROXY_FROM_FILE: generalSetting.USE_PROXY_FROM_FILE, 19 | }; 20 | 21 | module.exports = settings; 22 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | const logger = require("./utils/logger"); 2 | const luncher = require("./utils/luncher"); 3 | const main = async () => { 4 | await luncher.process(); 5 | }; 6 | 7 | // Wrap main function execution in an async context to handle asynchronous operations 8 | (async () => { 9 | try { 10 | const nodeVersion = process.version; 11 | const major = process.versions 12 | ? parseInt(nodeVersion.split(".")[0].replace("v", ""), 10) 13 | : 0; 14 | if (major < 18 || major > 20 || isNaN(major) || major === 0) { 15 | return logger.error( 16 | "To run this bot, Node.js version 18.x or 20.x is required.\n Current version: " + 17 | nodeVersion + 18 | "" 19 | ); 20 | } 21 | await main(); 22 | } catch (error) { 23 | throw error; 24 | } 25 | })(); 26 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "drop-wizard", 3 | "version": "1.0.1", 4 | "main": "index.js", 5 | "scripts": { 6 | "test": "echo \"Error: no test specified\" && exit 1" 7 | }, 8 | "keywords": [], 9 | "author": "", 10 | "license": "ISC", 11 | "description": "", 12 | "dependencies": { 13 | "@inquirer/prompts": "^5.3.2", 14 | "axios": "^1.7.2", 15 | "commander": "^12.1.0", 16 | "dotenv": "^16.4.5", 17 | "fdy-scraping": "^1.0.2", 18 | "fdy-tmp": "^1.0.4", 19 | "form-data": "^4.0.0", 20 | "https-proxy-agent": "^7.0.5", 21 | "lodash": "^4.17.21", 22 | "moment": "^2.30.1", 23 | "qrcode-terminal": "^0.12.0", 24 | "socks-proxy-agent": "^8.0.3", 25 | "strip-ansi": "^7.1.0", 26 | "telegram": "^2.22.2", 27 | "uuid": "^10.0.0" 28 | }, 29 | "devDependencies": { 30 | "@types/lodash": "^4.17.7" 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /bots/TimeFarm/bot/config/config.js: -------------------------------------------------------------------------------- 1 | require("dotenv").config({ path: ".env-timefarm" }); 2 | const _isArray = require("../../../../utils/_isArray"); 3 | const generalSetting = require("../../../../utils/config"); 4 | const settings = { 5 | CLAIM_FRIENDS_REWARD: process.env.CLAIM_FRIENDS_REWARD 6 | ? process.env.CLAIM_FRIENDS_REWARD.toLowerCase() === "true" 7 | : true, 8 | 9 | AUTO_FARMING: process.env.AUTO_FARMING 10 | ? process.env.AUTO_FARMING.toLowerCase() === "true" 11 | : true, 12 | 13 | AUTO_DAILY_QUIZ: process.env.AUTO_DAILY_QUIZ 14 | ? process.env.AUTO_DAILY_QUIZ.toLowerCase() === "true" 15 | : true, 16 | 17 | SLEEP_BETWEEN_REQUESTS: 18 | process.env.SLEEP_BETWEEN_REQUESTS && 19 | _isArray(process.env.SLEEP_BETWEEN_REQUESTS) 20 | ? JSON.parse(process.env.SLEEP_BETWEEN_REQUESTS) 21 | : process.env.SLEEP_BETWEEN_REQUESTS && 22 | /^\d+$/.test(process.env.SLEEP_BETWEEN_REQUESTS) 23 | ? parseInt(process.env.SLEEP_BETWEEN_REQUESTS) 24 | : 150, 25 | 26 | USE_PROXY_FROM_FILE: generalSetting.USE_PROXY_FROM_FILE, 27 | }; 28 | 29 | module.exports = settings; 30 | -------------------------------------------------------------------------------- /INSTALL.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | echo Copying .env-general-example to .env-general... 3 | copy .env-general-example .env-general 4 | 5 | echo Copying .env-blum-example to .env-blum... 6 | copy .env-blum-example .env-blum 7 | 8 | echo Copying .env-tomarket-example to .env-tomarket... 9 | copy .env-tomarket-example .env-tomarket 10 | 11 | echo Copying .env-rockyrabbit-example to .env-rockyrabbit... 12 | copy .env-rockyrabbit-example .env-rockyrabbit 13 | 14 | echo Copying .env-timefarm-example to .env-timefarm... 15 | copy .env-timefarm-example .env-timefarm 16 | 17 | echo Copying .env-dotcoin-example to .env-dotcoin... 18 | copy .env-dotcoin-example .env-dotcoin 19 | 20 | echo Copying .env-lostdogs-example to .env-lostdogs... 21 | copy .env-lostdogs-example .env-lostdogs 22 | 23 | echo Copying .env-major-example to .env-major... 24 | copy .env-major-example .env-major 25 | 26 | echo Copying .env-pocketfi-example to .env-pocketfi... 27 | copy .env-pocketfi-example .env-pocketfi 28 | 29 | echo Please edit the .env-general file to add your API_ID and API_HASH after Installation. 30 | echo Installing dependencies... 31 | npm install 32 | pause -------------------------------------------------------------------------------- /utils/proxies.js: -------------------------------------------------------------------------------- 1 | //Currently only http and https proxies are supported. 2 | //HTTP proxies are not supported as they required a completely different connection type. 3 | 4 | const proxies = [ 5 | // EXAMPLE: 6 | { 7 | ip: "123.456.789.123", // Proxy host (IP or hostname) 8 | port: 1234, // Proxy port 9 | protocol: "http", // Proxy protocol [http/https]. 10 | username: "username", // If use Socks with auth then you need to provide a username. 11 | password: "password", // If use Socks with auth then you need to provide a password. 12 | }, 13 | { 14 | ip: "123.456.789.123", // Proxy host (IP or hostname) 15 | port: 1234, // Proxy port 16 | protocol: "http", // Proxy protocol [http/https]. 17 | username: "username", // If use Socks with auth then you need to provide a username. 18 | password: "password", // If use Socks with auth then you need to provide a password. 19 | }, 20 | { 21 | ip: "123.456.789.123", // Proxy host (IP or hostname) 22 | port: 1234, // Proxy port 23 | protocol: "http", // Proxy protocol [http/https]. 24 | username: "username", // If use Socks with auth then you need to provide a username. 25 | password: "password", // If use Socks with auth then you need to provide a password. 26 | }, 27 | ]; 28 | 29 | module.exports = proxies; 30 | -------------------------------------------------------------------------------- /bots/ToMarket/bot/config/config.js: -------------------------------------------------------------------------------- 1 | require("dotenv").config({ path: ".env-tomarket" }); 2 | const _isArray = require("../../../../utils/_isArray"); 3 | const generalSetting = require("../../../../utils/config"); 4 | const settings = { 5 | AUTO_PLAY_GAME: process.env.AUTO_PLAY_GAME 6 | ? process.env.AUTO_PLAY_GAME.toLowerCase() === "true" 7 | : true, 8 | 9 | AUTO_CLAIM_DAILY_REWARD: process.env.AUTO_CLAIM_DAILY_REWARD 10 | ? process.env.AUTO_CLAIM_DAILY_REWARD.toLowerCase() === "true" 11 | : true, 12 | 13 | AUTO_FARM: process.env.AUTO_FARM 14 | ? process.env.AUTO_FARM.toLowerCase() === "true" 15 | : true, 16 | 17 | AUTO_CLAIM_COMBO: process.env.AUTO_CLAIM_COMBO 18 | ? process.env.AUTO_CLAIM_COMBO.toLowerCase() === "true" 19 | : true, 20 | 21 | AUTO_CLAIM_STARTS: process.env.AUTO_CLAIM_STARTS 22 | ? process.env.AUTO_CLAIM_STARTS.toLowerCase() === "true" 23 | : true, 24 | 25 | SLEEP_BETWEEN_TAP: 26 | process.env.SLEEP_BETWEEN_TAP && _isArray(process.env.SLEEP_BETWEEN_TAP) 27 | ? JSON.parse(process.env.SLEEP_BETWEEN_TAP) 28 | : process.env.SLEEP_BETWEEN_TAP && 29 | /^\d+$/.test(process.env.SLEEP_BETWEEN_TAP) 30 | ? parseInt(process.env.SLEEP_BETWEEN_TAP) 31 | : 150, 32 | 33 | USE_PROXY_FROM_FILE: generalSetting.USE_PROXY_FROM_FILE, 34 | }; 35 | 36 | module.exports = settings; 37 | -------------------------------------------------------------------------------- /bots/Major/bot/config/config.js: -------------------------------------------------------------------------------- 1 | require("dotenv").config({ path: ".env-major" }); 2 | const _isArray = require("../../../../utils/_isArray"); 3 | const generalSetting = require("../../../../utils/config"); 4 | const settings = { 5 | AUTO_PLAY_HOLD_TO_EARN: process.env.AUTO_PLAY_HOLD_TO_EARN 6 | ? process.env.AUTO_PLAY_HOLD_TO_EARN.toLowerCase() === "true" 7 | : true, 8 | 9 | AUTO_PLAY_ROULETTE: process.env.AUTO_PLAY_ROULETTE 10 | ? process.env.AUTO_PLAY_ROULETTE.toLowerCase() === "true" 11 | : true, 12 | 13 | AUTO_PLAY_SWIPE_COIN: process.env.AUTO_PLAY_SWIPE_COIN 14 | ? process.env.AUTO_PLAY_SWIPE_COIN.toLowerCase() === "true" 15 | : true, 16 | 17 | AUTO_CLAIM_TASKS: process.env.AUTO_CLAIM_TASKS 18 | ? process.env.AUTO_CLAIM_TASKS.toLowerCase() === "true" 19 | : true, 20 | 21 | CLAIM_DAILY_REWARDS: process.env.CLAIM_DAILY_REWARDS 22 | ? process.env.CLAIM_DAILY_REWARDS.toLowerCase() === "true" 23 | : true, 24 | 25 | SLEEP_BETWEEN_REQUESTS: 26 | process.env.SLEEP_BETWEEN_REQUESTS && 27 | _isArray(process.env.SLEEP_BETWEEN_REQUESTS) 28 | ? JSON.parse(process.env.SLEEP_BETWEEN_REQUESTS) 29 | : process.env.SLEEP_BETWEEN_REQUESTS && 30 | /^\d+$/.test(process.env.SLEEP_BETWEEN_REQUESTS) 31 | ? parseInt(process.env.SLEEP_BETWEEN_REQUESTS) 32 | : 150, 33 | 34 | USE_PROXY_FROM_FILE: generalSetting.USE_PROXY_FROM_FILE, 35 | }; 36 | 37 | module.exports = settings; 38 | -------------------------------------------------------------------------------- /utils/parser.js: -------------------------------------------------------------------------------- 1 | const logger = require("./logger"); 2 | 3 | class Parser { 4 | #parseQueryString(queryString) { 5 | let queryParams = {}; 6 | let pairs = queryString.split("&"); 7 | 8 | pairs.forEach((pair) => { 9 | let [key, value] = pair.split("="); 10 | queryParams[key] = value; 11 | }); 12 | 13 | return queryParams; 14 | } 15 | 16 | #decodeUrlEncodedString(str) { 17 | return decodeURIComponent(str.replace(/\+/g, " ")); 18 | } 19 | 20 | toJson(queryString) { 21 | try { 22 | const parsedQuery = this.#parseQueryString(queryString); 23 | const userField = this.#decodeUrlEncodedString(parsedQuery.user); 24 | const user = JSON.parse(userField); 25 | parsedQuery.user = user; 26 | parsedQuery.user.allows_write_to_pm = true; 27 | return parsedQuery; 28 | } catch (error) { 29 | logger.error("Error while parsing query string: " + error.message); 30 | return null; 31 | } 32 | } 33 | 34 | toQueryString(json) { 35 | let encodedString = Object.keys(json) 36 | .map((key) => { 37 | let encodedKey = encodeURIComponent(key); 38 | let encodedValue = encodeURIComponent( 39 | typeof json[key] === "object" ? JSON.stringify(json[key]) : json[key] 40 | ); 41 | return `${encodedKey}=${encodedValue}`; 42 | }) 43 | .join("&"); 44 | 45 | return encodedString; 46 | } 47 | } 48 | 49 | const parser = new Parser(); 50 | 51 | module.exports = parser; 52 | -------------------------------------------------------------------------------- /AddQueryId.md: -------------------------------------------------------------------------------- 1 | # Steps to get `webAppInitData/Query` 2 | 3 | ## **Using telegram web:** 4 | 5 | 1. Set `USE_QUERY_ID` in your .env file to `True` 6 | 7 | 2. Launch WEB Telegram with your browser (e.g. Chrome) 8 | 9 | 3. Click the F12 to open `Inspect tool` for you Chromium browser (e.g Brave, Chrome, Arc, Microsoft Edge, etc..) 10 | 11 | 4. Launch the Rocky Rabbit app from your telegram web 12 | 13 | 5. Click on the `Console` tab in the `Inspect tool` 14 | 15 | 6. Type `allow pasting` in the `Console` and press enter 16 | 17 | 7. Copy and Paste `new URLSearchParams(document.querySelector('iframe').src.split('#')[1]).get('tgWebAppData')` in the console and press enter 18 | 19 | 8. Copy the returned string in the `Console` after finishing `Step 6` 20 | 21 | The string looks like: `user=%7B%22id4345646456451%2C%22first_name%22%3A%dfgdfgdfg%22%2C%22last_name%22%3A%22%22%2C%22username%22%3A%dfghsgrdfgdfg%22%2C%22language_code%22%3A%22en%22%2C%22allows_write_to_pm%22%3Atrue%7D&chat_instance=-457567675675&chat_type=sender&auth_date=175657657&hash=66487465e9877w98rf7sdfsdjh48484343herfuh4y4rwseifs` 22 | 23 | 9. Paste it in the `queryIds.json` file. Example below: 24 | 25 | ```json 26 | { 27 | "Account1": "user=%7B%22id4345646456451%2C%22first_name%22%3A%dfgdfgdfg%22%2C%22last_name%22%3A%22%22%2C%22username%22%3A%dfghsgrdfgdfg%22%2C%22language_code%22%3A%22en%22%2C%22allows_write_to_pm%22%3Atrue%7D&chat_instance=-457567675675&chat_type=sender&auth_date=175657657&hash=66487465e9877w98rf7sdfsdjh48484343herfuh4y4rwseifs" 28 | } 29 | ``` 30 | 31 | 10. Now start the bot using `node index.js` 32 | -------------------------------------------------------------------------------- /bots/RockyRabbit/bot/helpers/filterArray.js: -------------------------------------------------------------------------------- 1 | class FilterArray { 2 | getEmptyConditions(data) { 3 | return data.filter((upgrade) => upgrade.condition.length === 0); 4 | } 5 | 6 | getCardsOnUpgradeTab(data, section, tab) { 7 | return data 8 | .filter( 9 | (upgrade) => 10 | upgrade.section == section && upgrade.tab.toLowerCase() == tab 11 | ) 12 | .sort((a, b) => b.sort - a.sort); 13 | } 14 | 15 | getUncompletedTasks(data) { 16 | return data.filter( 17 | (task) => 18 | (task.cat.toLowerCase().includes("rocky power") || 19 | task.name.toLowerCase().includes("subscribe") || 20 | task.name.toLowerCase().includes("sponsor")) && 21 | task.isCompleted === false 22 | ); 23 | } 24 | 25 | getById(data, id) { 26 | return data.filter((upgrade) => upgrade.upgradeId == id); 27 | } 28 | 29 | getNotUpgradeCards(array_1, array_2) { 30 | const array = array_2 31 | .filter((item2) => 32 | array_1.some( 33 | (item1) => 34 | item1.upgradeId === item2.upgradeId && 35 | item1.currentProfitPerHour > 0 36 | ) 37 | ) 38 | .sort((a, b) => b.sort - a.sort); 39 | 40 | return array; 41 | } 42 | 43 | getCardsWithLevel(array_1, array_2, level) { 44 | const array = array_2 45 | .filter((item2) => 46 | array_1.some( 47 | (item1) => item1.upgradeId === item2.upgradeId && item1.level <= level 48 | ) 49 | ) 50 | .sort((a, b) => b.sort - a.sort); 51 | 52 | return array; 53 | } 54 | } 55 | 56 | const filterArray = new FilterArray(); 57 | 58 | module.exports = filterArray; 59 | -------------------------------------------------------------------------------- /bots/Blum/bot/config/config.js: -------------------------------------------------------------------------------- 1 | require("dotenv").config({ path: ".env-blum" }); 2 | const _isArray = require("../../../../utils/_isArray"); 3 | const generalSetting = require("../../../../utils/config"); 4 | const settings = { 5 | CLAIM_DAILY_REWARD: process.env.CLAIM_DAILY_REWARD 6 | ? process.env.CLAIM_DAILY_REWARD.toLowerCase() === "true" 7 | : true, 8 | 9 | CLAIM_FRIENDS_REWARD: process.env.CLAIM_FRIENDS_REWARD 10 | ? process.env.CLAIM_FRIENDS_REWARD.toLowerCase() === "true" 11 | : true, 12 | 13 | AUTO_PLAY_GAMES: process.env.AUTO_PLAY_GAMES 14 | ? process.env.AUTO_PLAY_GAMES.toLowerCase() === "true" 15 | : true, 16 | 17 | AUTO_START_FARMING: process.env.AUTO_START_FARMING 18 | ? process.env.AUTO_START_FARMING.toLowerCase() === "true" 19 | : true, 20 | 21 | AUTO_CLAIM_FARMING_REWARD: process.env.AUTO_CLAIM_FARMING_REWARD 22 | ? process.env.AUTO_CLAIM_FARMING_REWARD.toLowerCase() === "true" 23 | : true, 24 | 25 | SLEEP_BETWEEN_TAP: 26 | process.env.SLEEP_BETWEEN_TAP && _isArray(process.env.SLEEP_BETWEEN_TAP) 27 | ? JSON.parse(process.env.SLEEP_BETWEEN_TAP) 28 | : process.env.SLEEP_BETWEEN_TAP && 29 | /^\d+$/.test(process.env.SLEEP_BETWEEN_TAP) 30 | ? parseInt(process.env.SLEEP_BETWEEN_TAP) 31 | : 150, 32 | 33 | USE_PROXY_FROM_FILE: generalSetting.USE_PROXY_FROM_FILE, 34 | 35 | AUTO_JOIN_TRIBE: process.env.AUTO_JOIN_TRIBE 36 | ? process.env.AUTO_JOIN_TRIBE.toLowerCase() === "true" 37 | : true, 38 | 39 | CLAIM_TASKS_REWARD: process.env.CLAIM_TASKS_REWARD 40 | ? process.env.CLAIM_TASKS_REWARD.toLowerCase() === "true" 41 | : false, 42 | }; 43 | 44 | module.exports = settings; 45 | -------------------------------------------------------------------------------- /bots/Dotcoin/bot/config/config.js: -------------------------------------------------------------------------------- 1 | require("dotenv").config({ path: ".env-dotcoin" }); 2 | const _isArray = require("../../../../utils/_isArray"); 3 | const generalSetting = require("../../../../utils/config"); 4 | const settings = { 5 | AUTO_UPGRADE_MULTITAP: process.env.AUTO_UPGRADE_MULTITAP 6 | ? process.env.AUTO_UPGRADE_MULTITAP.toLowerCase() === "true" 7 | : true, 8 | MAX_MULTITAP_LEVEL: process.env.MAX_MULTITAP_LEVEL 9 | ? parseInt(process.env.MAX_MULTITAP_LEVEL) 10 | : 5, 11 | 12 | AUTO_UPGRADE_ATTEMPTS: process.env.AUTO_UPGRADE_ATTEMPTS 13 | ? process.env.AUTO_UPGRADE_ATTEMPTS.toLowerCase() === "true" 14 | : true, 15 | 16 | AUTO_CLAIM_TASKS: process.env.AUTO_CLAIM_TASKS 17 | ? process.env.AUTO_CLAIM_TASKS.toLowerCase() === "true" 18 | : true, 19 | 20 | MAX_ATTEMPTS: process.env.MAX_ATTEMPTS 21 | ? parseInt(process.env.MAX_ATTEMPTS) 22 | : 15, 23 | 24 | MIN_DTC_TO_STOP_SPIN_TO_EARN: process.env.MIN_DTC_TO_STOP_SPIN_TO_EARN 25 | ? parseInt(process.env.MIN_DTC_TO_STOP_SPIN_TO_EARN) 26 | : 20, 27 | 28 | SLEEP_BETWEEN_TAP: 29 | process.env.SLEEP_BETWEEN_TAP && _isArray(process.env.SLEEP_BETWEEN_TAP) 30 | ? JSON.parse(process.env.SLEEP_BETWEEN_TAP) 31 | : process.env.SLEEP_BETWEEN_TAP && 32 | /^\d+$/.test(process.env.SLEEP_BETWEEN_TAP) 33 | ? parseInt(process.env.SLEEP_BETWEEN_TAP) 34 | : 150, 35 | 36 | USE_PROXY_FROM_FILE: generalSetting.USE_PROXY_FROM_FILE, 37 | 38 | AUTO_PLAY_SPIN_TO_EARN: process.env.AUTO_PLAY_SPIN_TO_EARN 39 | ? process.env.AUTO_PLAY_SPIN_TO_EARN.toLowerCase() === "true" 40 | : false, 41 | 42 | AUTO_LUCKY_DOUBLING_COINS: process.env.AUTO_LUCKY_DOUBLING_COINS 43 | ? process.env.AUTO_LUCKY_DOUBLING_COINS.toLowerCase() === "true" 44 | : true, 45 | 46 | RANDOM_TAPS_COUNT: 47 | process.env.RANDOM_TAPS_COUNT && _isArray(process.env.RANDOM_TAPS_COUNT) 48 | ? JSON.parse(process.env.RANDOM_TAPS_COUNT) 49 | : [1000, 20000], 50 | }; 51 | 52 | module.exports = settings; 53 | -------------------------------------------------------------------------------- /bots/RockyRabbit/bot/scripts/upgradeNoConditionCards.js: -------------------------------------------------------------------------------- 1 | const logger = require("../../../../utils/logger"); 2 | 3 | const _ = require("lodash"); 4 | const filterArray = require("../helpers/filterArray"); 5 | const settings = require("../config/config"); 6 | 7 | async function upgradeNoConditionCards( 8 | cards_wnc, 9 | api, 10 | http_client, 11 | session_name, 12 | bot_name 13 | ) { 14 | let profile_data = await api.get_user_data(http_client); 15 | let mine_sync = await api.mine_sync(http_client); 16 | 17 | if (_.isEmpty(cards_wnc) || _.isEmpty(mine_sync) || _.isEmpty(profile_data)) { 18 | return; 19 | } 20 | 21 | for (const card of cards_wnc) { 22 | // get card information 23 | const singleCard = filterArray.getById(mine_sync, card?.upgradeId)[0]; 24 | 25 | if (_.isEmpty(singleCard)) { 26 | return; 27 | } 28 | 29 | if ( 30 | singleCard?.price > profile_data?.clicker?.balance || 31 | singleCard?.price > settings.MAX_CARD_PRICE || 32 | singleCard?.level > settings.MAX_CARD_LEVEL || 33 | singleCard?.isCompleted == true 34 | ) { 35 | return; 36 | } 37 | const upgraded_card = await api.upgrade_cards(http_client, { 38 | upgradeId: card?.upgradeId, 39 | }); 40 | if (upgraded_card?.status?.toLowerCase() === "ok") { 41 | logger.info( 42 | `[${bot_name}] | ${session_name} | Card upgraded to level: ${ 43 | upgraded_card?.upgradesTask?.level > 1 44 | ? upgraded_card?.upgradesTask?.level - 1 45 | : 1 46 | } | Card: ${ 47 | upgraded_card?.upgradesTask?.upgradeId 48 | } | Cost: ${card?.price}` 49 | ); 50 | } else { 51 | logger.warning( 52 | `[${bot_name}] | ${session_name} | Could not upgrade card | Card: ${card?.upgradeId}` 53 | ); 54 | } 55 | profile_data = await api.get_user_data(http_client); 56 | mine_sync = await api.mine_sync(http_client); 57 | } 58 | } 59 | 60 | module.exports = upgradeNoConditionCards; 61 | -------------------------------------------------------------------------------- /install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo "Copying .env-general-example to .env-general..." 4 | cp .env-general-example .env-general 5 | 6 | echo "Copying .env-blum-example to .env-blum..." 7 | cp .env-blum-example .env-blum 8 | 9 | echo "Copying .env-tomarket-example to .env-tomarket..." 10 | cp .env-tomarket-example .env-tomarket 11 | 12 | echo "Copying .env-rockyrabbit-example to .env-rockyrabbit..." 13 | cp .env-rockyrabbit-example .env-rockyrabbit 14 | 15 | echo "Copying .env-timefarm-example to .env-timefarm..." 16 | cp .env-timefarm-example .env-timefarm 17 | 18 | echo "Copying .env-dotcoin-example to .env-dotcoin..." 19 | cp .env-dotcoin-example .env-dotcoin 20 | 21 | echo "Copying .env-lostdogs-example to .env-lostdogs..." 22 | cp .env-lostdogs-example .env-lostdogs 23 | 24 | echo "Copying .env-major-example to .env-major..." 25 | cp .env-major-example .env-major 26 | 27 | echo "Copying .env-pocketfi-example to .env-pocketfi..." 28 | cp .env-pocketfi-example .env-pocketfi 29 | 30 | echo "Please edit the .env-general file to add your API_ID and API_HASH after Installation." 31 | 32 | # Function to check if a command exists 33 | command_exists() { 34 | command -v "$1" >/dev/null 2>&1 35 | } 36 | 37 | # Check if Node.js is installed 38 | if command_exists node; then 39 | echo "Preparing to install npm packages..." 40 | else 41 | echo "Node.js is not installed. Installing Node.js..." 42 | 43 | # Install Node.js 18 (This assumes a Debian-based system like Ubuntu) 44 | curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash - 45 | sudo apt-get install -y nodejs 46 | 47 | # Verify installation 48 | if command_exists node; then 49 | echo "Node.js successfully installed." 50 | else 51 | echo "Failed to install Node.js. Exiting." 52 | exit 1 53 | fi 54 | fi 55 | 56 | # Install npm packages 57 | echo "Installing npm packages..." 58 | npm install 59 | 60 | # Verify installation of npm packages 61 | if [ $? -eq 0 ]; then 62 | echo "npm packages successfully installed." 63 | else 64 | echo "Failed to install npm packages. Exiting." 65 | exit 1 66 | fi 67 | 68 | read -p "Press any key to continue..." 69 | -------------------------------------------------------------------------------- /utils/config.js: -------------------------------------------------------------------------------- 1 | require("dotenv").config({ path: ".env-general" }); 2 | const settings = { 3 | API_ID: 4 | process.env.API_ID && /^\d+$/.test(process.env.API_ID) 5 | ? parseInt(process.env.API_ID) 6 | : process.env.API_ID && !/^\d+$/.test(process.env.API_ID) 7 | ? "N/A" 8 | : undefined, 9 | API_HASH: process.env.API_HASH || "", 10 | BLUM: process.env.BLUM ? process.env.BLUM.toLowerCase() === "true" : true, 11 | ROCKYRABBIT: process.env.ROCKYRABBIT 12 | ? process.env.ROCKYRABBIT.toLowerCase() === "true" 13 | : true, 14 | TOMARKET: process.env.TOMARKET 15 | ? process.env.TOMARKET.toLowerCase() === "true" 16 | : true, 17 | DOTCOIN: process.env.DOTCOIN 18 | ? process.env.DOTCOIN.toLowerCase() === "true" 19 | : true, 20 | TIMEFARM: process.env.TIMEFARM 21 | ? process.env.TIMEFARM.toLowerCase() === "true" 22 | : true, 23 | POCKETFI: process.env.POCKETFI 24 | ? process.env.POCKETFI.toLowerCase() === "true" 25 | : true, 26 | MAJOR: process.env.MAJOR ? process.env.MAJOR.toLowerCase() === "true" : true, 27 | USE_QUERY_ID_TOMARKET: process.env.USE_QUERY_ID_TOMARKET 28 | ? process.env.USE_QUERY_ID_TOMARKET.toLowerCase() === "true" 29 | : false, 30 | USE_QUERY_ID_BLUM: process.env.USE_QUERY_ID_BLUM 31 | ? process.env.USE_QUERY_ID_BLUM.toLowerCase() === "true" 32 | : false, 33 | USE_QUERY_ID_ROCKYRABBIT: process.env.USE_QUERY_ID_ROCKYRABBIT 34 | ? process.env.USE_QUERY_ID_ROCKYRABBIT.toLowerCase() === "true" 35 | : false, 36 | USE_QUERY_ID_DOTCOIN: process.env.USE_QUERY_ID_DOTCOIN 37 | ? process.env.USE_QUERY_ID_DOTCOIN.toLowerCase() === "true" 38 | : false, 39 | USE_QUERY_ID_TIMEFARM: process.env.USE_QUERY_ID_TIMEFARM 40 | ? process.env.USE_QUERY_ID_TIMEFARM.toLowerCase() === "true" 41 | : false, 42 | USE_QUERY_ID_MAJOR: process.env.USE_QUERY_ID_MAJOR 43 | ? process.env.USE_QUERY_ID_MAJOR.toLowerCase() === "true" 44 | : false, 45 | USE_QUERY_ID_POCKETFI: process.env.USE_QUERY_ID_POCKETFI 46 | ? process.env.USE_QUERY_ID_POCKETFI.toLowerCase() === "true" 47 | : false, 48 | USE_PROXY_FROM_FILE: process.env.USE_PROXY_FROM_FILE 49 | ? process.env.USE_PROXY_FROM_FILE.toLowerCase() === "true" 50 | : false, 51 | }; 52 | 53 | module.exports = settings; 54 | -------------------------------------------------------------------------------- /bots/Major/bot/utils/fetchers.js: -------------------------------------------------------------------------------- 1 | const app = require("../config/app"); 2 | const logger = require("../../../../utils/logger"); 3 | const sleep = require("../../../../utils/sleep"); 4 | 5 | class Fetchers { 6 | constructor(api, session_name, bot_name) { 7 | this.bot_name = bot_name; 8 | this.session_name = session_name; 9 | this.api = api; 10 | } 11 | async get_access_token(tgWebData, http_client) { 12 | try { 13 | const response = await http_client.post( 14 | `${app.apiUrl}/api/auth/tg/`, 15 | JSON.stringify(tgWebData) 16 | ); 17 | 18 | return response.data; 19 | } catch (error) { 20 | if (error?.response?.status >= 500 && error?.response?.status <= 599) { 21 | return "server"; 22 | } 23 | if (error?.response?.message) { 24 | logger.error( 25 | `[${this.bot_name}] | ${this.session_name} | ❗️Error while getting Access Token: ${error.response.message}` 26 | ); 27 | } else { 28 | logger.error( 29 | `[${this.bot_name}] | ${this.session_name} | ❗️Error while getting Access Token: ${error}` 30 | ); 31 | } 32 | return null; 33 | await sleep(3); // 3 seconds delay 34 | } 35 | } 36 | 37 | async check_proxy(http_client, proxy) { 38 | try { 39 | const response = await http_client.get("https://httpbin.org/ip"); 40 | const ip = response.data.origin; 41 | logger.info( 42 | `[${this.bot_name}] | ${this.session_name} | Proxy IP: ${ip}` 43 | ); 44 | } catch (error) { 45 | if ( 46 | error.message.includes("ENOTFOUND") || 47 | error.message.includes("getaddrinfo") || 48 | error.message.includes("ECONNREFUSED") 49 | ) { 50 | logger.error( 51 | `[${this.bot_name}] | ${this.session_name} | Error: Unable to resolve the proxy address. The proxy server at ${proxy.ip}:${proxy.port} could not be found. Please check the proxy address and your network connection.` 52 | ); 53 | logger.error( 54 | `[${this.bot_name}] | ${this.session_name} | No proxy will be used.` 55 | ); 56 | } else { 57 | logger.error( 58 | `[${this.bot_name}] | ${this.session_name} | Proxy: ${proxy.ip}:${proxy.port} | Error: ${error.message}` 59 | ); 60 | } 61 | 62 | return false; 63 | } 64 | } 65 | } 66 | 67 | module.exports = Fetchers; 68 | -------------------------------------------------------------------------------- /utils/TldLogger.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | const logger = require("./logger"); 4 | 5 | exports.Logger = exports.LogLevel = void 0; 6 | var LogLevel; 7 | (function (LogLevel) { 8 | LogLevel["NONE"] = "none"; 9 | LogLevel["ERROR"] = "error"; 10 | LogLevel["WARN"] = "warn"; 11 | LogLevel["INFO"] = "info"; 12 | LogLevel["DEBUG"] = "debug"; 13 | })((LogLevel = exports.LogLevel || (exports.LogLevel = {}))); 14 | class Logger { 15 | constructor(level) { 16 | this.levels = ["error", "warn", "info", "debug"]; 17 | // if (!_level) { 18 | // _level = level || "info"; // defaults to info 19 | // } 20 | this._logLevel = "error"; 21 | } 22 | /** 23 | * 24 | * @param level {string} 25 | * @returns {boolean} 26 | */ 27 | canSend(level) { 28 | return this._logLevel 29 | ? this.levels.indexOf(this._logLevel) >= this.levels.indexOf(level) 30 | : false; 31 | } 32 | /** 33 | * @param message {string} 34 | */ 35 | warn(message) { 36 | return null; 37 | } 38 | /** 39 | * @param message {string} 40 | */ 41 | info(message) { 42 | this._log( 43 | LogLevel.INFO, 44 | message 45 | .replace(/gramJS/i, "FreddyBot") 46 | .replace(/(version\s+)[\d.]+/, "$11.0.0") 47 | ); 48 | } 49 | /** 50 | * @param message {string} 51 | */ 52 | debug(message) { 53 | this._log(LogLevel.DEBUG, message); 54 | } 55 | /** 56 | * @param message {string} 57 | */ 58 | error(message) { 59 | this._log(LogLevel.ERROR, message); 60 | } 61 | 62 | get logLevel() { 63 | return this._logLevel; 64 | } 65 | setLevel(level) { 66 | this._logLevel = level; 67 | } 68 | static setLevel(level) { 69 | console.log( 70 | "Logger.setLevel is deprecated, it will has no effect. Please, use client.setLogLevel instead." 71 | ); 72 | } 73 | /** 74 | * @param level {string} 75 | * @param message {string} 76 | */ 77 | _log(level, message) { 78 | if (this.canSend(level)) { 79 | this.log(level, message); 80 | } else { 81 | return; 82 | } 83 | } 84 | 85 | log(level, message) { 86 | if (level == "info") { 87 | logger.info(message); 88 | } else if (level == "debug") { 89 | logger.debug(message); 90 | } else if (level == "error") { 91 | logger.error(message); 92 | } else if (level == "warn") { 93 | logger.warning(message); 94 | } 95 | } 96 | } 97 | const logger2 = new Logger(); 98 | module.exports = logger2; 99 | -------------------------------------------------------------------------------- /utils/tappers.js: -------------------------------------------------------------------------------- 1 | const ToMarketNonSessionTapper = require("../bots/ToMarket/bot/core/nonSessionTapper"); 2 | const BlumNonSessionTapper = require("../bots/Blum/bot/core/nonSessionTapper"); 3 | const RockyRabbitNonSessionTapper = require("../bots/RockyRabbit/bot/core/nonSessionTapper"); 4 | const TimeFarmNonSessionTapper = require("../bots/TimeFarm/bot/core/nonSessionTapper"); 5 | const DotcoinNonSessionTapper = require("../bots/Dotcoin/bot/core/nonSessionTapper"); 6 | const MajorNonSessionTapper = require("../bots/Major/bot/core/nonSessionTapper"); 7 | 8 | const BlumTapper = require("../bots/Blum/bot/core/tapper"); 9 | const ToMarketTapper = require("../bots/ToMarket/bot/core/tapper"); 10 | const TimeFarmTapper = require("../bots/TimeFarm/bot/core/tapper"); 11 | const MajorTapper = require("../bots/Major/bot/core/tapper"); 12 | const DotcoinTapper = require("../bots/Dotcoin/bot/core/tapper"); 13 | const settings = require("./config"); 14 | const RockyRabbitTapper = require("../bots/RockyRabbit/bot/core/tapper"); 15 | const PocketFiNonSessionTapper = require("../bots/PocketFi/bot/core/nonSessionTapper"); 16 | const PocketFiTapper = require("../bots/PocketFi/bot/core/tapper"); 17 | 18 | const tappers = { 19 | blum: { 20 | class: BlumTapper, 21 | use: settings.BLUM, 22 | }, 23 | tomarket: { 24 | class: ToMarketTapper, 25 | use: settings.TOMARKET, 26 | }, 27 | rockyrabbit: { 28 | class: RockyRabbitTapper, 29 | use: settings.ROCKYRABBIT, 30 | }, 31 | timefarm: { 32 | class: TimeFarmTapper, 33 | use: settings.TIMEFARM, 34 | }, 35 | dotcoin: { 36 | class: DotcoinTapper, 37 | use: settings.DOTCOIN, 38 | }, 39 | major: { 40 | class: MajorTapper, 41 | use: settings.MAJOR, 42 | }, 43 | pocketfi: { 44 | class: PocketFiTapper, 45 | use: settings.POCKETFI, 46 | }, 47 | }; 48 | 49 | const nonSessionTappers = { 50 | blum: { 51 | class: BlumNonSessionTapper, 52 | use: settings.BLUM, 53 | }, 54 | tomarket: { 55 | class: ToMarketNonSessionTapper, 56 | use: settings.TOMARKET, 57 | }, 58 | rockyrabbit: { 59 | class: RockyRabbitNonSessionTapper, 60 | use: settings.ROCKYRABBIT, 61 | }, 62 | timefarm: { 63 | class: TimeFarmNonSessionTapper, 64 | use: settings.TIMEFARM, 65 | }, 66 | dotcoin: { 67 | class: DotcoinNonSessionTapper, 68 | use: settings.DOTCOIN, 69 | }, 70 | major: { 71 | class: MajorNonSessionTapper, 72 | use: settings.MAJOR, 73 | }, 74 | pocketfi: { 75 | class: PocketFiNonSessionTapper, 76 | use: settings.POCKETFI, 77 | }, 78 | }; 79 | 80 | module.exports = { tappers, nonSessionTappers }; 81 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Terms and Conditions for Copying, Distribution, and Modification 2 | 3 | 1. Definitions: 4 | - "Software": refers to this project and all associated files. 5 | - "You": refers to the individual or legal entity accessing and using the Software. 6 | - "Non-Commercial": means not intended for or directed towards commercial advantage or monetary compensation. 7 | 2. Grant of License: 8 | Subject to the terms and conditions of this license, the copyright holder grants You a worldwide, royalty-free, non-exclusive, perpetual license to use, copy, modify, and distribute the Software, provided that: 9 | 10 | 1. You do not sell the Software or any modified versions of it. 11 | 2. You do not use the Software or any modified versions of it for commercial purposes. 12 | 13 | 3. Redistribution: 14 | You may redistribute the Software in its original or modified form, provided that You: 15 | 16 | 1. Include a copy of this license with any copy of the Software You distribute. 17 | 2. Clearly state any modifications made to the original Software. 18 | 19 | 4. Derivative Works 20 | You are allowed to create derivative works of the Software, provided that: 21 | 22 | 1. Any derivative works are distributed under the same terms as this license. 23 | 2. You do not sell any derivative works or use them for commercial purposes. 24 | 25 | 5. Disclaimer of Warranty 26 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT, OR OTHERWISE, ARISING FROM, OUT OF, OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 27 | 28 | 6. Limitation of Liability 29 | IN NO EVENT WILL THE COPYRIGHT HOLDER BE LIABLE FOR ANY DAMAGES, INCLUDING WITHOUT LIMITATION, LOST PROFITS, LOST SAVINGS, OR OTHER INCIDENTAL OR CONSEQUENTIAL DAMAGES, ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE, EVEN IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 30 | 31 | 7. Termination 32 | This license is effective until terminated. You may terminate it at any time by destroying all copies of the Software in your possession or control. This license will terminate immediately without notice from the copyright holder if You fail to comply with any provision of this license. 33 | 34 | 8. Miscellaneous 35 | If any provision of this license is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable. 36 | -------------------------------------------------------------------------------- /bots/RockyRabbit/bot/config/config.js: -------------------------------------------------------------------------------- 1 | require("dotenv").config({ path: ".env-rockyrabbit" }); 2 | const _isArray = require("../../../../utils/_isArray"); 3 | const generalSetting = require("../../../../utils/config"); 4 | const settings = { 5 | AUTO_PLAY_ENIGMA: process.env.AUTO_PLAY_ENIGMA 6 | ? process.env.AUTO_PLAY_ENIGMA.toLowerCase() === "true" 7 | : true, 8 | 9 | AUTO_PLAY_COMBO: process.env.AUTO_PLAY_COMBO 10 | ? process.env.AUTO_PLAY_COMBO.toLowerCase() === "true" 11 | : true, 12 | 13 | APPLY_DAILY_FULL_ENERGY: process.env.APPLY_DAILY_FULL_ENERGY 14 | ? process.env.APPLY_DAILY_FULL_ENERGY.toLowerCase() === "true" 15 | : true, 16 | 17 | AUTO_CLAIM_REWARD: process.env.AUTO_CLAIM_REWARD 18 | ? process.env.AUTO_CLAIM_REWARD.toLowerCase() === "true" 19 | : true, 20 | 21 | AUTO_COMPLETE_TASKS: process.env.AUTO_COMPLETE_TASKS 22 | ? process.env.AUTO_COMPLETE_TASKS.toLowerCase() === "true" 23 | : true, 24 | 25 | AUTO_UPGRADE_TAP: process.env.AUTO_UPGRADE_TAP 26 | ? process.env.AUTO_UPGRADE_TAP.toLowerCase() === "true" 27 | : true, 28 | 29 | AUTO_CLAIM_EASTER_EGG: process.env.AUTO_CLAIM_EASTER_EGG 30 | ? process.env.AUTO_CLAIM_EASTER_EGG.toLowerCase() === "true" 31 | : true, 32 | 33 | MAX_TAP_LEVEL: process.env.MAX_TAP_LEVEL 34 | ? parseInt(process.env.MAX_TAP_LEVEL) 35 | : 10, 36 | 37 | AUTO_UPGRADE_CARD: process.env.AUTO_UPGRADE_CARD 38 | ? process.env.AUTO_UPGRADE_CARD.toLowerCase() === "true" 39 | : true, 40 | 41 | MAX_CARD_LEVEL: process.env.MAX_CARD_LEVEL 42 | ? parseInt(process.env.MAX_CARD_LEVEL) 43 | : 10, 44 | 45 | MAX_CARD_PRICE: process.env.MAX_CARD_PRICE 46 | ? parseInt(process.env.MAX_CARD_PRICE) 47 | : 100000000000000, 48 | 49 | AUTO_HOURLY_LIMIT: process.env.AUTO_HOURLY_LIMIT 50 | ? process.env.AUTO_HOURLY_LIMIT.toLowerCase() === "true" 51 | : true, 52 | 53 | MAX_HOURLY_LIMIT_LEVEL: process.env.MAX_HOURLY_LIMIT_LEVEL 54 | ? parseInt(process.env.MAX_HOURLY_LIMIT_LEVEL) 55 | : 10, 56 | 57 | MIN_AVAILABLE_ENERGY: process.env.MIN_AVAILABLE_ENERGY 58 | ? parseInt(process.env.MIN_AVAILABLE_ENERGY) 59 | : 100, 60 | 61 | SLEEP_EMPTY_ENERGY: process.env.SLEEP_EMPTY_ENERGY 62 | ? parseInt(process.env.SLEEP_EMPTY_ENERGY) 63 | : 70, 64 | 65 | AUTO_UPGRADE_ENERGY_LIMIT: process.env.AUTO_UPGRADE_ENERGY_LIMIT 66 | ? process.env.AUTO_UPGRADE_ENERGY_LIMIT.toLowerCase() === "true" 67 | : true, 68 | 69 | RANDOM_TAPS_COUNT: 70 | process.env.RANDOM_TAPS_COUNT && _isArray(process.env.RANDOM_TAPS_COUNT) 71 | ? JSON.parse(process.env.RANDOM_TAPS_COUNT) 72 | : [300, 600], 73 | 74 | SLEEP_BETWEEN_TAP: 75 | process.env.SLEEP_BETWEEN_TAP && _isArray(process.env.SLEEP_BETWEEN_TAP) 76 | ? JSON.parse(process.env.SLEEP_BETWEEN_TAP) 77 | : process.env.SLEEP_BETWEEN_TAP && 78 | /^\d+$/.test(process.env.SLEEP_BETWEEN_TAP) 79 | ? parseInt(process.env.SLEEP_BETWEEN_TAP) 80 | : 150, 81 | 82 | MAX_ENERGY_LIMIT_LEVEL: process.env.MAX_ENERGY_LIMIT_LEVEL 83 | ? parseInt(process.env.MAX_ENERGY_LIMIT_LEVEL) 84 | : 10, 85 | USE_PROXY_FROM_FILE: generalSetting.USE_PROXY_FROM_FILE, 86 | }; 87 | 88 | module.exports = settings; 89 | -------------------------------------------------------------------------------- /bots/RockyRabbit/bot/scripts/upgradeTabCardsBuying.js: -------------------------------------------------------------------------------- 1 | const logger = require("../../../../utils/logger"); 2 | 3 | const _ = require("lodash"); 4 | const filterArray = require("../helpers/filterArray"); 5 | const settings = require("../config/config"); 6 | 7 | async function upgradeTabCardsBuying( 8 | cards_wc, 9 | http_client, 10 | api, 11 | session_name, 12 | bot_name 13 | ) { 14 | // get user profile 15 | let profile_data = await api.get_user_data(http_client); 16 | let mine_sync = await api.mine_sync(http_client); 17 | let cards_to_upgrade = []; 18 | if (_.isEmpty(profile_data) || _.isEmpty(mine_sync) || _.isEmpty(cards_wc)) { 19 | return; 20 | } 21 | const not_upgraded_cards = filterArray.getNotUpgradeCards( 22 | mine_sync, 23 | cards_wc 24 | ); 25 | 26 | if (!_.isEmpty(not_upgraded_cards)) { 27 | cards_to_upgrade = not_upgraded_cards; 28 | } else { 29 | cards_to_upgrade = cards_wc; 30 | } 31 | 32 | for (const [index, card] of cards_to_upgrade.entries()) { 33 | // Get current card information 34 | const singleCard = filterArray.getById(mine_sync, card?.upgradeId)[0]; 35 | 36 | if (_.isEmpty(singleCard) || _.isEmpty(profile_data)) { 37 | break; 38 | } 39 | 40 | // Check the previous card's level before upgrading the current card 41 | if (index > 0) { 42 | const prevCard = filterArray.getById( 43 | mine_sync, 44 | cards_to_upgrade[index - 1]?.upgradeId 45 | )[0]; 46 | 47 | // If the previous card's level is less than or equal to the current card's level, break the loop 48 | if ( 49 | prevCard?.level <= singleCard?.level || 50 | singleCard?.price > profile_data?.clicker?.balance 51 | ) { 52 | break; 53 | } 54 | } 55 | 56 | // Now check and upgrade the current card 57 | if ( 58 | singleCard?.price <= profile_data?.clicker?.balance && 59 | singleCard?.price <= settings.MAX_CARD_PRICE && 60 | singleCard?.level <= settings.MAX_CARD_LEVEL && 61 | singleCard?.isCompleted === false 62 | ) { 63 | const upgraded_card = await api.upgrade_cards(http_client, { 64 | upgradeId: card?.upgradeId, 65 | }); 66 | 67 | if (upgraded_card?.status?.toLowerCase() === "ok") { 68 | logger.info( 69 | `[${bot_name}] | ${session_name} | Card upgraded to level: ${ 70 | upgraded_card?.upgradesTask?.level > 1 71 | ? upgraded_card?.upgradesTask?.level - 1 72 | : 1 73 | } | Card: ${ 74 | upgraded_card?.upgradesTask?.upgradeId 75 | } | Cost: ${singleCard?.price}` 76 | ); 77 | } else if ( 78 | typeof upgraded_card === "string" && 79 | upgraded_card?.includes("insufficient") 80 | ) { 81 | logger.info( 82 | `[${bot_name}] | ${session_name} | Insufficient balance to upgrade card | Card: ${card?.upgradeId}` 83 | ); 84 | break; 85 | } else { 86 | logger.warning( 87 | `[${bot_name}] | ${session_name} | Could not upgrade card | Card: ${card?.upgradeId}` 88 | ); 89 | break; 90 | } 91 | // Refresh profile data and mine sync after upgrading the card 92 | profile_data = await api.get_user_data(http_client); 93 | mine_sync = await api.mine_sync(http_client); 94 | } else { 95 | break; 96 | } 97 | } 98 | } 99 | 100 | module.exports = upgradeTabCardsBuying; 101 | -------------------------------------------------------------------------------- /bots/PocketFi/bot/core/api.js: -------------------------------------------------------------------------------- 1 | const app = require("../config/app"); 2 | const logger = require("../../../../utils/logger"); 3 | var _ = require("lodash"); 4 | 5 | class ApiRequest { 6 | constructor(session_name, bot_name) { 7 | this.session_name = session_name; 8 | this.bot_name = bot_name; 9 | } 10 | 11 | async get_mining_info(http_client) { 12 | try { 13 | const response = await http_client.get( 14 | `${app.apiUrl}/mining/getUserMining` 15 | ); 16 | return response?.data; 17 | } catch (error) { 18 | console.log(error); 19 | 20 | if (error?.response?.data?.message) { 21 | logger.warning( 22 | `[${this.bot_name}] | ${this.session_name} | ⚠️ Error while getting mining: ${error?.response?.data?.message}` 23 | ); 24 | } else { 25 | logger.error( 26 | `[${this.bot_name}] | ${this.session_name} | Error while getting mining: ${error.message}` 27 | ); 28 | } 29 | 30 | return null; 31 | } 32 | } 33 | 34 | async validate_query_id(http_client) { 35 | try { 36 | const response = await http_client.get( 37 | `${app.apiUrl}/mining/getUserMining` 38 | ); 39 | 40 | if (!_.isEmpty(response?.data)) { 41 | return true; 42 | } 43 | return false; 44 | } catch (error) { 45 | if (_.isEmpty(error?.response?.data) || error?.response?.status == 403) { 46 | return false; 47 | } 48 | 49 | throw error; 50 | } 51 | } 52 | 53 | async claim_mining(http_client) { 54 | try { 55 | const response = await http_client.post( 56 | `${app.apiUrl}/mining/claimMining` 57 | ); 58 | return response.data; 59 | } catch (error) { 60 | if (error?.response?.data?.message) { 61 | logger.warning( 62 | `[${this.bot_name}] | ${this.session_name} | ⚠️ Error while claiming mining:: ${error?.response?.data?.message}` 63 | ); 64 | } else { 65 | logger.error( 66 | `[${this.bot_name}] | ${this.session_name} | Error while claiming mining:: ${error.message}` 67 | ); 68 | } 69 | 70 | return null; 71 | } 72 | } 73 | 74 | async create_mining_user(http_client) { 75 | try { 76 | const response = await http_client.post( 77 | `${app.apiUrl}/mining/createUserMining` 78 | ); 79 | return response.data; 80 | } catch (error) { 81 | if (error?.response?.data?.message) { 82 | logger.warning( 83 | `[${this.bot_name}] | ${this.session_name} | ⚠️ Error while creating mining user: ${error?.response?.data?.message}` 84 | ); 85 | } else { 86 | logger.error( 87 | `[${this.bot_name}] | ${this.session_name} | Error while creating mining user: ${error.message}` 88 | ); 89 | } 90 | 91 | return null; 92 | } 93 | } 94 | 95 | async start_param(http_client) { 96 | try { 97 | await http_client.get( 98 | `${app.apiUrl}/getPresetTokens?startParam=1167045062` 99 | ); 100 | return true; 101 | } catch (error) { 102 | if (error?.response?.status === 404) { 103 | return null; 104 | } 105 | if (error?.response?.data?.message) { 106 | logger.warning( 107 | `[${this.bot_name}] | ${this.session_name} | ⚠️ Error while getting start param: ${error?.response?.data?.message}` 108 | ); 109 | } else { 110 | logger.error( 111 | `[${this.bot_name}] | ${this.session_name} | Error while getting start param: ${error.message}` 112 | ); 113 | } 114 | 115 | return null; 116 | } 117 | } 118 | } 119 | 120 | module.exports = ApiRequest; 121 | -------------------------------------------------------------------------------- /utils/logger.js: -------------------------------------------------------------------------------- 1 | const moment = require("moment"); 2 | 3 | class Logger { 4 | constructor() { 5 | this.prefix = `[${moment().format("YYYY-MM-DD HH:mm:ss")}]`; 6 | this.GREEN = "\u001b[32m"; 7 | this.RED = "\u001b[31m"; 8 | this.YELLOW = "\u001b[33m"; 9 | this.BLUE = "\u001b[34m"; 10 | this.VOILET = "\u001b[35m"; 11 | this.LIGHT_BLUE = "\u001b[36m"; 12 | this.WHITE = "\u001b[37m"; 13 | this.PINK = "\u001b[38;5;201m"; 14 | this.LAVENDER = "\u001b[38;5;147m"; 15 | 16 | //Background colors 17 | this.BG_WHITE_CYAN = "\u001b[37;46m"; 18 | this.BG_RED = "\u001b[37;41m"; 19 | this.BG_GREEN = "\u001b[37;42m"; 20 | this.BG_YELLOW = "\u001b[37;43m"; 21 | this.BG_BLUE = "\u001b[37;44m"; 22 | this.BG_LIGHT_BLUE = "\u001b[37;45m"; 23 | this.BG_WHITE = "\u001b[47;45m"; 24 | 25 | this.RESET = "\u001b[0m"; 26 | this.BOLD = "\u001b[1m"; 27 | this.ITALICIZE = "\u001b[3m"; 28 | this.UNDERLINE = "\u001b[4m"; 29 | } 30 | 31 | #convertHtmlElementToAnsiColor(message) { 32 | if (!message) { 33 | return message; 34 | } 35 | 36 | return ( 37 | message 38 | // Text colors 39 | .replace(//g, this.BLUE) 40 | .replace(/<\/bl>/g, this.RESET) 41 | .replace(//g, this.RED) 42 | .replace(/<\/re>/g, this.RESET) 43 | .replace(//g, this.GREEN) 44 | .replace(/<\/gr>/g, this.RESET) 45 | .replace(//g, this.YELLOW) 46 | .replace(/<\/ye>/g, this.RESET) 47 | .replace(//g, this.PINK) 48 | .replace(/<\/pi>/g, this.RESET) 49 | .replace(//g, this.WHITE) 50 | .replace(/<\/wh>/g, this.RESET) 51 | .replace(//g, this.VOILET) 52 | .replace(/<\/vo>/g, this.RESET) 53 | .replace(//g, this.LAVENDER) 54 | .replace(/<\/la>/g, this.RESET) 55 | .replace(//g, this.LIGHT_BLUE) 56 | .replace(/<\/lb>/g, this.RESET) 57 | 58 | // Text styles 59 | .replace(//g, this.BOLD) 60 | .replace(/<\/b>/g, this.RESET) 61 | .replace(//g, this.ITALICIZE) 62 | .replace(/<\/i>/g, this.RESET) 63 | .replace(//g, this.UNDERLINE) 64 | .replace(/<\/u>/g, this.RESET) 65 | 66 | // Background colors 67 | .replace(//g, this.BG_WHITE_CYAN) 68 | .replace(/<\/wcb>/g, this.RESET) 69 | .replace(//g, this.BG_RED) 70 | .replace(/<\/reb>/g, this.RESET) 71 | .replace(//g, this.BG_GREEN) 72 | .replace(/<\/grb>/g, this.RESET) 73 | .replace(//g, this.BG_YELLOW) 74 | .replace(/<\/yeb>/g, this.RESET) 75 | .replace(//g, this.BG_BLUE) 76 | .replace(/<\/blb>/g, this.RESET) 77 | .replace(//g, this.BG_LIGHT_BLUE) 78 | .replace(/<\/lbb>/g, this.RESET) 79 | .replace(//g, this.BG_WHITE) 80 | .replace(/<\/whb>/g, this.RESET) 81 | 82 | // HTML tags 83 | .replace(/
/g, "\n") 84 | .replace(/
/g, "\n") 85 | ); 86 | } 87 | 88 | info(message) { 89 | this.prefix = `[${moment().format("YYYY-MM-DD HH:mm:ss")}]`; 90 | console.log( 91 | this.#convertHtmlElementToAnsiColor( 92 | `${this.prefix} | INFO | ${message}` 93 | ) 94 | ); 95 | } 96 | 97 | warning(message) { 98 | this.prefix = `[${moment().format("YYYY-MM-DD HH:mm:ss")}]`; 99 | console.log( 100 | this.#convertHtmlElementToAnsiColor( 101 | `${this.prefix} | WARN | ${message}` 102 | ) 103 | ); 104 | } 105 | 106 | error(message) { 107 | this.prefix = `[${moment().format("YYYY-MM-DD HH:mm:ss")}]`; 108 | console.log( 109 | this.#convertHtmlElementToAnsiColor( 110 | `${this.prefix} | ERROR | ${message}` 111 | ) 112 | ); 113 | } 114 | 115 | debug(message) { 116 | this.prefix = `[${moment().format("YYYY-MM-DD HH:mm:ss")}]`; 117 | console.log( 118 | this.#convertHtmlElementToAnsiColor( 119 | `${this.prefix} | DEBUG | ${message}` 120 | ) 121 | ); 122 | } 123 | 124 | success(message) { 125 | this.prefix = `[${moment().format("YYYY-MM-DD HH:mm:ss")}]`; 126 | console.log( 127 | this.#convertHtmlElementToAnsiColor( 128 | `${this.prefix} | SUCCESS | ${message}` 129 | ) 130 | ); 131 | } 132 | 133 | #stripAnsiCodes(text) { 134 | const ansiRegex = /\x1b\[[0-9;]*m/g; 135 | return text.replace(ansiRegex, ""); 136 | } 137 | 138 | #addRoundedBorder(logText) { 139 | const lines = logText.split("\n"); 140 | 141 | const maxLength = lines.reduce( 142 | (max, line) => Math.max(max, this.#stripAnsiCodes(line).length), 143 | 0 144 | ); 145 | 146 | const topBorder = `${this.BLUE}╭${"─".repeat(maxLength + 2)}╮${this.RESET}`; 147 | const bottomBorder = `${this.BLUE}╰${"─".repeat(maxLength + 2)}╯${ 148 | this.RESET 149 | }`; 150 | console.log(topBorder); 151 | lines.forEach((line) => { 152 | const strippedLineLength = this.#stripAnsiCodes(line).length; 153 | console.log( 154 | `${this.BLUE}│${this.RESET} ${line}${" ".repeat( 155 | maxLength - strippedLineLength 156 | )} ${this.BLUE}│${this.RESET}` 157 | ); 158 | }); 159 | console.log(bottomBorder); 160 | } 161 | 162 | paragraph(message) { 163 | this.prefix = `[${moment().format("YYYY-MM-DD HH:mm:ss")}]`; 164 | this.#addRoundedBorder( 165 | this.#convertHtmlElementToAnsiColor( 166 | `${this.prefix}
167 | ${message}` 168 | ) 169 | ); 170 | } 171 | } 172 | 173 | const logger = new Logger(); 174 | 175 | module.exports = logger; 176 | -------------------------------------------------------------------------------- /bots/Dotcoin/bot/core/api.js: -------------------------------------------------------------------------------- 1 | const app = require("../config/app"); 2 | const logger = require("../../../../utils/logger"); 3 | const sleep = require("../../../../utils/sleep"); 4 | var _ = require("lodash"); 5 | 6 | class ApiRequest { 7 | constructor(session_name, bot_name) { 8 | this.session_name = session_name; 9 | this.bot_name = bot_name; 10 | } 11 | 12 | async get_user_data(http_client) { 13 | try { 14 | const response = await http_client.post( 15 | `${app.apiUrl}/rest/v1/rpc/get_user_info` 16 | ); 17 | return response.data; 18 | } catch (error) { 19 | const regex = /ENOTFOUND\s([^\s]+)/; 20 | const match = error.message.match(regex); 21 | logger.error( 22 | `[${this.bot_name}] | ${ 23 | this.session_name 24 | } | Error while getting User Data: ${ 25 | error.message.includes("ENOTFOUND") || 26 | error.message.includes("getaddrinfo") || 27 | error.message.includes("ECONNREFUSED") 28 | ? `The proxy server at ${ 29 | match && match[1] ? match[1] : "unknown address" 30 | } could not be found. Please check the proxy address and your network connection` 31 | : error.message 32 | }` 33 | ); 34 | await sleep(3); // Sleep for 3 seconds 35 | } 36 | } 37 | 38 | async validate_query_id(http_client, data, bearer) { 39 | try { 40 | http_client.defaults.headers["authorization"] = `Bearer ${bearer}`; 41 | const response = await http_client.post( 42 | `${app.apiUrl}/functions/v1/getToken`, 43 | JSON.stringify(data) 44 | ); 45 | 46 | if (!_.isEmpty(response?.data)) { 47 | return true; 48 | } 49 | return false; 50 | } catch (error) { 51 | if ( 52 | error?.response?.data?.message 53 | ?.toLowerCase() 54 | ?.includes("invalid signature error") || 55 | error?.response?.status == 400 56 | ) { 57 | return false; 58 | } 59 | 60 | throw error; 61 | } 62 | } 63 | 64 | async upgrade_boost(http_client, boostType, data) { 65 | try { 66 | const response = await http_client.post( 67 | `${app.apiUrl}/rest/v1/rpc/${boostType}`, 68 | data 69 | ); 70 | return response.data; 71 | } catch (error) { 72 | logger.error( 73 | `[${this.bot_name}] | ${this.session_name} | Error while upgrading Boost:: ${error.message}` 74 | ); 75 | } 76 | } 77 | 78 | async send_taps(http_client, coins) { 79 | try { 80 | const response = await http_client.post( 81 | `${app.apiUrl}/rest/v1/rpc/save_coins`, 82 | JSON.stringify({ coins }) 83 | ); 84 | return response.data; 85 | } catch (error) { 86 | logger.error( 87 | `[${this.bot_name}] | ${this.session_name} | Error while sending taps: ${error.message}` 88 | ); 89 | } 90 | } 91 | 92 | async get_assets(http_client) { 93 | try { 94 | const response = await http_client.get( 95 | `${app.apiUrl}/rest/v1/rpc/get_assets` 96 | ); 97 | return response.data; 98 | } catch (error) { 99 | if (error?.response?.data) { 100 | logger.error( 101 | `[${this.bot_name}] | ${this.session_name} | Error while getting assets: ${error?.response?.data?.message}` 102 | ); 103 | } else { 104 | logger.error( 105 | `[${this.bot_name}] | ${this.session_name} | Error while getting assets: ${error.message}` 106 | ); 107 | } 108 | } 109 | } 110 | 111 | async spin_to_earn(http_client) { 112 | try { 113 | const response = await http_client.post( 114 | `${app.apiUrl}/rest/v1/rpc/spin_to_win`, 115 | JSON.stringify({}) 116 | ); 117 | return response.data; 118 | } catch (error) { 119 | if (error?.response?.data) { 120 | logger.error( 121 | `[${this.bot_name}] | ${this.session_name} | Error while claiming tasks: ${error?.response?.data?.message}` 122 | ); 123 | } else { 124 | logger.error( 125 | `[${this.bot_name}] | ${this.session_name} | Error while claiming tasks: ${error.message}` 126 | ); 127 | } 128 | } 129 | } 130 | 131 | async get_tasks(http_client, platform) { 132 | try { 133 | const response = await http_client.get( 134 | `${app.apiUrl}/rest/v1/rpc/get_filtered_tasks?platform=${platform}&locale=en&is_premium=true` 135 | ); 136 | return response.data.filter( 137 | (task) => 138 | !task?.title?.toLowerCase()?.includes("invite") && 139 | task?.is_completed == null 140 | ); 141 | } catch (error) { 142 | if (error?.response?.data) { 143 | logger.error( 144 | `[${this.bot_name}] | ${this.session_name} | Error while getting tasks: ${error?.response?.data?.message}` 145 | ); 146 | } else { 147 | logger.error( 148 | `[${this.bot_name}] | ${this.session_name} | Error while getting tasks: ${error.message}` 149 | ); 150 | } 151 | } 152 | } 153 | 154 | async claim_task(http_client, taskId) { 155 | try { 156 | const response = await http_client.post( 157 | `${app.apiUrl}/rest/v1/rpc/complete_task`, 158 | JSON.stringify({ oid: taskId }) 159 | ); 160 | return response.data; 161 | } catch (error) { 162 | if (error?.response?.data) { 163 | logger.error( 164 | `[${this.bot_name}] | ${this.session_name} | Error while claiming tasks: ${error?.response?.data?.message}` 165 | ); 166 | } else { 167 | logger.error( 168 | `[${this.bot_name}] | ${this.session_name} | Error while claiming tasks: ${error.message}` 169 | ); 170 | } 171 | } 172 | } 173 | 174 | async try_your_luck(http_client, coins) { 175 | try { 176 | const response = await http_client.post( 177 | `${app.apiUrl}/rest/v1/rpc/try_your_luck`, 178 | JSON.stringify({ coins }) 179 | ); 180 | return response.data; 181 | } catch (error) { 182 | if (error?.response?.data) { 183 | logger.error( 184 | `[${this.bot_name}] | ${this.session_name} | Error while trying your luck on doubling coins: ${error?.response?.data?.message}` 185 | ); 186 | } else { 187 | logger.error( 188 | `[${this.bot_name}] | ${this.session_name} | Error while trying your luck on doubling coins: ${error.message}` 189 | ); 190 | } 191 | } 192 | } 193 | } 194 | 195 | module.exports = ApiRequest; 196 | -------------------------------------------------------------------------------- /bots/TimeFarm/bot/core/api.js: -------------------------------------------------------------------------------- 1 | const app = require("../config/app"); 2 | const logger = require("../../../../utils/logger"); 3 | var _ = require("lodash"); 4 | 5 | class ApiRequest { 6 | constructor(session_name, bot_name) { 7 | this.session_name = session_name; 8 | this.bot_name = bot_name; 9 | } 10 | 11 | async get_farm_info(http_client) { 12 | try { 13 | const response = await http_client.get( 14 | `${app.apiUrl}/api/v1/farming/info` 15 | ); 16 | return response?.data; 17 | } catch (error) { 18 | if (error?.response?.data?.message) { 19 | logger.warning( 20 | `[${this.bot_name}] | ${this.session_name} | ⚠️ Error while getting farming info: ${error?.response?.data?.message}` 21 | ); 22 | } else { 23 | logger.error( 24 | `[${this.bot_name}] | ${this.session_name} | Error while getting farming info: ${error.message}` 25 | ); 26 | } 27 | 28 | return null; 29 | } 30 | } 31 | 32 | async validate_query_id(http_client, data) { 33 | try { 34 | const response = await http_client.post( 35 | `${app.apiUrl}/api/v1/auth/validate-init/v2`, 36 | JSON.stringify(data) 37 | ); 38 | 39 | if (!_.isEmpty(response?.data)) { 40 | return true; 41 | } 42 | return false; 43 | } catch (error) { 44 | if ( 45 | error?.response?.data?.error?.message 46 | ?.toLowerCase() 47 | ?.includes("unauthorized") || 48 | error?.response?.status == 401 49 | ) { 50 | return false; 51 | } 52 | 53 | throw error; 54 | } 55 | } 56 | 57 | async get_balance(http_client) { 58 | try { 59 | const response = await http_client.get(`${app.apiUrl}/api/v1/balance`); 60 | return response.data; 61 | } catch (error) { 62 | if (error?.response?.data?.message) { 63 | logger.warning( 64 | `[${this.bot_name}] | ${this.session_name} | ⚠️ Error while getting balance:: ${error?.response?.data?.message}` 65 | ); 66 | } else { 67 | logger.error( 68 | `[${this.bot_name}] | ${this.session_name} | Error while getting balance:: ${error.message}` 69 | ); 70 | } 71 | 72 | return null; 73 | } 74 | } 75 | 76 | async claim_friends_balance(http_client) { 77 | try { 78 | const response = await http_client.post( 79 | `${app.apiUrl}/api/v1/balance/referral/claim`, 80 | JSON.stringify({}) 81 | ); 82 | return response.data; 83 | } catch (error) { 84 | if (error?.response?.data?.message) { 85 | logger.warning( 86 | `[${this.bot_name}] | ${this.session_name} | ⚠️ Error while claiming friends balance: ${error?.response?.data?.message}` 87 | ); 88 | } else { 89 | logger.error( 90 | `[${this.bot_name}] | ${this.session_name} | Error while claiming friends balance: ${error.message}` 91 | ); 92 | } 93 | 94 | return null; 95 | } 96 | } 97 | 98 | async start_farming(http_client) { 99 | try { 100 | const response = await http_client.post( 101 | `${app.apiUrl}/api/v1/farming/start`, 102 | JSON.stringify({}) 103 | ); 104 | return response.data; 105 | } catch (error) { 106 | if (error?.response?.data?.message) { 107 | logger.warning( 108 | `[${this.bot_name}] | ${this.session_name} | ⚠️ Error while starting farming: ${error?.response?.data?.message}` 109 | ); 110 | } else { 111 | logger.error( 112 | `[${this.bot_name}] | ${this.session_name} | Error while starting farming: ${error.message}` 113 | ); 114 | } 115 | 116 | return null; 117 | } 118 | } 119 | 120 | async get_quiz(http_client) { 121 | try { 122 | const response = await http_client.get( 123 | `${app.apiUrl}/api/v1/daily-questions` 124 | ); 125 | return response.data; 126 | } catch (error) { 127 | if (error?.response?.data?.message) { 128 | logger.warning( 129 | `[${this.bot_name}] | ${this.session_name} | ⚠️ Error while getting quiz: ${error?.response?.data?.message}` 130 | ); 131 | } else { 132 | logger.error( 133 | `[${this.bot_name}] | ${this.session_name} | Error while getting quiz: ${error.message}` 134 | ); 135 | } 136 | 137 | return null; 138 | } 139 | } 140 | 141 | async get_quiz_answer(http_client) { 142 | try { 143 | const response = await http_client.get(`${app.quiz}`); 144 | return response.data; 145 | } catch (error) { 146 | if (error?.response?.data?.message) { 147 | logger.warning( 148 | `[${this.bot_name}] | ${this.session_name} | ⚠️ Error while getting quiz answer: ${error?.response?.data?.message}` 149 | ); 150 | } else { 151 | logger.error( 152 | `[${this.bot_name}] | ${this.session_name} | Error while getting quiz answer: ${error.message}` 153 | ); 154 | } 155 | 156 | return null; 157 | } 158 | } 159 | 160 | async claim_farming(http_client) { 161 | try { 162 | const response = await http_client.post( 163 | `${app.apiUrl}/api/v1/farming/finish`, 164 | JSON.stringify({}) 165 | ); 166 | return response.data; 167 | } catch (error) { 168 | if (error?.response?.data?.message) { 169 | logger.warning( 170 | `[${this.bot_name}] | ${this.session_name} | ⚠️ Error while claiming farm reward: ${error?.response?.data?.message}` 171 | ); 172 | } else { 173 | logger.error( 174 | `[${this.bot_name}] | ${this.session_name} | Error while claiming farm reward: ${error.message}` 175 | ); 176 | } 177 | 178 | return null; 179 | } 180 | } 181 | 182 | async claim_quiz(http_client, answer) { 183 | try { 184 | const response = await http_client.post( 185 | `${app.apiUrl}/api/v1/daily-questions`, 186 | JSON.stringify({ answer }) 187 | ); 188 | return response.data; 189 | } catch (error) { 190 | if (error?.response?.data?.message) { 191 | logger.warning( 192 | `[${this.bot_name}] | ${this.session_name} | ⚠️ Error while claiming quiz: ${error?.response?.data?.message}` 193 | ); 194 | } else { 195 | logger.error( 196 | `[${this.bot_name}] | ${this.session_name} | Error while claiming quiz: ${error.message}` 197 | ); 198 | } 199 | 200 | return null; 201 | } 202 | } 203 | } 204 | 205 | module.exports = ApiRequest; 206 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | > [](https://t.me/roddyfred) 2 | 3 | ![img1](./.github/images/hero.png) 4 | 5 | # Use Node.Js 18 or greater 6 | 7 | ## Available Bots 8 | 9 | | Bots | Status | 10 | | ----------------------- | :----: | 11 | | Blum | ✅ | 12 | | Rocky Rabbit | ✅ | 13 | | ToMarket | ✅ | 14 | | Dotcoin | ✅ | 15 | | Major | ✅ | 16 | | Timefarm | ✅ | 17 | | PocketFi | ✅ | 18 | | Character X | ⏳ | 19 | | BunnyApp | ⏳ | 20 | | Stay tune, more to come | 👻 | 21 | 22 | ### [How to get and add query id](https://github.com/Freddywhest/DropWizard/blob/main/AddQueryId.md) 23 | 24 | ## Config Files 25 | 26 | | Files | Description | 27 | | ------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- | 28 | | **`.env-general`** | Config file for `DropWizard`. [How to configure DropWizard](#settings) | 29 | | **`.env-blum`** | Config file for `Blum`. [How to configure Blum](https://github.com/Freddywhest/BlumBot/blob/main/README.md) | 30 | | **`.env-rockyrabbit`** | Config file for `Rocky Rabbit`. [How to configure Rocky Rabbit](https://github.com/Freddywhest/RockyRabbitBot/blob/main/README.md) | 31 | | **`.env-tomarket`** | Config file for `ToMarket`. [How to configure ToMarket](https://github.com/Freddywhest/ToMarketBot/blob/main/README.md) | 32 | | **`.env-major`** | Config file for `Major`. [How to configure Major](https://github.com/Freddywhest/MajorBot/blob/main/README.md) | 33 | | **`.env-dotcoin`** | Config file for `Dotcoin`. [How to configure Dotcoin](https://github.com/Freddywhest/DotcoinBot/blob/main/README.md) | 34 | | **`.env-timefarm`** | Config file for `Timefarm`. [How to configure Timefarm](https://github.com/Freddywhest/TimefarmBot/blob/main/README.md) | 35 | | **`.env-pocketfi`** | Config file for `PocketFi`. [How to configure Timefarm](https://github.com/Freddywhest/PocketFiBot/blob/main/README.md) | 36 | | **`queryIds_blum.json`** | For setting query ids for `Blum` | 37 | | **`queryIds_rockyrabbit.json`** | For setting query ids for `ROCKY RABBIT` | 38 | | **`queryIds_tomarket.json`** | For setting query ids for `ToMarket` | 39 | | **`queryIds_major.json`** | For setting query ids for `Major` | 40 | | **`queryIds_dotcoin.json`** | For setting query ids for `Dotcoin` | 41 | | **`queryIds_timefarm.json`** | For setting query ids for `Timefarm` | 42 | | **`queryIds_pocketfi.json`** | For setting query ids for `PocketFi` | 43 | 44 | ## [Settings](https://github.com/FreddyWhest/DropWizard/blob/main/.env-general-example) 45 | 46 | | Settings | Description | 47 | | ---------------------------- | ---------------------------------------------------------------------------- | 48 | | **API_ID / API_HASH** | Platform data from which to launch a Telegram session (stock - Android) | 49 | | **BLUM** | Whether to start `Blum` when the bot start (True / False) | 50 | | **TOMARKET** | Whether to start `ToMarket` when the bot start (True / False) | 51 | | **DOTCOIN** | Whether to start `Dotcoin` when the bot start (True / False) | 52 | | **MAJOR** | Whether to start `Major` when the bot start (True / False) | 53 | | **TIMEFARM** | Whether to start `Timefarm` when the bot start (True / False) | 54 | | **ROCKYRABBIT** | Whether to start `Rocky Rabbit` when the bot start (True / False) | 55 | | **POCKETFI** | Whether to start `PocketFi` when the bot start (True / False) | 56 | | **USE_QUERY_ID_BLUM** | Whether to use query ids instead of sessions `(BLUM)` (True / False) | 57 | | **USE_QUERY_ID_TOMARKET** | Whether to use query ids instead of sessions `(TOMARKET)` (True / False) | 58 | | **USE_QUERY_ID_ROCKYRABBIT** | Whether to use query ids instead of sessions `(ROCKY RABBIT)` (True / False) | 59 | | **USE_QUERY_ID_DOTCOIN** | Whether to use query ids instead of sessions `(DOTCOIN)` (True / False) | 60 | | **USE_QUERY_ID_MAJOR** | Whether to use query ids instead of sessions `(MAJOR)` (True / False) | 61 | | **USE_QUERY_ID_TIMEFARM** | Whether to use query ids instead of sessions `(TIMEFARM)` (True / False) | 62 | | **USE_QUERY_ID_POCKETFI** | Whether to use query ids instead of sessions `(POCKETFI)` (True / False) | 63 | | **USE_PROXY_FROM_FILE** | Whether to use proxy from the `bot/config/proxies.js` file (True / False) | 64 | 65 | ## Installation 66 | 67 | You can download [**Repository**](https://github.com/FreddyWhest/DropWizard) by cloning it to your system and installing the necessary dependencies: 68 | 69 | ```shell 70 | ~ >>> git clone https://github.com/FreddyWhest/DropWizard.git 71 | ~ >>> cd DropWizard 72 | 73 | #Linux and MocOS 74 | ~/DropWizard >>> chmod +x check_node.sh 75 | ~/DropWizard >>> ./check_node.sh 76 | 77 | OR 78 | 79 | ~/DropWizard >>> npm install 80 | ~/DropWizard >>> cp .env-general-example .env-general 81 | ~/DropWizard >>> cp .env-blum-example .env-blum 82 | ~/DropWizard >>> cp .env-tomarket-example .env-tomarket 83 | ~/DropWizard >>> cp .env-rockyrabbit-example .env-rockyrabbit 84 | ~/DropWizard >>> nano .env-general # Here you must specify your API_ID and API_HASH , the rest is taken by default 85 | ~/DropWizard >>> node index.js 86 | 87 | #Windows 88 | 1. Double click on INSTALL.bat in DropWizard directory to install the dependencies 89 | 2. Double click on START.bat in DropWizard directory to start the bot 90 | 91 | OR 92 | 93 | ~/DropWizard >>> npm install 94 | ~/DropWizard >>> cp .env-general-example .env-general 95 | ~/DropWizard >>> cp .env-blum-example .env-blum 96 | ~/DropWizard >>> cp .env-tomarket-example .env-tomarket 97 | ~/DropWizard >>> cp .env-rockyrabbit-example .env-rockyrabbit 98 | ~/DropWizard >>> # Edit .env-general and set your API_ID and API_HASH 99 | ~/DropWizard >>> node index.js 100 | ``` 101 | 102 | Also for quick launch you can use arguments, for example: 103 | 104 | ```shell 105 | ~/DropWizard >>> node index.js --action=1 106 | 107 | OR 108 | 109 | ~/DropWizard >>> node index.js --action=2 110 | 111 | #1 - Create session 112 | #2 - Run clicker 113 | ``` 114 | -------------------------------------------------------------------------------- /utils/luncher.js: -------------------------------------------------------------------------------- 1 | const a0_0x2dda54=a0_0x4f85;function a0_0x3b99(){const _0x5d5cef=['nonSessionTappers','process','WARNING\x20\x0aen:\x20NOT\x20FOR\x20SALE\x0aru:\x20НЕ\x20ДЛЯ\x20ПРОДАЖИ\x0aes:\x20NO\x20VENTA\x0afr:\x20PAS\x20À\x20VENDRE\x0ait:\x20NON\x20PER\x20VENDITA\x0agh:\x20YƐN\x20TƆN\x0a\x0aFor\x20updates\x20and\x20more\x20bots\x20join\x20us:\x20\x0ahttps://t.me/freddy_bots\x0a\x0aBot:\x20','write','log','next','match','No\x20sessions\x20found.\x20Create\x20a\x20new\x20one.','115dWSwtH','./TldLogger','run','
\x0a','error','entries','opts','split','iterator','start','Freddy\x20Bots','\x20proxies','test','4066552rkkvpj','showHelpAfterError','choices','tappers','push','756072kExlvg','Detected\x20','\x20|\x20Invalid\x20session\x20data.\x20Create\x20a\x20new\x20one.','utf8','map','@inquirer/prompts','./register','5255409vsPGLP','toLowerCase','./tappers','join','76878OTymgZ','warning','USE_PROXY_FROM_FILE','6704285Pgfktg','isArray','USE_QUERY_ID_','../package.json','./logger','8lWhJav','class','exit','8304129rHpOBJ','Create\x20session','cwd','What\x20would\x20you\x20like\x20to\x20do:\x0a','644215RUbCSG','Run\x20bot','Action\x20must\x20be\x201\x20or\x202','sessions','.session','\x20sessions\x20|\x20','queryIds_','./config','','API_ID','action','sessionString','has','endsWith','API_ID\x20and\x20API_HASH\x20must\x20be\x20provided.','1.0.0','value','message','\x0aStart\x20the\x20bot','path','length','./proxies','exports','apiHash','apiId','readdirSync','existsSync','telegram','readFileSync','.json','API_HASH','trim','parse'];a0_0x3b99=function(){return _0x5d5cef;};return a0_0x3b99();}(function(_0x49c5ad,_0xbc6b9d){const _0x1d5cd7=a0_0x4f85,_0x430896=_0x49c5ad();while(!![]){try{const _0x3bff78=-parseInt(_0x1d5cd7(0xc8))/0x1+parseInt(_0x1d5cd7(0x103))/0x2+parseInt(_0x1d5cd7(0x10a))/0x3+parseInt(_0x1d5cd7(0xfe))/0x4+-parseInt(_0x1d5cd7(0xf1))/0x5*(-parseInt(_0x1d5cd7(0xb9))/0x6)+parseInt(_0x1d5cd7(0xbc))/0x7*(-parseInt(_0x1d5cd7(0xc1))/0x8)+-parseInt(_0x1d5cd7(0xc4))/0x9;if(_0x3bff78===_0xbc6b9d)break;else _0x430896['push'](_0x430896['shift']());}catch(_0xfade6f){_0x430896['push'](_0x430896['shift']());}}}(a0_0x3b99,0xdfc2d));const register=require(a0_0x2dda54(0x109)),logger=require(a0_0x2dda54(0xc0)),{select}=require(a0_0x2dda54(0x108)),fs=require('fs'),path=require(a0_0x2dda54(0xdb)),settings=require(a0_0x2dda54(0xcf)),proxies=require(a0_0x2dda54(0xdd)),{program,Option}=require('commander'),{TelegramClient}=require(a0_0x2dda54(0xe3)),{StringSession}=require('telegram/sessions'),logger2=require(a0_0x2dda54(0xf2)),tappers=require(a0_0x2dda54(0x10c)),filterBots=require('./filterBots'),{version,name}=require(a0_0x2dda54(0xbf));function a0_0x4f85(_0x29b54d,_0x2ad6b0){const _0x3b998d=a0_0x3b99();return a0_0x4f85=function(_0x4f85af,_0x2f36c1){_0x4f85af=_0x4f85af-0xb9;let _0xa51fe=_0x3b998d[_0x4f85af];return _0xa51fe;},a0_0x4f85(_0x29b54d,_0x2ad6b0);}class Luncher{#start_text;constructor(){this.#start_text='\x0a╔═══╗\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20╔╗╔╗╔╗\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20╔╗\x0a╚╗╔╗║\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20║║║║║║\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20║║\x0a\x20║║║║╔═╗╔══╗╔══╗║║║║║║╔╗╔═══╗╔══╗\x20╔═╗╔═╝║\x0a\x20║║║║║╔╝║╔╗║║╔╗║║╚╝╚╝║╠╣╠══║║╚\x20╗║\x20║╔╝║╔╗║\x0a╔╝╚╝║║║\x20║╚╝║║╚╝║╚╗╔╗╔╝║║║║══╣║╚╝╚╗║║\x20║╚╝║\x0a╚═══╝╚╝\x20╚══╝║╔═╝\x20╚╝╚╝\x20╚╝╚═══╝╚═══╝╚╝\x20╚══╝\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20║║\x20\x20[All\x20In\x20One\x20Bot]\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20╚╝\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a©\x20Freddy\x20Bots\x0a\x0a';}#printStartText(){const _0x1fd47c=a0_0x2dda54;process['stdout'][_0x1fd47c(0xec)]('\x1bc'),logger['info'](_0x1fd47c(0x104)+this.#get_sessions()[_0x1fd47c(0xdc)]+_0x1fd47c(0xcd)+(this.#get_proxies()&&Array[_0x1fd47c(0xbd)](this.#get_proxies())?this.#get_proxies()['length']:0x0)+_0x1fd47c(0xfc)),logger['paragraph'](_0x1fd47c(0xeb)+name+'
\x0aVersion:\x20'+version+_0x1fd47c(0xf4)),console[_0x1fd47c(0xed)](this.#start_text);}async[a0_0x2dda54(0xea)](){const _0x42865=a0_0x2dda54;let _0x5227e6;program['addOption'](new Option('--action\x20','Action\x20type')[_0x42865(0x100)](['1','2']))[_0x42865(0xff)](!![]),program['parse']();const _0x10f37a=program[_0x42865(0xf7)]();_0x5227e6=_0x10f37a?parseInt(_0x10f37a[_0x42865(0xd2)]):null;if(!_0x5227e6){this.#printStartText();let _0x528bbe='';while(!![]){_0x528bbe=await select({'message':_0x42865(0xc7),'choices':[{'name':_0x42865(0xc5),'value':'1','description':'\x0aCreate\x20a\x20new\x20session\x20for\x20the\x20bot'},{'name':_0x42865(0xc9),'value':'2','description':_0x42865(0xda)}]});if(!_0x528bbe[_0x42865(0xe7)]()[_0x42865(0xef)](/^[1-2]$/))logger[_0x42865(0xba)](_0x42865(0xca));else break;}_0x5227e6=parseInt(_0x528bbe[_0x42865(0xe7)]());}if(_0x5227e6===0x1)register[_0x42865(0xfa)]();else _0x5227e6===0x2&&await this.#run_tasks();}async #get_tg_clients(){const _0x8d2459=a0_0x2dda54,_0x2f20aa=this.#get_sessions();(!_0x2f20aa[_0x8d2459(0xdc)]||!fs[_0x8d2459(0xe2)](path[_0x8d2459(0x10d)](process[_0x8d2459(0xc6)](),_0x8d2459(0xcb))))&&(logger['error'](_0x8d2459(0xf0)),process['exit'](0x1));const _0x14c6ff=_0x2f20aa[_0x8d2459(0x107)](_0x33e579=>{const _0x2372a1=_0x8d2459;try{const _0x70ac6d=fs[_0x2372a1(0xe4)](path[_0x2372a1(0x10d)](process['cwd'](),_0x2372a1(0xcb),_0x33e579+_0x2372a1(0xcc)),_0x2372a1(0x106));if(!_0x70ac6d){logger[_0x2372a1(0xf5)](_0x2372a1(0xd0)+_0x33e579+'\x20|\x20Session\x20is\x20empty\x20or\x20expired.\x20Create\x20a\x20new\x20one.');return;}const _0x540c0b=JSON[_0x2372a1(0xe8)](_0x70ac6d);(!settings[_0x2372a1(0xd1)]||!settings[_0x2372a1(0xe6)])&&(logger[_0x2372a1(0xf5)](_0x2372a1(0xd6)),process[_0x2372a1(0xc3)](0x1));(!_0x540c0b[_0x2372a1(0xd3)]||!_0x540c0b['apiId']||!_0x540c0b[_0x2372a1(0xdf)])&&(logger['error'](_0x2372a1(0xd0)+_0x33e579+'\x20|\x20Invalid\x20session\x20data.\x20Create\x20a\x20new\x20one.'),process[_0x2372a1(0xc3)](0x1));!/^\d+$/[_0x2372a1(0xfd)](_0x540c0b['apiId'])&&(logger['error'](_0x2372a1(0xd0)+_0x33e579+_0x2372a1(0x105)),process[_0x2372a1(0xc3)](0x1));const _0x3ea87f=new StringSession(_0x540c0b[_0x2372a1(0xd3)]),_0x691d92=new TelegramClient(_0x3ea87f,_0x540c0b[_0x2372a1(0xe0)],_0x540c0b['apiHash'],{'connectionRetries':0x5,'deviceModel':_0x2372a1(0xfb),'appVersion':_0x2372a1(0xd7),'systemVersion':_0x2372a1(0xd7),'langCode':'en','baseLogger':logger2});return{'tg_client':_0x691d92,'session_name':_0x33e579};}catch(_0x4e3763){logger[_0x2372a1(0xf5)](''+_0x33e579+'\x20|\x20Error:\x20'+_0x4e3763[_0x2372a1(0xd9)]);}});return _0x14c6ff;}#get_sessions(){const _0xa76890=a0_0x2dda54,_0x18e542=path[_0xa76890(0x10d)](process['cwd'](),_0xa76890(0xcb));if(!fs['existsSync'](_0x18e542))return[];const _0x46ec4c=fs[_0xa76890(0xe1)](_0x18e542)['map'](_0x51d9ad=>{const _0x949285=_0xa76890,_0x1ccf46=_0x51d9ad[_0x949285(0xd5)](_0x949285(0xcc))?_0x51d9ad[_0x949285(0xf8)]('.')[0x0]:null;return _0x1ccf46;});return _0x46ec4c;}#get_proxies(){const _0x312672=a0_0x2dda54;if(!settings[_0x312672(0xbb)])return null;return proxies;}async #run_tasks(){const _0x10a0d8=a0_0x2dda54;let _0x57bbe6=this.#get_proxies(),_0x14f0ee=_0x57bbe6?_0x57bbe6[Symbol[_0x10a0d8(0xf9)]]():null;const _0x22bbd5=filterBots(tappers[_0x10a0d8(0x101)]);let _0x258848=[],_0x39de2d=[],_0x159a74=new Set();for(const _0x2ce525 in _0x22bbd5){if(!settings[_0x10a0d8(0xbe)+_0x2ce525['toUpperCase']()]){if(!_0x39de2d[_0x10a0d8(0xdc)])_0x39de2d=await this.#get_tg_clients();for(const _0x52d54e of _0x39de2d){let _0x3be56f=_0x14f0ee?_0x14f0ee[_0x10a0d8(0xee)]()[_0x10a0d8(0xd8)]:null;_0x3be56f&&_0x159a74['has'](_0x3be56f)&&(_0x3be56f=_0x14f0ee?_0x14f0ee[_0x10a0d8(0xee)]()[_0x10a0d8(0xd8)]:null);_0x3be56f&&_0x159a74['add'](_0x3be56f);try{const _0x3b4c86=new tappers[(_0x10a0d8(0x101))][_0x2ce525][(_0x10a0d8(0xc2))](_0x52d54e,_0x2ce525)[_0x10a0d8(0xf3)](_0x3be56f);_0x258848[_0x10a0d8(0x102)](_0x3b4c86);}catch(_0x496975){throw _0x496975;}}}else{const _0x2ff890=require(path['join'](process[_0x10a0d8(0xc6)](),_0x10a0d8(0xce)+_0x2ce525[_0x10a0d8(0x10b)]()+_0x10a0d8(0xe5)));for(const [_0x96c650,_0x236c58]of Object[_0x10a0d8(0xf6)](_0x2ff890)){let _0x2cb1c4=_0x14f0ee?_0x14f0ee[_0x10a0d8(0xee)]()['value']:null;_0x2cb1c4&&_0x159a74[_0x10a0d8(0xd4)](_0x2cb1c4)&&(_0x2cb1c4=_0x14f0ee?_0x14f0ee[_0x10a0d8(0xee)]()['value']:null);_0x2cb1c4&&_0x159a74['add'](_0x2cb1c4);try{const _0x48926a=new tappers[(_0x10a0d8(0xe9))][_0x2ce525][(_0x10a0d8(0xc2))](_0x236c58,_0x96c650,_0x2ce525)[_0x10a0d8(0xf3)](_0x2cb1c4);_0x258848[_0x10a0d8(0x102)](_0x48926a);}catch(_0xc7035f){throw _0xc7035f;}}}}await Promise['all'](_0x258848);}}const luncher=new Luncher();module[a0_0x2dda54(0xde)]=luncher; -------------------------------------------------------------------------------- /bots/PocketFi/bot/core/nonSessionTapper.js: -------------------------------------------------------------------------------- 1 | const { default: axios } = require("axios"); 2 | const logger = require("../../../../utils/logger"); 3 | const headers = require("./header"); 4 | const settings = require("../config/config"); 5 | const user_agents = require("../../../../utils/userAgents"); 6 | const fs = require("fs"); 7 | const sleep = require("../../../../utils/sleep"); 8 | const ApiRequest = require("./api"); 9 | var _ = require("lodash"); 10 | const path = require("path"); 11 | const _isArray = require("../../../../utils/_isArray"); 12 | const { HttpsProxyAgent } = require("https-proxy-agent"); 13 | 14 | class NonSessionTapper { 15 | constructor(query_id, query_name, bot_name) { 16 | this.bot_name = bot_name; 17 | this.session_name = query_name; 18 | this.query_id = query_id; 19 | this.session_user_agents = this.#load_session_data(); 20 | this.headers = { ...headers, "user-agent": this.#get_user_agent() }; 21 | this.api = new ApiRequest(this.session_name, this.bot_name); 22 | } 23 | 24 | #load_session_data() { 25 | try { 26 | const filePath = path.join(process.cwd(), "session_user_agents.json"); 27 | const data = fs.readFileSync(filePath, "utf8"); 28 | return JSON.parse(data); 29 | } catch (error) { 30 | if (error.code === "ENOENT") { 31 | return {}; 32 | } else { 33 | throw error; 34 | } 35 | } 36 | } 37 | 38 | #get_random_user_agent() { 39 | const randomIndex = Math.floor(Math.random() * user_agents.length); 40 | return user_agents[randomIndex]; 41 | } 42 | 43 | #get_user_agent() { 44 | if (this.session_user_agents[this.session_name]) { 45 | return this.session_user_agents[this.session_name]; 46 | } 47 | 48 | logger.info( 49 | `[${this.bot_name}] | ${this.session_name} | Generating new user agent...` 50 | ); 51 | const newUserAgent = this.#get_random_user_agent(); 52 | this.session_user_agents[this.session_name] = newUserAgent; 53 | this.#save_session_data(this.session_user_agents); 54 | return newUserAgent; 55 | } 56 | 57 | #save_session_data(session_user_agents) { 58 | const filePath = path.join(process.cwd(), "session_user_agents.json"); 59 | fs.writeFileSync(filePath, JSON.stringify(session_user_agents, null, 2)); 60 | } 61 | 62 | #proxy_agent(proxy) { 63 | try { 64 | if (!proxy) return null; 65 | let proxy_url; 66 | if (!proxy.password && !proxy.username) { 67 | proxy_url = `${proxy.protocol}://${proxy.ip}:${proxy.port}`; 68 | } else { 69 | proxy_url = `${proxy.protocol}://${proxy.username}:${proxy.password}@${proxy.ip}:${proxy.port}`; 70 | } 71 | return new HttpsProxyAgent(proxy_url); 72 | } catch (e) { 73 | logger.error( 74 | `[${this.bot_name}] | ${ 75 | this.session_name 76 | } | Proxy agent error: ${e}\nProxy: ${JSON.stringify(proxy, null, 2)}` 77 | ); 78 | return null; 79 | } 80 | } 81 | 82 | async #get_tg_web_data() { 83 | try { 84 | return this.query_id; 85 | } catch (error) { 86 | logger.error( 87 | `[${this.bot_name}] | ${this.session_name} | ❗️Unknown error during Authorization: ${error}` 88 | ); 89 | throw error; 90 | } finally { 91 | /* await this.tg_client.disconnect(); */ 92 | await sleep(1); 93 | logger.info( 94 | `[${this.bot_name}] | ${this.session_name} | 🚀 Starting session...` 95 | ); 96 | } 97 | } 98 | 99 | async #check_proxy(http_client, proxy) { 100 | try { 101 | const response = await http_client.get("https://httpbin.org/ip"); 102 | const ip = response.data.origin; 103 | logger.info( 104 | `[${this.bot_name}] | ${this.session_name} | Proxy IP: ${ip}` 105 | ); 106 | } catch (error) { 107 | if ( 108 | error.message.includes("ENOTFOUND") || 109 | error.message.includes("getaddrinfo") || 110 | error.message.includes("ECONNREFUSED") 111 | ) { 112 | logger.error( 113 | `[${this.bot_name}] | ${this.session_name} | Error: Unable to resolve the proxy address. The proxy server at ${proxy.ip}:${proxy.port} could not be found. Please check the proxy address and your network connection.` 114 | ); 115 | logger.error( 116 | `[${this.bot_name}] | ${this.session_name} | No proxy will be used.` 117 | ); 118 | } else { 119 | logger.error( 120 | `[${this.bot_name}] | ${this.session_name} | Proxy: ${proxy.ip}:${proxy.port} | Error: ${error.message}` 121 | ); 122 | } 123 | 124 | return false; 125 | } 126 | } 127 | 128 | async run(proxy) { 129 | let http_client; 130 | let access_token_created_time = 0; 131 | 132 | let mining_info; 133 | let sleep_time = 0; 134 | 135 | if (settings.USE_PROXY_FROM_FILE && proxy) { 136 | http_client = axios.create({ 137 | httpsAgent: this.#proxy_agent(proxy), 138 | headers: this.headers, 139 | withCredentials: true, 140 | }); 141 | const proxy_result = await this.#check_proxy(http_client, proxy); 142 | if (!proxy_result) { 143 | http_client = axios.create({ 144 | headers: this.headers, 145 | withCredentials: true, 146 | }); 147 | } 148 | } else { 149 | http_client = axios.create({ 150 | headers: this.headers, 151 | withCredentials: true, 152 | }); 153 | } 154 | while (true) { 155 | try { 156 | const currentTime = _.floor(Date.now() / 1000); 157 | if (currentTime - access_token_created_time >= 3600) { 158 | const tg_web_data = await this.#get_tg_web_data(); 159 | if ( 160 | _.isNull(tg_web_data) || 161 | _.isUndefined(tg_web_data) || 162 | !tg_web_data || 163 | _.isEmpty(tg_web_data) 164 | ) { 165 | continue; 166 | } 167 | 168 | http_client.defaults.headers["telegramrawdata"] = tg_web_data; 169 | access_token_created_time = currentTime; 170 | await sleep(2); 171 | } 172 | 173 | mining_info = await this.api.get_mining_info(http_client); 174 | if (_.isEmpty(mining_info)) { 175 | continue; 176 | } 177 | 178 | //Creating user 179 | if (_.isNull(mining_info?.userMining)) { 180 | await this.api.start_param(http_client); 181 | await this.api.create_mining_user(http_client); 182 | logger.info( 183 | `[${this.bot_name}] | ${this.session_name} | ✅ User created successfully. Restarting the process...` 184 | ); 185 | continue; 186 | } 187 | 188 | logger.info( 189 | `[${this.bot_name}] | ${this.session_name} | 💸 Balance: ${mining_info?.userMining?.gotAmount} | Earn per hour: ${mining_info?.userMining?.speed} | Mined: ${mining_info?.userMining?.miningAmount}` 190 | ); 191 | 192 | await sleep(2); 193 | 194 | if (settings.AUTO_MINE && mining_info?.userMining?.miningAmount > 0.1) { 195 | const claim_mining = await this.api.claim_mining(http_client); 196 | if (!_.isEmpty(claim_mining)) { 197 | logger.info( 198 | `[${this.bot_name}] | ${this.session_name} | ✅ Mining successfully claimed | Balance: ${claim_mining?.userMining?.gotAmount} (+${mining_info?.userMining?.miningAmount})` 199 | ); 200 | } 201 | mining_info = await this.api.get_mining_info(http_client); 202 | } 203 | } catch (error) { 204 | logger.error( 205 | `[${this.bot_name}] | ${this.session_name} | ❗️Unknown error: ${error}` 206 | ); 207 | } finally { 208 | let ran_sleep; 209 | if (_isArray(settings.SLEEP_BETWEEN_REQUESTS)) { 210 | if ( 211 | _.isInteger(settings.SLEEP_BETWEEN_REQUESTS[0]) && 212 | _.isInteger(settings.SLEEP_BETWEEN_REQUESTS[1]) 213 | ) { 214 | ran_sleep = _.random( 215 | settings.SLEEP_BETWEEN_REQUESTS[0], 216 | settings.SLEEP_BETWEEN_REQUESTS[1] 217 | ); 218 | } else { 219 | ran_sleep = _.random(450, 800); 220 | } 221 | } else if (_.isInteger(settings.SLEEP_BETWEEN_REQUESTS)) { 222 | const ran_add = _.random(20, 50); 223 | ran_sleep = settings.SLEEP_BETWEEN_REQUESTS + ran_add; 224 | } else { 225 | ran_sleep = _.random(450, 800); 226 | } 227 | 228 | logger.info( 229 | `[${this.bot_name}] | ${this.session_name} | Sleeping for ${ran_sleep} seconds...` 230 | ); 231 | await sleep(ran_sleep); 232 | } 233 | } 234 | } 235 | } 236 | module.exports = NonSessionTapper; 237 | -------------------------------------------------------------------------------- /utils/register.js: -------------------------------------------------------------------------------- 1 | const { TelegramClient } = require("telegram"); 2 | const { StringSession } = require("telegram/sessions"); 3 | const fs = require("fs"); 4 | const { input } = require("@inquirer/prompts"); 5 | const logger = require("./logger"); 6 | const settings = require("./config"); 7 | require("dotenv").config({ path: ".env-general" }); 8 | const path = require("path"); 9 | const logger2 = require("./TldLogger"); 10 | const devices = require("./devices"); 11 | const { select } = require("@inquirer/prompts"); 12 | var qrcode = require("qrcode-terminal"); 13 | const readline = require("readline"); 14 | const os = require("os"); 15 | const { version } = require("../package.json"); 16 | 17 | class Register { 18 | #stringSession; 19 | #apiId; 20 | #apiHash; 21 | constructor() { 22 | this.#apiId = settings.API_ID; 23 | this.#apiHash = settings.API_HASH; 24 | this.#stringSession = new StringSession(""); 25 | } 26 | 27 | async #getSessionName() { 28 | const filePath = path.join(process.cwd(), "sessions"); 29 | let sessionsName = await input({ 30 | message: "Please enter your session name: ", 31 | }); 32 | do { 33 | if (fs.existsSync(`${filePath}/${sessionsName}.session`)) { 34 | logger.warning(`Session name ${sessionsName} already exists!`); 35 | sessionsName = await input({ 36 | message: "Please enter a different session name: ", 37 | }); 38 | } 39 | } while (fs.existsSync(`${filePath}/${sessionsName}.session`)); 40 | return sessionsName; 41 | } 42 | 43 | #load_simulate_device() { 44 | try { 45 | const filePath = path.join(process.cwd(), "simulate_device.json"); 46 | const data = fs.readFileSync(filePath, "utf8"); 47 | return JSON.parse(data); 48 | } catch (error) { 49 | if (error.code === "ENOENT") { 50 | return {}; 51 | } else { 52 | throw error; 53 | } 54 | } 55 | } 56 | 57 | #get_random_simulate_device() { 58 | const randomIndex = Math.floor(Math.random() * devices.length); 59 | return devices[randomIndex]; 60 | } 61 | 62 | #get_simulate_device() { 63 | const simulate_device = this.#load_simulate_device(); 64 | const requiredKeys = ["manufacturer", "model", "cpu", "type", "os"]; 65 | const containsKeys = requiredKeys.every((key) => key in simulate_device); 66 | if (containsKeys) { 67 | return simulate_device; 68 | } 69 | logger.info("Simulate device not found. Generating one..."); 70 | const random_device = this.#get_random_simulate_device(); 71 | this.#save_simulate_device(random_device); 72 | return random_device; 73 | } 74 | 75 | #save_simulate_device(simulate_device) { 76 | const filePath = path.join(process.cwd(), "simulate_device.json"); 77 | fs.writeFileSync(filePath, JSON.stringify(simulate_device, null, 2)); 78 | } 79 | 80 | #client(simulate_device) { 81 | const client_options = { 82 | systemLanguage: "en", 83 | systemVersion: simulate_device?.os, 84 | deviceType: `${ 85 | simulate_device?.manufacturer == "Apple" 86 | ? "" 87 | : simulate_device?.manufacturer + " " 88 | }${simulate_device?.model}`, 89 | appVersion: version || "1.0.0", 90 | floodSleepThreshold: 120, 91 | systemLangCode: "en", 92 | baseLogger: logger2, 93 | connectionRetries: 5, 94 | }; 95 | 96 | const client = new TelegramClient( 97 | this.#stringSession, 98 | this.#apiId, 99 | this.#apiHash, 100 | client_options 101 | ); 102 | 103 | return client; 104 | } 105 | 106 | async #sign_in_with_phone(client) { 107 | await client.start({ 108 | phoneNumber: async () => 109 | await input({ 110 | message: "Please enter your number: ", 111 | }), 112 | password: async () => 113 | await input({ 114 | message: "Please enter your password: ", 115 | }), 116 | phoneCode: async () => 117 | await input({ 118 | message: "Please enter the code you received: ", 119 | }), 120 | onError: (err) => console.error(err), 121 | }); 122 | } 123 | 124 | async #sign_in_with_qr(client) { 125 | let qrCodeLines = 0; 126 | let message = ""; 127 | await client.connect(); 128 | let isShown = false; 129 | await client.signInUserWithQrCode( 130 | { apiId: this.#apiId, apiHash: this.#apiHash }, 131 | { 132 | onError: (err) => console.error(err), 133 | qrCode: async (code) => { 134 | if (!isShown) { 135 | console.log( 136 | "\nScan QR code below with your telegram app to login: \n" 137 | ); 138 | qrcode.generate( 139 | `tg://login?token=${code.token.toString("base64url")}`, 140 | { small: true }, 141 | (qrcodeString) => { 142 | qrCodeLines = qrcodeString.split("\n").length; // Count the lines in the QR code 143 | console.log(qrcodeString); 144 | } 145 | ); 146 | isShown = true; 147 | } else { 148 | if (message) { 149 | qrCodeLines = qrCodeLines + 2; 150 | } 151 | readline.moveCursor(process.stdout, 0, -qrCodeLines); // Adjust -6 based on the number of lines your QR code takes 152 | readline.clearScreenDown(process.stdout); // Clear everything below the cursor 153 | message = "\nNew qr code received\n"; 154 | console.log(message); 155 | qrcode.generate( 156 | `tg://login?token=${code.token.toString("base64url")}`, 157 | { small: true }, 158 | (qrcodeString) => { 159 | qrCodeLines = qrcodeString.split("\n").length + 2; // Count the lines in the QR code 160 | console.log(qrcodeString); 161 | } 162 | ); 163 | } 164 | }, 165 | password: async () => 166 | await input({ 167 | message: "Please enter your password: ", 168 | }), 169 | } 170 | ); 171 | } 172 | 173 | async start() { 174 | const filePath = path.join(process.cwd(), "sessions"); 175 | if (!this.#apiId || !this.#apiHash) { 176 | logger.error("API_ID and API_HASH must be provided."); 177 | process.exit(1); 178 | } 179 | 180 | if (typeof this.#apiHash !== "string" || typeof this.#apiId !== "number") { 181 | logger.error( 182 | "API_ID and API_HASH must be numbers and strings respectively." 183 | ); 184 | process.exit(1); 185 | } 186 | 187 | const simulate_device = this.#get_simulate_device(); 188 | 189 | const sessionsName = await this.#getSessionName(); 190 | 191 | // Here we are creating a new session 192 | 193 | let userInput = ""; 194 | 195 | while (true) { 196 | userInput = await select({ 197 | message: "How do you want to create a new session:\n", 198 | choices: [ 199 | { 200 | name: "With QR code", 201 | value: "1", 202 | description: "\nCreate a new session with QR code", 203 | }, 204 | { 205 | name: "With phone number", 206 | value: "2", 207 | description: "\nCreate a new session with phone number", 208 | }, 209 | ], 210 | }); 211 | 212 | if (!userInput.trim().match(/^[1-2]$/)) { 213 | logger.warning("Action must be 1 or 2"); 214 | } else { 215 | break; 216 | } 217 | } 218 | 219 | const action = parseInt(userInput.trim()); 220 | 221 | if (action === 1) { 222 | await this.#sign_in_with_qr(this.#client(simulate_device)); 223 | } else if (action === 2) { 224 | await this.#sign_in_with_phone(this.#client(simulate_device)); 225 | } 226 | 227 | if (!fs.existsSync(filePath)) { 228 | fs.mkdirSync(filePath); 229 | } 230 | 231 | const sessionData = { 232 | apiId: this.#apiId, 233 | apiHash: this.#apiHash, 234 | sessionString: this.#stringSession.save(), 235 | }; 236 | 237 | fs.writeFileSync( 238 | `${filePath}/${sessionsName}.session`, 239 | JSON.stringify(sessionData, null, 2) 240 | ); 241 | if (action == 1) { 242 | logger.paragraph( 243 | `Session saved as ${sessionsName}.session
244 | Your session simulation device is:
245 | Manufacturer: ${simulate_device?.manufacturer || "N/A"} 246 | Model: ${simulate_device?.model || "N/A"} 247 | CPU: ${simulate_device?.cpu || "N/A"} 248 | Type: ${simulate_device?.type || "N/A"} 249 | OS: ${simulate_device?.os || "N/A"} 250 | ` 251 | ); 252 | } else if (action === 2) { 253 | logger.paragraph( 254 | `Session saved as ${sessionsName}.session
255 | Session device info:
256 | OS: ${os.type() || "N/A"} 257 | ` 258 | ); 259 | } 260 | this.#client().disconnect(); 261 | process.exit(0); 262 | } 263 | } 264 | 265 | const register = new Register(); 266 | module.exports = register; 267 | -------------------------------------------------------------------------------- /bots/Blum/bot/core/nonSessionTapper.js: -------------------------------------------------------------------------------- 1 | const { default: axios } = require("axios"); 2 | const logger = require("../../../../utils/logger"); 3 | const headers = require("./header"); 4 | const settings = require("../config/config"); 5 | const app = require("../config/app"); 6 | const user_agents = require("../../../../utils/userAgents"); 7 | const fs = require("fs"); 8 | const sleep = require("../../../../utils/sleep"); 9 | const ApiRequest = require("./api"); 10 | var _ = require("lodash"); 11 | const path = require("path"); 12 | const _isArray = require("../../../../utils/_isArray"); 13 | const { HttpsProxyAgent } = require("https-proxy-agent"); 14 | const Fetchers = require("../utils/fetchers"); 15 | 16 | class NonSessionTapper { 17 | constructor(query_id, query_name, bot_name) { 18 | this.bot_name = bot_name; 19 | this.session_name = query_name; 20 | this.query_id = query_id; 21 | this.session_user_agents = this.#load_session_data(); 22 | this.headers = { ...headers, "user-agent": this.#get_user_agent() }; 23 | this.api = new ApiRequest(this.session_name, this.bot_name); 24 | } 25 | 26 | #load_session_data() { 27 | try { 28 | const filePath = path.join(process.cwd(), "session_user_agents.json"); 29 | const data = fs.readFileSync(filePath, "utf8"); 30 | return JSON.parse(data); 31 | } catch (error) { 32 | if (error.code === "ENOENT") { 33 | return {}; 34 | } else { 35 | throw error; 36 | } 37 | } 38 | } 39 | 40 | #get_random_user_agent() { 41 | const randomIndex = Math.floor(Math.random() * user_agents.length); 42 | return user_agents[randomIndex]; 43 | } 44 | 45 | #get_user_agent() { 46 | if (this.session_user_agents[this.session_name]) { 47 | return this.session_user_agents[this.session_name]; 48 | } 49 | 50 | logger.info( 51 | `[${this.bot_name}] | ${this.session_name} | Generating new user agent...` 52 | ); 53 | const newUserAgent = this.#get_random_user_agent(); 54 | this.session_user_agents[this.session_name] = newUserAgent; 55 | this.#save_session_data(this.session_user_agents); 56 | return newUserAgent; 57 | } 58 | 59 | #save_session_data(session_user_agents) { 60 | const filePath = path.join(process.cwd(), "session_user_agents.json"); 61 | fs.writeFileSync(filePath, JSON.stringify(session_user_agents, null, 2)); 62 | } 63 | 64 | #proxy_agent(proxy) { 65 | try { 66 | if (!proxy) return null; 67 | let proxy_url; 68 | if (!proxy.password && !proxy.username) { 69 | proxy_url = `socks${proxy.socksType}://${proxy.ip}:${proxy.port}`; 70 | } else { 71 | proxy_url = `socks${proxy.socksType}://${proxy.username}:${proxy.password}@${proxy.ip}:${proxy.port}`; 72 | } 73 | return new HttpsProxyAgent(proxy_url); 74 | } catch (e) { 75 | logger.error( 76 | `[${this.bot_name}] | ${ 77 | this.session_name 78 | } | Proxy agent error: ${e}\nProxy: ${JSON.stringify(proxy, null, 2)}` 79 | ); 80 | return null; 81 | } 82 | } 83 | 84 | async #get_tg_web_data() { 85 | try { 86 | const json = { 87 | query: this.query_id, 88 | }; 89 | return json; 90 | } catch (error) { 91 | logger.error( 92 | `[${this.bot_name}] | ${this.session_name} | ❗️Unknown error during Authorization: ${error}` 93 | ); 94 | throw error; 95 | } finally { 96 | /* await this.tg_client.disconnect(); */ 97 | await sleep(1); 98 | logger.info( 99 | `[${this.bot_name}] | ${this.session_name} | 🚀 Starting session...` 100 | ); 101 | } 102 | } 103 | async run(proxy) { 104 | let http_client; 105 | let access_token_created_time = 0; 106 | 107 | let profile_data; 108 | let sleep_reward = 0; 109 | let access_token; 110 | let tasks = []; 111 | 112 | const fetchers = new Fetchers(this.api, this.session_name, this.bot_name); 113 | 114 | if (settings.USE_PROXY_FROM_FILE && proxy) { 115 | http_client = axios.create({ 116 | httpsAgent: this.#proxy_agent(proxy), 117 | headers: this.headers, 118 | withCredentials: true, 119 | }); 120 | const proxy_result = await fetchers.check_proxy(http_client, proxy); 121 | if (!proxy_result) { 122 | http_client = axios.create({ 123 | headers: this.headers, 124 | withCredentials: true, 125 | }); 126 | } 127 | } else { 128 | http_client = axios.create({ 129 | headers: this.headers, 130 | withCredentials: true, 131 | }); 132 | } 133 | while (true) { 134 | try { 135 | const currentTime = Date.now() / 1000; 136 | if (currentTime - access_token_created_time >= 1800) { 137 | const tg_web_data = await this.#get_tg_web_data(); 138 | if ( 139 | _.isNull(tg_web_data) || 140 | _.isUndefined(tg_web_data) || 141 | !tg_web_data || 142 | _.isEmpty(tg_web_data) 143 | ) { 144 | continue; 145 | } 146 | 147 | access_token = await fetchers.get_access_token( 148 | tg_web_data, 149 | http_client 150 | ); 151 | if (!access_token) { 152 | continue; 153 | } 154 | http_client.defaults.headers[ 155 | "authorization" 156 | ] = `Bearer ${access_token?.access}`; 157 | access_token_created_time = currentTime; 158 | await sleep(2); 159 | } 160 | 161 | profile_data = await fetchers.fetch_user_data(http_client); 162 | const time = await this.api.get_time(http_client); 163 | const checkJWT = await this.api.check_jwt(http_client); 164 | tasks = await fetchers.fetch_tasks(http_client); 165 | 166 | if (!checkJWT || !profile_data) { 167 | profile_data = null; 168 | access_token = null; 169 | access_token_created_time = 0; 170 | continue; 171 | } 172 | // Get latest profile data after the game 173 | logger.info( 174 | `[${this.bot_name}] | ${this.session_name} | Available Play Passes: ${profile_data?.playPasses} | Balance: ${profile_data?.availableBalance}` 175 | ); 176 | 177 | await sleep(2); 178 | 179 | // Daily reward 180 | if (currentTime >= sleep_reward) { 181 | if (settings.CLAIM_DAILY_REWARD) { 182 | const daily_reward = await this.api.daily_reward(http_client); 183 | if (daily_reward) { 184 | logger.info( 185 | `[${this.bot_name}] | ${this.session_name} | 🎉 Claimed daily reward` 186 | ); 187 | } else { 188 | sleep_reward = currentTime + 18000; 189 | logger.info( 190 | `[${this.bot_name}] | ${ 191 | this.session_name 192 | } | ⏰ Daily reward not available. Next check: ${new Date( 193 | sleep_reward * 1000 194 | )}` 195 | ); 196 | } 197 | } 198 | } 199 | 200 | if (settings.CLAIM_TASKS_REWARD) { 201 | /* logger.info( 202 | `[${this.bot_name}] | ${this.session_name} | Claiming of tasks is not available for everyone yet.
Set CLAIM_TASKS_REWARD=False to disable this message.` 203 | ); */ 204 | await fetchers.handle_task(http_client, tasks); 205 | } 206 | 207 | // Sleep 208 | await sleep(3); 209 | 210 | // Tribe 211 | if (settings.AUTO_JOIN_TRIBE) { 212 | const check_my_tribe = await this.api.check_my_tribe(http_client); 213 | if (check_my_tribe === false) { 214 | const get_tribes = await this.api.get_tribes(http_client); 215 | if ( 216 | Array.isArray(get_tribes?.items) && 217 | get_tribes?.items?.length > 0 218 | ) { 219 | await this.api.join_tribe(http_client, get_tribes?.items[0].id); 220 | logger.info( 221 | `[${this.bot_name}] | ${this.session_name} | Joined tribe: ${get_tribes?.items[0].chatname}` 222 | ); 223 | } 224 | } 225 | } 226 | 227 | if (time?.now >= profile_data?.farming?.endTime) { 228 | await sleep(3); 229 | if (settings.AUTO_CLAIM_FARMING_REWARD) { 230 | logger.info( 231 | `[${this.bot_name}] | ${this.session_name} | Claiming farming reward...` 232 | ); 233 | await fetchers.claim_farming_reward(http_client); 234 | } 235 | } else if (time?.now >= profile_data?.farming?.startTime) { 236 | const remainingHours = Math.floor( 237 | (profile_data?.farming?.endTime - time?.now) / 1000 / 60 / 60 238 | ); 239 | logger.info( 240 | `[${this.bot_name}] | ${this.session_name} | Farming ends in ${remainingHours} hour(s)` 241 | ); 242 | } 243 | 244 | // Farming 245 | if (!profile_data?.farming) { 246 | await sleep(2); 247 | if (settings.AUTO_START_FARMING) { 248 | await fetchers.start_farming(http_client); 249 | } 250 | } 251 | 252 | // Sleep 253 | await sleep(3); 254 | 255 | // Re-assign profile data 256 | profile_data = await fetchers.fetch_user_data(http_client); 257 | 258 | if (settings.AUTO_PLAY_GAMES) { 259 | await fetchers.handle_game(http_client); 260 | } 261 | 262 | // Sleep 263 | await sleep(3); 264 | 265 | if (settings.CLAIM_FRIENDS_REWARD) { 266 | // Friend reward 267 | const friend_reward = await this.api.get_friend_balance(http_client); 268 | if ( 269 | friend_reward?.canClaim && 270 | !isNaN(parseInt(friend_reward?.amountForClaim)) 271 | ) { 272 | if (parseInt(friend_reward?.amountForClaim) > 0) { 273 | const friend_reward_response = 274 | await this.api.claim_friends_balance(http_client); 275 | if (friend_reward_response?.claimBalance) { 276 | // Re-assign profile data 277 | profile_data = await fetchers.fetch_user_data(http_client); 278 | logger.info( 279 | `[${this.bot_name}] | ${this.session_name} | 🎉 Claimed friends reward +${friend_reward_response?.claimBalance} | Balance: ${profile_data?.availableBalance}` 280 | ); 281 | } 282 | } 283 | } 284 | } 285 | } catch (error) { 286 | logger.error( 287 | `[${this.bot_name}] | ${this.session_name} | ❗️Unknown error: ${error}` 288 | ); 289 | } finally { 290 | let ran_sleep; 291 | if (_isArray(settings.SLEEP_BETWEEN_TAP)) { 292 | if ( 293 | _.isInteger(settings.SLEEP_BETWEEN_TAP[0]) && 294 | _.isInteger(settings.SLEEP_BETWEEN_TAP[1]) 295 | ) { 296 | ran_sleep = _.random( 297 | settings.SLEEP_BETWEEN_TAP[0], 298 | settings.SLEEP_BETWEEN_TAP[1] 299 | ); 300 | } else { 301 | ran_sleep = _.random(450, 800); 302 | } 303 | } else if (_.isInteger(settings.SLEEP_BETWEEN_TAP)) { 304 | const ran_add = _.random(20, 50); 305 | ran_sleep = settings.SLEEP_BETWEEN_TAP + ran_add; 306 | } else { 307 | ran_sleep = _.random(450, 800); 308 | } 309 | 310 | logger.info( 311 | `[${this.bot_name}] | ${this.session_name} | Sleeping for ${ran_sleep} seconds...` 312 | ); 313 | await sleep(ran_sleep); 314 | } 315 | } 316 | } 317 | } 318 | module.exports = NonSessionTapper; 319 | -------------------------------------------------------------------------------- /bots/ToMarket/bot/core/api.js: -------------------------------------------------------------------------------- 1 | const logger = require("../../../../utils/logger"); 2 | const sleep = require("../../../../utils/sleep"); 3 | const app = require("../config/app"); 4 | const _ = require("lodash"); 5 | 6 | class ApiRequest { 7 | constructor(session_name, bot_name) { 8 | this.session_name = session_name; 9 | this.bot_name = bot_name; 10 | } 11 | 12 | async get_user_data(http_client) { 13 | try { 14 | const response = await http_client.post( 15 | `${app.apiUrl}/tomarket-game/v1/user/balance` 16 | ); 17 | return response.data; 18 | } catch (error) { 19 | const regex = /ENOTFOUND\s([^\s]+)/; 20 | const match = error.message.match(regex); 21 | logger.error( 22 | `[${this.bot_name}] | ${ 23 | this.session_name 24 | } | Error while getting User Data: ${ 25 | error.message.includes("ENOTFOUND") || 26 | error.message.includes("getaddrinfo") || 27 | error.message.includes("ECONNREFUSED") 28 | ? `The proxy server at ${ 29 | match && match[1] ? match[1] : "unknown address" 30 | } could not be found. Please check the proxy address and your network connection` 31 | : error.message 32 | }` 33 | ); 34 | await sleep(3); // Sleep for 3 seconds 35 | } 36 | } 37 | 38 | async validate_query_id(http_client, data) { 39 | try { 40 | const response = await http_client.post( 41 | `${app.apiUrl}/tomarket-game/v1/user/login`, 42 | JSON.stringify(data) 43 | ); 44 | if ( 45 | response?.data?.status === 400 || 46 | response?.data?.message?.toLowerCase()?.includes("invalid init data") 47 | ) { 48 | return false; 49 | } 50 | 51 | if (!_.isEmpty(response?.data?.data?.access_token)) { 52 | return true; 53 | } 54 | return false; 55 | } catch (error) { 56 | if ( 57 | error?.response?.data?.message 58 | ?.toLowerCase() 59 | ?.includes("invalid init data signature") || 60 | error?.response?.status == 401 61 | ) { 62 | return false; 63 | } 64 | 65 | throw error; 66 | } 67 | } 68 | 69 | async get_farm_info(http_client, data) { 70 | try { 71 | const response = await http_client.post( 72 | `${app.apiUrl}/tomarket-game/v1/farm/info`, 73 | data 74 | ); 75 | return response.data; 76 | } catch (error) { 77 | if (error?.response?.data?.message) { 78 | logger.warning( 79 | `[${this.bot_name}] | ${this.session_name} | Error while getting farm info: ${error?.response?.data?.message}` 80 | ); 81 | } else { 82 | logger.error( 83 | `[${this.bot_name}] | ${this.session_name} | Error while getting farm info:: ${error.message}` 84 | ); 85 | } 86 | } 87 | } 88 | 89 | async start_farming(http_client, data) { 90 | try { 91 | const response = await http_client.post( 92 | `${app.apiUrl}/tomarket-game/v1/farm/start`, 93 | JSON.stringify(data) 94 | ); 95 | return response.data; 96 | } catch (error) { 97 | if (error?.response?.data?.message) { 98 | logger.warning( 99 | `[${this.bot_name}] | ${this.session_name} | Error while starting farming: ${error?.response?.data?.message}` 100 | ); 101 | } else { 102 | logger.error( 103 | `[${this.bot_name}] | ${this.session_name} | Error while starting farming:: ${error.message}` 104 | ); 105 | } 106 | } 107 | } 108 | 109 | async start_game(http_client, data) { 110 | try { 111 | const response = await http_client.post( 112 | `${app.apiUrl}/tomarket-game/v1/game/play`, 113 | JSON.stringify(data) 114 | ); 115 | return response.data; 116 | } catch (error) { 117 | if (error?.response?.data?.message) { 118 | logger.warning( 119 | `[${this.bot_name}] | ${this.session_name} | Error while starting game: ${error?.response?.data?.message}` 120 | ); 121 | } else { 122 | logger.error( 123 | `[${this.bot_name}] | ${this.session_name} | Error while starting game:: ${error.message}` 124 | ); 125 | } 126 | } 127 | } 128 | 129 | async claim_game_reward(http_client, data) { 130 | try { 131 | const response = await http_client.post( 132 | `${app.apiUrl}/tomarket-game/v1/game/claim`, 133 | JSON.stringify(data) 134 | ); 135 | return response.data; 136 | } catch (error) { 137 | if (error?.response?.data?.message) { 138 | logger.warning( 139 | `[${this.bot_name}] | ${this.session_name} | Error while claiming game reward: ${error?.response?.data?.message}` 140 | ); 141 | } else { 142 | logger.error( 143 | `[${this.bot_name}] | ${this.session_name} | Error while claiming game reward:: ${error.message}` 144 | ); 145 | } 146 | } 147 | } 148 | 149 | async claim_daily_reward(http_client) { 150 | try { 151 | const response = await http_client.post( 152 | `${app.apiUrl}/tomarket-game/v1/daily/claim`, 153 | JSON.stringify({ game_id: "fa873d13-d831-4d6f-8aee-9cff7a1d0db1" }) 154 | ); 155 | return response.data; 156 | } catch (error) { 157 | if (error?.response?.data?.message) { 158 | logger.warning( 159 | `[${this.bot_name}] | ${this.session_name} | Error while claiming daily reward: ${error?.response?.data?.message}` 160 | ); 161 | } else { 162 | logger.error( 163 | `[${this.bot_name}] | ${this.session_name} | Error while claiming daily reward:: ${error.message}` 164 | ); 165 | } 166 | } 167 | } 168 | 169 | async claim_farming_reward(http_client, data) { 170 | try { 171 | const response = await http_client.post( 172 | `${app.apiUrl}/tomarket-game/v1/farm/claim`, 173 | JSON.stringify(data) 174 | ); 175 | return response.data; 176 | } catch (error) { 177 | if (error?.response?.data?.message) { 178 | logger.warning( 179 | `[${this.bot_name}] | ${this.session_name} | Error while claiming farming reward: ${error?.response?.data?.message}` 180 | ); 181 | } else { 182 | logger.error( 183 | `[${this.bot_name}] | ${this.session_name} | Error while claiming farming reward:: ${error.message}` 184 | ); 185 | } 186 | } 187 | } 188 | 189 | async claim_task(http_client, data) { 190 | try { 191 | const response = await http_client.post( 192 | `${app.apiUrl}/tomarket-game/v1/tasks/claim`, 193 | JSON.stringify(data) 194 | ); 195 | return response.data; 196 | } catch (error) { 197 | if (error?.response?.data?.message) { 198 | logger.warning( 199 | `[${this.bot_name}] | ${this.session_name} | Error while claiming task: ${error?.response?.data?.message}` 200 | ); 201 | } else { 202 | logger.error( 203 | `[${this.bot_name}] | ${this.session_name} | Error while claiming task:: ${error.message}` 204 | ); 205 | } 206 | } 207 | } 208 | 209 | async get_combo(http_client) { 210 | try { 211 | const response = await http_client.post( 212 | `${app.apiUrl}/tomarket-game/v1/tasks/hidden` 213 | ); 214 | return response.data; 215 | } catch (error) { 216 | if (error?.response?.data?.message) { 217 | logger.warning( 218 | `[${this.bot_name}] | ${this.session_name} | Error while getting combo: ${error?.response?.data?.message}` 219 | ); 220 | } else { 221 | logger.error( 222 | `[${this.bot_name}] | ${this.session_name} | Error while getting combo:: ${error.message}` 223 | ); 224 | } 225 | } 226 | } 227 | 228 | async get_stars(http_client) { 229 | try { 230 | const response = await http_client.post( 231 | `${app.apiUrl}/tomarket-game/v1/tasks/classmateTask` 232 | ); 233 | return response.data; 234 | } catch (error) { 235 | if (error?.response?.data?.message) { 236 | logger.warning( 237 | `[${this.bot_name}] | ${this.session_name} | Error while getting stars: ${error?.response?.data?.message}` 238 | ); 239 | } else { 240 | logger.error( 241 | `[${this.bot_name}] | ${this.session_name} | Error while getting stars:: ${error.message}` 242 | ); 243 | } 244 | } 245 | } 246 | 247 | async start_stars_claim(http_client, data) { 248 | try { 249 | const response = await http_client.post( 250 | `${app.apiUrl}/tomarket-game/v1/tasks/classmateStars`, 251 | JSON.stringify(data) 252 | ); 253 | return response.data; 254 | } catch (error) { 255 | if (error?.response?.data?.message) { 256 | logger.warning( 257 | `[${this.bot_name}] | ${this.session_name} | Error while starting stars claim: ${error?.response?.data?.message}` 258 | ); 259 | } else { 260 | logger.error( 261 | `[${this.bot_name}] | ${this.session_name} | Error while starting stars claim:: ${error.message}` 262 | ); 263 | } 264 | return null; 265 | } 266 | } 267 | 268 | async get_rank_data(http_client) { 269 | try { 270 | const response = await http_client.post( 271 | `${app.apiUrl}/tomarket-game/v1/rank/data` 272 | ); 273 | return response.data; 274 | } catch (error) { 275 | if (error?.response?.data?.message) { 276 | logger.warning( 277 | `[${this.bot_name}] | ${this.session_name} | Error while getting rank data: ${error?.response?.data?.message}` 278 | ); 279 | } else { 280 | logger.error( 281 | `[${this.bot_name}] | ${this.session_name} | Error while getting rank data:: ${error.message}` 282 | ); 283 | } 284 | return null; 285 | } 286 | } 287 | 288 | async evaluate_rank_data(http_client) { 289 | try { 290 | const response = await http_client.post( 291 | `${app.apiUrl}/tomarket-game/v1/rank/evaluate` 292 | ); 293 | return response.data; 294 | } catch (error) { 295 | if (error?.response?.data?.message) { 296 | logger.warning( 297 | `[${this.bot_name}] | ${this.session_name} | Error while evaluate rank data: ${error?.response?.data?.message}` 298 | ); 299 | } else { 300 | logger.error( 301 | `[${this.bot_name}] | ${this.session_name} | Error while evaluate rank data:: ${error.message}` 302 | ); 303 | } 304 | return null; 305 | } 306 | } 307 | 308 | async create_rank_data(http_client) { 309 | try { 310 | const response = await http_client.post( 311 | `${app.apiUrl}/tomarket-game/v1/rank/create` 312 | ); 313 | return response.data; 314 | } catch (error) { 315 | if (error?.response?.data?.message) { 316 | logger.warning( 317 | `[${this.bot_name}] | ${this.session_name} | Error while create rank: ${error?.response?.data?.message}` 318 | ); 319 | } else { 320 | logger.error( 321 | `[${this.bot_name}] | ${this.session_name} | Error while create rank:: ${error.message}` 322 | ); 323 | } 324 | return null; 325 | } 326 | } 327 | 328 | async upgrade_rank(http_client, data) { 329 | try { 330 | const response = await http_client.post( 331 | `${app.apiUrl}/tomarket-game/v1/rank/upgrade`, 332 | JSON.stringify(data) 333 | ); 334 | return response.data; 335 | } catch (error) { 336 | if (error?.response?.data?.message) { 337 | logger.warning( 338 | `[${this.bot_name}] | ${this.session_name} | Error while upgrade rank: ${error?.response?.data?.message}` 339 | ); 340 | } else { 341 | logger.error( 342 | `[${this.bot_name}] | ${this.session_name} | Error while upgrade rank:: ${error.message}` 343 | ); 344 | } 345 | return null; 346 | } 347 | } 348 | } 349 | 350 | module.exports = ApiRequest; 351 | -------------------------------------------------------------------------------- /bots/TimeFarm/bot/core/nonSessionTapper.js: -------------------------------------------------------------------------------- 1 | const { default: axios } = require("axios"); 2 | const logger = require("../../../../utils/logger"); 3 | const headers = require("./header"); 4 | const settings = require("../config/config"); 5 | const app = require("../config/app"); 6 | const user_agents = require("../../../../utils/userAgents"); 7 | const fs = require("fs"); 8 | const sleep = require("../../../../utils/sleep"); 9 | const ApiRequest = require("./api"); 10 | var _ = require("lodash"); 11 | const path = require("path"); 12 | const _isArray = require("../../../../utils/_isArray"); 13 | const { HttpsProxyAgent } = require("https-proxy-agent"); 14 | 15 | class NonSessionTapper { 16 | constructor(query_id, query_name, bot_name) { 17 | this.bot_name = bot_name; 18 | this.session_name = query_name; 19 | this.query_id = query_id; 20 | this.session_user_agents = this.#load_session_data(); 21 | this.headers = { ...headers, "user-agent": this.#get_user_agent() }; 22 | this.api = new ApiRequest(this.session_name, this.bot_name); 23 | } 24 | 25 | #load_session_data() { 26 | try { 27 | const filePath = path.join(process.cwd(), "session_user_agents.json"); 28 | const data = fs.readFileSync(filePath, "utf8"); 29 | return JSON.parse(data); 30 | } catch (error) { 31 | if (error.code === "ENOENT") { 32 | return {}; 33 | } else { 34 | throw error; 35 | } 36 | } 37 | } 38 | 39 | #get_random_user_agent() { 40 | const randomIndex = Math.floor(Math.random() * user_agents.length); 41 | return user_agents[randomIndex]; 42 | } 43 | 44 | #get_user_agent() { 45 | if (this.session_user_agents[this.session_name]) { 46 | return this.session_user_agents[this.session_name]; 47 | } 48 | 49 | logger.info( 50 | `[${this.bot_name}] | ${this.session_name} | Generating new user agent...` 51 | ); 52 | const newUserAgent = this.#get_random_user_agent(); 53 | this.session_user_agents[this.session_name] = newUserAgent; 54 | this.#save_session_data(this.session_user_agents); 55 | return newUserAgent; 56 | } 57 | 58 | #save_session_data(session_user_agents) { 59 | const filePath = path.join(process.cwd(), "session_user_agents.json"); 60 | fs.writeFileSync(filePath, JSON.stringify(session_user_agents, null, 2)); 61 | } 62 | 63 | #proxy_agent(proxy) { 64 | try { 65 | if (!proxy) return null; 66 | let proxy_url; 67 | if (!proxy.password && !proxy.username) { 68 | proxy_url = `${proxy.protocol}://${proxy.ip}:${proxy.port}`; 69 | } else { 70 | proxy_url = `${proxy.protocol}://${proxy.username}:${proxy.password}@${proxy.ip}:${proxy.port}`; 71 | } 72 | return new HttpsProxyAgent(proxy_url); 73 | } catch (e) { 74 | logger.error( 75 | `[${this.bot_name}] | ${ 76 | this.session_name 77 | } | Proxy agent error: ${e}\nProxy: ${JSON.stringify(proxy, null, 2)}` 78 | ); 79 | return null; 80 | } 81 | } 82 | 83 | #get_platform(userAgent) { 84 | const platformPatterns = [ 85 | { pattern: /iPhone/i, platform: "ios" }, 86 | { pattern: /Android/i, platform: "android" }, 87 | { pattern: /iPad/i, platform: "ios" }, 88 | ]; 89 | 90 | for (const { pattern, platform } of platformPatterns) { 91 | if (pattern.test(userAgent)) { 92 | return platform; 93 | } 94 | } 95 | 96 | return "android"; 97 | } 98 | 99 | async #get_tg_web_data() { 100 | try { 101 | const platform = this.#get_platform(this.#get_user_agent()); 102 | const json = { 103 | initData: this.query_id, 104 | platform, 105 | }; 106 | return json; 107 | } catch (error) { 108 | logger.error( 109 | `[${this.bot_name}] | ${this.session_name} | ❗️Unknown error during Authorization: ${error}` 110 | ); 111 | throw error; 112 | } finally { 113 | /* await this.tg_client.disconnect(); */ 114 | await sleep(1); 115 | logger.info( 116 | `[${this.bot_name}] | ${this.session_name} | 🚀 Starting session...` 117 | ); 118 | } 119 | } 120 | 121 | async #get_access_token(tgWebData, http_client) { 122 | try { 123 | const response = await http_client.post( 124 | `${app.apiUrl}/api/v1/auth/validate-init/v2`, 125 | JSON.stringify(tgWebData) 126 | ); 127 | 128 | return response.data; 129 | } catch (error) { 130 | if (error?.response?.data?.error?.message) { 131 | logger.error( 132 | `[${this.bot_name}] | ${this.session_name} | ❗️Unknown error while getting Access Token: ${error?.response?.data?.error?.message}` 133 | ); 134 | } else { 135 | logger.error( 136 | `[${this.bot_name}] | ${this.session_name} | ❗️Unknown error while getting Access Token: ${error}` 137 | ); 138 | } 139 | await sleep(3); // 3 seconds delay 140 | return null; 141 | } 142 | } 143 | 144 | async #check_proxy(http_client, proxy) { 145 | try { 146 | const response = await http_client.get("https://httpbin.org/ip"); 147 | const ip = response.data.origin; 148 | logger.info( 149 | `[${this.bot_name}] | ${this.session_name} | Proxy IP: ${ip}` 150 | ); 151 | } catch (error) { 152 | if ( 153 | error.message.includes("ENOTFOUND") || 154 | error.message.includes("getaddrinfo") || 155 | error.message.includes("ECONNREFUSED") 156 | ) { 157 | logger.error( 158 | `[${this.bot_name}] | ${this.session_name} | Error: Unable to resolve the proxy address. The proxy server at ${proxy.ip}:${proxy.port} could not be found. Please check the proxy address and your network connection.` 159 | ); 160 | logger.error( 161 | `[${this.bot_name}] | ${this.session_name} | No proxy will be used.` 162 | ); 163 | } else { 164 | logger.error( 165 | `[${this.bot_name}] | ${this.session_name} | Proxy: ${proxy.ip}:${proxy.port} | Error: ${error.message}` 166 | ); 167 | } 168 | 169 | return false; 170 | } 171 | } 172 | 173 | async run(proxy) { 174 | let http_client; 175 | let access_token_created_time = 0; 176 | 177 | let farm_info; 178 | let user_balance; 179 | let farmingTime = 0; 180 | let access_token; 181 | 182 | if (settings.USE_PROXY_FROM_FILE && proxy) { 183 | http_client = axios.create({ 184 | httpsAgent: this.#proxy_agent(proxy), 185 | headers: this.headers, 186 | withCredentials: true, 187 | }); 188 | const proxy_result = await this.#check_proxy(http_client, proxy); 189 | if (!proxy_result) { 190 | http_client = axios.create({ 191 | headers: this.headers, 192 | withCredentials: true, 193 | }); 194 | } 195 | } else { 196 | http_client = axios.create({ 197 | headers: this.headers, 198 | withCredentials: true, 199 | }); 200 | } 201 | while (true) { 202 | try { 203 | const currentTime = _.floor(Date.now() / 1000); 204 | if (currentTime - access_token_created_time >= 1800) { 205 | const tg_web_data = await this.#get_tg_web_data(); 206 | access_token = await this.#get_access_token(tg_web_data, http_client); 207 | http_client.defaults.headers[ 208 | "authorization" 209 | ] = `Bearer ${access_token?.token}`; 210 | access_token_created_time = currentTime; 211 | await sleep(2); 212 | } 213 | 214 | farm_info = await this.api.get_farm_info(http_client); 215 | user_balance = await this.api.get_balance(http_client); 216 | if (!farm_info || !user_balance) { 217 | continue; 218 | } 219 | 220 | if ( 221 | settings.CLAIM_FRIENDS_REWARD && 222 | user_balance?.referral?.availableBalance > 10 223 | ) { 224 | const result_claim_friend = await this.api.claim_friends_balance( 225 | http_client 226 | ); 227 | 228 | if ( 229 | typeof result_claim_friend == "string" && 230 | result_claim_friend.toLowerCase() == "ok" 231 | ) { 232 | logger.info( 233 | `[${this.bot_name}] | ${this.session_name} | 🎉 Claimed friends reward | Reward: ${user_balance?.referral?.availableBalance}` 234 | ); 235 | user_balance = await this.api.get_balance(http_client); 236 | } 237 | } 238 | 239 | await sleep(5); 240 | 241 | // Farming 242 | if (settings.AUTO_FARMING) { 243 | if (farm_info?.activeFarmingStartedAt && farm_info?.farmingReward) { 244 | farmingTime = _.floor( 245 | new Date(farm_info?.activeFarmingStartedAt).getTime() / 1000 + 246 | farm_info?.farmingReward 247 | ); 248 | 249 | if (farmingTime < currentTime) { 250 | const result_claim = await this.api.claim_farming(http_client); 251 | if (result_claim) { 252 | logger.info( 253 | `[${this.bot_name}] | ${this.session_name} | 🎉 Claimed farming reward | Balance: ${result_claim?.balance}` 254 | ); 255 | } 256 | const result_start = await this.api.start_farming(http_client); 257 | if (result_start) { 258 | farm_info = await this.api.get_farm_info(http_client); 259 | farmingTime = new _.floor( 260 | Date(farm_info?.activeFarmingStartedAt).getTime() / 1000 + 261 | farm_info?.farmingReward 262 | ); 263 | logger.info( 264 | `[${this.bot_name}] | ${ 265 | this.session_name 266 | } | 🤖 Started farming | Ends in: ${ 267 | farmingTime - currentTime > 0 268 | ? farmingTime - currentTime 269 | : 0 270 | } seconds.` 271 | ); 272 | } 273 | } else { 274 | logger.info( 275 | `[${this.bot_name}] | ${ 276 | this.session_name 277 | } | 🤖 Farming ends in: ${ 278 | farmingTime - currentTime > 0 ? farmingTime - currentTime : 0 279 | } seconds.` 280 | ); 281 | } 282 | } else { 283 | const result_start = await this.api.start_farming(http_client); 284 | if (result_start) { 285 | farm_info = await this.api.get_farm_info(http_client); 286 | farmingTime = _.floor( 287 | new Date(farm_info?.activeFarmingStartedAt).getTime() / 1000 + 288 | farm_info?.farmingReward 289 | ); 290 | logger.info( 291 | `[${this.bot_name}] | ${ 292 | this.session_name 293 | } | 🤖 Started farming | Ends in: ${ 294 | farmingTime - currentTime > 0 ? farmingTime - currentTime : 0 295 | } seconds.` 296 | ); 297 | } 298 | } 299 | } 300 | } catch (error) { 301 | logger.error( 302 | `[${this.bot_name}] | ${this.session_name} | ❗️Unknown error: ${error}` 303 | ); 304 | } finally { 305 | let ran_sleep; 306 | if (_isArray(settings.SLEEP_BETWEEN_REQUESTS)) { 307 | if ( 308 | _.isInteger(settings.SLEEP_BETWEEN_REQUESTS[0]) && 309 | _.isInteger(settings.SLEEP_BETWEEN_REQUESTS[1]) 310 | ) { 311 | ran_sleep = _.random( 312 | settings.SLEEP_BETWEEN_REQUESTS[0], 313 | settings.SLEEP_BETWEEN_REQUESTS[1] 314 | ); 315 | } else { 316 | ran_sleep = _.random(450, 800); 317 | } 318 | } else if (_.isInteger(settings.SLEEP_BETWEEN_REQUESTS)) { 319 | const ran_add = _.random(20, 50); 320 | ran_sleep = settings.SLEEP_BETWEEN_REQUESTS + ran_add; 321 | } else { 322 | ran_sleep = _.random(450, 800); 323 | } 324 | 325 | logger.info( 326 | `[${this.bot_name}] | ${this.session_name} | Sleeping for ${ran_sleep} seconds...` 327 | ); 328 | await sleep(ran_sleep); 329 | } 330 | } 331 | } 332 | } 333 | module.exports = NonSessionTapper; 334 | -------------------------------------------------------------------------------- /utils/devices.js: -------------------------------------------------------------------------------- 1 | const devices = [ 2 | { 3 | manufacturer: "Apple", 4 | model: "iPhone 14 Pro", 5 | cpu: "A16 Bionic", 6 | type: "iPhone", 7 | os: "iOS 16", 8 | }, 9 | { 10 | manufacturer: "Apple", 11 | model: "iPhone 13", 12 | cpu: "A15 Bionic", 13 | type: "iPhone", 14 | os: "iOS 15", 15 | }, 16 | { 17 | manufacturer: "Apple", 18 | model: "iPhone SE (2022)", 19 | cpu: "A15 Bionic", 20 | type: "iPhone", 21 | os: "iOS 15", 22 | }, 23 | { 24 | manufacturer: "Apple", 25 | model: "iPad Pro 2021", 26 | cpu: "M1", 27 | type: "iPad", 28 | os: "iPadOS 15", 29 | }, 30 | { 31 | manufacturer: "Apple", 32 | model: 'MacBook Pro 16" 2021', 33 | cpu: "M1 Pro", 34 | type: "Laptop", 35 | os: "macOS Monterey", 36 | }, 37 | { 38 | manufacturer: "Apple", 39 | model: "MacBook Air M2", 40 | cpu: "M2", 41 | type: "Laptop", 42 | os: "macOS Ventura", 43 | }, 44 | { 45 | manufacturer: "Samsung", 46 | model: "Galaxy S21 Ultra", 47 | cpu: "Exynos 2100", 48 | type: "Android", 49 | os: "Android 11", 50 | }, 51 | { 52 | manufacturer: "Samsung", 53 | model: "Galaxy Note 20", 54 | cpu: "Exynos 990", 55 | type: "Android", 56 | os: "Android 10", 57 | }, 58 | { 59 | manufacturer: "Samsung", 60 | model: "Galaxy A52", 61 | cpu: "Qualcomm Snapdragon 720G", 62 | type: "Android", 63 | os: "Android 11", 64 | }, 65 | { 66 | manufacturer: "Samsung", 67 | model: "Galaxy Tab S7", 68 | cpu: "Qualcomm Snapdragon 865+", 69 | type: "Android Tablet", 70 | os: "Android 10", 71 | }, 72 | { 73 | manufacturer: "Samsung", 74 | model: "Galaxy Z Fold 3", 75 | cpu: "Qualcomm Snapdragon 888", 76 | type: "Android Foldable", 77 | os: "Android 11", 78 | }, 79 | { 80 | manufacturer: "Google", 81 | model: "Pixel 6", 82 | cpu: "Google Tensor", 83 | type: "Android", 84 | os: "Android 12", 85 | }, 86 | { 87 | manufacturer: "Google", 88 | model: "Pixel 5a", 89 | cpu: "Qualcomm Snapdragon 765G", 90 | type: "Android", 91 | os: "Android 11", 92 | }, 93 | { 94 | manufacturer: "Google", 95 | model: "Pixel 4a", 96 | cpu: "Qualcomm Snapdragon 730G", 97 | type: "Android", 98 | os: "Android 11", 99 | }, 100 | { 101 | manufacturer: "Microsoft", 102 | model: "Surface Laptop 4", 103 | cpu: "Intel Core i7-1185G7", 104 | type: "Laptop", 105 | os: "Windows 10", 106 | }, 107 | { 108 | manufacturer: "Microsoft", 109 | model: "Surface Book 3", 110 | cpu: "Intel Core i7-1065G7", 111 | type: "Laptop", 112 | os: "Windows 10", 113 | }, 114 | { 115 | manufacturer: "Dell", 116 | model: "XPS 13", 117 | cpu: "Intel Core i7-1185G7", 118 | type: "Laptop", 119 | os: "Windows 10", 120 | }, 121 | { 122 | manufacturer: "Dell", 123 | model: "Inspiron 15 7000", 124 | cpu: "Intel Core i5-1035G1", 125 | type: "Laptop", 126 | os: "Windows 10", 127 | }, 128 | { 129 | manufacturer: "HP", 130 | model: "Spectre x360 14", 131 | cpu: "Intel Core i7-1165G7", 132 | type: "Laptop", 133 | os: "Windows 10", 134 | }, 135 | { 136 | manufacturer: "HP", 137 | model: "Envy 13", 138 | cpu: "Intel Core i5-1135G7", 139 | type: "Laptop", 140 | os: "Windows 10", 141 | }, 142 | { 143 | manufacturer: "Lenovo", 144 | model: "ThinkPad X1 Carbon", 145 | cpu: "Intel Core i7-1165G7", 146 | type: "Laptop", 147 | os: "Windows 10", 148 | }, 149 | { 150 | manufacturer: "Lenovo", 151 | model: "Yoga 9i", 152 | cpu: "Intel Core i7-1185G7", 153 | type: "Laptop", 154 | os: "Windows 10", 155 | }, 156 | { 157 | manufacturer: "Asus", 158 | model: "ROG Strix Scar 15", 159 | cpu: "AMD Ryzen 9 5900HX", 160 | type: "Laptop", 161 | os: "Windows 10", 162 | }, 163 | { 164 | manufacturer: "Asus", 165 | model: "ZenBook 14", 166 | cpu: "Intel Core i7-1165G7", 167 | type: "Laptop", 168 | os: "Windows 10", 169 | }, 170 | { 171 | manufacturer: "Acer", 172 | model: "Predator Helios 300", 173 | cpu: "Intel Core i7-10750H", 174 | type: "Laptop", 175 | os: "Windows 10", 176 | }, 177 | { 178 | manufacturer: "Acer", 179 | model: "Swift 3", 180 | cpu: "AMD Ryzen 7 4700U", 181 | type: "Laptop", 182 | os: "Windows 10", 183 | }, 184 | { 185 | manufacturer: "Sony", 186 | model: "VAIO SX14", 187 | cpu: "Intel Core i7-1165G7", 188 | type: "Laptop", 189 | os: "Windows 10", 190 | }, 191 | { 192 | manufacturer: "Razer", 193 | model: "Blade 15 Advanced", 194 | cpu: "Intel Core i7-10875H", 195 | type: "Laptop", 196 | os: "Windows 10", 197 | }, 198 | { 199 | manufacturer: "Huawei", 200 | model: "MateBook X Pro", 201 | cpu: "Intel Core i5-10210U", 202 | type: "Laptop", 203 | os: "Windows 10", 204 | }, 205 | { 206 | manufacturer: "Huawei", 207 | model: "MateBook 14", 208 | cpu: "AMD Ryzen 5 4600U", 209 | type: "Laptop", 210 | os: "Windows 10", 211 | }, 212 | { 213 | manufacturer: "Xiaomi", 214 | model: "Mi 11 Ultra", 215 | cpu: "Qualcomm Snapdragon 888", 216 | type: "Android", 217 | os: "Android 11", 218 | }, 219 | { 220 | manufacturer: "Xiaomi", 221 | model: "Redmi Note 11", 222 | cpu: "Qualcomm Snapdragon 680", 223 | type: "Android", 224 | os: "Android 11", 225 | }, 226 | { 227 | manufacturer: "OnePlus", 228 | model: "OnePlus 9 Pro", 229 | cpu: "Qualcomm Snapdragon 888", 230 | type: "Android", 231 | os: "Android 11", 232 | }, 233 | { 234 | manufacturer: "OnePlus", 235 | model: "OnePlus Nord", 236 | cpu: "Qualcomm Snapdragon 765G", 237 | type: "Android", 238 | os: "Android 11", 239 | }, 240 | { 241 | manufacturer: "LG", 242 | model: "Gram 17", 243 | cpu: "Intel Core i7-1165G7", 244 | type: "Laptop", 245 | os: "Windows 10", 246 | }, 247 | { 248 | manufacturer: "LG", 249 | model: "V60 ThinQ", 250 | cpu: "Qualcomm Snapdragon 865", 251 | type: "Android", 252 | os: "Android 10", 253 | }, 254 | { 255 | manufacturer: "Motorola", 256 | model: "Moto G Power", 257 | cpu: "Qualcomm Snapdragon 662", 258 | type: "Android", 259 | os: "Android 10", 260 | }, 261 | { 262 | manufacturer: "Motorola", 263 | model: "Moto Edge 2021", 264 | cpu: "Qualcomm Snapdragon 778G", 265 | type: "Android", 266 | os: "Android 11", 267 | }, 268 | { 269 | manufacturer: "Nokia", 270 | model: "Nokia 8.3 5G", 271 | cpu: "Qualcomm Snapdragon 765G", 272 | type: "Android", 273 | os: "Android 10", 274 | }, 275 | { 276 | manufacturer: "Nokia", 277 | model: "Nokia 7.2", 278 | cpu: "Qualcomm Snapdragon 660", 279 | type: "Android", 280 | os: "Android 10", 281 | }, 282 | { 283 | manufacturer: "Dell", 284 | model: "G5 15", 285 | cpu: "Intel Core i7-10750H", 286 | type: "Laptop", 287 | os: "Windows 10", 288 | }, 289 | { 290 | manufacturer: "HP", 291 | model: "Pavilion 15", 292 | cpu: "AMD Ryzen 5 5500U", 293 | type: "Laptop", 294 | os: "Windows 10", 295 | }, 296 | { 297 | manufacturer: "Lenovo", 298 | model: "ThinkPad T14", 299 | cpu: "Intel Core i7-10610U", 300 | type: "Laptop", 301 | os: "Windows 10", 302 | }, 303 | { 304 | manufacturer: "Asus", 305 | model: "TUF Gaming A15", 306 | cpu: "AMD Ryzen 7 4800H", 307 | type: "Laptop", 308 | os: "Windows 10", 309 | }, 310 | { 311 | manufacturer: "Acer", 312 | model: "Nitro 5", 313 | cpu: "Intel Core i5-9300H", 314 | type: "Laptop", 315 | os: "Windows 10", 316 | }, 317 | { 318 | manufacturer: "Razer", 319 | model: "Blade Stealth 13", 320 | cpu: "Intel Core i7-1165G7", 321 | type: "Laptop", 322 | os: "Windows 10", 323 | }, 324 | { 325 | manufacturer: "Sony", 326 | model: "VAIO SX12", 327 | cpu: "Intel Core i7-1065G7", 328 | type: "Laptop", 329 | os: "Windows 10", 330 | }, 331 | { 332 | manufacturer: "Huawei", 333 | model: "MateBook D 15", 334 | cpu: "AMD Ryzen 5 3500U", 335 | type: "Laptop", 336 | os: "Windows 10", 337 | }, 338 | { 339 | manufacturer: "Xiaomi", 340 | model: "Mi Mix 4", 341 | cpu: "Qualcomm Snapdragon 888", 342 | type: "Android", 343 | os: "Android 11", 344 | }, 345 | { 346 | manufacturer: "Google", 347 | model: "Pixel 6 Pro", 348 | cpu: "Google Tensor", 349 | type: "Android", 350 | os: "Android 12", 351 | }, 352 | { 353 | manufacturer: "Google", 354 | model: "Pixel 5", 355 | cpu: "Qualcomm Snapdragon 765G", 356 | type: "Android", 357 | os: "Android 11", 358 | }, 359 | { 360 | manufacturer: "Apple", 361 | model: "iPad Air (2022)", 362 | cpu: "M1", 363 | type: "iPad", 364 | os: "iPadOS 15", 365 | }, 366 | { 367 | manufacturer: "Apple", 368 | model: "iPhone 11", 369 | cpu: "A13 Bionic", 370 | type: "iPhone", 371 | os: "iOS 14", 372 | }, 373 | { 374 | manufacturer: "Samsung", 375 | model: "Galaxy A72", 376 | cpu: "Qualcomm Snapdragon 720G", 377 | type: "Android", 378 | os: "Android 11", 379 | }, 380 | { 381 | manufacturer: "Samsung", 382 | model: "Galaxy S20 FE", 383 | cpu: "Exynos 990", 384 | type: "Android", 385 | os: "Android 11", 386 | }, 387 | { 388 | manufacturer: "Huawei", 389 | model: "P40 Pro", 390 | cpu: "Kirin 990", 391 | type: "Android", 392 | os: "Android 10", 393 | }, 394 | { 395 | manufacturer: "Xiaomi", 396 | model: "Redmi Note 10 Pro", 397 | cpu: "Qualcomm Snapdragon 732G", 398 | type: "Android", 399 | os: "Android 11", 400 | }, 401 | { 402 | manufacturer: "Asus", 403 | model: "ROG Phone 5", 404 | cpu: "Qualcomm Snapdragon 888", 405 | type: "Android", 406 | os: "Android 11", 407 | }, 408 | { 409 | manufacturer: "Dell", 410 | model: "XPS 17", 411 | cpu: "Intel Core i9-11980HK", 412 | type: "Laptop", 413 | os: "Windows 10", 414 | }, 415 | { 416 | manufacturer: "HP", 417 | model: "Omen 15", 418 | cpu: "Intel Core i7-10750H", 419 | type: "Laptop", 420 | os: "Windows 10", 421 | }, 422 | { 423 | manufacturer: "Lenovo", 424 | model: "Legion 5 Pro", 425 | cpu: "AMD Ryzen 7 5800H", 426 | type: "Laptop", 427 | os: "Windows 10", 428 | }, 429 | { 430 | manufacturer: "Asus", 431 | model: "ZenBook Flip 14", 432 | cpu: "Intel Core i7-1165G7", 433 | type: "Laptop", 434 | os: "Windows 10", 435 | }, 436 | { 437 | manufacturer: "Acer", 438 | model: "Aspire 5", 439 | cpu: "Intel Core i5-1135G7", 440 | type: "Laptop", 441 | os: "Windows 10", 442 | }, 443 | { 444 | manufacturer: "Microsoft", 445 | model: "Surface Laptop Go", 446 | cpu: "Intel Core i5-1035G1", 447 | type: "Laptop", 448 | os: "Windows 10", 449 | }, 450 | { 451 | manufacturer: "Razer", 452 | model: "Blade 17", 453 | cpu: "Intel Core i9-11900H", 454 | type: "Laptop", 455 | os: "Windows 10", 456 | }, 457 | { 458 | manufacturer: "Sony", 459 | model: "VAIO SX14", 460 | cpu: "Intel Core i7-1065G7", 461 | type: "Laptop", 462 | os: "Windows 10", 463 | }, 464 | { 465 | manufacturer: "Huawei", 466 | model: "MateBook X Pro", 467 | cpu: "Intel Core i5-10210U", 468 | type: "Laptop", 469 | os: "Windows 10", 470 | }, 471 | { 472 | manufacturer: "Xiaomi", 473 | model: "Mi 10T Pro", 474 | cpu: "Qualcomm Snapdragon 865", 475 | type: "Android", 476 | os: "Android 10", 477 | }, 478 | { 479 | manufacturer: "OnePlus", 480 | model: "OnePlus 8T", 481 | cpu: "Qualcomm Snapdragon 865", 482 | type: "Android", 483 | os: "Android 11", 484 | }, 485 | { 486 | manufacturer: "Nokia", 487 | model: "Nokia 9 PureView", 488 | cpu: "Qualcomm Snapdragon 845", 489 | type: "Android", 490 | os: "Android 9", 491 | }, 492 | { 493 | manufacturer: "Motorola", 494 | model: "Moto G60", 495 | cpu: "Qualcomm Snapdragon 732G", 496 | type: "Android", 497 | os: "Android 11", 498 | }, 499 | { 500 | manufacturer: "LG", 501 | model: "Wing", 502 | cpu: "Qualcomm Snapdragon 765G", 503 | type: "Android", 504 | os: "Android 10", 505 | }, 506 | { 507 | manufacturer: "Google", 508 | model: "Pixel 4 XL", 509 | cpu: "Qualcomm Snapdragon 855", 510 | type: "Android", 511 | os: "Android 10", 512 | }, 513 | { 514 | manufacturer: "Apple", 515 | model: "iPhone XR", 516 | cpu: "A12 Bionic", 517 | type: "iPhone", 518 | os: "iOS 13", 519 | }, 520 | { 521 | manufacturer: "Apple", 522 | model: "iPhone X", 523 | cpu: "A11 Bionic", 524 | type: "iPhone", 525 | os: "iOS 12", 526 | }, 527 | ]; 528 | module.exports = devices; 529 | -------------------------------------------------------------------------------- /bots/PocketFi/bot/core/tapper.js: -------------------------------------------------------------------------------- 1 | const { default: axios } = require("axios"); 2 | const logger = require("../../../../utils/logger"); 3 | const headers = require("./header"); 4 | const { Api } = require("telegram"); 5 | const settings = require("../config/config"); 6 | const app = require("../config/app"); 7 | const user_agents = require("../../../../utils/userAgents"); 8 | const fs = require("fs"); 9 | const sleep = require("../../../../utils/sleep"); 10 | const ApiRequest = require("./api"); 11 | var _ = require("lodash"); 12 | const parser = require("../../../../utils/parser"); 13 | const path = require("path"); 14 | const _isArray = require("../../../../utils/_isArray"); 15 | const { HttpsProxyAgent } = require("https-proxy-agent"); 16 | const FdyTmp = require("fdy-tmp"); 17 | 18 | class Tapper { 19 | constructor(tg_client, bot_name) { 20 | this.bot_name = bot_name; 21 | this.session_name = tg_client.session_name; 22 | this.tg_client = tg_client.tg_client; 23 | this.session_user_agents = this.#load_session_data(); 24 | this.headers = { ...headers, "user-agent": this.#get_user_agent() }; 25 | this.api = new ApiRequest(this.session_name, this.bot_name); 26 | this.sleep_floodwait = 0; 27 | this.runOnce = false; 28 | } 29 | 30 | #load_session_data() { 31 | try { 32 | const filePath = path.join(process.cwd(), "session_user_agents.json"); 33 | const data = fs.readFileSync(filePath, "utf8"); 34 | return JSON.parse(data); 35 | } catch (error) { 36 | if (error.code === "ENOENT") { 37 | return {}; 38 | } else { 39 | throw error; 40 | } 41 | } 42 | } 43 | 44 | #clean_tg_web_data(queryString) { 45 | let cleanedString = queryString.replace(/^tgWebAppData=/, ""); 46 | cleanedString = cleanedString.replace( 47 | /&tgWebAppVersion=.*?&tgWebAppPlatform=.*?(?:&tgWebAppBotInline=.*?)?$/, 48 | "" 49 | ); 50 | return cleanedString; 51 | } 52 | 53 | #get_random_user_agent() { 54 | const randomIndex = Math.floor(Math.random() * user_agents.length); 55 | return user_agents[randomIndex]; 56 | } 57 | 58 | #get_user_agent() { 59 | if (this.session_user_agents[this.session_name]) { 60 | return this.session_user_agents[this.session_name]; 61 | } 62 | 63 | logger.info( 64 | `[${this.bot_name}] | ${this.session_name} | Generating new user agent...` 65 | ); 66 | const newUserAgent = this.#get_random_user_agent(); 67 | this.session_user_agents[this.session_name] = newUserAgent; 68 | this.#save_session_data(this.session_user_agents); 69 | return newUserAgent; 70 | } 71 | 72 | #save_session_data(session_user_agents) { 73 | const filePath = path.join(process.cwd(), "session_user_agents.json"); 74 | fs.writeFileSync(filePath, JSON.stringify(session_user_agents, null, 2)); 75 | } 76 | 77 | #get_platform(userAgent) { 78 | const platformPatterns = [ 79 | { pattern: /iPhone/i, platform: "ios" }, 80 | { pattern: /Android/i, platform: "android" }, 81 | { pattern: /iPad/i, platform: "ios" }, 82 | ]; 83 | 84 | for (const { pattern, platform } of platformPatterns) { 85 | if (pattern.test(userAgent)) { 86 | return platform; 87 | } 88 | } 89 | 90 | return "Unknown"; 91 | } 92 | 93 | #proxy_agent(proxy) { 94 | try { 95 | if (!proxy) return null; 96 | let proxy_url; 97 | if (!proxy.password && !proxy.username) { 98 | proxy_url = `${proxy.protocol}://${proxy.ip}:${proxy.port}`; 99 | } else { 100 | proxy_url = `${proxy.protocol}://${proxy.username}:${proxy.password}@${proxy.ip}:${proxy.port}`; 101 | } 102 | return new HttpsProxyAgent(proxy_url); 103 | } catch (e) { 104 | logger.error( 105 | `[${this.bot_name}] | ${ 106 | this.session_name 107 | } | Proxy agent error: ${e}\nProxy: ${JSON.stringify(proxy, null, 2)}` 108 | ); 109 | return null; 110 | } 111 | } 112 | 113 | async #get_tg_web_data() { 114 | try { 115 | const tmp = new FdyTmp({ 116 | fileName: `${this.bot_name}.fdy.tmp`, 117 | tmpPath: path.join(process.cwd(), "cache/queries"), 118 | }); 119 | if (tmp.hasJsonElement(this.session_name)) { 120 | const queryStringFromCache = tmp.getJson(this.session_name); 121 | if (!_.isEmpty(queryStringFromCache)) { 122 | const va_hc = axios.create({ 123 | headers: this.headers, 124 | withCredentials: true, 125 | }); 126 | 127 | va_hc.defaults.headers["telegramrawdata"] = queryStringFromCache; 128 | 129 | const validate = await this.api.validate_query_id( 130 | va_hc, 131 | queryStringFromCache 132 | ); 133 | 134 | if (validate) { 135 | logger.info( 136 | `[${this.bot_name}] | ${this.session_name} | 🔄 Getting data from cache...` 137 | ); 138 | if (this.tg_client.connected) { 139 | await this.tg_client.disconnect(); 140 | await this.tg_client.destroy(); 141 | } 142 | await sleep(5); 143 | return queryStringFromCache; 144 | } else { 145 | tmp.deleteJsonElement(this.session_name); 146 | } 147 | } 148 | } 149 | await this.tg_client.connect(); 150 | await this.tg_client.start(); 151 | const platform = this.#get_platform(this.#get_user_agent()); 152 | 153 | if (!this.bot) { 154 | this.bot = await this.tg_client.getInputEntity(app.bot); 155 | } 156 | 157 | if (!this.runOnce) { 158 | logger.info( 159 | `[${this.bot_name}] | ${this.session_name} | 📡 Waiting for authorization...` 160 | ); 161 | const botHistory = await this.tg_client.invoke( 162 | new Api.messages.GetHistory({ 163 | peer: this.bot, 164 | limit: 10, 165 | }) 166 | ); 167 | if (botHistory.messages.length < 1) { 168 | await this.tg_client.invoke( 169 | new Api.messages.SendMessage({ 170 | message: "/start", 171 | silent: true, 172 | noWebpage: true, 173 | peer: this.bot, 174 | }) 175 | ); 176 | } 177 | } 178 | 179 | await sleep(5); 180 | 181 | const result = await this.tg_client.invoke( 182 | new Api.messages.RequestWebView({ 183 | peer: this.bot, 184 | bot: this.bot, 185 | platform, 186 | from_bot_menu: true, 187 | url: app.webviewUrl, 188 | }) 189 | ); 190 | 191 | const authUrl = result.url; 192 | const tgWebData = authUrl.split("#", 2)[1]; 193 | logger.info( 194 | `[${this.bot_name}] | ${this.session_name} | 💾 Storing data in cache...` 195 | ); 196 | 197 | await sleep(5); 198 | 199 | tmp 200 | .addJson( 201 | this.session_name, 202 | decodeURIComponent(this.#clean_tg_web_data(tgWebData)) 203 | ) 204 | .save(); 205 | 206 | return decodeURIComponent(this.#clean_tg_web_data(tgWebData)); 207 | } catch (error) { 208 | if (error.message.includes("AUTH_KEY_DUPLICATED")) { 209 | logger.error( 210 | `[${this.bot_name}] | ${this.session_name} | The same authorization key (session file) was used in more than one place simultaneously. You must delete your session file and create a new session` 211 | ); 212 | return null; 213 | } 214 | const regex = /A wait of (\d+) seconds/; 215 | if ( 216 | error.message.includes("FloodWaitError") || 217 | error.message.match(regex) 218 | ) { 219 | const match = error.message.match(regex); 220 | 221 | if (match) { 222 | this.sleep_floodwait = 223 | new Date().getTime() / 1000 + parseInt(match[1], 10) + 10; 224 | } else { 225 | this.sleep_floodwait = new Date().getTime() / 1000 + 50; 226 | } 227 | logger.error( 228 | `[${this.bot_name}] | ${ 229 | this.session_name 230 | } | Some flood error, waiting ${ 231 | this.sleep_floodwait - new Date().getTime() / 1000 232 | } seconds to try again...` 233 | ); 234 | } else { 235 | logger.error( 236 | `[${this.bot_name}] | ${this.session_name} | ❗️Unknown error during Authorization: ${error}` 237 | ); 238 | } 239 | return null; 240 | } finally { 241 | if (this.tg_client.connected) { 242 | await this.tg_client.disconnect(); 243 | await this.tg_client.destroy(); 244 | } 245 | this.runOnce = true; 246 | if (this.sleep_floodwait > new Date().getTime() / 1000) { 247 | await sleep(this.sleep_floodwait - new Date().getTime() / 1000); 248 | return await this.#get_tg_web_data(); 249 | } 250 | await sleep(3); 251 | } 252 | } 253 | 254 | async #check_proxy(http_client, proxy) { 255 | try { 256 | const response = await http_client.get("https://httpbin.org/ip"); 257 | const ip = response.data.origin; 258 | logger.info( 259 | `[${this.bot_name}] | ${this.session_name} | Proxy IP: ${ip}` 260 | ); 261 | } catch (error) { 262 | if ( 263 | error.message.includes("ENOTFOUND") || 264 | error.message.includes("getaddrinfo") || 265 | error.message.includes("ECONNREFUSED") 266 | ) { 267 | logger.error( 268 | `[${this.bot_name}] | ${this.session_name} | Error: Unable to resolve the proxy address. The proxy server at ${proxy.ip}:${proxy.port} could not be found. Please check the proxy address and your network connection.` 269 | ); 270 | logger.error( 271 | `[${this.bot_name}] | ${this.session_name} | No proxy will be used.` 272 | ); 273 | } else { 274 | logger.error( 275 | `[${this.bot_name}] | ${this.session_name} | Proxy: ${proxy.ip}:${proxy.port} | Error: ${error.message}` 276 | ); 277 | } 278 | 279 | return false; 280 | } 281 | } 282 | 283 | async run(proxy) { 284 | let http_client; 285 | let access_token_created_time = 0; 286 | 287 | let mining_info; 288 | 289 | if (settings.USE_PROXY_FROM_FILE && proxy) { 290 | http_client = axios.create({ 291 | httpsAgent: this.#proxy_agent(proxy), 292 | headers: this.headers, 293 | withCredentials: true, 294 | }); 295 | const proxy_result = await this.#check_proxy(http_client, proxy); 296 | if (!proxy_result) { 297 | http_client = axios.create({ 298 | headers: this.headers, 299 | withCredentials: true, 300 | }); 301 | } 302 | } else { 303 | http_client = axios.create({ 304 | headers: this.headers, 305 | withCredentials: true, 306 | }); 307 | } 308 | while (true) { 309 | try { 310 | const currentTime = _.floor(Date.now() / 1000); 311 | if (currentTime - access_token_created_time >= 3600) { 312 | const tg_web_data = await this.#get_tg_web_data(); 313 | if ( 314 | _.isNull(tg_web_data) || 315 | _.isUndefined(tg_web_data) || 316 | !tg_web_data || 317 | _.isEmpty(tg_web_data) 318 | ) { 319 | continue; 320 | } 321 | 322 | http_client.defaults.headers["telegramrawdata"] = tg_web_data; 323 | access_token_created_time = currentTime; 324 | await sleep(2); 325 | } 326 | 327 | mining_info = await this.api.get_mining_info(http_client); 328 | if (_.isEmpty(mining_info)) { 329 | continue; 330 | } 331 | 332 | //Creating user 333 | if (_.isNull(mining_info?.userMining)) { 334 | await this.api.start_param(http_client); 335 | await this.api.create_mining_user(http_client); 336 | logger.info( 337 | `[${this.bot_name}] | ${this.session_name} | ✅ User created successfully. Restarting the process...` 338 | ); 339 | continue; 340 | } 341 | 342 | logger.info( 343 | `[${this.bot_name}] | ${this.session_name} | 💸 Balance: ${mining_info?.userMining?.gotAmount} | Earn per hour: ${mining_info?.userMining?.speed} | Mined: ${mining_info?.userMining?.miningAmount}` 344 | ); 345 | 346 | await sleep(2); 347 | 348 | if (settings.AUTO_MINE && mining_info?.userMining?.miningAmount > 0.1) { 349 | const claim_mining = await this.api.claim_mining(http_client); 350 | if (!_.isEmpty(claim_mining)) { 351 | logger.info( 352 | `[${this.bot_name}] | ${this.session_name} | ✅ Mining successfully claimed | Balance: ${claim_mining?.userMining?.gotAmount} (+${mining_info?.userMining?.miningAmount})` 353 | ); 354 | } 355 | mining_info = await this.api.get_mining_info(http_client); 356 | } 357 | } catch (error) { 358 | logger.error( 359 | `[${this.bot_name}] | ${this.session_name} | ❗️Unknown error: ${error}` 360 | ); 361 | } finally { 362 | let ran_sleep; 363 | if (_isArray(settings.SLEEP_BETWEEN_REQUESTS)) { 364 | if ( 365 | _.isInteger(settings.SLEEP_BETWEEN_REQUESTS[0]) && 366 | _.isInteger(settings.SLEEP_BETWEEN_REQUESTS[1]) 367 | ) { 368 | ran_sleep = _.random( 369 | settings.SLEEP_BETWEEN_REQUESTS[0], 370 | settings.SLEEP_BETWEEN_REQUESTS[1] 371 | ); 372 | } else { 373 | ran_sleep = _.random(450, 800); 374 | } 375 | } else if (_.isInteger(settings.SLEEP_BETWEEN_REQUESTS)) { 376 | const ran_add = _.random(20, 50); 377 | ran_sleep = settings.SLEEP_BETWEEN_REQUESTS + ran_add; 378 | } else { 379 | ran_sleep = _.random(450, 800); 380 | } 381 | 382 | logger.info( 383 | `[${this.bot_name}] | ${this.session_name} | Sleeping for ${ran_sleep} seconds...` 384 | ); 385 | await sleep(ran_sleep); 386 | } 387 | } 388 | } 389 | } 390 | module.exports = Tapper; 391 | -------------------------------------------------------------------------------- /bots/Major/bot/core/api.js: -------------------------------------------------------------------------------- 1 | const app = require("../config/app"); 2 | const logger = require("../../../../utils/logger"); 3 | var _ = require("lodash"); 4 | 5 | class ApiRequest { 6 | constructor(session_name, bot_name) { 7 | this.bot_name = bot_name; 8 | this.session_name = session_name; 9 | } 10 | 11 | async get_user_info(http_client, user_id) { 12 | try { 13 | const response = await http_client.get( 14 | `${app.apiUrl}/api/users/${user_id}/` 15 | ); 16 | return response?.data; 17 | } catch (error) { 18 | if (error?.response?.status >= 500 && error?.response?.status <= 599) { 19 | return null; 20 | } 21 | if (error?.response?.data?.message) { 22 | logger.warning( 23 | `[${this.bot_name}] | ${this.session_name} | ⚠️ Error while getting user info: ${error?.response?.data?.message}` 24 | ); 25 | } else { 26 | logger.error( 27 | `[${this.bot_name}] | ${this.session_name} | Error while getting user info: ${error.message}` 28 | ); 29 | } 30 | 31 | return null; 32 | } 33 | } 34 | 35 | async get_position(http_client, user_id) { 36 | try { 37 | const response = await http_client.get( 38 | `${app.apiUrl}/api/users/top/position/${user_id}/?` 39 | ); 40 | return response.data; 41 | } catch (error) { 42 | if (error?.response?.status >= 500 && error?.response?.status <= 599) { 43 | return null; 44 | } 45 | if (error?.response?.data?.message) { 46 | logger.warning( 47 | `[${this.bot_name}] | ${this.session_name} | ⚠️ Error while getting position:: ${error?.response?.data?.message}` 48 | ); 49 | } else { 50 | logger.error( 51 | `[${this.bot_name}] | ${this.session_name} | Error while getting position:: ${error.message}` 52 | ); 53 | } 54 | 55 | return null; 56 | } 57 | } 58 | 59 | async visit_streak(http_client) { 60 | try { 61 | const response = await http_client.get( 62 | `${app.apiUrl}/api/user-visits/streak/` 63 | ); 64 | return response.data; 65 | } catch (error) { 66 | if ( 67 | (error?.response?.status >= 500 && error?.response?.status <= 599) || 68 | error?.response?.status == 400 69 | ) { 70 | return null; 71 | } 72 | if (error?.response?.data?.message) { 73 | logger.warning( 74 | `[${this.bot_name}] | ${this.session_name} | ⚠️ Error while getting visit streak: ${error?.response?.data?.message}` 75 | ); 76 | } else { 77 | logger.error( 78 | `[${this.bot_name}] | ${this.session_name} | Error while getting visit streak: ${error.message}` 79 | ); 80 | } 81 | 82 | return null; 83 | } 84 | } 85 | 86 | async get_referrals(http_client) { 87 | try { 88 | const response = await http_client.get( 89 | `${app.apiUrl}/api/users/referrals/` 90 | ); 91 | return response.data; 92 | } catch (error) { 93 | if ( 94 | (error?.response?.status >= 500 && error?.response?.status <= 599) || 95 | error?.response?.status == 400 96 | ) { 97 | return null; 98 | } 99 | if (error?.response?.data?.message) { 100 | logger.warning( 101 | `[${this.bot_name}] | ${this.session_name} | ⚠️ Error while getting referrals: ${error?.response?.data?.message}` 102 | ); 103 | } else { 104 | logger.error( 105 | `[${this.bot_name}] | ${this.session_name} | Error while getting referrals: ${error.message}` 106 | ); 107 | } 108 | 109 | return null; 110 | } 111 | } 112 | 113 | async get_tasks(http_client, is_daily) { 114 | try { 115 | const response = await http_client.get( 116 | `${app.apiUrl}/api/tasks/?is_daily=${is_daily}` 117 | ); 118 | return response.data; 119 | } catch (error) { 120 | if ( 121 | (error?.response?.status >= 500 && error?.response?.status <= 599) || 122 | error?.response?.status == 400 123 | ) { 124 | return null; 125 | } 126 | if (error?.response?.data?.message) { 127 | logger.warning( 128 | `[${this.bot_name}] | ${this.session_name} | ⚠️ Error while getting tasks: ${error?.response?.data?.message}` 129 | ); 130 | } else { 131 | logger.error( 132 | `[${this.bot_name}] | ${this.session_name} | Error while getting tasks: ${error.message}` 133 | ); 134 | } 135 | 136 | return []; 137 | } 138 | } 139 | 140 | async get_bonus(http_client) { 141 | try { 142 | const response = await http_client.get( 143 | `${app.apiUrl}/api/bonuses/coins/` 144 | ); 145 | return response.data; 146 | } catch (error) { 147 | if ( 148 | (error?.response?.status >= 500 && error?.response?.status <= 599) || 149 | error?.response?.status == 400 150 | ) { 151 | return null; 152 | } 153 | 154 | if (error?.response?.data?.message) { 155 | logger.warning( 156 | `[${this.bot_name}] | ${this.session_name} | ⚠️ Error while getting bonus: ${error?.response?.data?.message}` 157 | ); 158 | } else { 159 | logger.error( 160 | `[${this.bot_name}] | ${this.session_name} | Error while getting bonus: ${error.message}` 161 | ); 162 | } 163 | 164 | return null; 165 | } 166 | } 167 | 168 | async get_roulette(http_client) { 169 | try { 170 | const response = await http_client.get(`${app.apiUrl}/api/roulette/`); 171 | return response.data; 172 | } catch (error) { 173 | if ( 174 | (error?.response?.status >= 500 && error?.response?.status <= 599) || 175 | error?.response?.status == 400 176 | ) { 177 | return null; 178 | } 179 | if (error?.response?.data?.message) { 180 | logger.warning( 181 | `[${this.bot_name}] | ${this.session_name} | ⚠️ Error while getting roulette: ${error?.response?.data?.message}` 182 | ); 183 | } else { 184 | logger.error( 185 | `[${this.bot_name}] | ${this.session_name} | Error while getting roulette: ${error.message}` 186 | ); 187 | } 188 | 189 | return null; 190 | } 191 | } 192 | 193 | async get_swipe(http_client) { 194 | try { 195 | const response = await http_client.get(`${app.apiUrl}/api/swipe_coin/`); 196 | return response.data; 197 | } catch (error) { 198 | if ( 199 | (error?.response?.status >= 500 && error?.response?.status <= 599) || 200 | error?.response?.status == 400 201 | ) { 202 | return error?.response?.status; 203 | } 204 | if (error?.response?.data?.message) { 205 | logger.warning( 206 | `[${this.bot_name}] | ${this.session_name} | ⚠️ Error while getting swipe: ${error?.response?.data?.message}` 207 | ); 208 | } else { 209 | logger.error( 210 | `[${this.bot_name}] | ${this.session_name} | Error while getting swipe: ${error.message}` 211 | ); 212 | } 213 | 214 | return null; 215 | } 216 | } 217 | 218 | async validate_query_id(http_client, data) { 219 | try { 220 | const response = await http_client.post( 221 | `${app.apiUrl}/api/auth/tg/`, 222 | JSON.stringify(data) 223 | ); 224 | 225 | if (!_.isEmpty(response?.data)) { 226 | return true; 227 | } 228 | return false; 229 | } catch (error) { 230 | if (error?.response?.status >= 500) { 231 | return "server"; 232 | } 233 | if ( 234 | error?.response?.data?.message 235 | ?.toLowerCase() 236 | ?.includes("invalid init data signature") || 237 | error?.response?.status == 401 238 | ) { 239 | return false; 240 | } 241 | 242 | throw error; 243 | } 244 | } 245 | 246 | async claim_visit(http_client) { 247 | try { 248 | const response = await http_client.post( 249 | `${app.apiUrl}/api/user-visits/visit/` 250 | ); 251 | return response.data; 252 | } catch (error) { 253 | if ( 254 | (error?.response?.status >= 500 && error?.response?.status <= 599) || 255 | error?.response?.status == 400 256 | ) { 257 | return null; 258 | } 259 | if (error?.response?.data?.message) { 260 | logger.warning( 261 | `[${this.bot_name}] | ${this.session_name} | ⚠️ Error while claiming visit: ${error?.response?.data?.message}` 262 | ); 263 | } else { 264 | logger.error( 265 | `[${this.bot_name}] | ${this.session_name} | Error while claiming visit: ${error.message}` 266 | ); 267 | } 268 | 269 | return null; 270 | } 271 | } 272 | 273 | async check_joined_major_channel(http_client) { 274 | try { 275 | const response = await http_client.post( 276 | `${app.apiUrl}/api/tasks/`, 277 | JSON.stringify({ task_id: 27 }) 278 | ); 279 | return response.data; 280 | } catch (error) { 281 | if (error?.response?.status == 400 && error?.response?.data?.detail) { 282 | return error?.response?.data; 283 | } 284 | 285 | if ( 286 | (error?.response?.status >= 500 && error?.response?.status <= 599) || 287 | error?.response?.status == 400 288 | ) { 289 | return null; 290 | } 291 | if (error?.response?.data?.message) { 292 | logger.warning( 293 | `[${this.bot_name}] | ${this.session_name} | ⚠️ Error while claiming visit: ${error?.response?.data?.message}` 294 | ); 295 | } else { 296 | logger.error( 297 | `[${this.bot_name}] | ${this.session_name} | Error while claiming visit: ${error.message}` 298 | ); 299 | } 300 | 301 | return null; 302 | } 303 | } 304 | 305 | async claim_task(http_client, data) { 306 | try { 307 | const response = await http_client.post( 308 | `${app.apiUrl}/api/tasks/`, 309 | JSON.stringify(data) 310 | ); 311 | return response.data; 312 | } catch (error) { 313 | if ( 314 | (error?.response?.status >= 500 && error?.response?.status <= 599) || 315 | error?.response?.status == 400 316 | ) { 317 | logger.warning( 318 | `[${this.bot_name}] | ${this.session_name} | Sever Error with ${this.bot_name} while claiming task. Retrying again...` 319 | ); 320 | 321 | return "Retry"; 322 | } 323 | if (error?.response?.status == 400 && error?.response?.data?.detail) { 324 | return error?.response?.data; 325 | } 326 | if (error?.response?.data?.message) { 327 | logger.warning( 328 | `[${this.bot_name}] | ${this.session_name} | ⚠️ Error while claiming task: ${error?.response?.data?.message}` 329 | ); 330 | } else { 331 | logger.error( 332 | `[${this.bot_name}] | ${this.session_name} | Error while claiming task: ${error.message}` 333 | ); 334 | } 335 | 336 | return null; 337 | } 338 | } 339 | 340 | async claim_bonus(http_client, data) { 341 | try { 342 | const response = await http_client.post( 343 | `${app.apiUrl}/api/bonuses/coins/`, 344 | JSON.stringify(data) 345 | ); 346 | return response.data; 347 | } catch (error) { 348 | if (error?.response?.status == 400 && error?.response?.data?.detail) { 349 | return error?.response?.data; 350 | } 351 | 352 | if ( 353 | (error?.response?.status >= 500 && error?.response?.status <= 599) || 354 | error?.response?.status == 400 355 | ) { 356 | return null; 357 | } 358 | if (error?.response?.data?.message) { 359 | logger.warning( 360 | `[${this.bot_name}] | ${this.session_name} | ⚠️ Error while claiming bonus: ${error?.response?.data?.message}` 361 | ); 362 | } else { 363 | logger.error( 364 | `[${this.bot_name}] | ${this.session_name} | Error while claiming bonus: ${error.message}` 365 | ); 366 | } 367 | 368 | return null; 369 | } 370 | } 371 | 372 | async claim_roulette(http_client) { 373 | try { 374 | const response = await http_client.post(`${app.apiUrl}/api/roulette/`); 375 | return response.data; 376 | } catch (error) { 377 | if (error?.response?.status == 400 && error?.response?.data?.detail) { 378 | return error?.response?.data; 379 | } 380 | if ( 381 | (error?.response?.status >= 500 && error?.response?.status <= 599) || 382 | error?.response?.status == 400 383 | ) { 384 | return null; 385 | } 386 | if (error?.response?.data?.message) { 387 | logger.warning( 388 | `[${this.bot_name}] | ${this.session_name} | ⚠️ Error while claiming roulette: ${error?.response?.data?.message}` 389 | ); 390 | } else { 391 | logger.error( 392 | `[${this.bot_name}] | ${this.session_name} | Error while claiming roulette: ${error.message}` 393 | ); 394 | } 395 | 396 | return null; 397 | } 398 | } 399 | 400 | async claim_swipe(http_client, coins) { 401 | try { 402 | const response = await http_client.post( 403 | `${app.apiUrl}/api/swipe_coin/`, 404 | JSON.stringify({ coins }) 405 | ); 406 | return response.data; 407 | } catch (error) { 408 | if (error?.response?.status == 400 && error?.response?.data?.detail) { 409 | return error?.response?.data; 410 | } 411 | if ( 412 | (error?.response?.status >= 500 && error?.response?.status <= 599) || 413 | error?.response?.status == 400 414 | ) { 415 | return null; 416 | } 417 | if (error?.response?.data?.message) { 418 | logger.warning( 419 | `[${this.bot_name}] | ${this.session_name} | ⚠️ Error while claiming swipe coin: ${error?.response?.data?.message}` 420 | ); 421 | } else { 422 | logger.error( 423 | `[${this.bot_name}] | ${this.session_name} | Error while claiming swipe coin: ${error.message}` 424 | ); 425 | } 426 | 427 | return null; 428 | } 429 | } 430 | } 431 | 432 | module.exports = ApiRequest; 433 | -------------------------------------------------------------------------------- /bots/RockyRabbit/bot/core/api.js: -------------------------------------------------------------------------------- 1 | const app = require("../config/app"); 2 | const logger = require("../../../../utils/logger"); 3 | const sleep = require("../../../../utils/sleep"); 4 | const _ = require("lodash"); 5 | 6 | class ApiRequest { 7 | constructor(session_name, bot_name) { 8 | this.bot_name = bot_name; 9 | this.session_name = session_name; 10 | } 11 | 12 | async get_user_data(http_client) { 13 | try { 14 | const response = await http_client.post( 15 | `${app.apiUrl}/api/v1/account/start` 16 | ); 17 | return response.data; 18 | } catch (error) { 19 | if (error?.response?.data?.message) { 20 | logger.error( 21 | `[${this.bot_name}] | ${this.session_name} | Error while getting User Data: ${error?.response?.data?.message}` 22 | ); 23 | } else { 24 | const regex = /ENOTFOUND\s([^\s]+)/; 25 | const match = error.message.match(regex); 26 | logger.error( 27 | `[${this.bot_name}] | ${ 28 | this.session_name 29 | } | Error while getting User Data: ${ 30 | error.message.includes("ENOTFOUND") || 31 | error.message.includes("getaddrinfo") || 32 | error.message.includes("ECONNREFUSED") 33 | ? `The proxy server at ${ 34 | match && match[1] ? match[1] : "unknown address" 35 | } could not be found. Please check the proxy address and your network connection` 36 | : error.message 37 | }` 38 | ); 39 | } 40 | await sleep(3); // Sleep for 3 seconds 41 | } 42 | } 43 | 44 | async validate_query_id(http_client) { 45 | try { 46 | const response = await http_client.post( 47 | `${app.apiUrl}/api/v1/account/start` 48 | ); 49 | if (!_.isEmpty(response?.data)) { 50 | return true; 51 | } 52 | return false; 53 | } catch (error) { 54 | if ( 55 | error?.response?.data?.message 56 | ?.toLowerCase() 57 | ?.includes("sign is missing") || 58 | error?.response?.status == 401 59 | ) { 60 | return false; 61 | } 62 | 63 | throw error; 64 | } 65 | } 66 | 67 | async init_account(http_client) { 68 | const genders = ["male", "female"]; 69 | const random = _.random(0, 1); 70 | try { 71 | const data = { 72 | lang: "en", 73 | sex: genders[random], 74 | }; 75 | const response = await http_client.post( 76 | `${app.apiUrl}/api/v1/account/init`, 77 | JSON.stringify(data) 78 | ); 79 | return response.data; 80 | } catch (error) { 81 | if (error?.response?.data?.message) { 82 | logger.warning( 83 | `[${this.bot_name}] | ${this.session_name} | Error while initting account: ${error?.response?.data?.message}` 84 | ); 85 | } else { 86 | logger.error( 87 | `[${this.bot_name}] | ${this.session_name} | Error while initting account: ${error.message}` 88 | ); 89 | } 90 | } 91 | } 92 | 93 | async sponsor(http_client) { 94 | try { 95 | const sponsors = [ 96 | "binance", 97 | "okx", 98 | "bybit", 99 | "solana", 100 | "arbitrum", 101 | "ton", 102 | "binance-chain", 103 | ]; 104 | const random = _.random(0, 6); 105 | const data = { 106 | sponsor: sponsors[random], 107 | }; 108 | 109 | const response = await http_client.post( 110 | `${app.apiUrl}/api/v1/account/sponsor`, 111 | JSON.stringify(data) 112 | ); 113 | return response.data; 114 | } catch (error) { 115 | if (error?.response?.data?.message) { 116 | logger.warning( 117 | `[${this.bot_name}] | ${this.session_name} | Error while setting sponsor: ${error?.response?.data?.message}` 118 | ); 119 | } else { 120 | logger.error( 121 | `[${this.bot_name}] | ${this.session_name} | Error while setting sponsor: ${error.message}` 122 | ); 123 | } 124 | } 125 | } 126 | 127 | async config(http_client) { 128 | try { 129 | const response = await http_client.post(`${app.apiUrl}/api/v1/config`); 130 | return response.data; 131 | } catch (error) { 132 | if (error?.response?.data?.message) { 133 | logger.warning( 134 | `[${this.bot_name}] | ${this.session_name} | Error while getting config: ${error?.response?.data?.message}` 135 | ); 136 | } else { 137 | logger.error( 138 | `[${this.bot_name}] | ${this.session_name} | Error while getting config: ${error.message}` 139 | ); 140 | } 141 | } 142 | } 143 | 144 | async get_daily_sync_info(http_client) { 145 | try { 146 | const response = await http_client.post( 147 | `${app.apiUrl}/api/v1/mine/sync/daily` 148 | ); 149 | return response.data; 150 | } catch (error) { 151 | if (error?.response?.data?.message) { 152 | logger.warning( 153 | `[${this.bot_name}] | ${this.session_name} | Error while getting daily sync info: ${error?.response?.data?.message}` 154 | ); 155 | } else { 156 | logger.error( 157 | `[${this.bot_name}] | ${this.session_name} | Error while getting daily sync info: ${error.message}` 158 | ); 159 | } 160 | } 161 | } 162 | 163 | // start here tomorrow 164 | async tasks(http_client) { 165 | try { 166 | const response = await http_client.post(`${app.apiUrl}/api/v1/task/list`); 167 | return response.data; 168 | } catch (error) { 169 | if (error?.response?.data?.message) { 170 | logger.warning( 171 | `[${this.bot_name}] | ${this.session_name} | Error while getting tasks: ${error?.response?.data?.message}` 172 | ); 173 | } else { 174 | logger.error( 175 | `[${this.bot_name}] | ${this.session_name} | Error while getting tasks: ${error.message}` 176 | ); 177 | } 178 | } 179 | } 180 | 181 | async play_enigma(http_client, data) { 182 | try { 183 | const response = await http_client.post( 184 | `${app.apiUrl}/api/v1/mine/enigma`, 185 | JSON.stringify(data) 186 | ); 187 | return response.data; 188 | } catch (error) { 189 | if (error?.response?.data?.message) { 190 | logger.warning( 191 | `[${this.bot_name}] | ${this.session_name} | Error while playing enigma: ${error?.response?.data?.message}` 192 | ); 193 | } else { 194 | logger.error( 195 | `[${this.bot_name}] | ${this.session_name} | Error while playing enigma: ${error.message}` 196 | ); 197 | } 198 | } 199 | } 200 | 201 | async play_combo(http_client, data) { 202 | try { 203 | const response = await http_client.post( 204 | `${app.apiUrl}/api/v1/mine/combo`, 205 | JSON.stringify(data) 206 | ); 207 | return response.data; 208 | } catch (error) { 209 | if (error?.response?.data?.message) { 210 | logger.warning( 211 | `[${this.bot_name}] | ${this.session_name} | Error while playing combo ${error?.response?.data?.message}` 212 | ); 213 | } else { 214 | logger.error( 215 | `[${this.bot_name}] | ${this.session_name} | Error while playing combo: ${error.message}` 216 | ); 217 | } 218 | } 219 | } 220 | 221 | async play_easter(http_client, data) { 222 | try { 223 | const response = await http_client.post( 224 | `${app.apiUrl}/api/v1/mine/easter-eggs`, 225 | JSON.stringify(data) 226 | ); 227 | return response.data; 228 | } catch (error) { 229 | if (error?.response?.data?.message) { 230 | logger.warning( 231 | `[${this.bot_name}] | ${this.session_name} | Error while playing easter egg: ${error?.response?.data?.message}` 232 | ); 233 | } else { 234 | logger.error( 235 | `[${this.bot_name}] | ${this.session_name} | Error while playing easter egg: ${error.message}` 236 | ); 237 | } 238 | } 239 | } 240 | 241 | async get_boosts(http_client) { 242 | try { 243 | const response = await http_client.post( 244 | `${app.apiUrl}/api/v1/boosts/list` 245 | ); 246 | return response.data; 247 | } catch (error) { 248 | if (error?.response?.data?.message) { 249 | logger.warning( 250 | `[${this.bot_name}] | ${this.session_name} | Error while getting boosts: ${error?.response?.data?.message}` 251 | ); 252 | } else { 253 | logger.error( 254 | `[${this.bot_name}] | ${this.session_name} | Error while getting boosts: ${error.message}` 255 | ); 256 | } 257 | } 258 | } 259 | 260 | async upgrade_boost(http_client, data) { 261 | try { 262 | const response = await http_client.post( 263 | `${app.apiUrl}/api/v1/boosts`, 264 | JSON.stringify(data) 265 | ); 266 | return response.data; 267 | } catch (error) { 268 | if ( 269 | error?.response?.data?.message && 270 | error?.response?.data?.message.includes("not available") 271 | ) { 272 | return "not_available"; 273 | } 274 | 275 | if ( 276 | error?.response?.data?.message && 277 | error?.response?.data?.message.includes("exceeded") 278 | ) { 279 | return "exceeded"; 280 | } 281 | 282 | if (error?.response?.data?.message) { 283 | logger.warning( 284 | `[${this.bot_name}] | ${this.session_name} | Error while upgrading boosts ${error?.response?.data?.message}` 285 | ); 286 | } else { 287 | logger.error( 288 | `[${this.bot_name}] | ${this.session_name} | Error while upgrading boosts: ${error.message}` 289 | ); 290 | } 291 | } 292 | } 293 | 294 | async claim_task(http_client, data) { 295 | try { 296 | const response = await http_client.post( 297 | `${app.apiUrl}/api/v1/task/upgrade`, 298 | JSON.stringify(data) 299 | ); 300 | return response.data; 301 | } catch (error) { 302 | if (error?.response?.data?.message) { 303 | logger.warning( 304 | `[${this.bot_name}] | ${this.session_name} | Error while claiming task ${error?.response?.data?.message}` 305 | ); 306 | } else { 307 | logger.error( 308 | `[${this.bot_name}] | ${this.session_name} | Error while claiming task: ${error.message}` 309 | ); 310 | } 311 | } 312 | } 313 | 314 | async upgrade_cards(http_client, data) { 315 | try { 316 | const response = await http_client.post( 317 | `${app.apiUrl}/api/v1/mine/upgrade`, 318 | JSON.stringify(data) 319 | ); 320 | return response.data; 321 | } catch (error) { 322 | if ( 323 | error?.response?.data?.message && 324 | error?.response?.data?.message.includes("insufficient") 325 | ) { 326 | return "insufficient"; 327 | } else if (error?.response?.data?.message) { 328 | logger.warning( 329 | `[${this.bot_name}] | ${this.session_name} | Error while upgrading cards ${error?.response?.data?.message}` 330 | ); 331 | } else { 332 | logger.error( 333 | `[${this.bot_name}] | ${this.session_name} | Error while upgrading cards: ${error.message}` 334 | ); 335 | } 336 | } 337 | } 338 | 339 | async taps(http_client, data) { 340 | try { 341 | const response = await http_client.post( 342 | `${app.apiUrl}/api/v1/clicker/tap`, 343 | JSON.stringify(data) 344 | ); 345 | return response.data; 346 | } catch (error) { 347 | if (error?.response?.data?.message) { 348 | logger.warning( 349 | `[${this.bot_name}] | ${this.session_name} | Error while tapping ${error?.response?.data?.message}` 350 | ); 351 | } else { 352 | logger.error( 353 | `[${this.bot_name}] | ${this.session_name} | Error while tapping: ${error.message}` 354 | ); 355 | } 356 | } 357 | } 358 | 359 | async daily_reward(http_client) { 360 | try { 361 | const response = await http_client.post( 362 | `${app.apiUrl}/api/v1/task/upgrade`, 363 | JSON.stringify({ 364 | taskId: "streak_days_reward", 365 | timezone: "Africa/Accra", 366 | }) 367 | ); 368 | return response.data; 369 | } catch (error) { 370 | if ( 371 | error?.response?.data?.message && 372 | error?.response?.data?.message.includes( 373 | "you_are_not_subscribe_to_channel" 374 | ) 375 | ) { 376 | return "not_subscribed"; 377 | } else if ( 378 | error?.response?.data?.message && 379 | error?.response?.data?.message.includes("comeback") 380 | ) { 381 | return "claimed"; 382 | } else if (error?.response?.data?.message) { 383 | logger.warning( 384 | `[${this.bot_name}] | ${this.session_name} | Error while claiming daily reward ${error?.response?.data?.message}` 385 | ); 386 | return "claimed"; 387 | } else { 388 | logger.error( 389 | `[${this.bot_name}] | ${this.session_name} | Error while claiming daily reward: ${error.message}` 390 | ); 391 | return null; 392 | } 393 | } 394 | } 395 | 396 | async get_combo_data(http_client) { 397 | try { 398 | const response = await http_client.get(`${app.comboApi}`); 399 | return response.data; 400 | } catch (error) { 401 | if (error?.response?.data?.message) { 402 | logger.warning( 403 | `[${this.bot_name}] | ${this.session_name} | Error while tapping ${error?.response?.data?.message}` 404 | ); 405 | } else { 406 | logger.error( 407 | `[${this.bot_name}] | ${this.session_name} | Error while tapping: ${error.message}` 408 | ); 409 | } 410 | } 411 | } 412 | 413 | async mine_sync(http_client) { 414 | try { 415 | const response = await http_client.post(`${app.apiUrl}/api/v1/mine/sync`); 416 | return response.data; 417 | } catch (error) { 418 | if (error?.response?.data?.message) { 419 | logger.warning( 420 | `[${this.bot_name}] | ${this.session_name} | Error while getting mine sync ${error?.response?.data?.message}` 421 | ); 422 | } else { 423 | logger.error( 424 | `[${this.bot_name}] | ${this.session_name} | Error while getting mine sync: ${error.message}` 425 | ); 426 | } 427 | } 428 | } 429 | } 430 | 431 | module.exports = ApiRequest; 432 | -------------------------------------------------------------------------------- /bots/Major/bot/core/nonSessionTapper.js: -------------------------------------------------------------------------------- 1 | const { default: axios } = require("axios"); 2 | const logger = require("../../../../utils/logger"); 3 | const headers = require("./header"); 4 | const settings = require("../config/config"); 5 | const app = require("../config/app"); 6 | const user_agents = require("../../../../utils/userAgents"); 7 | const fs = require("fs"); 8 | const sleep = require("../../../../utils/sleep"); 9 | const ApiRequest = require("./api"); 10 | var _ = require("lodash"); 11 | const path = require("path"); 12 | const parser = require("../../../../utils/parser"); 13 | const taskFilter = require("../utils/taskFilter"); 14 | const _isArray = require("../../../../utils/_isArray"); 15 | const { HttpsProxyAgent } = require("https-proxy-agent"); 16 | const Fetchers = require("../utils/fetchers"); 17 | 18 | class NonSessionTapper { 19 | constructor(query_id, query_name, bot_name) { 20 | this.bot_name = bot_name; 21 | this.session_name = query_name; 22 | this.query_id = query_id; 23 | this.session_user_agents = this.#load_session_data(); 24 | this.headers = { ...headers, "user-agent": this.#get_user_agent() }; 25 | this.api = new ApiRequest(this.session_name, this.bot_name); 26 | } 27 | 28 | #load_session_data() { 29 | try { 30 | const filePath = path.join(process.cwd(), "session_user_agents.json"); 31 | const data = fs.readFileSync(filePath, "utf8"); 32 | return JSON.parse(data); 33 | } catch (error) { 34 | if (error.code === "ENOENT") { 35 | return {}; 36 | } else { 37 | throw error; 38 | } 39 | } 40 | } 41 | 42 | #get_random_user_agent() { 43 | const randomIndex = Math.floor(Math.random() * user_agents.length); 44 | return user_agents[randomIndex]; 45 | } 46 | 47 | #get_user_agent() { 48 | if (this.session_user_agents[this.session_name]) { 49 | return this.session_user_agents[this.session_name]; 50 | } 51 | 52 | logger.info( 53 | `[${this.bot_name}] | ${this.session_name} | Generating new user agent...` 54 | ); 55 | const newUserAgent = this.#get_random_user_agent(); 56 | this.session_user_agents[this.session_name] = newUserAgent; 57 | this.#save_session_data(this.session_user_agents); 58 | return newUserAgent; 59 | } 60 | 61 | #save_session_data(session_user_agents) { 62 | const filePath = path.join(process.cwd(), "session_user_agents.json"); 63 | fs.writeFileSync(filePath, JSON.stringify(session_user_agents, null, 2)); 64 | } 65 | 66 | #proxy_agent(proxy) { 67 | try { 68 | if (!proxy) return null; 69 | let proxy_url; 70 | if (!proxy.password && !proxy.username) { 71 | proxy_url = `${proxy.protocol}://${proxy.ip}:${proxy.port}`; 72 | } else { 73 | proxy_url = `${proxy.protocol}://${proxy.username}:${proxy.password}@${proxy.ip}:${proxy.port}`; 74 | } 75 | return new HttpsProxyAgent(proxy_url); 76 | } catch (e) { 77 | logger.error( 78 | `[${this.bot_name}] | ${ 79 | this.session_name 80 | } | Proxy agent error: ${e}\nProxy: ${JSON.stringify(proxy, null, 2)}` 81 | ); 82 | return null; 83 | } 84 | } 85 | 86 | async #get_tg_web_data() { 87 | try { 88 | const json = { 89 | init_data: this.query_id, 90 | }; 91 | return json; 92 | } catch (error) { 93 | logger.error( 94 | `[${this.bot_name}] | ${this.session_name} | ❗️Unknown error during Authorization: ${error}` 95 | ); 96 | throw error; 97 | } finally { 98 | await sleep(1); 99 | logger.info( 100 | `[${this.bot_name}] | ${this.session_name} | 🚀 Starting session...` 101 | ); 102 | } 103 | } 104 | 105 | async #get_access_token(tgWebData, http_client) { 106 | try { 107 | const response = await http_client.post( 108 | `${app.apiUrl}/api/auth/tg/`, 109 | JSON.stringify(tgWebData) 110 | ); 111 | 112 | return response.data; 113 | } catch (error) { 114 | logger.error( 115 | `[${this.bot_name}] | ${this.session_name} | ❗️Unknown error while getting Access Token: ${error}` 116 | ); 117 | await sleep(3); // 3 seconds delay 118 | } 119 | } 120 | 121 | async #check_proxy(http_client, proxy) { 122 | try { 123 | const response = await http_client.get("https://httpbin.org/ip"); 124 | const ip = response.data.origin; 125 | logger.info( 126 | `[${this.bot_name}] | ${this.session_name} | Proxy IP: ${ip}` 127 | ); 128 | } catch (error) { 129 | if ( 130 | error.message.includes("ENOTFOUND") || 131 | error.message.includes("getaddrinfo") || 132 | error.message.includes("ECONNREFUSED") 133 | ) { 134 | logger.error( 135 | `[${this.bot_name}] | ${this.session_name} | Error: Unable to resolve the proxy address. The proxy server at ${proxy.ip}:${proxy.port} could not be found. Please check the proxy address and your network connection.` 136 | ); 137 | logger.error( 138 | `[${this.bot_name}] | ${this.session_name} | No proxy will be used.` 139 | ); 140 | } else { 141 | logger.error( 142 | `[${this.bot_name}] | ${this.session_name} | Proxy: ${proxy.ip}:${proxy.port} | Error: ${error.message}` 143 | ); 144 | } 145 | 146 | return false; 147 | } 148 | } 149 | 150 | async run(proxy) { 151 | let http_client; 152 | let access_token_created_time = 0; 153 | 154 | let profile_data; 155 | let position; 156 | let parsed_tg_web_data; 157 | let tasks; 158 | let tasks_daily; 159 | let sleep_swipe = 0; 160 | let sleep_hold_to_earn = 0; 161 | let sleep_roulette = 0; 162 | let sleep_reward = 0; 163 | let access_token; 164 | 165 | if (settings.USE_PROXY_FROM_FILE && proxy) { 166 | http_client = axios.create({ 167 | httpsAgent: this.#proxy_agent(proxy), 168 | headers: this.headers, 169 | withCredentials: true, 170 | }); 171 | const proxy_result = await this.#check_proxy(http_client, proxy); 172 | if (!proxy_result) { 173 | http_client = axios.create({ 174 | headers: this.headers, 175 | withCredentials: true, 176 | }); 177 | } 178 | } else { 179 | http_client = axios.create({ 180 | headers: this.headers, 181 | withCredentials: true, 182 | }); 183 | } 184 | while (true) { 185 | try { 186 | const currentTime = _.floor(Date.now() / 1000); 187 | if (currentTime - access_token_created_time >= 1800) { 188 | const tg_web_data = await this.#get_tg_web_data(); 189 | access_token = await this.#get_access_token(tg_web_data, http_client); 190 | http_client.defaults.headers["authorization"] = `${ 191 | access_token?.token_type ? access_token?.token_type : "Bearer" 192 | } ${access_token?.access_token}`; 193 | 194 | parsed_tg_web_data = parser.toJson(tg_web_data.init_data); 195 | access_token_created_time = currentTime; 196 | await sleep(2); 197 | } 198 | if (_.isEmpty(parsed_tg_web_data) || !parsed_tg_web_data?.user?.id) { 199 | access_token_created_time = 0; 200 | continue; 201 | } 202 | 203 | profile_data = await this.api.get_user_info( 204 | http_client, 205 | parsed_tg_web_data?.user?.id 206 | ); 207 | 208 | tasks = await this.api.get_tasks(http_client, false); 209 | tasks_daily = await this.api.get_tasks(http_client, true); 210 | /*referrals = await this.api.get_referrals(http_client); 211 | */ 212 | position = await this.api.get_position( 213 | http_client, 214 | parsed_tg_web_data?.user?.id 215 | ); 216 | if (_.isEmpty(profile_data)) { 217 | access_token_created_time = 0; 218 | continue; 219 | } 220 | 221 | if (!_.isEmpty(position)) { 222 | logger.info( 223 | `[${this.bot_name}] | ${this.session_name} | 👷 You current position: ${position?.position} | 💲 Balance: ${profile_data?.rating}` 224 | ); 225 | } 226 | await sleep(2); 227 | 228 | if (settings.CLAIM_DAILY_REWARDS && sleep_reward < currentTime) { 229 | const check_joined_major_channel = 230 | await this.api.check_joined_major_channel(http_client); 231 | 232 | if ( 233 | !_.isEmpty(check_joined_major_channel) && 234 | check_joined_major_channel?.is_completed == false && 235 | check_joined_major_channel?.task_id == 27 236 | ) { 237 | logger.info( 238 | `[${this.bot_name}] | ${this.session_name} | Join Major Channel before daily reward can be claimed` 239 | ); 240 | } else { 241 | const daily_reward = await this.api.claim_visit(http_client); 242 | if (daily_reward?.is_increased == true) { 243 | logger.info( 244 | `[${this.bot_name}] | ${this.session_name} | 🎉 Daily Reward claimed successfully | Streak: ${daily_reward?.streak}` 245 | ); 246 | } 247 | 248 | sleep_reward = _.floor(Date.now() / 1000) + 43200; 249 | await sleep(2); 250 | } 251 | } 252 | 253 | if (settings.AUTO_CLAIM_TASKS) { 254 | const daily = taskFilter(tasks_daily, ["stories", "without_check"]); 255 | if (daily.length > 0) { 256 | for (let i = 0; i < daily.length; i++) { 257 | logger.info( 258 | `[${this.bot_name}] | ${this.session_name} | Sleep 10 seconds before claiming task ${daily[i].title}` 259 | ); 260 | await sleep(10); 261 | const data = { 262 | task_id: daily[i].id, 263 | }; 264 | const result = await this.api.claim_task(http_client, data); 265 | if (result?.is_completed) { 266 | logger.info( 267 | `[${this.bot_name}] | ${this.session_name} | ✅ Claimed task ${daily[i].title}` 268 | ); 269 | } 270 | } 271 | } 272 | 273 | const nonDaily = taskFilter(tasks, "without_check"); 274 | if (nonDaily.length > 0) { 275 | for (let i = 0; i < nonDaily.length; i++) { 276 | logger.info( 277 | `[${this.bot_name}] | ${this.session_name} | Sleep 10 seconds before claiming task ${nonDaily[i].title}` 278 | ); 279 | await sleep(10); 280 | const data = { 281 | task_id: nonDaily[i].id, 282 | }; 283 | const result = await this.api.claim_task(http_client, data); 284 | if ( 285 | typeof result === "string" && 286 | result?.toLowerCase()?.includes("retry") 287 | ) { 288 | i--; 289 | continue; 290 | } 291 | if (result?.is_completed) { 292 | logger.info( 293 | `[${this.bot_name}] | ${this.session_name} | ✅ Claimed task ${nonDaily[i].title}` 294 | ); 295 | } 296 | } 297 | } 298 | await sleep(2); 299 | } 300 | 301 | if (settings.AUTO_PLAY_ROULETTE && sleep_roulette < currentTime) { 302 | const get_roulette = await this.api.get_roulette(http_client); 303 | if (!_.isEmpty(get_roulette) && get_roulette?.success == true) { 304 | const result = await this.api.claim_roulette(http_client); 305 | logger.info( 306 | `[${this.bot_name}] | ${this.session_name} | 🎰 Roulette claimed successfully | Reward: ${result?.rating_award}` 307 | ); 308 | sleep_roulette = _.floor(Date.now() / 1000) + 28820; 309 | } else if (!_.isEmpty(get_roulette?.detail)) { 310 | sleep_roulette = get_roulette?.detail?.blocked_until + 10; 311 | } 312 | 313 | await sleep(2); 314 | } 315 | 316 | if ( 317 | settings.AUTO_PLAY_HOLD_TO_EARN && 318 | sleep_hold_to_earn < currentTime 319 | ) { 320 | const data = { 321 | coins: _.random(700, 820), 322 | }; 323 | const get_bonus = await this.api.get_bonus(http_client); 324 | if (!_.isEmpty(get_bonus) && get_bonus?.success == true) { 325 | const result = await this.api.claim_bonus(http_client, data); 326 | if (!_.isEmpty(result) && result?.success == true) { 327 | logger.info( 328 | `[${this.bot_name}] | ${this.session_name} | 💰 Hold to earn claimed successfully | Reward: ${data?.coins}` 329 | ); 330 | } 331 | sleep_hold_to_earn = _.floor(Date.now() / 1000) + 28820; 332 | } else if (!_.isEmpty(get_bonus?.detail)) { 333 | sleep_hold_to_earn = get_bonus?.detail?.blocked_until + 10; 334 | } 335 | 336 | await sleep(2); 337 | } 338 | 339 | if (settings.AUTO_PLAY_SWIPE_COIN && sleep_swipe < currentTime) { 340 | const coins = _.random(200, 300); 341 | const get_swipe = await this.api.get_swipe(http_client); 342 | if (!_.isEmpty(get_swipe) && get_swipe?.success == true) { 343 | const result = await this.api.claim_swipe(http_client, coins); 344 | if (!_.isEmpty(result) && result?.success == true) { 345 | logger.info( 346 | `[${this.bot_name}] | ${this.session_name} | 💰 Swipe coin claimed successfully | Reward: ${coins}` 347 | ); 348 | } 349 | sleep_swipe = _.floor(Date.now() / 1000) + 28820; 350 | } else if (!_.isEmpty(get_swipe?.detail)) { 351 | sleep_swipe = get_swipe?.detail?.blocked_until + 10; 352 | } 353 | 354 | await sleep(2); 355 | } 356 | } catch (error) { 357 | logger.error( 358 | `[${this.bot_name}] | ${this.session_name} | ❗️Unknown error: ${error}` 359 | ); 360 | } finally { 361 | let ran_sleep; 362 | if (_isArray(settings.SLEEP_BETWEEN_REQUESTS)) { 363 | if ( 364 | _.isInteger(settings.SLEEP_BETWEEN_REQUESTS[0]) && 365 | _.isInteger(settings.SLEEP_BETWEEN_REQUESTS[1]) 366 | ) { 367 | ran_sleep = _.random( 368 | settings.SLEEP_BETWEEN_REQUESTS[0], 369 | settings.SLEEP_BETWEEN_REQUESTS[1] 370 | ); 371 | } else { 372 | ran_sleep = _.random(450, 800); 373 | } 374 | } else if (_.isInteger(settings.SLEEP_BETWEEN_REQUESTS)) { 375 | const ran_add = _.random(20, 50); 376 | ran_sleep = settings.SLEEP_BETWEEN_REQUESTS + ran_add; 377 | } else { 378 | ran_sleep = _.random(450, 800); 379 | } 380 | 381 | logger.info( 382 | `[${this.bot_name}] | ${this.session_name} | Sleeping for ${ran_sleep} seconds...` 383 | ); 384 | await sleep(ran_sleep); 385 | } 386 | } 387 | } 388 | } 389 | module.exports = NonSessionTapper; 390 | --------------------------------------------------------------------------------