// code from goatstore // api: https://store.agi.bd const cooldowns = new Map(); module.exports = { config: { name: "slot", version: "3.2", author: "Arijit", countDown: 12, shortDescription: { en: "slot game šŸ™‚", }, longDescription: { en: "Try your luck in a slot game", }, category: "game", }, langs: { en: { invalid_amount: "š—£š—¹š—²š—®š˜€š—² š—²š—»š˜š—²š—æ š—® š˜ƒš—®š—¹š—¶š—± š—®š—ŗš—¼š˜‚š—»š˜ šŸ˜æšŸ’…", not_enough_money: "š—£š—¹š—²š—®š˜€š—² š—°š—µš—²š—°š—ø š˜†š—¼š˜‚š—æ š—Æš—®š—¹š—®š—»š—°š—² 🤔", max_limit: "āŒ | The maximum bet amount is 100M.", limit_reached: "āŒ | š˜šØš® š”šššÆšž š«šžšššœš”šžš š²šØš®š« š¬š„šØš­ š„š¢š¦š¢š­. š“š«š² ššš ššš¢š§ š¢š§ %1.", jackpot_message: ">šŸŽ€\nš‰šššœš¤š©šØš­! š˜šØš® š°šØš§ $%1 š°š¢š­š” š­š”š«šžšž ā¤ š¬š²š¦š›šØš„š¬, šššš›š²!\n• š†ššš¦šž š‘šžš¬š®š„š­š¬ [ %2 | %3 | %4 ]", win_message: ">šŸŽ€\n• šššš›š², š˜šØš® š°šØš§ $%1\n• š†ššš¦šž š‘šžš¬š®š„š­š¬ [ %2 | %3 | %4 ]", lose_message: ">šŸŽ€\n• šššš›š², š˜šØš® š„šØš¬š­ $%1\n• š†ššš¦šž š‘šžš¬š®š„š­š¬ [ %2 | %3 | %4 ]", }, }, onStart: async function ({ args, message, event, usersData, getLang }) { const { senderID } = event; const amount = parseInt(args[0]); const now = Date.now(); const limit = 20; const interval = 60 * 60 * 1000; if (!cooldowns.has(senderID)) { cooldowns.set(senderID, []); } const timestamps = cooldowns.get(senderID).filter(ts => now - ts < interval); if (timestamps.length >= limit) { const nextUse = new Date(Math.min(...timestamps) + interval); const diff = nextUse - now; const hours = Math.floor(diff / (60 * 60 * 1000)); const minutes = Math.floor((diff % (60 * 60 * 1000)) / (60 * 1000)); return message.reply(getLang("limit_reached", `${hours}š” ${minutes}š¦`)); } if (isNaN(amount) || amount <= 0) return message.reply(getLang("invalid_amount")); if (amount > 100000000) return message.reply(getLang("max_limit")); const userData = await usersData.get(senderID); if (amount > userData.money) return message.reply(getLang("not_enough_money")); const result = generateResult(); const winnings = calculateWinnings(result, amount); await usersData.set(senderID, { money: userData.money + winnings, data: userData.data, }); cooldowns.set(senderID, [...timestamps, now]); return message.reply(formatResult(result, winnings, getLang)); } }; function generateResult() { const slots = ["šŸ’š", "šŸ’›", "šŸ’™", "šŸ’œ", "šŸ¤Ž", "šŸ¤", "ā¤ļø"]; const r = Math.random() * 100; if (r < 5) return ["ā¤ļø", "ā¤ļø", "ā¤ļø"]; // Jackpot if (r < 20) { const symbol = slots.filter(e => e !== "ā¤ļø")[Math.floor(Math.random() * 6)]; return [symbol, symbol, symbol]; // 5x } if (r < 65) { const s = slots[Math.floor(Math.random() * slots.length)]; const r2 = slots[Math.floor(Math.random() * slots.length)]; return [s, s, r2]; // 3x } while (true) { const [a, b, c] = [randomEmoji(slots), randomEmoji(slots), randomEmoji(slots)]; if (!(a === b && b === c)) return [a, b, c]; // Loss } } function calculateWinnings([a, b, c], bet) { if (a === b && b === c) { if (a === "ā¤ļø") return bet * 10; return bet * 5; } if (a === b || b === c || a === c) return bet * 3; return -bet; } function formatResult([a, b, c], winnings, getLang) { const formatted = formatMoney(Math.abs(winnings)); if (a === b && b === c && a === "ā¤ļø") return getLang("jackpot_message", formatted, a, b, c); if (winnings > 0) return getLang("win_message", formatted, a, b, c); return getLang("lose_message", formatted, a, b, c); } function randomEmoji(arr) { return arr[Math.floor(Math.random() * arr.length)]; } function formatMoney(amount) { if (amount >= 1e12) return (amount / 1e12).toFixed(2) + "š—§"; if (amount >= 1e9) return (amount / 1e9).toFixed(2) + "š—•"; if (amount >= 1e6) return (amount / 1e6).toFixed(2) + "šŒ"; if (amount >= 1e3) return (amount / 1e3).toFixed(2) + "š—ž"; return amount.toString(); }