Discord Bot Slash Commands Not Updating: Fix
🔍 WiseChecker

Discord Bot Slash Commands Not Updating: Fix

You have added new slash commands to your Discord bot code, but the old commands still appear in your server. The new commands do not show up, or the bot does not respond to them. This happens because Discord caches slash command definitions and does not automatically sync changes with your bot’s code. This article explains the root cause of sync failures and provides step-by-step fixes for global and guild-specific commands.

Key Takeaways: Fixing Slash Command Sync in Discord Bots

  • Global command sync via bot code: Run the sync function once after code changes to push new definitions to Discord API.
  • Guild command sync via guild ID: Use guild-specific sync to test commands instantly without waiting for global cache.
  • Discord Developer Portal > Bot > Reset Token: Regenerate the bot token if commands still fail to register after multiple sync attempts.

ADVERTISEMENT

Why Slash Commands Do Not Update Automatically

Discord slash commands are registered through the Discord API, not directly from your bot’s running code. When you edit command definitions in your source files, the bot must send a bulk overwrite request to Discord’s servers. If you do not call the sync function, Discord keeps the old command definitions cached. This cache applies globally for commands registered without a guild ID, and it can take up to one hour to refresh automatically. For guild-specific commands, the cache updates faster but still requires a manual sync call. The most common root cause is missing or incorrect sync logic in the bot’s startup sequence.

Global vs Guild Command Registration

A global slash command is available in every server where the bot is present. Discord caches global commands for up to one hour. A guild command is scoped to a single server and updates almost immediately after sync. Developers often use guild commands during testing to avoid the one-hour wait. When you deploy final commands, you must switch to global registration and remove the guild ID parameter.

Rate Limits on Command Registration

Discord applies rate limits to command creation and update requests. You can send up to 200 global command updates per day per bot. Exceeding this limit causes the API to reject further requests. If you run your bot multiple times in a short period, you may hit the rate limit and see old commands persist. Check the API response headers for retry-after values to determine if you are being rate limited.

Steps to Force Slash Commands to Update

The following steps assume you use discord.js v14 or a similar library. Adjust library-specific method names as needed.

  1. Add a sync function to your bot startup
    In your main bot file, call the REST API bulk overwrite method after defining commands. In discord.js, use rest.put(Routes.applicationCommands(clientId), { body: commands }) for global commands or Routes.applicationGuildCommands(clientId, guildId) for guild commands. Place this call inside an async function that runs after the client logs in.
  2. Run the bot once to push new commands
    Stop the bot if it is running. Start it again. The sync function will send the full list of command definitions to Discord. Wait for the console to show a success message or check for HTTP 200 responses. After the bot is online, test the commands in a server.
  3. Clear the command cache manually in Discord
    If commands still show old names, force a cache refresh by leaving and rejoining the voice channel or by restarting the Discord client. For persistent cache issues, right-click the server icon and select Server Settings > Integrations > Bots and Apps. Remove the bot, then re-add it using the invite link.
  4. Delete individual commands via Developer Portal
    Go to the Discord Developer Portal, select your application, then click on the Slash Commands tab under General Information. Delete any stale commands manually. Then run the bot sync again to re-register only the current commands.
  5. Reset the bot token and re-invite
    In the Developer Portal, navigate to Bot > Reset Token. Copy the new token and update your bot code. Re-invite the bot to your server using the new token. This clears all previously cached command registrations and forces a fresh sync.

ADVERTISEMENT

If Slash Commands Still Do Not Update After the Main Fix

Bot Does Not Respond to Any Slash Commands

If the bot shows commands in the slash command menu but does not respond, the issue is likely in the interaction handler. Ensure your bot code includes an event listener for interactionCreate. In discord.js, use client.on('interactionCreate', async interaction => { ... }). Check that the handler executes the correct command file and does not throw an unhandled error. Add a console.log inside the handler to verify the bot receives the interaction.

Commands Appear in One Server but Not Another

This usually means you registered commands as guild-specific for the first server but did not register them globally. To fix, change the registration method to global by removing the guild ID parameter from the REST route. Then run the sync function again. Global commands propagate to all servers within one hour.

Rate Limit Error 429 Appears in Console

Discord returns a 429 status code when you exceed the command update rate limit. Wait the number of seconds specified in the Retry-After response header. Do not restart the bot during this wait. After the cooldown, run the sync function once. To avoid hitting the limit in the future, call the sync function only when command definitions change, not on every bot restart.

Discord Bot Command Registration Methods: Global vs Guild

Item Global Commands Guild Commands
Scope All servers where the bot is present Only the specified server
Cache update time Up to 1 hour Instant after sync
Rate limit 200 updates per day Same pool as global commands
Best for Production deployment Testing during development
API route /applications/{id}/commands /applications/{id}/guilds/{guildId}/commands

After you finish testing with guild commands, remove the guild ID from the route and run the sync function again to register commands globally. Do not keep guild commands in production because they will not appear in other servers.

You can now force slash command updates by adding a sync function, clearing the Discord cache, or resetting the bot token. Next time you edit a command name or option, run the sync function once and wait up to one hour for global propagation. For advanced control, use the guild-specific route during development and switch to global only when you deploy to all servers.

ADVERTISEMENT