From 87adfab706203496a6f2feb96c4ee488090db5b5 Mon Sep 17 00:00:00 2001 From: jamz-uk <222520099+jamz-uk@users.noreply.github.com> Date: Wed, 13 Aug 2025 17:05:52 +0100 Subject: [PATCH 1/8] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 799a606..86c47d8 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ This project was fork from https://github.com/DarkModde/WPlace-AutoBOT
-### πŸŽ―β”ƒAuto-Farm (NOT WORKING 🚫) +### πŸŽ―β”ƒAuto-Farm ```js javascript:fetch("https://raw.githubusercontent.com/Wplace-AutoBot/WPlace-AutoBOT/refs/heads/main/Auto-Farm.js").then(t=>t.text()).then(eval); From 44e64f64510b598a6ddc4090a24044d2f45a5748 Mon Sep 17 00:00:00 2001 From: jamz-uk <222520099+jamz-uk@users.noreply.github.com> Date: Wed, 13 Aug 2025 17:26:49 +0100 Subject: [PATCH 2/8] Update Auto-Farm.js --- Auto-Farm.js | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/Auto-Farm.js b/Auto-Farm.js index eee7317..723fa7e 100644 --- a/Auto-Farm.js +++ b/Auto-Farm.js @@ -30,7 +30,7 @@ const originalFetch = window.fetch; let capturedCaptchaToken = null; - let stoppedForToken = false; + let stoppedForToken = false; // flag for auto-resume window.fetch = async (url, options = {}) => { if (typeof url === 'string' && url.includes('https://backend.wplace.live/s0/pixel/')) { try { @@ -38,7 +38,8 @@ if (payload.t) { console.log('βœ… CAPTCHA Token Captured:', payload.t); capturedCaptchaToken = payload.t; - stoppedForToken = false; + stoppedForToken = false; // Clear stopped flag on new token capture + // Auto-resume if stopped due to token expiry if (stoppedForToken) { stoppedForToken = false; state.running = true; @@ -48,6 +49,7 @@ ); paintLoop(); } + // new token captured } } catch (e) { } @@ -85,9 +87,9 @@ }); if (res.status === 403) { console.error('❌ 403 Forbidden. CAPTCHA token might be invalid or expired.'); - capturedCaptchaToken = null; + capturedCaptchaToken = null; // Invalidate our stored token. stoppedForToken = true; - return 'token_error'; + return 'token_error'; // Return a special status to stop the bot. } const data = await res.json(); return data; @@ -141,23 +143,23 @@ const randomPos = getRandomPosition(); const paintResult = await paintPixel(randomPos.x, randomPos.y); + // If token expired or invalid, stop the loop if (paintResult === 'token_error') { updateUI( state.language === 'pt' - ? '❌ Token expirado. Clique em qualquer pixel para obter novo token.' - : '❌ CAPTCHA token expired. Click any pixel to obtain a new token.', + ? '❌ Token expirado! Tentando recapturar automaticamente...' + : '❌ CAPTCHA token expired! Attempting auto-refresh...', 'error' ); - while (!capturedCaptchaToken && state.running) { - await sleep(500); - } - // Resume painting - updateUI( - state.language === 'pt' - ? 'πŸš€ Token capturado! Reiniciando auto-farm...' - : 'πŸš€ Token captured! Resuming auto-farm...', - 'success' - ); + // Auto-click sequence to trigger CAPTCHA refresh + document.querySelector('div.flex.items-center.gap-2')?.click(); + document.querySelector('#color-0')?.click(); + // Click center of viewport + const cx = window.innerWidth / 2; + const cy = window.innerHeight / 2; + document.elementFromPoint(cx, cy)?.click(); + // Click confirm paint button + document.querySelector('div.absolute.bottom-0.left-1\\/2 button.btn.btn-primary')?.click(); continue; } @@ -454,6 +456,7 @@ toggleBtn.innerHTML = ` ${t.start}`; toggleBtn.classList.add('wplace-btn-primary'); toggleBtn.classList.remove('wplace-btn-stop'); + // Clear previous stats and show stopped message statsArea.innerHTML = ''; updateUI(state.language === 'pt' ? '⏹️ Parado' : '⏹️ Stopped', 'default'); } From 78c7e9b7673e5be81ae13ea81e38584dc7d41c70 Mon Sep 17 00:00:00 2001 From: jamz-uk <222520099+jamz-uk@users.noreply.github.com> Date: Wed, 13 Aug 2025 17:30:53 +0100 Subject: [PATCH 3/8] Update Auto-Farm.js --- Auto-Farm.js | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/Auto-Farm.js b/Auto-Farm.js index 723fa7e..931e165 100644 --- a/Auto-Farm.js +++ b/Auto-Farm.js @@ -27,6 +27,16 @@ }; const sleep = ms => new Promise(r => setTimeout(r, ms)); + // Utility to wait for a selector to appear in the DOM + const waitForSelector = async (selector, interval = 200, timeout = 5000) => { + const start = Date.now(); + while (Date.now() - start < timeout) { + const el = document.querySelector(selector); + if (el) return el; + await sleep(interval); + } + return null; + }; const originalFetch = window.fetch; let capturedCaptchaToken = null; @@ -152,15 +162,19 @@ 'error' ); // Auto-click sequence to trigger CAPTCHA refresh - document.querySelector('div.flex.items-center.gap-2')?.click(); - document.querySelector('#color-0')?.click(); - // Click center of viewport - const cx = window.innerWidth / 2; - const cy = window.innerHeight / 2; - document.elementFromPoint(cx, cy)?.click(); - // Click confirm paint button - document.querySelector('div.absolute.bottom-0.left-1\\/2 button.btn.btn-primary')?.click(); - continue; + // Auto-click sequence with waits for element availability + const paintBtn = await waitForSelector('div.flex.items-center.gap-2'); + paintBtn?.click(); + const transBtn = await waitForSelector('#color-0'); + transBtn?.click(); + await sleep(500); + const cx = window.innerWidth / 2; + const cy = window.innerHeight / 2; + const centerEl = document.elementFromPoint(cx, cy); + centerEl?.click(); + const confirmBtn = await waitForSelector('div.absolute.bottom-0.left-1\\/2 button.btn.btn-primary'); + confirmBtn?.click(); + continue; } if (paintResult?.painted === 1) { From b5ab79c099fb4f88f0720cdc739ec3d3624ab4d4 Mon Sep 17 00:00:00 2001 From: jamz-uk <222520099+jamz-uk@users.noreply.github.com> Date: Wed, 13 Aug 2025 17:34:31 +0100 Subject: [PATCH 4/8] Update Auto-Farm.js --- Auto-Farm.js | 51 +++++++++++++++++++++++++++++++++++---------------- 1 file changed, 35 insertions(+), 16 deletions(-) diff --git a/Auto-Farm.js b/Auto-Farm.js index 931e165..62dd716 100644 --- a/Auto-Farm.js +++ b/Auto-Farm.js @@ -157,24 +157,43 @@ if (paintResult === 'token_error') { updateUI( state.language === 'pt' - ? '❌ Token expirado! Tentando recapturar automaticamente...' - : '❌ CAPTCHA token expired! Attempting auto-refresh...', + ? '❌ Token expirado. Aguardando elemento Paint...' + : '❌ CAPTCHA token expired. Waiting for Paint button...', 'error' ); - // Auto-click sequence to trigger CAPTCHA refresh - // Auto-click sequence with waits for element availability - const paintBtn = await waitForSelector('div.flex.items-center.gap-2'); - paintBtn?.click(); - const transBtn = await waitForSelector('#color-0'); - transBtn?.click(); - await sleep(500); - const cx = window.innerWidth / 2; - const cy = window.innerHeight / 2; - const centerEl = document.elementFromPoint(cx, cy); - centerEl?.click(); - const confirmBtn = await waitForSelector('div.absolute.bottom-0.left-1\\/2 button.btn.btn-primary'); - confirmBtn?.click(); - continue; + // Click the Paint div to trigger CAPTCHA + const paintDiv = await waitForSelector('div.flex.items-center.gap-2'); + if (paintDiv) paintDiv.click(); + await sleep(500); + // Click transparent color button + updateUI( + state.language === 'pt' ? 'Selecionando transparente...' : 'Selecting transparent...', + 'status' + ); + const transBtn = await waitForSelector('button#color-0'); + if (transBtn) transBtn.click(); + await sleep(500); + // Click center pixel on canvas + const canvas = await waitForSelector('canvas'); + if (canvas) { + const rect = canvas.getBoundingClientRect(); + const evt = new MouseEvent('click', { + clientX: rect.left + rect.width/2, + clientY: rect.top + rect.height/2, + bubbles: true + }); + canvas.dispatchEvent(evt); + } + await sleep(500); + // Click confirm Paint button + updateUI( + state.language === 'pt' ? 'Confirmando pintura...' : 'Confirming paint...', + 'status' + ); + const confirmBtn = await waitForSelector('div.absolute.bottom-0.left-1\\/2 button.btn.btn-primary.btn-lg, div.absolute.bottom-0.left-1\\/2 button.btn.btn-primary.sm\\:btn-xl'); + if (confirmBtn) confirmBtn.click(); + await sleep(1000); + continue; } if (paintResult?.painted === 1) { From 1f3d72f92f66dbdbef26135c673b00775aeff1f6 Mon Sep 17 00:00:00 2001 From: jamz-uk <222520099+jamz-uk@users.noreply.github.com> Date: Wed, 13 Aug 2025 17:36:56 +0100 Subject: [PATCH 5/8] Update Auto-Farm.js --- Auto-Farm.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Auto-Farm.js b/Auto-Farm.js index 62dd716..030f44b 100644 --- a/Auto-Farm.js +++ b/Auto-Farm.js @@ -190,8 +190,12 @@ state.language === 'pt' ? 'Confirmando pintura...' : 'Confirming paint...', 'status' ); - const confirmBtn = await waitForSelector('div.absolute.bottom-0.left-1\\/2 button.btn.btn-primary.btn-lg, div.absolute.bottom-0.left-1\\/2 button.btn.btn-primary.sm\\:btn-xl'); - if (confirmBtn) confirmBtn.click(); + // Try clicking the confirm Paint button inside its container + const confirmContainer = await waitForSelector('div.absolute.bottom-0.left-1\\/2'); + if (confirmContainer) { + const confirmBtn = confirmContainer.querySelector('button.btn-primary.btn-lg, button.btn-primary.sm\\:btn-xl'); + confirmBtn?.click(); + } await sleep(1000); continue; } From 7d4847b069bf878241e284ae099e95e9365960c2 Mon Sep 17 00:00:00 2001 From: jamz-uk <222520099+jamz-uk@users.noreply.github.com> Date: Wed, 13 Aug 2025 17:40:05 +0100 Subject: [PATCH 6/8] Update Auto-Farm.js --- Auto-Farm.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Auto-Farm.js b/Auto-Farm.js index 030f44b..ca41928 100644 --- a/Auto-Farm.js +++ b/Auto-Farm.js @@ -161,9 +161,9 @@ : '❌ CAPTCHA token expired. Waiting for Paint button...', 'error' ); - // Click the Paint div to trigger CAPTCHA - const paintDiv = await waitForSelector('div.flex.items-center.gap-2'); - if (paintDiv) paintDiv.click(); + // Click the main Paint button to trigger CAPTCHA + const mainPaintBtn = await waitForSelector('button.btn.btn-primary.btn-lg, button.btn-primary.sm\\:btn-xl'); + if (mainPaintBtn) mainPaintBtn.click(); await sleep(500); // Click transparent color button updateUI( From 5f171c95607a53b92d6435884d0f180e1a55f9a0 Mon Sep 17 00:00:00 2001 From: jamz-uk <222520099+jamz-uk@users.noreply.github.com> Date: Wed, 13 Aug 2025 17:41:48 +0100 Subject: [PATCH 7/8] Update Auto-Farm.js --- Auto-Farm.js | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/Auto-Farm.js b/Auto-Farm.js index ca41928..1566399 100644 --- a/Auto-Farm.js +++ b/Auto-Farm.js @@ -27,7 +27,6 @@ }; const sleep = ms => new Promise(r => setTimeout(r, ms)); - // Utility to wait for a selector to appear in the DOM const waitForSelector = async (selector, interval = 200, timeout = 5000) => { const start = Date.now(); while (Date.now() - start < timeout) { @@ -40,7 +39,7 @@ const originalFetch = window.fetch; let capturedCaptchaToken = null; - let stoppedForToken = false; // flag for auto-resume + let stoppedForToken = false; window.fetch = async (url, options = {}) => { if (typeof url === 'string' && url.includes('https://backend.wplace.live/s0/pixel/')) { try { @@ -48,8 +47,7 @@ if (payload.t) { console.log('βœ… CAPTCHA Token Captured:', payload.t); capturedCaptchaToken = payload.t; - stoppedForToken = false; // Clear stopped flag on new token capture - // Auto-resume if stopped due to token expiry + stoppedForToken = false; if (stoppedForToken) { stoppedForToken = false; state.running = true; @@ -59,7 +57,7 @@ ); paintLoop(); } - // new token captured + } } catch (e) { } @@ -97,9 +95,9 @@ }); if (res.status === 403) { console.error('❌ 403 Forbidden. CAPTCHA token might be invalid or expired.'); - capturedCaptchaToken = null; // Invalidate our stored token. + capturedCaptchaToken = null; stoppedForToken = true; - return 'token_error'; // Return a special status to stop the bot. + return 'token_error'; } const data = await res.json(); return data; @@ -153,7 +151,6 @@ const randomPos = getRandomPosition(); const paintResult = await paintPixel(randomPos.x, randomPos.y); - // If token expired or invalid, stop the loop if (paintResult === 'token_error') { updateUI( state.language === 'pt' @@ -161,11 +158,9 @@ : '❌ CAPTCHA token expired. Waiting for Paint button...', 'error' ); - // Click the main Paint button to trigger CAPTCHA const mainPaintBtn = await waitForSelector('button.btn.btn-primary.btn-lg, button.btn-primary.sm\\:btn-xl'); if (mainPaintBtn) mainPaintBtn.click(); await sleep(500); - // Click transparent color button updateUI( state.language === 'pt' ? 'Selecionando transparente...' : 'Selecting transparent...', 'status' @@ -173,7 +168,6 @@ const transBtn = await waitForSelector('button#color-0'); if (transBtn) transBtn.click(); await sleep(500); - // Click center pixel on canvas const canvas = await waitForSelector('canvas'); if (canvas) { const rect = canvas.getBoundingClientRect(); @@ -185,12 +179,10 @@ canvas.dispatchEvent(evt); } await sleep(500); - // Click confirm Paint button updateUI( state.language === 'pt' ? 'Confirmando pintura...' : 'Confirming paint...', 'status' ); - // Try clicking the confirm Paint button inside its container const confirmContainer = await waitForSelector('div.absolute.bottom-0.left-1\\/2'); if (confirmContainer) { const confirmBtn = confirmContainer.querySelector('button.btn-primary.btn-lg, button.btn-primary.sm\\:btn-xl'); @@ -493,7 +485,6 @@ toggleBtn.innerHTML = ` ${t.start}`; toggleBtn.classList.add('wplace-btn-primary'); toggleBtn.classList.remove('wplace-btn-stop'); - // Clear previous stats and show stopped message statsArea.innerHTML = ''; updateUI(state.language === 'pt' ? '⏹️ Parado' : '⏹️ Stopped', 'default'); } From 8d9e5b88a81c3083000fa645da1bb7c2b48d4f69 Mon Sep 17 00:00:00 2001 From: jamz-uk <222520099+jamz-uk@users.noreply.github.com> Date: Wed, 13 Aug 2025 17:45:02 +0100 Subject: [PATCH 8/8] Update Auto-Farm.js --- Auto-Farm.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/Auto-Farm.js b/Auto-Farm.js index 1566399..ef5dde2 100644 --- a/Auto-Farm.js +++ b/Auto-Farm.js @@ -183,11 +183,16 @@ state.language === 'pt' ? 'Confirmando pintura...' : 'Confirming paint...', 'status' ); - const confirmContainer = await waitForSelector('div.absolute.bottom-0.left-1\\/2'); - if (confirmContainer) { - const confirmBtn = confirmContainer.querySelector('button.btn-primary.btn-lg, button.btn-primary.sm\\:btn-xl'); - confirmBtn?.click(); + let confirmBtn = await waitForSelector( + 'button.btn.btn-primary.btn-lg, button.btn.btn-primary.sm\\:btn-xl' + ); + if (!confirmBtn) { + const allPrimary = Array.from( + document.querySelectorAll('button.btn-primary') + ); + confirmBtn = allPrimary.length ? allPrimary[allPrimary.length - 1] : null; } + confirmBtn?.click(); await sleep(1000); continue; }