Dadu Fix OK

jdj

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

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

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

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

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

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.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

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