Writing a command handler does not make the command exist. Discord has to be told about the command separately, and where you register it decides how long it takes to show up.
Guild versus global registration
| Guild | Global | |
|---|---|---|
| Appears in | One server | Every server the bot is in |
| Takes effect | Immediately | Up to an hour |
| Good for | Development and testing | The finished command |
What to do
- Register during development to one guild
Instant updates mean you can iterate without waiting. Point it at your own test server.
- Switch to global when it is ready
Then wait. The delay is on Discord's side and nothing you do speeds it up.
- Check the bot was invited with
applications.commandsAn invite link missing that scope produces a bot that joins fine and can never have slash commands. Re-inviting with the right scope fixes it without removing the bot.
- Restart your Discord client
The client caches the command list.
Ctrl+Rrefreshes it, and this alone explains a surprising share of «it's not there».
Registration is rate-limited. A bot that crash-loops while re-registering will get throttled, and then the commands stop updating for reasons that have nothing to do with your code. Register when they change, not when the process starts.
Deleting the handler leaves the command visible and broken. You have to overwrite the registered set with one that no longer includes it.
Typing / in the server shows your command with its description, and running it gets a reply.