RSFaucet Full Auto (ON)

Auto on RsFaucet

// ==UserScript==
// @name         RSFaucet Full Auto (ON)
// @namespace    http://tampermonkey.net/
// @version      1.9
// @description  Auto on RsFaucet
// @author       👽
// @match        https://rsfaucet.com/faucet
// @grant        none
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    const MIN_DELAY = 3000;
    const MAX_DELAY = 7000;
    const REFRESH_TIMEOUT = 4 * 60 * 1000; // 4 minutes in ms

    let lastMutationTime = Date.now();

    function getRandomDelay(minMs, maxMs) {
        return Math.floor(Math.random() * (maxMs - minMs + 1)) + minMs;
    }

    function checkAndClick(buttonId) {
        const button = document.getElementById(buttonId);
        if (button && !button.disabled) {
            const delay = getRandomDelay(MIN_DELAY, MAX_DELAY);
            console.log(`🟢 [${buttonId}] Button found. Will click in ${delay / 1000} seconds.`);
            setTimeout(() => {
                console.log(`🖱️ Clicking ${buttonId} button!`);
                button.click();
            }, delay);
            return true;
        }
        return false;
    }

    function monitorButtons() {
        if (!checkAndClick("standard") && !checkAndClick("premium")) {
            setTimeout(monitorButtons, 1000);
        }
    }

    function setupInactivityWatcher() {
        const observer = new MutationObserver(() => {
            lastMutationTime = Date.now();
        });

        observer.observe(document.body, { childList: true, subtree: true, attributes: true });

        setInterval(() => {
            const now = Date.now();
            if (now - lastMutationTime > REFRESH_TIMEOUT) {
                console.log("🔄 No changes detected in 4 minutes. Refreshing page...");
                location.reload();
            }
        }, 60000); // check every 1 minute
    }

    window.addEventListener('load', () => {
        console.log("🚀 RSFaucet Auto Clicker started...");
        monitorButtons();
        setupInactivityWatcher();
    });
})();