Slash command error
why is it showing this when i run
main code:
register command code:
/wave in chat?main code:
require('dotenv').config();
const { Client, IntentsBitField } = require('discord.js');
const client = new Client({
// make sure all 3 intents are enabled in developer portal
intents: [
IntentsBitField.Flags.Guilds,
IntentsBitField.Flags.GuildMembers,
IntentsBitField.Flags.GuildMessages,
IntentsBitField.Flags.MessageContent,
],
});
client.on('ready' , (c) => {
console.log(${c.user.tag} is online.);
});
client.on('interactionCreate', (interaction) => {
if (!interaction.isChatInputCommand()) return;
if (interaction.commandName === 'wave') {
interaction.reply('Heyπ!');
}
});
client.login(process.env.TOKEN);register command code:
require('dotenv').config();
const { REST , Routes} = require ('discord.js');
const commands = [
{
name: 'wave',
description: 'wave to the bot :)',
},
];
const rest = new REST({version: '10'}).setToken(process.env.TOKEN);
(async () => {
try {
console.log('Registering slash commands...');
await rest.put (
Routes.applicationGuildCommands(process.env.CLIENT_ID, process.env.GUILD_ID),
{body: commands}
);
console.log('Slash commands were registered successfully!');
} catch (error){
console.log(There was an error: ${error});
}
})();
