// code from goatstore // api: https://store.agi.bd const fs = require("fs-extra"); const { utils } = global; module.exports = { config: { name: "prefix", version: "4.0", author: "Chat GPT", countDown: 5, role: 0, description: "3D VIP Prefix Control System", category: "config", guide: { en: " {pn} \n" + " Example: {pn} #\n\n" + " {pn} -g\n" + " Global prefix change (Bot Admin only)\n\n" + " {pn} reset\n" + " Reset group prefix to default" } }, langs: { en: { reset: "╔══════════════════════════════╗\n" + "║ 🔄 R E S E T ║\n" + "║ 3D SYSTEM ║\n" + "╠══════════════════════════════╣\n" + "║ ║\n" + "║ 🧊 GROUP PREFIX RESET ║\n" + "║ ║\n" + "║ PREFIX : %1 ║\n" + "║ STATUS : ● DEFAULT ║\n" + "║ ║\n" + "║ ✦ Configuration restored ║\n" + "║ ║\n" + "╚══════════════════════════════╝\n" + " ◢━━━━━━━━━━━━━━◣\n" + " 𝙑𝙄𝙋 𝘽𝙊𝙏 𝘾𝙊𝙍𝙀\n" + " ◥━━━━━━━━━━━━━━◤", onlyAdmin: "╔══════════════════════════════╗\n" + "║ 🔐 A C C E S S ║\n" + "║ D E N I E D ║\n" + "╠══════════════════════════════╣\n" + "║ ║\n" + "║ 👑 ADMIN ACCESS REQUIRED ║\n" + "║ ║\n" + "║ Global prefix control is ║\n" + "║ restricted to Bot Admin. ║\n" + "║ ║\n" + "╚══════════════════════════════╝\n" + " ◢━━━━━━━━━━━━━━◣\n" + " 🔒 SECURE CORE\n" + " ◥━━━━━━━━━━━━━━◤", invalid: "╔══════════════════════════════╗\n" + "║ ⚠️ I N V A L I D ║\n" + "║ I N P U T ║\n" + "╠══════════════════════════════╣\n" + "║ ║\n" + "║ ❌ Prefix format invalid ║\n" + "║ ║\n" + "║ • 1–5 characters ║\n" + "║ • No spaces ║\n" + "║ • No extra arguments ║\n" + "║ • \"reset\" is reserved ║\n" + "║ ║\n" + "║ 💡 Example: !prefix # ║\n" + "║ ║\n" + "╚══════════════════════════════╝", confirmGlobal: "╔══════════════════════════════╗\n" + "║ 👑 G L O B A L ║\n" + "║ 3D SYSTEM CORE ║\n" + "╠══════════════════════════════╣\n" + "║ ║\n" + "║ 🌐 GLOBAL PREFIX ║\n" + "║ ║\n" + "║ OLD : %1 ║\n" + "║ NEW : %2 ║\n" + "║ ║\n" + "║ 🔐 ADMIN VERIFIED ║\n" + "║ ⚡ REACT TO CONFIRM ║\n" + "║ ║\n" + "╚══════════════════════════════╝\n" + " ◢━━━━━━━━━━━━━━━━━━━━━━◣\n" + " 💎 𝙎𝙔𝙎𝙏𝙀𝙈 𝘾𝙊𝙍𝙀 𝙍𝙀𝘼𝘿𝙔\n" + " ◥━━━━━━━━━━━━━━━━━━━━━━◤", confirmThisThread: "╔══════════════════════════════╗\n" + "║ ◈ P R E F I X ◈ ║\n" + "║ 3D CONTROL ║\n" + "╠══════════════════════════════╣\n" + "║ ║\n" + "║ 🧊 CURRENT PREFIX ║\n" + "║ ╭─────────╮ ║\n" + "║ │ %1 │ ║\n" + "║ ╰─────────╯ ║\n" + "║ ╲ ║\n" + "║ ╲ ➜ %2 ║\n" + "║ ╲ ║\n" + "║ ✦ NEW PREFIX ║\n" + "║ ║\n" + "║ ⚡ STATUS: AWAITING ACTION ║\n" + "║ 🔐 REACT TO CONFIRM ║\n" + "║ ║\n" + "╚══════════════════════════════╝\n" + " ◢━━━━━━━━━━━━━━◣\n" + " 𝙋𝙍𝙀𝙈𝙄𝙐𝙈 𝘾𝙊𝙉𝙏𝙍𝙊𝙇\n" + " ◥━━━━━━━━━━━━━━◤", successGlobal: "╔══════════════════════════════╗\n" + "║ 🚀 S U C C E S S ║\n" + "║ 3D SYSTEM ║\n" + "╠══════════════════════════════╣\n" + "║ ║\n" + "║ ╭───────╮ ║\n" + "║ ╱ %1 ╲ ║\n" + "║ ╲ ✓ OK ╱ ║\n" + "║ ╰───────╯ ║\n" + "║ ║\n" + "║ PREFIX : %1 ║\n" + "║ STATUS : ● ACTIVE ║\n" + "║ MODE : GLOBAL ║\n" + "║ ║\n" + "║ 💎 CONFIGURATION SAVED ║\n" + "║ ║\n" + "╚══════════════════════════════╝\n" + " ◢━━━━━━━━━━━━━━◣\n" + " 𝙑𝙄𝙋 𝘽𝙊𝙏 𝘾𝙊𝙍𝙀\n" + " ◥━━━━━━━━━━━━━━◤", successThisThread: "╔══════════════════════════════╗\n" + "║ 🚀 S U C C E S S ║\n" + "║ 3D GROUP CORE ║\n" + "╠══════════════════════════════╣\n" + "║ ║\n" + "║ ╭───────╮ ║\n" + "║ ╱ %1 ╲ ║\n" + "║ ╲ ✓ OK ╱ ║\n" + "║ ╰───────╯ ║\n" + "║ ║\n" + "║ PREFIX : %1 ║\n" + "║ STATUS : ● ACTIVE ║\n" + "║ MODE : GROUP ║\n" + "║ ║\n" + "║ 💎 GROUP CONFIG SAVED ║\n" + "║ ║\n" + "╚══════════════════════════════╝\n" + " ◢━━━━━━━━━━━━━━◣\n" + " 𝙋𝙍𝙀𝙈𝙄𝙐𝙈 𝘾𝙊𝙍𝙀\n" + " ◥━━━━━━━━━━━━━━◤", saveError: "╔══════════════════════════════╗\n" + "║ ❌ S Y S T E M ║\n" + "║ E R R O R ║\n" + "╠══════════════════════════════╣\n" + "║ ║\n" + "║ Unable to save config. ║\n" + "║ Please check permissions. ║\n" + "║ ║\n" + "╚══════════════════════════════╝", myPrefix: "╔══════════════════════════════╗\n" + "║ 🤖 B O T ║\n" + "║ 3D PREFIX CORE ║\n" + "╠══════════════════════════════╣\n" + "║ ║\n" + "║ 🌐 GLOBAL PREFIX ║\n" + "║ ╭──────────╮ ║\n" + "║ │ %1 │ ║\n" + "║ ╰──────────╯ ║\n" + "║ ║\n" + "║ 🛸 GROUP PREFIX ║\n" + "║ ╭──────────╮ ║\n" + "║ │ %2 │ ║\n" + "║ ╰──────────╯ ║\n" + "║ ║\n" + "║ 💎 PREFIX MANAGER ║\n" + "║ ● ONLINE • 3D CORE ║\n" + "║ ║\n" + "╚══════════════════════════════╝\n" + " ◢━━━━━━━━━━━━━━◣\n" + " 𝙑𝙄𝙋 𝘽𝙊𝙏 𝙎𝙔𝙎𝙏𝙀𝙈\n" + " ◥━━━━━━━━━━━━━━◤" } }, onStart: async function ({ message, role, args, commandName, event, threadsData, getLang }) { /* ━━━━━━━━━━━━━━━━━━━━━ INPUT VALIDATION ━━━━━━━━━━━━━━━━━━━━━ */ if (!args[0]) return message.SyntaxError(); const firstArg = String(args[0]).trim(); // RESET if (firstArg.toLowerCase() === "reset") { if (args.length > 1) return message.reply(getLang("invalid")); await threadsData.set( event.threadID, null, "data.prefix" ); return message.reply( getLang( "reset", global.GoatBot.config.prefix ) ); } // Prefix must be 1–5 chars if ( firstArg.length < 1 || firstArg.length > 5 || /\s/.test(firstArg) || firstArg.toLowerCase() === "reset" ) { return message.reply(getLang("invalid")); } // Only valid second argument is -g if ( args.length > 2 || (args.length === 2 && args[1] !== "-g") ) { return message.reply(getLang("invalid")); } const newPrefix = firstArg; const currentPrefix = utils.getPrefix(event.threadID); const setGlobal = args[1] === "-g"; // GLOBAL PREFIX if (setGlobal && role < 2) return message.reply(getLang("onlyAdmin")); const formSet = { commandName, author: event.senderID, newPrefix, setGlobal, currentPrefix }; const confirmMessage = setGlobal ? getLang( "confirmGlobal", global.GoatBot.config.prefix, newPrefix ) : getLang( "confirmThisThread", currentPrefix, newPrefix ); return message.reply( confirmMessage, (err, info) => { if (err || !info) return; formSet.messageID = info.messageID; global.GoatBot.onReaction.set( info.messageID, formSet ); } ); }, onReaction: async function ({ message, threadsData, event, Reaction, getLang }) { if (!Reaction) return; const { author, newPrefix, setGlobal } = Reaction; // Only command author can confirm if (event.userID !== author) return; /* ━━━━━━━━━━━━━━━━━━━━━ GLOBAL PREFIX ━━━━━━━━━━━━━━━━━━━━━ */ if (setGlobal) { const oldPrefix = global.GoatBot.config.prefix; global.GoatBot.config.prefix = newPrefix; try { fs.writeFileSync( global.client.dirConfig, JSON.stringify( global.GoatBot.config, null, 2 ) ); } catch (error) { // Restore old value if saving fails global.GoatBot.config.prefix = oldPrefix; console.error( "[PREFIX] Config save error:", error ); return message.reply( getLang("saveError") ); } return message.reply( getLang( "successGlobal", newPrefix ) ); } /* ━━━━━━━━━━━━━━━━━━━━━ GROUP PREFIX ━━━━━━━━━━━━━━━━━━━━━ */ await threadsData.set( event.threadID, newPrefix, "data.prefix" ); return message.reply( getLang( "successThisThread", newPrefix ) ); }, onChat: async function ({ event, message, getLang }) { if ( event.body && event.body.trim().toLowerCase() === "prefix" ) { return () => { return message.reply( getLang( "myPrefix", global.GoatBot.config.prefix, utils.getPrefix( event.threadID ) ) ); }; } } };