Reload command issue

I have been trying to use the reload cmd from the djs docs but it gives me this error
No description
4 Replies
d.js toolkit
d.js toolkit10mo 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 OP
Electrix
ElectrixOP10mo ago
const { EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle, ModalBuilder, TextInputBuilder, TextInputStyle } = require('discord.js');
const config = require("../config.js")
module.exports = {
name: "reload",
description: "Admin command.",
options: [{
name: "command",
description: "The command to reload.",
type: 3,
required: true
}],
async execute(interaction) {
const commandName = interaction.options.getString('command', true).toLowerCase();
const command = interaction.client.commands.get(commandName);

if (!command) {
return interaction.reply(`There is no command with name \`${commandName}\`!`);
}

delete require.cache[require.resolve(`..commands/${command.data.name}.js`)];

try {
interaction.client.commands.delete(command.data.name);
const newCommand = require(`..commands/${command.data.name}.js`);
interaction.client.commands.set(newCommand.data.name, newCommand);
await interaction.reply(`Command \`${newCommand.data.name}\` was reloaded!`);
} catch (error) {
console.error(error);
await interaction.reply(`There was an error while reloading a command \`${command.data.name}\`:\n\`${error.message}\``);
}
},
};
const { EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle, ModalBuilder, TextInputBuilder, TextInputStyle } = require('discord.js');
const config = require("../config.js")
module.exports = {
name: "reload",
description: "Admin command.",
options: [{
name: "command",
description: "The command to reload.",
type: 3,
required: true
}],
async execute(interaction) {
const commandName = interaction.options.getString('command', true).toLowerCase();
const command = interaction.client.commands.get(commandName);

if (!command) {
return interaction.reply(`There is no command with name \`${commandName}\`!`);
}

delete require.cache[require.resolve(`..commands/${command.data.name}.js`)];

try {
interaction.client.commands.delete(command.data.name);
const newCommand = require(`..commands/${command.data.name}.js`);
interaction.client.commands.set(newCommand.data.name, newCommand);
await interaction.reply(`Command \`${newCommand.data.name}\` was reloaded!`);
} catch (error) {
console.error(error);
await interaction.reply(`There was an error while reloading a command \`${command.data.name}\`:\n\`${error.message}\``);
}
},
};
Here is the code
lupus
lupus10mo ago
Could you get me the full stacktrace (you can censor usernames if you want)?
Ashish
Ashish10mo ago
Also, show your handler, how you handle ur commands
Want results from more Discord servers?
Add your server