Final help fix...

This commit is contained in:
SileNce5k 2022-03-25 00:00:02 +01:00
parent 56df5dcea3
commit 908526eda9
Failed to extract signature

View file

@ -15,6 +15,7 @@ module.exports = {
let commands = "" let commands = ""
let commandFiles = getSubdirFiles('commands/') let commandFiles = getSubdirFiles('commands/')
let x = 0 let x = 0
let fieldName = "General";
if (args[0] == "netmodules") { if (args[0] == "netmodules") {
commandFiles = fs.readdirSync('../../netload').filter(file => file.endsWith('.js')); commandFiles = fs.readdirSync('../../netload').filter(file => file.endsWith('.js'));
if (commandFiles.length == 0) { if (commandFiles.length == 0) {
@ -31,7 +32,6 @@ module.exports = {
.setTimestamp() .setTimestamp()
.setAuthor(client.user.username, client.user.avatarURL({ dynamic: true, size: 4096 })) .setAuthor(client.user.username, client.user.avatarURL({ dynamic: true, size: 4096 }))
let noHelp = 0;
for (const file of commandFiles) { for (const file of commandFiles) {
const command = require(`../../${file}`); const command = require(`../../${file}`);
if(command.disabled) continue; if(command.disabled) continue;
@ -50,22 +50,17 @@ module.exports = {
commands = commands + `${element}\n` commands = commands + `${element}\n`
}); });
} else { } else {
commands = commands + `Description:\n${command.description}\n`; fieldName = "Description";
commands = commands + `${command.description}`;
} }
break; break;
} }
} }
let regex = /<prefix>/g let regex = /<prefix>/g;
if(commands === ""){
noHelp = 1;
}
commands = commands.replace(regex, prefix) commands = commands.replace(regex, prefix)
embed.addFields( embed.addFields(
{ name: "General", value: commands }, { name: fieldName, value: commands },
) )
if(noHelp == 0)
message.channel.send({embeds :[embed]}); message.channel.send({embeds :[embed]});
else
message.channel.send("Either there is no command with that name, or there is no specific help for it.")
}, },
}; };