Discord.js Version: 14.3.0
Node.js Version: 17.0.1
I've been following the guide and went through the commands with options, but I can't execute /echo. I always get the error "TypeError: command.execute is not a function"
Here is my code for the interaction handler:
async execute(interaction) {
if (!interaction.isChatInputCommand()) return;
// fetch the command, and see if it is valid
const command = interaction.client.commands.get(interaction.commandName);
if (!command) return;
// execute the command, catch and log err
console.log(`'${interaction.user.tag}' in '#${interaction.channel.name}' triggered '/${interaction.commandName}'`);
try {
await command.execute(interaction);
}
catch (error) {
console.log(`\x1b[1m\x1b[31m └── ${error}\x1b[0m`);
console.trace();
await interaction.reply({ content: 'There was an error while executing this command!', ephemeral: true });
}
},