discord.js slash commands 1

discord.js slash commands

client.on('interactionCreate', (interaction) => {
	if(!interaction.isCommand()) return;
  	interaction.reply('Pong!')
})

Here is what the above code is Doing:
1. We’re importing the client from the discord.js library.
2. We’re creating a new client.
3. We’re logging in with the token we got from the Discord Developer Portal.
4. We’re listening for the interactionCreate event.
5. We’re checking if the interaction is a command.
6. We’re replying to the interaction with “Pong!”.

Similar Posts