-5
It is possible to make a help command where it looks for an element of the module.exports
guy... module.exports = { name: 'help', description: '...', execute(message, args){ }
and within the execute(message, args){ (aqui) }
fetch the name of module.exports
of all other command files in the Commands folder including that file and merge them into one Embed?
Remembering q I’m using an Handler command with Fs...
const { prefix, token } = require('./config.json');
const client = new Discord.Client();
const fs = require('fs');
client.commands = new Discord.Collection();
const commandFiles = fs.readdirSync('./commands').filter(file => file.endsWith('.js'));
for(const file of commandsFiles){
const command = require(`./commands/${file}`);
client.commands.set(command.name, command);
}
client.once('ready', () => {
console.log('Ready!');
});
client.on('message', message =>{
if(!message.content.startsWith(prefix) || message.author.bot) return;
const args = message.content.slice(prefix.length).split(/ +/);
const command = args.shift().toLowerCase();
if(command === 'ping'){
client.commands.get('ping').execute(message, args);
} else if (command == 'help'){
client.commands.get('help').execute(message, args);
}
});
client.login(token);```
e a base de comando é
```module.exports = {
name: 'help',
description: "This is a Help command!",
execute(message, args){
}
}```
Important you [Dit] your question and explain objectively and punctually the difficulty found, accompanied by a [mcve] of the problem and attempt to solve. To better enjoy the site, understand and avoid closures and negativities worth reading the Stack Overflow Survival Guide in English.
– Bacco