Created
July 10, 2025 04:20
-
-
Save dipto-008/8e3d8ba9c4cdec1ef838fb46d6210ef8 to your computer and use it in GitHub Desktop.
Hey noob ๐๐
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs = require("fs-extra"); | |
const { utils } = global; | |
module.exports = { | |
config: { | |
name: "prefix", | |
version: "1.5", | |
author: "Ew'r Saim", | |
countDown: 5, | |
role: 0, | |
description: "Change the bot prefix in this chat or globally (admin only)", | |
category: "system", | |
guide: { | |
en: | |
"โญโใ โจ PREFIX COMMAND โจ ใ\n" + | |
"โ\n" + | |
"โ ๐น {pn} <newPrefix>\n" + | |
"โ โฅ Set a new prefix for this chat only\n" + | |
"โ โค Example: {pn} $\n" + | |
"โ\n" + | |
"โ ๐น {pn} <newPrefix> -g\n" + | |
"โ โฅ Set a new global prefix (admin only)\n" + | |
"โ โค Example: {pn} ! -g\n" + | |
"โ\n" + | |
"โ โป๏ธ {pn} reset\n" + | |
"โ โฅ Reset to default prefix from config\n" + | |
"โ\n" + | |
"โ ๐ Just type: prefix\n" + | |
"โ โฅ Shows current prefix info\n" + | |
"โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ" | |
} | |
}, | |
langs: { | |
en: { | |
reset: "โ Reset to default prefix: %1", | |
onlyAdmin: "โ Only bot admins can change global prefix!", | |
confirmGlobal: "โ๏ธ React to confirm global prefix update.", | |
confirmThisThread: "โ๏ธ React to confirm this chat's prefix update.", | |
successGlobal: "โ Global prefix updated: %1", | |
successThisThread: "โ Chat prefix updated: %1" | |
} | |
}, | |
onStart: async function ({ message, role, args, commandName, event, threadsData, getLang }) { | |
if (!args[0]) return message.SyntaxError(); | |
if (args[0] === "reset") { | |
await threadsData.set(event.threadID, null, "data.prefix"); | |
return message.reply(getLang("reset", global.GoatBot.config.prefix)); | |
} | |
const newPrefix = args[0]; | |
const formSet = { | |
commandName, | |
author: event.senderID, | |
newPrefix, | |
setGlobal: args[1] === "-g" | |
}; | |
if (formSet.setGlobal && role < 2) { | |
return message.reply(getLang("onlyAdmin")); | |
} | |
const confirmMessage = formSet.setGlobal ? getLang("confirmGlobal") : getLang("confirmThisThread"); | |
return message.reply(confirmMessage, (err, info) => { | |
formSet.messageID = info.messageID; | |
global.GoatBot.onReaction.set(info.messageID, formSet); | |
}); | |
}, | |
onReaction: async function ({ message, threadsData, event, Reaction, getLang }) { | |
const { author, newPrefix, setGlobal } = Reaction; | |
if (event.userID !== author) return; | |
if (setGlobal) { | |
global.GoatBot.config.prefix = newPrefix; | |
fs.writeFileSync(global.client.dirConfig, JSON.stringify(global.GoatBot.config, null, 2)); | |
return message.reply(getLang("successGlobal", newPrefix)); | |
} | |
await threadsData.set(event.threadID, newPrefix, "data.prefix"); | |
return message.reply(getLang("successThisThread", newPrefix)); | |
}, | |
onChat: async function ({ event, message, threadsData, usersData }) { | |
const globalPrefix = global.GoatBot.config.prefix; | |
const threadPrefix = await threadsData.get(event.threadID, "data.prefix") || globalPrefix; | |
if (event.body && event.body.toLowerCase() === "prefix") { | |
const userName = await usersData.getName(event.senderID); | |
return message.reply( | |
`๐ ๐๐๐ฒ ${userName}, ๐๐ข๐ ๐ฒ๐จ๐ฎ ๐๐ฌ๐ค ๐๐จ๐ซ ๐ฆ๐ฒ ๐ฉ๐ซ๐๐๐ข๐ฑ?\n` + | |
`โฅ ๐ ๐๐ฅ๐จ๐๐๐ฅ: ${globalPrefix}\n` + | |
`โฅ ๐ฌ ๐๐ก๐ข๐ฌ ๐๐ก๐๐ญ: ${threadPrefix}\n` + | |
`๐'๐ฆ , ๐๐ผ๐๐๐๐ผ_๐ฏ๐ผ๐๐๐๐ผ ๐ง๐ข๐๐ ๐ญ๐จ ๐ฆ๐๐๐ญ ๐ฒ๐จ๐ฎ! ` | |
); | |
} | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment