SatsFaucet Auto Dashboard + Bounty LOOP

Continuous automation: Dashboard → Faucet → Bounty → Claim → wait 1h → repeat

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         SatsFaucet Auto Dashboard + Bounty LOOP
// @namespace    http://tampermonkey.net/
// @version      1.7
// @description  Continuous automation: Dashboard → Faucet → Bounty → Claim → wait 1h → repeat
// @author       Rubystance
// @license      MIT
// @match        https://www.satsfaucet.com/app/*
// @grant        none
// ==/UserScript==

(function () {
    'use strict';

    const log = (...args) => console.log('[SatsBot]', ...args);

    const ONE_HOUR = 60 * 60 * 1000;
    const STORAGE_KEY = 'satsfaucet_last_claim';

    function isVisible(el) {
        if (!el) return false;
        const r = el.getBoundingClientRect();
        return r.width > 0 && r.height > 0;
    }

    function clickByText(tag, text) {
        const els = [...document.querySelectorAll(tag)];
        return els.find(el =>
            el.textContent.trim().toLowerCase() === text &&
            isVisible(el)
        );
    }

    function clickAllClaimRewards() {
        const buttons = [...document.querySelectorAll('button')];

        buttons.forEach(btn => {
            if (
                btn.textContent.trim().toLowerCase() === 'claim reward' &&
                !btn.disabled &&
                isVisible(btn)
            ) {
                btn.click();
                log('Clicked: Claim reward');

                localStorage.setItem(STORAGE_KEY, Date.now().toString());
            }
        });
    }

    function handleDashboard() {
        const faucet = clickByText('span', 'faucet');
        if (faucet) {
            faucet.click();
            log('Clicked: Faucet (Dashboard)');
        }
    }

    function handleBounty() {
        clickAllClaimRewards();
    }

    function checkCooldownAndRestart() {
        const lastClaim = localStorage.getItem(STORAGE_KEY);
        if (!lastClaim) return;

        const elapsed = Date.now() - Number(lastClaim);

        if (elapsed >= ONE_HOUR) {
            log('Cooldown finished. Restarting routine.');
            localStorage.removeItem(STORAGE_KEY);
            location.href = 'https://www.satsfaucet.com/app/dashboard';
        }
    }

    let lastURL = location.href;

    setInterval(() => {
        if (location.href !== lastURL) {
            lastURL = location.href;
            log('URL changed:', lastURL);
        }

        checkCooldownAndRestart();

        if (lastURL.includes('/app/dashboard')) {
            handleDashboard();
        }

        if (lastURL.includes('/app/bounty')) {
            handleBounty();
        }
    }, 1000);

    const observer = new MutationObserver(() => {
        if (location.href.includes('/app/bounty')) {
            handleBounty();
        }
    });

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

})();