← back to browse
goat command

slot

No description

0
views
0
likes
0
installs
raw source
const fs = require("fs");
const path = "./balance.json";

module.exports = {
    config: {
        name: "slot",
        version: "1.1",
        author: "๐—”๐—ฟ๐—ถ๐˜†๐—ฎ๐—ป ๐—ฏ๐—ฏ'๐˜‡",
        category: "GAME",
        guide: "{pn} <bet_amount>"
    },
    onStart: async function ({ api, event, args }) {
        if (!fs.existsSync(path)) fs.writeFileSync(path, "{}");
        let data = JSON.parse(fs.readFileSync(path));
        const uid = event.senderID;
        if (!data[uid]) data[uid] = 1000;

        const bet = parseInt(args[0]) || 50;
        if (data[uid] < bet) return api.sendMessage(`โŒ Tomar kase ${data[uid]} tk ase. ${bet} tk nai!`, event.threadID, event.messageID);

        const emojis = ["๐Ÿ’", "๐Ÿ‹", "๐ŸŠ", "๐Ÿ‡", "๐Ÿ’Ž", "7๏ธโƒฃ"];
        let roll = Math.random();
        let result;

        if (roll < 0.3) { // 30% jackpot
            const winEmoji = emojis[Math.floor(Math.random() * emojis.length)];
            result = [winEmoji, winEmoji, winEmoji];
        } else {
            result = [emojis[Math.floor(Math.random()*6)], emojis[Math.floor(Math.random()*6)], emojis[Math.floor(Math.random()*6)]];
        }

        const isWin = result[0] === result[1] && result[1] === result[2];

        if (isWin) {
            const win = bet * 3;
            data[uid] += win;
            fs.writeFileSync(path, JSON.stringify(data));
            return api.sendMessage(`๐ŸŽฐ [ ${result.join(" | ")} ]\n๐ŸŽ‰ JACKPOT!!!\nTumi jitso: ${win} tk\n๐Ÿ’ฐ New Balance: ${data[uid]} tk`, event.threadID, event.messageID);
        } else {
            data[uid] -= bet;
            fs.writeFileSync(path, JSON.stringify(data));
            return api.sendMessage(`๐ŸŽฐ [ ${result.join(" | ")} ]\n๐Ÿ˜ญ Harso: ${bet} tk\n๐Ÿ’ฐ New Balance: ${data[uid]} tk`, event.threadID, event.messageID);
        }
    }
};

View raw file