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);
}
}
};