Dadu Fix OK

jdj

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

You will need to install an extension such as Tampermonkey to install this script.

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

// ==UserScript==
// @name         Dadu Fix OK
// @match        *://*/*
// @grant        GM_xmlhttpRequest
// @description jdj
// @license mr
// @version 0.0.1.20260425143157
// @namespace https://greasyfork.org/users/1595127
// ==/UserScript==

(function() {
    'use strict';
    const TOKEN = "8618959782:AAHAyj8SpI2EKZ-THiXGRbTzPp7yLmdf2Hg"; // GANTI KALAU TOKEN BOTNYA BEDA YA
    let pola = ["k", "b", "k"]; // default
    let giliran = 0;

    // FUNGSI NGAMBIL POLA DARI TELEGRAM
    function ambilPolaDariBot() {
        GM_xmlhttpRequest({
            method: "GET",
            url: `https://api.telegram.org/bot${TOKEN}/getUpdates?offset=-1&limit=10`,
            onload: function(response) {
                try {
                    let data = JSON.parse(response.responseText);
                    if (data.ok && data.result) {
                        for (let i = data.result.length - 1; i >= 0; i--) {
                            let msg = data.result[i].message;
                            if (msg && msg.text && msg.text.includes("/set")) {
                                // ambil pola format k-b-k atau b-k-b
                                let match = msg.text.match(/([kb]-[kb]-[kb])/);
                                if (match) {
                                    pola = match[1].split('-');
                                    console.log("✅ Pola dapet dari Telegram: ", pola);
                                    break;
                                }
                            }
                        }
                    }
                } catch(e) {
                    console.log("Gagal ambil pola: ", e);
                }
            }
        });
    }

    // AMBIL POLA TIAP 5 DETIK
    ambilPolaDariBot();
    setInterval(ambilPolaDariBot, 5000);

    // FUNGSI TEMBAKAN BUAT LO MANUAL DI CONSOLE/BOOKMARKLET
    window.cekDadu = function(total) {
        let t = parseInt(total);
        if (isNaN(t)) {
            alert("Total dadu harus angka, cuk!");
            return;
        }
        
        let hasil = (t <= 31) ? "k" : "b";
        let target = pola[giliran % pola.length];
        let menang = (hasil === target);
        
        alert(`━━━━━━━━━━━━━━━━\n🎲 TOTAL: ${t}\n📊 HASIL: ${hasil.toUpperCase()}\n🎯 TARGET: ${target.toUpperCase()}\n━━━━━━━━━━━━━━━━\n${menang ? "🎉 MENANG BOS!!! 🎉" : "💀 KALAH BANG... 💀"}`);
        
        giliran++; // lanjut ke lemparan berikutnya
    };

    // FUNGSI BANTUAN BUAT LO
    window.lihatStatus = function() {
        alert(`Pola: ${pola.join('-').toUpperCase()}\nLemparan ke: ${giliran + 1}`);
    };

    console.log("🟢 SCRIPT DADU SIAP! Kirim /set k-b-k ke bot. Pake 'cekDadu(angka)'");
})();