Slash Commands
Last updated
Last updated
Slash Commands are the new, exciting way to build and interact with bots on Discord. With Slash Commands, all you have to do is type /
and you're ready to use your favorite bot. Users can learn everything your bot does and easily find new features as you add them. Validation, error states, and helpful UI walks them through your commands, meaning they can get it right the first time, especially on mobile. You now have one more ally in the fight against your phone's autocorrect. Slash Commands set your users up for success instead of confusion and frustration. They separate how users think and how your code works, meaning no matter how complex your codebase and commands may get, people who love your bot will find it approachable and easy to use.
Your bot must be invited with the bot
and applications.commands
scopes.
Re-invite your bot with these scopes, else slash commands will not work.
Don't forget to add the onInteraction
event to your main file. For example:
Each bot can have 100 global slash commands, as well as, 100 slash commands per guild.
Slash commands can not share the same name.
Slash command names can not contain special characters and must be shorter than 32 characters.
Create slash command data in your main file.
Template:
With Options
Without Options
Example:
Finalizing your slash commands.
slashCommandName
must remain the same as what you inputted for the application command data.
Global slash commands can take up to an hour to fully register. Guild slash commands should be registered instantly.
Template: Guild Slash Command_
Global Slash Command
Examples: Guild Slash Command
Global Slash Command
slashCommandName
must remain the same as what you inputted for the application command data.
Template:
Example: