const fs = require("fs-extra"); module.exports = { config: { name: "prefix", aliases: ["pre", "setprefix"], version: "3.0", author: "ใ€ฒMAMUNใƒ„เฟ", countDown: 5, role: 0, description: "Change & show bot prefix", category: "config" }, langs: { en: { usage: " ๐๐‘๐„๐…๐ˆ๐— ๐’๐˜๐’๐“๐„๐Œ \n" + "\n" + " ๐ฉ๐ซ๐ž๐Ÿ๐ข๐ฑ\n" + " ๐ฉ๐ซ๐ž๐Ÿ๐ข๐ฑ <๐ง๐ž๐ฐ๐๐ซ๐ž๐Ÿ๐ข๐ฑ>\n" + " ๐ฉ๐ซ๐ž๐Ÿ๐ข๐ฑ <๐ง๐ž๐ฐ๐๐ซ๐ž๐Ÿ๐ข๐ฑ> -๐ \n" + " ๐ฉ๐ซ๐ž๐Ÿ๐ข๐ฑ ๐ซ๐ž๐ฌ๐ž๐ญ\n" + "\n", reset: "๐๐‘๐„๐…๐ˆ๐— ๐‘๐„๐’๐„๐“\n" + "\n" + "โœ… ๐๐ซ๐ž๐Ÿ๐ข๐ฑ ๐ซ๐ž๐ฌ๐ž๐ญ ๐ฌ๐ฎ๐œ๐œ๐ž๐ฌ๐ฌ๐Ÿ๐ฎ๐ฅ!\n" + "๐Ÿ” ๐’๐ฒ๐ฌ๐ญ๐ž๐ฆ ๐ฉ๐ซ๐ž๐Ÿ๐ข๐ฑ: %1\n" + "\n", onlyAdmin: "โ›” ๐Ž๐ง๐ฅ๐ฒ ๐›๐จ๐ญ ๐š๐๐ฆ๐ข๐ง ๐œ๐š๐ง ๐œ๐ก๐š๐ง๐ ๐ž ๐ ๐ฅ๐จ๐›๐š๐ฅ ๐ฉ๐ซ๐ž๐Ÿ๐ข๐ฑ.", invalid: "โŒ ๐๐ซ๐ž๐Ÿ๐ข๐ฑ ๐œ๐š๐ง๐ง๐จ๐ญ ๐œ๐จ๐ง๐ญ๐š๐ข๐ง ๐ฌ๐ฉ๐š๐œ๐ž๐ฌ ๐จ๐ซ ๐›๐ž ๐ž๐ฆ๐ฉ๐ญ๐ฒ.", tooLong: "โŒ ๐๐ซ๐ž๐Ÿ๐ข๐ฑ ๐ข๐ฌ ๐ญ๐จ๐จ ๐ฅ๐จ๐ง๐ . ๐Œ๐š๐ฑ๐ข๐ฆ๐ฎ๐ฆ ๐Ÿ๐ŸŽ ๐œ๐ก๐š๐ซ๐š๐œ๐ญ๐ž๐ซ๐ฌ ๐š๐ฅ๐ฅ๐จ๐ฐ๐ž๐.", confirmGlobal: " ๐๐‘๐„๐…๐ˆ๐— ๐‚๐Ž๐๐…๐ˆ๐‘๐Œ\n" + "\n" + "โš™๏ธ ๐†๐ฅ๐จ๐›๐š๐ฅ ๐ฉ๐ซ๐ž๐Ÿ๐ข๐ฑ ๐œ๐ก๐š๐ง๐ ๐ž ๐ซ๐ž๐ช๐ฎ๐ž๐ฌ๐ญ๐ž๐.\n" + "๐Ÿ†• ๐๐ž๐ฐ ๐ฉ๐ซ๐ž๐Ÿ๐ข๐ฑ: %1\n" + "๐Ÿ‘‰ ๐‘๐ž๐š๐œ๐ญ ๐ญ๐จ ๐œ๐จ๐ง๐Ÿ๐ข๐ซ๐ฆ.\n", confirmThisThread: "๐๐‘๐„๐…๐ˆ๐— ๐‚๐Ž๐๐…๐ˆ๐‘๐Œ\n" + "\n" + "๐Ÿ  ๐†๐ซ๐จ๐ฎ๐ฉ ๐ฉ๐ซ๐ž๐Ÿ๐ข๐ฑ ๐œ๐ก๐š๐ง๐ ๐ž ๐ซ๐ž๐ช๐ฎ๐ž๐ฌ๐ญ๐ž๐.\n" + "๐Ÿ†• ๐๐ž๐ฐ ๐ฉ๐ซ๐ž๐Ÿ๐ข๐ฑ: %1\n" + "๐Ÿ‘‰ ๐‘๐ž๐š๐œ๐ญ ๐ญ๐จ ๐œ๐จ๐ง๐Ÿ๐ข๐ซ๐ฆ.", successGlobal: " ๐๐‘๐„๐…๐ˆ๐— ๐”๐๐ƒ๐€๐“๐„๐ƒ\n" + "\n" + "โœ… ๐†๐ฅ๐จ๐›๐š๐ฅ ๐ฉ๐ซ๐ž๐Ÿ๐ข๐ฑ ๐œ๐ก๐š๐ง๐ ๐ž๐!\n" + "๐Ÿ†• ๐๐ž๐ฐ ๐ฉ๐ซ๐ž๐Ÿ๐ข๐ฑ: %1\n" + "\n", successThisThread: " ๐๐‘๐„๐…๐ˆ๐— ๐”๐๐ƒ๐€๐“๐„๐ƒ\n" + "\n" + "โœ… ๐†๐ซ๐จ๐ฎ๐ฉ ๐ฉ๐ซ๐ž๐Ÿ๐ข๐ฑ ๐œ๐ก๐š๐ง๐ ๐ž๐!\n" + "๐Ÿ†• ๐๐ž๐ฐ ๐ฉ๐ซ๐ž๐Ÿ๐ข๐ฑ: %1\n" + "\n" } }, onStart: async function ({ message, role, args, commandName, event, threadsData, getLang }) { if (!args[0]) { const systemPrefix = global.GoatBot.config.prefix; const groupPrefix = global.utils.getPrefix(event.threadID); return message.reply( ` ๐๐‘๐„๐…๐ˆ๐— ๐ŸŒ ๐’๐ฒ๐ฌ๐ญ๐ž๐ฆ : ใ€Œ ${systemPrefix} ใ€ ๐Ÿ  ๐†๐ซ๐จ๐ฎ๐ฉ : ใ€Œ ${groupPrefix} ใ€` ); } if (args[0].toLowerCase() === "reset") { await threadsData.set( event.threadID, null, "data.prefix" ); return message.reply( getLang( "reset", global.GoatBot.config.prefix ) ); } const newPrefix = args[0]; const setGlobal = args[1] === "-g"; if (!newPrefix || /\s/.test(newPrefix)) return message.reply(getLang("invalid")); if (newPrefix.length > 10) return message.reply(getLang("tooLong")); if (setGlobal && role < 2) return message.reply(getLang("onlyAdmin")); const confirmMsg = setGlobal ? getLang("confirmGlobal", newPrefix) : getLang("confirmThisThread", newPrefix); return message.reply(confirmMsg, (err, info) => { if (err) return; global.GoatBot.onReaction.set(info.messageID, { commandName, author: event.senderID, newPrefix, setGlobal, threadID: event.threadID }); }); }, onReaction: async function ({ event, message, threadsData, Reaction, getLang }) { if (!Reaction) return; if (event.userID !== Reaction.author) return; global.GoatBot.onReaction.delete(event.messageID); if (Reaction.setGlobal) { global.GoatBot.config.prefix = Reaction.newPrefix; try { fs.writeFileSync( global.client.dirConfig, JSON.stringify( global.GoatBot.config, null, 2 ) ); } catch (error) { console.error( "[PREFIX] Config save error:", error ); } return message.reply( getLang( "successGlobal", Reaction.newPrefix ) ); } await threadsData.set( Reaction.threadID || event.threadID, Reaction.newPrefix, "data.prefix" ); return message.reply( getLang( "successThisThread", Reaction.newPrefix ) ); }, onChat: async function ({ event, message }) { if ( !event.body || event.body.trim().toLowerCase() !== "prefix" ) return; const systemPrefix = global.GoatBot.config.prefix; const groupPrefix = global.utils.getPrefix(event.threadID); return message.reply( ` ๐๐‘๐„๐…๐ˆ๐— ๐ˆ๐๐…๐Ž ๐ŸŒ ๐’๐˜๐’๐“๐„๐Œ ๐๐‘๐„๐…๐ˆ๐— โ”—โ”โ”โžค ใ€Œ ${systemPrefix} ใ€ ๐Ÿ  ๐†๐‘๐Ž๐”๐ ๐๐‘๐„๐…๐ˆ๐— โ”—โ”โ”โžค ใ€Œ ${groupPrefix} ใ€` ); } };