slash command issue
I have command called
/ping/ping and its loaded correctly but my bot is not showing/can't itconst commandFolders = fs.readdirSync("./commands");
for (const folder of commandFolders) {
const filePath = path.join("./commands", folder);
const commandFiles = fs
.readdirSync(filePath)
.filter((file) => file.endsWith(".js"));
for (const file of commandFiles) {
try {
let command = await import(`./commands/${folder}/${file}`); // Use dynamic import
command = command.default;
if (command.data && command.execute) {
client.commands.set(command.data.name, command);
} else {
console.log(
`[WARNING] The command at ${filePath} is missing a required "data" or "execute" property.`
);
}
} catch (error) {
console.error(`[ERROR] Failed to load command ${filePath}: ${error}`);
}
}
}const commandFolders = fs.readdirSync("./commands");
for (const folder of commandFolders) {
const filePath = path.join("./commands", folder);
const commandFiles = fs
.readdirSync(filePath)
.filter((file) => file.endsWith(".js"));
for (const file of commandFiles) {
try {
let command = await import(`./commands/${folder}/${file}`); // Use dynamic import
command = command.default;
if (command.data && command.execute) {
client.commands.set(command.data.name, command);
} else {
console.log(
`[WARNING] The command at ${filePath} is missing a required "data" or "execute" property.`
);
}
} catch (error) {
console.error(`[ERROR] Failed to load command ${filePath}: ${error}`);
}
}
}