'I am trying to make a discord.js discord bot and I am getting the error: TypeError: interaction.isCommand is not a function
I am making a slash commands and keep getting the error TypeError: interaction.isCommand is not a function. I am using discord.js version 12.5.3. It says that it should work and I have seen a few videos using it.
bot.ws.on('INTERACTION_CREATE', async interaction => {
if (!interaction.isCommand()) return;
const commandName = interaction.Name
const commad2 = interaction.name
console.log(commandName + " " + commad2)
if (commandName == 'name') {
await interaction.reply({
content: 'Yeet',
})
}
})
// Using the below I got it to say wow in console but nothing else and no error
bot.ws.on("INTERACTION_CREATE", interaction => {
console.log("Wow")
interaction.reply({ content: 'Pong!', ephemeral: true });
if(!interaction.isCommand()) return;
interaction.reply('Pong!')
})
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|