| module.exports.config = { |
| name: "help", |
| version: "1.0.0", |
| hasPermssion: 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.has(splitBody[1].toLowerCase())) return; |
| const threadSetting = global.data.threadData.get(parseInt(threadID)) || {}; |
| const command = commands.get(splitBody[1].toLowerCase()); |
| const prefix = (threadSetting.hasOwnProperty("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 { autoUnsend, delayUnsend } = global.configModule[this.config.name]; |
| const prefix = (threadSetting.hasOwnProperty("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: ${global.config.PREFIX} ใ\nโฐโโโโโโโโโโโโก`; |
|
|
| return api.shareContact(msg, api.getCurrentUserID(), threadID, async (error, info) => { |
| if (autoUnsend) { |
| await new Promise(resolve => setTimeout(resolve, delayUnsend * 60000)); |
| return api.unsendMessage(info.messageID); |
| } else return; |
| }); |
| }; |