Goal: Create /ping and see it respond.
Go to commands/ and create: ping.js
const { SlashCommandBuilder } = require("@discordjs/builders");
module.exports = {
dev: true, // only registers in DEV_GUILD_ID while learning
cooldown: 3,
data: new SlashCommandBuilder()
.setName("ping")
.setDescription("Replies with Pong!"),
async execute(interaction) {
await interaction.reply("Pong! 🏓");
},
};
Stop the bot (Ctrl + C), then:
node index.js
Go to your dev server and type /ping.
APP_ID in config.json is wrong (slash registration can fail)./ping shows in Discord