Dadu Fix OK

jdj

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==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)'");
})();