| | module.exports.config = { |
| | name: "help", |
| | version: "1.0.0", |
| | hasPermission: 0, |
| | credits: "august", |
| | description: "Guide for new users", |
| | commandCategory: "system", |
| | usages: "/help", |
| | hide: true, |
| | usePrefix: true, |
| | cooldowns: 5, |
| | envConfig: { |
| | autoUnsend: true, |
| | delayUnsend: 60 |
| | } |
| | }; |
| |
|
| | const mathSansBold = { |
| | A: "๐ ", B: "๐ก", C: "๐ข", D: "๐ฃ", E: "๐ค", F: "๐ฅ", G: "๐ฆ", H: "๐ง", I: "๐จ", |
| | J: "๐ฉ", K: "๐ช", L: "๐ซ", M: "๐ฌ", N: "๐ญ", O: "๐ฎ", P: "๐ฏ", Q: "๐ฐ", R: "๐ฑ", |
| | S: "๐ฒ", T: "๐ณ", U: "๐ด", V: "๐ต", W: "๐ถ", X: "๐ท", Y: "๐ธ", Z: "๐น", |
| | a: "๐บ", b: "๐ป", c: "๐ผ", d: "๐ฝ", e: "๐พ", f: "๐ฟ", g: "๐", h: "๐", i: "๐", |
| | j: "๐", k: "๐", l: "๐
", m: "๐", n: "๐", o: "๐", p: "๐", q: "๐", r: "๐", |
| | s: "๐", t: "๐", u: "๐", v: "๐", w: "๐", x: "๐", y: "๐", z: "๐" |
| | }; |
| |
|
| | module.exports.handleEvent = function ({ api, event, getText }) { |
| | const { commands } = global.client; |
| | const { threadID, messageID, body } = event; |
| |
|
| | if (!body || typeof body == "undefined" || body.indexOf("commands") !== 0) return; |
| | const splitBody = body.slice(body.indexOf("commands")).trim().split(/\s+/); |
| | if (splitBody.length === 1 || !commands.get(splitBody[1].toLowerCase())) return; |
| |
|
| | const threadSetting = global.data.threadData.get(parseInt(threadID)) || {}; |
| | const command = commands.get(splitBody[1].toLowerCase()); |
| | const prefix = threadSetting.PREFIX || global.config.PREFIX; |
| |
|
| | return api.sendMessage( |
| | getText("moduleInfo", command.config.name, command.config.description, |
| | `${prefix}${command.config.name} ${(command.config.usages) ? command.config.usages : ""}`, |
| | command.config.commandCategory, command.config.cooldowns, |
| | command.config.hasPermission === 0 ? getText("user") : |
| | command.config.hasPermission === 1 ? getText("adminGroup") : getText("adminBot"), |
| | command.config.credits), |
| | threadID, messageID |
| | ); |
| | }; |
| |
|
| | module.exports.run = async function ({ api, event, args }) { |
| | const uid = event.senderID; |
| | const userName = (await api.getUserInfo(uid))[uid].name; |
| |
|
| | const { commands } = global.client; |
| | const { threadID, messageID } = event; |
| | const threadSetting = global.data.threadData.get(parseInt(threadID)) || {}; |
| | |
| | const moduleConfig = global.configModule?.[this.config.name] || {}; |
| | const autoUnsend = moduleConfig.autoUnsend ?? false; |
| | const delayUnsend = moduleConfig.delayUnsend ?? 60; |
| | const prefix = threadSetting.PREFIX || global.config.PREFIX; |
| |
|
| | const categories = new Set(); |
| | const categorizedCommands = new Map(); |
| |
|
| | for (const [name, value] of commands) { |
| | if (value.config.hide) continue; |
| | const categoryName = value.config.commandCategory; |
| | if (!categories.has(categoryName)) { |
| | categories.add(categoryName); |
| | categorizedCommands.set(categoryName, []); |
| | } |
| | categorizedCommands.get(categoryName).push(`โ โง ${value.config.name}`); |
| | } |
| |
|
| | let msg = `๐ง๐พ๐ ${userName}, ๐๐๐พ๐๐พ ๐บ๐๐พ ๐ผ๐๐๐๐บ๐๐ฝ๐ ๐๐๐บ๐ ๐๐บ๐ ๐๐พ๐
๐ ๐๐๐:\n\n`; |
| |
|
| | for (const categoryName of categories) { |
| | const categoryNameSansBold = categoryName.split("").map(c => mathSansBold[c] || c).join(""); |
| | msg += `โญโโใ ${categoryNameSansBold} ใ\n`; |
| | msg += categorizedCommands.get(categoryName).join("\n"); |
| | msg += "\nโฐโโโโโโโโโโโโก\n"; |
| | } |
| |
|
| | msg += `โโโโโโโพโ\nโ ยป Total commands: [ ${commands.size} ]\nโใ โพโ PREFIX: ${prefix} ใ\nโฐโโโโโโโโโโโโก`; |
| |
|
| | return api.sendMessage(msg, threadID, async (error, info) => { |
| | if (autoUnsend) { |
| | await new Promise(resolve => setTimeout(resolve, delayUnsend * 60000)); |
| | return api.unsendMessage(info.messageID); |
| | } |
| | }); |
| | }; |