Slash command not appearing in Discord server

I’m working on a Discord bot and having trouble getting my slash commands to register properly. The /support command I created doesn’t show up when I type it in my server.

I’ve already tried adjusting bot permissions and reinviting it multiple times but nothing seems to work. My Node.js version should be fine. Here’s my current code:

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 supportCommand = 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 available here.', ephemeral: true });
        return;
    }

    const menuButtons = [
        {
            type: 2,
            style: 1,
            label: 'Account Issues',
            custom_id: 'account-btn'
        },
        {
            type: 2,
            style: 1,
            label: 'Technical Support',
            custom_id: 'tech-btn'
        },
        {
            type: 2,
            style: 2,
            label: 'Close',
            custom_id: 'close-btn'
        }
    ];

    await interaction.reply({
        content: 'Support menu loaded. Choose your issue type:',
        components: [{
            type: 1,
            components: menuButtons
        }],
        ephemeral: true
    });

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

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

bot.login(TOKEN);

What am I missing to make the slash command visible in Discord?

you’re missing the actual command registration part dude. building the command object dosnt automatically register it with discord - you need to use the REST api to push it to your guild or globally first.

Looking at your code, the issue is that you’re creating the slash command structure but never actually telling Discord about it. I ran into this exact problem last year and spent hours troubleshooting before realizing the registration step was missing. You need to use the REST client to deploy your commands - either create a deploy script or add registration logic in your ready event. The SlashCommandBuilder only creates the command definition locally, but Discord’s API requires you to explicitly register it through a PUT request to their endpoints. After you implement the registration using REST and Routes from discord.js, your command should appear within minutes for guild-specific commands or up to an hour for global ones.

Your command definition looks correct but you haven’t actually deployed it to Discord’s servers. After creating the SlashCommandBuilder object, you need to register it using Discord’s REST API. I had the same issue when I started - the command exists in your code but Discord doesn’t know about it yet. You’ll need to create a separate deployment script or add registration logic to your main file using the REST module from discord.js. The registration process involves sending your command data to either a specific guild (for testing) or globally (for production). Once you register it properly, there might be a delay of up to an hour for global commands to appear, though guild commands usually show up immediately.