forked from MarvinWariors/goatbotFiles
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathHelp
More file actions
136 lines (114 loc) ยท 4.75 KB
/
Help
File metadata and controls
136 lines (114 loc) ยท 4.75 KB
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
const fs = require("fs-extra");
const axios = require("axios");
const path = require("path");
const { getPrefix } = global.utils;
const { commands, aliases } = global.GoatBot;
const doNotDelete = "[ ๐ | VINCENT AI ]";
module.exports = {
config: {
name: "help",
version: "1.17",
author: "Vincent", // orginal author Vincent
countDown: 0,
role: 0,
shortDescription: {
en: "View command usage",
},
longDescription: {
en: "View command usage and list all commands directly",
},
category: "info",
guide: {
en: "{pn} / help cmdName ",
},
priority: 1,
},
onStart: async function ({ message, args, event, threadsData, role }) {
const { threadID } = event;
const threadData = await threadsData.get(threadID);
const prefix = getPrefix(threadID);
if (args.length === 0) {
const categories = {};
let msg = "";
msg += `โโโโโโโโฆโพโฆโโโโโโโ\n โช๏ธ ๐ฉ๐๐ก๐๐๐ก๐ง ๐๐ ๐๐ฆ โช๏ธ\nโโโโโโโโฆโพโฆโโโโโโโ`;
for (const [name, value] of commands) {
if (value.config.role > 1 && role < value.config.role) continue;
const category = value.config.category || "Uncategorized";
categories[category] = categories[category] || { commands: [] };
categories[category].commands.push(name);
}
8
Object.keys(categories).forEach(category => {
if (category !== "info") {
msg += `\nโญโโโโโโโโโโโโ๐\nโใ ${category.toUpperCase()} ใ`;
const names = categories[category].commands.sort();
for (let i = 0; i < names.length; i += 1) {
const cmds = names.slice(i, i + 1).map(item => `โโฅ${item}`);
msg += `\n${cmds.join(" ".repeat(Math.max(0, 5 - cmds.join("").length)))}`;
}
msg += `\nโฐโโโโโโโโ๐`;
}
});
const totalCommands = commands.size;
msg += `\n๐พ๐ช๐ง๐ง๐๐ฃ๐ฉ๐ก๐ฎ, ๐ ๐๐๐ซ๐ ${totalCommands} ๐๐ค๐ข๐ข๐๐ฃ๐๐จ ๐ฉ๐๐๐ฉ ๐๐๐ฃ ๐๐ ๐ช๐จ๐๐. ๐๐ค๐ค๐ฃ ๐ข๐ค๐ง๐ ๐๐ค๐ข๐ข๐๐ฃ๐๐จ ๐ฌ๐๐ก๐ก ๐๐ ๐๐๐๐๐\n`;
msg += `๐๐ฎ๐ฅ๐ ${prefix} ๐๐๐ก๐ฅ ๐ฐ๐ค๐ข๐ข๐๐ฃ๐ ๐ก๐ฎ๐บ๐ฒ ๐๐ผ ๐๐ถ๐ฒ๐ ๐๐ต๐ฒ ๐ฑ๐ฒ๐๐ฎ๐ถ๐น๐ ๐ผ๐ณ ๐๐ต๐ฎ๐ ๐ฐ๐ผ๐บ๐บ๐ฎ๐ป๐ฑ\n`;
msg += `๐๏ธใ ๐ฉ๐๐ก๐๐๐ก๐ง ๐๐ฅ๐ ๐๐ก๐๐ข๐ก ใ๐๏ธ`;
const helpListImages = [
"https://i.imgur.com/WHRGiPz.gif",
"https://i.imgur.com/zM4Hvmn.gif ",
"https://i.imgur.com/8d6WbRJ.gif",
"https://i.imgur.com/aYS6HRa.mp4",
"https://i.imgur.com/dOAZf6R.jpeg",
"https://i.imgur.com/AIz8ASV.jpeg",
"https://i.imgur.com/6vAPXOY.gif"
];
const helpListImage = helpListImages[Math.floor(Math.random() * helpListImages.length)];
await message.reply({
body: msg,
attachment: await global.utils.getStreamFromURL(helpListImage)
});
} else {
const commandName = args[0].toLowerCase();
const command = commands.get(commandName) || commands.get(aliases.get(commandName));
if (!command) {
await message.reply(`Command "${commandName}" not found.`);
} else {
const configCommand = command.config;
const roleText = roleTextToString(configCommand.role);
const author = configCommand.author || "Unknown";
const longDescription = configCommand.longDescription ? configCommand.longDescription.en || "No description" : "No description";
const guideBody = configCommand.guide?.en || "No guide available.";
const usage = guideBody.replace(/{p}/g, prefix).replace(/{n}/g, configCommand.name);
const response = `โญโโ NAME โโโโโโโ
โ ${configCommand.name}
โโโ INFO
โ Description: ${longDescription}
โ Other names: ${configCommand.aliases ? configCommand.aliases.join(", ") : "Do not have"}
โ Other names in your group: Do not have
โ Version: ${configCommand.version || "1.0"}
โ Role: ${roleText}
โ Time per command: ${configCommand.countDown || 1}s
โ Author: ${author}
โโโ Usage
โ ${usage}
โโโ Notes
โ The content inside <XXXXX> can be changed
โ The content inside [a|b|c] is a or b or c
โฐโโโโโโโโ`;
await message.reply(response);
}
}
},
};
function roleTextToString(roleText) {
switch (roleText) {
case 0:
return "0 (All users)";
case 1:
return "1 (Group administrators)";
case 2:
return "2 (Admin bot)";
default:
return "Unknown role";
}
}