// Function to register commands from the "./commands" directory
const registerCommands = async () => {
const commandFiles = await fsPromises.readdir("./commands");
for (const file of commandFiles) {
const command = require(`./commands/${file}`);
if (command && command.name) {
client.commands.set(command.name, command);
handlers.logHandler.log(`Registered Command ${command.name}`, 1);
} else {
handlers.logHandler.log(
`Command ${file} is missing data or name property. Skipping.`,
2
);
}
}
};
// Function to register commands from the "./commands" directory
const registerCommands = async () => {
const commandFiles = await fsPromises.readdir("./commands");
for (const file of commandFiles) {
const command = require(`./commands/${file}`);
if (command && command.name) {
client.commands.set(command.name, command);
handlers.logHandler.log(`Registered Command ${command.name}`, 1);
} else {
handlers.logHandler.log(
`Command ${file} is missing data or name property. Skipping.`,
2
);
}
}
};