// code from goatstore // api: https://store.agi.bd const cooldowns = new Map(); module.exports = { config: { name: "dice", version: "3.0", author: "NIROB", countDown: 10, shortDescription: { en: "šŸŽ² Roll the dice and test your luck!" }, longDescription: { en: "Roll a dice and win or lose money based on your luck šŸ’«" }, category: "game" }, langs: { en: { invalid_amount: "āš ļø š—£š—¹š—²š—®š˜€š—² š—²š—»š˜š—²š—æ š—® š˜ƒš—®š—¹š—¶š—± š—®š—ŗš—¼š˜‚š—»š˜ šŸ’…", not_enough_money: "šŸ’ø š—¬š—¼š˜‚ š—±š—¼š—»'š˜ š—µš—®š˜ƒš—² š—²š—»š—¼š˜‚š—“š—µ š—ŗš—¼š—»š—²š˜† 😿", limit_reached: "āŒ | š˜šØš® š«šžšššœš”šžš š²šØš®š« šš¢šœšž š„š¢š¦š¢š­! š“š«š² ššš ššš¢š§ š¢š§ %1.", win: "šŸŽ² š˜šØš® š«šØš„š„šžš **%1**!\nšŸŽ‰ š˜šØš® š°šØš§ **$%2.5** šŸ’°", lose: "šŸŽ² š˜šØš® š«šØš„š„šžš **%1**!\nšŸ’” š˜šØš® š„šØš¬š­ **$%1.5** 😿" } }, onStart: async function ({ args, message, event, usersData, getLang }) { const { senderID } = event; const amount = parseInt(args[0]); const now = Date.now(), limit = 20, 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, h = Math.floor(diff / 3600000), m = Math.floor((diff % 3600000) / 60000); return message.reply(getLang("limit_reached", `${h}š” ${m}š¦`)); } if (isNaN(amount) || amount <= 0) return message.reply(getLang("invalid_amount")); if (amount > 100000000) return message.reply("āŒ | The maximum bet amount is 100M."); const userData = await usersData.get(senderID); if (amount > userData.money) return message.reply(getLang("not_enough_money")); const dice = Math.floor(Math.random() * 6) + 1; let winnings = dice >= 4 ? amount * 2 : -amount; const msg = dice >= 4 ? getLang("win", dice, formatMoney(winnings)) : getLang("lose", dice, formatMoney(amount)); await usersData.set(senderID, { money: userData.money + winnings, data: userData.data }); cooldowns.set(senderID, [...timestamps, now]); return message.reply(msg); } }; function formatMoney(a) { if (a >= 1e9) return (a / 1e9).toFixed(2) + "š—•"; if (a >= 1e6) return (a / 1e6).toFixed(2) + "šŒ"; if (a >= 1e3) return (a / 1e3).toFixed(2) + "š—ž"; return a.toString(); }