File size: 3,904 Bytes
2821330 7c4f99b 2821330 7c4f99b 2821330 7c4f99b 2821330 7c4f99b 2821330 7c4f99b 2821330 7c4f99b 2821330 7c4f99b 2821330 7c4f99b 2821330 7c4f99b 2821330 7c4f99b 2821330 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 | module.exports.config = {
name: "help",
version: "1.0.0",
hasPermission: 0, // Fixed typo
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] || {}; // Fix for undefined configModule
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);
}
});
}; |