// code from goatstore // api: https://store.agi.bd const { config } = global.GoatBot; const { writeFileSync } = require("fs-extra"); const moment = require("moment-timezone"); module.exports = { config: { name: "wl", version: "2.5", author: "π‘π€π˜π‡π€π-π’π€πππˆπ‘", countDown: 5, role: 2, category: "owner", shortDescription: "Manage whitelist", longDescription: "Manage whiteListIds - Only whitelisted users can use bot", guide: { en: "{pn} add \n{pn} remove \n{pn} list\n{pn} on / off" } }, langs: { en: { added: "Β» πŸ‘‘π‘π€π˜π‡π€π-π’π€πππˆπ‘πŸ‘‘\n───────────────\nΒ» βœ… π€πππžπ:\n%1\n───────────────\nΒ» πŸ§šβ€β™€οΈ β€Ώπ—‘π—œπ—π—›π—¨π—  𝗖𝗛𝗔𝗧𝗕𝗒𝗧", removed: "Β» πŸ‘‘π‘π€π˜π‡π€π-π’π€πππˆπ‘πŸ‘‘\n───────────────\nΒ» βœ… π‘πžπ¦π¨π―πžπ:\n%1\n───────────────\nΒ» πŸ§šβ€β™€οΈ β€Ώπ—‘π—œπ—π—›π—¨π—  𝗖𝗛𝗔𝗧𝗕𝗒𝗧", listAdmin: "Β» πŸ‘‘π‘π€π˜π‡π€π-π’π€πππˆπ‘πŸ‘‘\n───────────────\nΒ» πŸ‘‘ π–π‘π’π­πžπ‹π’π¬π­ π”π¬πžπ«π¬:\n%1\n───────────────\nΒ» πŸ§šβ€β™€οΈ β€Ώπ—‘π—œπ—π—›π—¨π—  𝗖𝗛𝗔𝗧𝗕𝗒𝗧", missingIdAdd: "Β» ⚠️ UID বা Mention দাও বস!\nEx: wl add @tag", missingIdRemove: "Β» ⚠️ UID বা Mention দাও বস!\nEx: wl remove @tag", noUsers: "Β» ❌ কোনো WhiteList ΰ¦‡ΰ¦‰ΰ¦œΰ¦Ύΰ¦° নেই", guide: "Β» πŸ“– Guide:\nβ€’ wl add @tag - add\nβ€’ wl remove @tag - remove\nβ€’ wl list - see list\nβ€’ wl on/off - enable/disable" } }, onStart: async function ({ message, args, usersData, event, getLang }) { const whiteList = config.whiteListMode.whiteListIds; switch (args[0]) { // ================= ADD ================= case "add": case "-a": { if (!args[1] && Object.keys(event.mentions).length === 0 && !event.messageReply) { return message.reply(getLang("missingIdAdd")); } let uids = []; if (Object.keys(event.mentions).length > 0) uids = Object.keys(event.mentions); else if (event.messageReply) uids.push(event.messageReply.senderID); else uids = args.slice(1).filter(arg => !isNaN(arg)); const added = []; for (const uid of uids) { if (!whiteList.includes(uid)) { whiteList.push(uid); added.push(uid); } } writeFileSync(global.client.dirConfig, JSON.stringify(config, null, 2)); if (added.length === 0) return message.reply("Β» ⚠️ Already in whitelist"); const names = await Promise.all( added.map(async uid => { const name = await usersData.getName(uid).catch(() => uid); return `β€’ ${name} (${uid})`; }) ); return message.reply(getLang("added", names.join("\n"))); } // ================= REMOVE ================= case "remove": case "-r": { if (!args[1] && Object.keys(event.mentions).length === 0) { return message.reply(getLang("missingIdRemove")); } let uids = []; if (Object.keys(event.mentions).length > 0) uids = Object.keys(event.mentions); else uids = args.slice(1).filter(arg => !isNaN(arg)); const removed = []; for (const uid of uids) { if (whiteList.includes(uid)) { whiteList.splice(whiteList.indexOf(uid), 1); removed.push(uid); } } writeFileSync(global.client.dirConfig, JSON.stringify(config, null, 2)); if (removed.length === 0) return message.reply("Β» ⚠️ User not in whitelist"); const names = await Promise.all( removed.map(async uid => { const name = await usersData.getName(uid).catch(() => uid); return `β€’ ${name} (${uid})`; }) ); return message.reply(getLang("removed", names.join("\n"))); } // ================= LIST ================= case "list": case "-l": { if (whiteList.length === 0) return message.reply(getLang("noUsers")); const names = await Promise.all( whiteList.map(async uid => { const name = await usersData.getName(uid).catch(() => "Unknown"); return `β€’ ${name} (${uid})`; }) ); return message.reply(getLang("listAdmin", names.join("\n") || "Empty")); } // ================= ON ================= case "on": { config.whiteListMode.enable = true; writeFileSync(global.client.dirConfig, JSON.stringify(config, null, 2)); const time = moment().tz("Asia/Dhaka").format("hh:mm A"); const date = moment().tz("Asia/Dhaka").format("DD MMMM YYYY"); return message.reply( `πŸ‘‘ π‘π€π˜π‡π€π-π’π€πππˆπ‘ πŸ‘‘\nπŸ” π–π‡πˆπ“π„π‹πˆπ’π“ 𝐎𝐍\n───────────────\nπŸ”’ এখন ঢুধু বস π‘π€π˜π‡π€π-π’π€πππˆπ‘ বট ব্যবহার করঀে ΰ¦ͺারবে\n\nπŸ“… ${date}\n⏰ ${time}\nπŸ‘‘ π—‘π—œπ—π—›π—¨π—  𝗖𝗛𝗔𝗧 𝗕𝗒𝗧` ); } // ================= OFF ================= case "off": { config.whiteListMode.enable = false; writeFileSync(global.client.dirConfig, JSON.stringify(config, null, 2)); const time = moment().tz("Asia/Dhaka").format("hh:mm A"); const date = moment().tz("Asia/Dhaka").format("DD MMMM YYYY"); return message.reply( `πŸ‘‘ π‘π€π˜π‡π€π-π’π€πππˆπ‘ πŸ‘‘\n🌐 π–π‡πˆπ“π„π‹πˆπ’π“ πŽπ…π…\n───────────────\nπŸŽ‰ এখন সবাই বট ব্যবহার করঀে ΰ¦ͺারবে\n\nπŸ“… ${date}\n⏰ ${time}\nπŸ‘‘ π—‘π—œπ—π—›π—¨π—  𝗖𝗛𝗔𝗧 𝗕𝗒𝗧` ); } default: { return message.reply(getLang("guide")); } } } };