Jonell01 commited on
Commit
7c4f99b
ยท
verified ยท
1 Parent(s): 51a483e

Update modules/commands/help.js

Browse files
Files changed (1) hide show
  1. 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
- hasPermssion: 0,
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: "๐– ", 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.has(splitBody[1].toLowerCase())) return;
 
34
  const threadSetting = global.data.threadData.get(parseInt(threadID)) || {};
35
  const command = commands.get(splitBody[1].toLowerCase());
36
- const prefix = (threadSetting.hasOwnProperty("PREFIX")) ? threadSetting.PREFIX : global.config.PREFIX;
37
- 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);
 
 
 
 
 
 
 
 
 
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
- const { autoUnsend, delayUnsend } = global.configModule[this.config.name];
48
- const prefix = (threadSetting.hasOwnProperty("PREFIX")) ? threadSetting.PREFIX : global.config.PREFIX;
 
 
 
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; // Skip hidden commands
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: ${global.config.PREFIX} ใ€\nโ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โŸก`;
73
 
74
- return api.shareContact(msg, api.getCurrentUserID(), threadID, async (error, info) => {
75
  if (autoUnsend) {
76
  await new Promise(resolve => setTimeout(resolve, delayUnsend * 60000));
77
  return api.unsendMessage(info.messageID);
78
- } else return;
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
  };