// code from goatstore // api: https://store.agi.bd const fs = require("fs-extra"); const path = require("path"); const LOCK_FILE = path.join(__dirname, "cmdlock.json"); // Read group lock settings function readLocks() { try { if (!fs.existsSync(LOCK_FILE)) { fs.writeJsonSync(LOCK_FILE, {}, { spaces: 2 }); } return fs.readJsonSync(LOCK_FILE); } catch (err) { return {}; } } // Save group lock settings function saveLocks(data) { fs.writeJsonSync(LOCK_FILE, data, { spaces: 2 }); } module.exports = { config: { name: "cmdlock", aliases: ["lockcmd", "grouplock"], version: "2.0.0", author: "Jihad", countDown: 3, role: 2, description: { en: "Lock or unlock commands for a specific group" }, category: "owner", guide: { en: "{pn} on" + "\n{pn} off" } }, // Lock/unlock current group onStart: async function ({ args, message, event }) { const threadID = event.threadID; const action = (args[0] || "").toLowerCase(); if (!threadID) { return message.reply("❌ This command can only be used in a group."); } if (!["on", "off"].includes(action)) { return message.reply( "𝗫 𝗜𝗻𝗰𝗼𝗿𝗿𝗲𝗰𝘁 𝗦𝘆𝗻𝘁𝗮𝘅\n" + "━━━━━━━━━━━━━━━━━\n" + "› .cmdlock on\n" + "› .cmdlock off" ); } const locks = readLocks(); locks[threadID] = action === "on"; saveLocks(locks); if (action === "on") { return message.reply( "ᴏᴋ sɪʀ, ᴘʀɪᴠᴀᴄʏ ᴍᴏᴅᴇ ᴏɴ, ᴏɴʟʏ ᴊɪʜᴀᴅ sɪʀ ᴄᴀɴ ᴜsᴇ ᴀʟʟ ᴄᴏᴍᴍᴀɴᴅ 🖤🔐" ); } return message.reply( "ᴏᴋ sɪʀ, ᴘʀɪᴠᴀᴄʏ ᴍᴏᴅᴇ ᴏғғ, ɴᴏᴡ ᴇᴠᴇʀʏᴏɴᴇ ᴄᴀɴ ᴜsᴇ ᴀʟʟ ᴄᴏᴍᴍᴀɴᴅ 🖤🔓" ); }, // Helper: check whether a group is locked onChat: async function ({ event }) { const threadID = event.threadID; if (!threadID) return; const locks = readLocks(); // The actual command handler must enforce this setting. if (locks[threadID] === true) { return; } } };