// code from goatstore // api: https://store.agi.bd module.exports = { config: { name: "admin", version: "1.0", author: "ā€”ĶžšŹ€ÉŖį“į“‡Ģ", role: 1, category: "group", guide: "{pn} add/remove/list /reply" }, onStart: async function ({ api, event, args }) { const { threadID, messageID } = event; if (!args[0]) { return api.sendMessage(`━━━━━━━━━━━━━━━━━━━━\nāŒ Error Syntax\n━━━━━━━━━━━━━━━━━━━━\nUse: help admin`, threadID, messageID); } const cmd = args[0].toLowerCase(); const adminIDs = global.GoatBot.config.adminBot; if (cmd == "list") { let msg = `━━━━━━━━━━━━━━━━━━━━\nšŸ‘‘ BOT ADMIN LIST\n━━━━━━━━━━━━━━━━━━━━\n`; for (let i = 0; i < adminIDs.length; i++) { try { const info = await api.getUserInfo(adminIDs[i]); msg += `${i + 1}. ${info[adminIDs[i]].name} - ${adminIDs[i]}\n`; } catch { msg += `${i + 1}. ${adminIDs[i]}\n`; } } return api.sendMessage(msg + "━━━━━━━━━━━━━━━━━━━━", threadID, messageID); } if (cmd == "add") { let uid = args[1] || (event.messageReply? event.messageReply.senderID : null); if (!uid) return api.sendMessage(`āŒ admin add er jonno UID dao ba reply dao\nEx: admin add 1000...`, threadID, messageID); uid = uid.replace(/[^0-9]/g, ""); try { const uInfo = await api.getUserInfo(uid); const uName = uInfo[uid].name; if (adminIDs.includes(uid)) return api.sendMessage(`āš ļø Already Admin: ${uName}`, threadID, messageID); adminIDs.push(uid); return api.sendMessage(`āœ… ADMIN ADDED\nšŸ‘¤ ${uName}\nšŸ†” ${uid}`, threadID, messageID); } catch { return api.sendMessage(`āŒ UID Not Found`, threadID, messageID); } } if (cmd == "remove") { let uid = args[1] || (event.messageReply? event.messageReply.senderID : null); if (!uid) return api.sendMessage(`āŒ admin remove er jonno UID dao ba reply dao\nEx: admin remove 1000...`, threadID, messageID); uid = uid.replace(/[^0-9]/g, ""); try { const uInfo = await api.getUserInfo(uid); const uName = uInfo[uid].name; if (!adminIDs.includes(uid)) return api.sendMessage(`āš ļø Not Admin: ${uName}`, threadID, messageID); global.GoatBot.config.adminBot = adminIDs.filter(id => id!= uid); return api.sendMessage(`āŒ ADMIN REMOVED\nšŸ‘¤ ${uName}\nšŸ†” ${uid}`, threadID, messageID); } catch { return api.sendMessage(`āŒ UID Not Found`, threadID, messageID); } } return api.sendMessage(`āŒ Error Syntax\nUse: help admin`, threadID, messageID); } };