Update modules/commands/help.js
Browse files- modules/commands/help.js +28 -15
modules/commands/help.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
module.exports.config = {
|
| 2 |
name: "help",
|
| 3 |
version: "1.0.0",
|
| 4 |
-
|
| 5 |
credits: "august",
|
| 6 |
description: "Guide for new users",
|
| 7 |
commandCategory: "system",
|
|
@@ -18,23 +18,33 @@ module.exports.config = {
|
|
| 18 |
const mathSansBold = {
|
| 19 |
A: "๐ ", B: "๐ก", C: "๐ข", D: "๐ฃ", E: "๐ค", F: "๐ฅ", G: "๐ฆ", H: "๐ง", I: "๐จ",
|
| 20 |
J: "๐ฉ", K: "๐ช", L: "๐ซ", M: "๐ฌ", N: "๐ญ", O: "๐ฎ", P: "๐ฏ", Q: "๐ฐ", R: "๐ฑ",
|
| 21 |
-
S: "๐ฒ", T: "๐ณ", U: "๐ด", V: "๐ต", W: "๐ถ", X: "๐ท", Y: "๐ธ", Z: "๐น",
|
| 22 |
-
a: "
|
| 23 |
-
j: "
|
| 24 |
-
s: "
|
| 25 |
};
|
| 26 |
|
| 27 |
module.exports.handleEvent = function ({ api, event, getText }) {
|
| 28 |
const { commands } = global.client;
|
| 29 |
const { threadID, messageID, body } = event;
|
| 30 |
|
| 31 |
-
if (!body || typeof body == "undefined" || body.indexOf("commands")
|
| 32 |
const splitBody = body.slice(body.indexOf("commands")).trim().split(/\s+/);
|
| 33 |
-
if (splitBody.length
|
|
|
|
| 34 |
const threadSetting = global.data.threadData.get(parseInt(threadID)) || {};
|
| 35 |
const command = commands.get(splitBody[1].toLowerCase());
|
| 36 |
-
const prefix =
|
| 37 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
};
|
| 39 |
|
| 40 |
module.exports.run = async function ({ api, event, args }) {
|
|
@@ -44,14 +54,17 @@ module.exports.run = async function ({ api, event, args }) {
|
|
| 44 |
const { commands } = global.client;
|
| 45 |
const { threadID, messageID } = event;
|
| 46 |
const threadSetting = global.data.threadData.get(parseInt(threadID)) || {};
|
| 47 |
-
|
| 48 |
-
const
|
|
|
|
|
|
|
|
|
|
| 49 |
|
| 50 |
const categories = new Set();
|
| 51 |
const categorizedCommands = new Map();
|
| 52 |
|
| 53 |
for (const [name, value] of commands) {
|
| 54 |
-
if (value.config.hide) continue;
|
| 55 |
const categoryName = value.config.commandCategory;
|
| 56 |
if (!categories.has(categoryName)) {
|
| 57 |
categories.add(categoryName);
|
|
@@ -69,12 +82,12 @@ module.exports.run = async function ({ api, event, args }) {
|
|
| 69 |
msg += "\nโฐโโโโโโโโโโโโก\n";
|
| 70 |
}
|
| 71 |
|
| 72 |
-
msg += `โโโโโโโพโ\nโ ยป Total commands: [ ${commands.size} ]\nโใ โพโ PREFIX: ${
|
| 73 |
|
| 74 |
-
return api.
|
| 75 |
if (autoUnsend) {
|
| 76 |
await new Promise(resolve => setTimeout(resolve, delayUnsend * 60000));
|
| 77 |
return api.unsendMessage(info.messageID);
|
| 78 |
-
}
|
| 79 |
});
|
| 80 |
};
|
|
|
|
| 1 |
module.exports.config = {
|
| 2 |
name: "help",
|
| 3 |
version: "1.0.0",
|
| 4 |
+
hasPermission: 0, // Fixed typo
|
| 5 |
credits: "august",
|
| 6 |
description: "Guide for new users",
|
| 7 |
commandCategory: "system",
|
|
|
|
| 18 |
const mathSansBold = {
|
| 19 |
A: "๐ ", B: "๐ก", C: "๐ข", D: "๐ฃ", E: "๐ค", F: "๐ฅ", G: "๐ฆ", H: "๐ง", I: "๐จ",
|
| 20 |
J: "๐ฉ", K: "๐ช", L: "๐ซ", M: "๐ฌ", N: "๐ญ", O: "๐ฎ", P: "๐ฏ", Q: "๐ฐ", R: "๐ฑ",
|
| 21 |
+
S: "๐ฒ", T: "๐ณ", U: "๐ด", V: "๐ต", W: "๐ถ", X: "๐ท", Y: "๐ธ", Z: "๐น",
|
| 22 |
+
a: "๐บ", b: "๐ป", c: "๐ผ", d: "๐ฝ", e: "๐พ", f: "๐ฟ", g: "๐", h: "๐", i: "๐",
|
| 23 |
+
j: "๐", k: "๐", l: "๐
", m: "๐", n: "๐", o: "๐", p: "๐", q: "๐", r: "๐",
|
| 24 |
+
s: "๐", t: "๐", u: "๐", v: "๐", w: "๐", x: "๐", y: "๐", z: "๐"
|
| 25 |
};
|
| 26 |
|
| 27 |
module.exports.handleEvent = function ({ api, event, getText }) {
|
| 28 |
const { commands } = global.client;
|
| 29 |
const { threadID, messageID, body } = event;
|
| 30 |
|
| 31 |
+
if (!body || typeof body == "undefined" || body.indexOf("commands") !== 0) return;
|
| 32 |
const splitBody = body.slice(body.indexOf("commands")).trim().split(/\s+/);
|
| 33 |
+
if (splitBody.length === 1 || !commands.get(splitBody[1].toLowerCase())) return;
|
| 34 |
+
|
| 35 |
const threadSetting = global.data.threadData.get(parseInt(threadID)) || {};
|
| 36 |
const command = commands.get(splitBody[1].toLowerCase());
|
| 37 |
+
const prefix = threadSetting.PREFIX || global.config.PREFIX;
|
| 38 |
+
|
| 39 |
+
return api.sendMessage(
|
| 40 |
+
getText("moduleInfo", command.config.name, command.config.description,
|
| 41 |
+
`${prefix}${command.config.name} ${(command.config.usages) ? command.config.usages : ""}`,
|
| 42 |
+
command.config.commandCategory, command.config.cooldowns,
|
| 43 |
+
command.config.hasPermission === 0 ? getText("user") :
|
| 44 |
+
command.config.hasPermission === 1 ? getText("adminGroup") : getText("adminBot"),
|
| 45 |
+
command.config.credits),
|
| 46 |
+
threadID, messageID
|
| 47 |
+
);
|
| 48 |
};
|
| 49 |
|
| 50 |
module.exports.run = async function ({ api, event, args }) {
|
|
|
|
| 54 |
const { commands } = global.client;
|
| 55 |
const { threadID, messageID } = event;
|
| 56 |
const threadSetting = global.data.threadData.get(parseInt(threadID)) || {};
|
| 57 |
+
|
| 58 |
+
const moduleConfig = global.configModule?.[this.config.name] || {}; // Fix for undefined configModule
|
| 59 |
+
const autoUnsend = moduleConfig.autoUnsend ?? false;
|
| 60 |
+
const delayUnsend = moduleConfig.delayUnsend ?? 60;
|
| 61 |
+
const prefix = threadSetting.PREFIX || global.config.PREFIX;
|
| 62 |
|
| 63 |
const categories = new Set();
|
| 64 |
const categorizedCommands = new Map();
|
| 65 |
|
| 66 |
for (const [name, value] of commands) {
|
| 67 |
+
if (value.config.hide) continue;
|
| 68 |
const categoryName = value.config.commandCategory;
|
| 69 |
if (!categories.has(categoryName)) {
|
| 70 |
categories.add(categoryName);
|
|
|
|
| 82 |
msg += "\nโฐโโโโโโโโโโโโก\n";
|
| 83 |
}
|
| 84 |
|
| 85 |
+
msg += `โโโโโโโพโ\nโ ยป Total commands: [ ${commands.size} ]\nโใ โพโ PREFIX: ${prefix} ใ\nโฐโโโโโโโโโโโโก`;
|
| 86 |
|
| 87 |
+
return api.sendMessage(msg, threadID, async (error, info) => {
|
| 88 |
if (autoUnsend) {
|
| 89 |
await new Promise(resolve => setTimeout(resolve, delayUnsend * 60000));
|
| 90 |
return api.unsendMessage(info.messageID);
|
| 91 |
+
}
|
| 92 |
});
|
| 93 |
};
|