Slash command not appearing in Discord bot

I’ve built a Discord bot with a /support command, but it isn’t showing up when I type it in the server.

I’ve spent hours trying to resolve this issue and I’m at a loss. I’ve changed the bot’s permissions and re-invited it numerous times. My Node.js version seems fine and I followed the instructions from the discord.js documentation.

The bot logs in correctly, yet the slash command doesn’t appear in the list of commands. Here is the code I’m working with:

const { Client, GatewayIntentBits } = require('discord.js');
const { SlashCommandBuilder } = require('@discordjs/builders');

const bot = new Client({
  intents: [
    GatewayIntentBits.Guilds,
    GatewayIntentBits.GuildMessages,
    GatewayIntentBits.MessageContent,
  ],
});

const TOKEN = "YOUR_BOT_TOKEN";

bot.on('ready', () => {
  console.log(`Bot is online as ${bot.user.tag}`);
});

const supportCmd = new SlashCommandBuilder()
    .setName('support')
    .setDescription('Show support options and FAQ');

bot.on('interactionCreate', async (interaction) => {
    if (!interaction.isCommand() || interaction.commandName !== 'support') return;

    if (interaction.channelId !== 'YOUR_CHANNEL_ID') {
        await interaction.reply({ content: 'Command not allowed here.', ephemeral: true });
        return;
    }

    const optionButtons1 = [
        {
            type: 2,
            style: 1,
            label: 'Account Issues',
            custom_id: 'account-help'
        },
        {
            type: 2,
            style: 1,
            label: 'Technical Problems',
            custom_id: 'tech-help'
        },
        {
            type: 2,
            style: 3,
            label: 'Payment Help',
            custom_id: 'payment-help'
        }
    ];

    const optionButtons2 = [
        {
            type: 2,
            style: 1,
            label: 'Bug Reports',
            custom_id: 'bug-help'
        },
        {
            type: 2,
            style: 2,
            label: 'Close',
            custom_id: 'close-help'
        }
    ];

    await interaction.reply({
        content: 'Support Menu Available\nChoose a category below to get help with your issue.',
        components: [
            {
                type: 1,
                components: optionButtons1
            },
            {
                type: 1,
                components: optionButtons2
            }
        ],
        ephemeral: true
    });

    const buttonCollector = interaction.channel?.createMessageComponentCollector({ time: 45000 });

    buttonCollector?.on('collect', async (btnClick) => {
        if (btnClick.customId === 'account-help') {
            await btnClick.update({ content: 'Account help selected', ephemeral: true });
        } else if (btnClick.customId === 'tech-help') {
            await btnClick.update({ content: 'Technical support selected', ephemeral: true });
        } else if (btnClick.customId === 'close-help') {
            await btnClick.update({ content: 'Closing support menu...', ephemeral: true });
            buttonCollector.stop();
        }
    });
});

bot.login(TOKEN);

What am I missing? Do I need to register the command somewhere else?

you’re missing the registration step. you need to push that command to discord’s servers first. create a separate deploy file using the rest api to register your slash commands - discord won’t recognize your command without this, even tho your code looks fine.

Had the exact same issue when I started with discord.js v14. Your command handling looks fine, but you’re missing the deployment step. After you build your command with SlashCommandBuilder, you’ve got to use the REST API to actually send it to Discord’s servers. I make a separate deploy.js file that uses REST and Routes from discord.js to push commands globally or to specific guilds. Without this, Discord doesn’t know your command exists, even though your bot’s ready to handle interactions. Registration and interaction handling are totally separate - catches tons of people off guard.

You built the slash command but didn’t register it with Discord’s API. The SlashCommandBuilder just defines what the command looks like - you still need to deploy it so Discord actually knows it exists. Make a deployment script using Routes.applicationCommands() or Routes.applicationGuildCommands() with your client ID and token. Your bot can handle interactions just fine, but Discord won’t show the command until you register it. Super common mistake with slash commands.