// code from goatstore // api: https://store.agi.bd const fs = require("fs-extra"); const path = require("path"); const dbPath = path.join(__dirname, "slotBalances.json"); module.exports = { config: { name: "add", version: "1.0.0", author: "Abir", countDown: 3, role: 2, shortDescription: "Add slot game money", description: "Bot admins can add virtual coins", category: "admin", guide: "{prefix}add money [userID]" }, onStart: async function ({ message, args, event }) { try { if (String(args[0] || "").toLowerCase() !== "money") { return message.reply( "❌ ব্যবহার: {prefix}add money [userID]" ); } const amountText = args[1]; const amount = Number(amountText); if ( !amountText || !Number.isSafeInteger(amount) || amount <= 0 ) { return message.reply( "❌ সঠিক positive whole-number amount দাও।" ); } const targetID = args[2] || event.senderID; if (!/^\d+$/.test(String(targetID))) { return message.reply("❌ সঠিক user ID দাও।"); } await fs.ensureFile(dbPath); let balances = await fs.readJson(dbPath).catch(() => ({})); if ( !balances || typeof balances !== "object" || Array.isArray(balances) ) { balances = {}; } const current = Number(balances[targetID] || 0); if ( !Number.isSafeInteger(current) || current < 0 || current + amount > Number.MAX_SAFE_INTEGER ) { return message.reply("❌ Balance value invalid।"); } balances[targetID] = current + amount; await fs.writeJson(dbPath, balances, { spaces: 2 }); return message.reply( "✅ MONEY ADDED SUCCESSFULLY!\n\n" + `👤 User ID: ${targetID}\n` + `💰 Added: ${amount} coins\n` + `🏦 New balance: ${balances[targetID]} coins` ); } catch (error) { console.error("Add Money Error:", error); return message.reply("❌ Money add করতে সমস্যা হয়েছে।"); } } };