Discord takes /ban: lower case letters, digits, - and _ only.
Discord rejects a description longer than 100 characters.
Preview in Discord
Enter the command name.
- Where to send it
POST /applications/{application.id}/guilds/{guild.id}/commands
Request body
{
"name": "ban",
"description": "Bans a user from the server for good",
"type": 1,
"options": [
{
"name": "user",
"description": "Who to ban",
"type": 6,
"required": true
}
]
}Enter the command name and description.
How to use it in three steps
Step by step, with this page's example.
- 01
Give the command a name and description.
- 02
Add options with types and requirements.
- 03
Copy the JSON and register the command with the API.
Name "Ticket", an optional option details and a required option topic, both text
{
"name": "ticket",
"description": "Open a ticket",
"type": 1,
"options": [
{
"name": "topic",
"description": "What it is about",
"type": 3,
"required": true
},
{
"name": "details",
"description": "More about the ticket",
"type": 3,
"required": false
}
]
} Questions
- What is a Discord slash command?
- It is a command starting with / that a bot registers with the Discord API along with a description and options, so Discord suggests it to users.
- How do I register a slash command with the Discord API?
- Send the JSON from the tool with a POST request to the application commands endpoint: /applications/{application.id}/commands for a global command or /applications/{application.id}/guilds/{guild.id}/commands for one server.
- What does type 3 mean?
- It is the STRING option type. Discord numbers types: 3 is text, 4 an integer, 6 a user, 7 a channel, 8 a role.
- How is a global command different from a server command?
- A command registered for one server is available right away; a global one works on every server with the bot and needs a moment for Discord to propagate it.
- How many slash commands can a bot have?
- Up to 100 global slash commands per application, plus up to 100 commands for each server.