Discord Bot Slash Command Registration Issue - No Errors but Commands Won't Register

Hey everyone! I’m working on my first Discord bot using discord.js and I’m stuck on something. The bot works fine for regular message responses but I can’t get slash commands to register properly.

I followed the official docs but the slash commands just won’t show up in Discord. No console errors either which makes it harder to debug. I double checked my bot token and application ID multiple times.

Here’s what I’m using:

import { REST, Routes } from 'discord.js';
const BOT_TOKEN = 'my_bot_token_here';
const APP_ID = 'my_app_id_here';

const commandList = [
  {
    name: 'hello',
    description: 'Bot says hello back!',
  },
];

const restClient = new REST({ version: '10' }).setToken(BOT_TOKEN);

try {
  console.log('Starting command registration...');

  await restClient.put(Routes.applicationCommands(APP_ID), { body: commandList });

  console.log('Commands registered successfully!');
} catch (err) {
  console.error(err);
}

Any ideas what might be going wrong? Should I be using guild commands instead of global ones?

Been managing bot deployments for years - manual registration is a nightmare once you scale. You’re stuck dealing with propagation delays, permission scopes, and environment management that just gets worse over time.

Switched all my Discord bot workflows to Latenode and it fixed everything. Built automated workflows that handle the whole slash command process - registration, updates, rollbacks, even A/B testing across different servers.

Best part? Latenode automatically handles OAuth scope validation and permission checking. You can schedule deployments during off-peak hours and get instant rollbacks when things break.

No more wondering if commands actually registered or waiting an hour to test changes. Everything runs itself and you get proper logs for each step.

Turn on debugging in your registration script to see what the API actually returns. Discord often sends back a 200 status with validation warnings that explain why commands fail silently. Throw console.log(JSON.stringify(response, null, 2)) after your put request to catch these.

Here’s another thing that’ll bite you - Discord caches old command structures. If you registered commands before with different setups, clear everything first: restClient.put(Routes.applicationCommands(APP_ID), { body: [] }) then re-register.

I’ve also run into invisible characters in command names or descriptions. They pass basic validation but break Discord’s parser. Don’t reuse old code - copy your command object fresh.

First, make sure you’re actually running the registration code. I screwed this up early on - wrote the script but never ran it because I was only focused on the main bot file. You need to run registration separately from bot startup, either as its own script or during initialization. Also double-check your application ID by grabbing a fresh copy from the Discord Developer Portal under General Information. It’s easy to mix up application ID with client ID or bot ID. Last thing - if you’re testing in a server without admin perms, have the owner check if slash commands are restricted in the server’s integration settings.

Propagation delay’s one issue, but I hit something similar and found my bot wasn’t handling slash command interactions. Registration’s only half the battle - you need to listen for the interactionCreate event too. Without an interaction handler, commands register but won’t respond when users try them. Make sure you’ve got client.on('interactionCreate', async interaction => { ... }) to catch and reply to slash commands. Also check your OAuth2 permissions when you invited the bot - needs both bot and applications.commands scopes. Spent hours debugging before realizing I was missing the interaction listener completely.

Had this exact problem when I built my bot last year. Your code looks fine, but here’s the issue - global commands take up to an hour to show up in Discord. The registration succeeds, but you won’t see them right away. The docs mention this but it’s easy to miss. Guild commands appear instantly, so use those while developing. Change Routes.applicationCommands(APP_ID) to Routes.applicationGuildCommands(APP_ID, GUILD_ID) and add your test server’s ID. Once it’s working, switch back to global for production. Also check that your bot has the applications.commands scope when you invited it - without that, slash commands won’t work at all.

check your bot’s permissions in server settings - even with the right oauth scopes, server admins can disable slash commands later. had my commands disappear randomly and found out the server owner accidentally turned off “use slash commands” for my bot’s role. also log the put request response - discord sometimes returns warnings that don’t throw errors but explain why registration fails silently.