I dont know what wrong with the code

const { REST } = require("@discordjs/rest");
const { Routes } = require("discord-api-types/v9");
const fs = require("fs");

module.exports = (client) => {
client.handleCommands = async () => {
const commandFolders = fs.readdirSync("./src/commands");
for (const folder of commandFolders) {
const commandFiles = fs
.readdirSync(`./src/commands/${folder}`)
.filter((file) => file.endsWith(".js"));

const { commands, commandArray } = client;
for (const file of commandFiles)
{
const command = require(`../../commands/${folder}/${file}`);
commands.set(command.data.name, command);
commandArray.push(command.data.toJSON());
console.log(
`Command: ${command.data.name} has been passed through the handler.`
);
}
}
const { REST } = require("@discordjs/rest");
const { Routes } = require("discord-api-types/v9");

const clientId = "788922211389669397";
const rest = new REST({ version: "9" }).setToken(process.env.token);
try {
console.log("Started refreshing application (/) commands.");

await rest.put(Routes.applicationCommands(clientId), {
body: client.commandArray,
});
console.log("Successfully reloaded application (/) commands.");
} catch (error) {
console.error(error);
}
};
};
const { REST } = require("@discordjs/rest");
const { Routes } = require("discord-api-types/v9");
const fs = require("fs");

module.exports = (client) => {
client.handleCommands = async () => {
const commandFolders = fs.readdirSync("./src/commands");
for (const folder of commandFolders) {
const commandFiles = fs
.readdirSync(`./src/commands/${folder}`)
.filter((file) => file.endsWith(".js"));

const { commands, commandArray } = client;
for (const file of commandFiles)
{
const command = require(`../../commands/${folder}/${file}`);
commands.set(command.data.name, command);
commandArray.push(command.data.toJSON());
console.log(
`Command: ${command.data.name} has been passed through the handler.`
);
}
}
const { REST } = require("@discordjs/rest");
const { Routes } = require("discord-api-types/v9");

const clientId = "788922211389669397";
const rest = new REST({ version: "9" }).setToken(process.env.token);
try {
console.log("Started refreshing application (/) commands.");

await rest.put(Routes.applicationCommands(clientId), {
body: client.commandArray,
});
console.log("Successfully reloaded application (/) commands.");
} catch (error) {
console.error(error);
}
};
};
12 Replies
d.js toolkit
d.js toolkit7mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button! - Marked as resolved by staff
rewsos
rewsos7mo ago
v9
treble/luna
treble/luna7mo ago
we dont either you'll have to explain more
rewsos
rewsos7mo ago
?
rewsos
rewsos7mo ago
idk it just says
No description
No description
treble/luna
treble/luna7mo ago
one of your commands does not export a data property
rewsos
rewsos7mo ago
No description
treble/luna
treble/luna7mo ago
okay? reposting isnt gonna change my answer
rewsos
rewsos7mo ago
your like no help i was posting the command block
treble/luna
treble/luna7mo ago
one of your commands does not export a data property
rewsos
rewsos7mo ago
idk wtf i did but its fixed