Slash options
guideArgument types, descriptions and choices, autocomplete, typed options, bounds, and reading an option's value anywhere.
This page covers what goes inside the <name: type> slots of a slash command header: the type words Discord understands, how to describe an option and give it choices, autocomplete, and the bounds only a builder option can set. You're assumed to have a bot named "my-bot" logged in and a slash command header in front of you.
How options work
Every <name: type> in a slash command <path> <arguments>: header is one option. Discord shows it as a typed field in the client and validates it before the interaction ever reaches the bot, so {_name} already holds a real value, a member, a role, a number, never raw text left to parse.
slash command mod ban <target: member> [<reason: string>]: description: Ban a member trigger: reply with hidden "Would ban %{_target}% for %{_reason}%"
<target: member> is required; [<reason: string>] is optional and {_reason} reads none when the user leaves it out. A required option can never follow an optional one, the same rule the header itself enforces (see Slash commands). An option takes exactly one value: there's no plural form, and Discord has no notion of a default, so <name: type = x> isn't valid here the way it is for a discord command.
Option types
The type word decides both the Discord option Skript sends and what {_name} holds back.
Type word(s) | Discord type | What | Notes |
|---|---|---|---|
| STRING | the text typed | |
| INTEGER | a whole number | |
| NUMBER | a decimal number | |
| BOOLEAN |
| |
| USER | the Discord user | |
| USER | the guild member | same USER option, resolved to a member; unavailable outside a guild |
| ROLE | the role | |
| MENTIONABLE | a user, member or role | whichever the user picked |
| ATTACHMENT | the uploaded file | |
| CHANNEL | the channel | a specific kind restricts which channels Discord lets the user pick; see Bounds and channel kinds |
| STRING | a Skript colour | built-in autocomplete over colour names |
| STRING | an online (or offline) player | built-in autocomplete over online player names |
any Skript enum ( | STRING | the enum constant | its constants become fixed choices (25 or fewer), or an autocomplete past that |
The same words also build a typed slash option on a builder, outside a structure's header:
set {_target} to a new typed member option named "target" with description "Who"
[a] new typed %*classinfo% [slash] option (named|with [the] name) %string% with [the] desc[ription] %string%Creates a slash option from a Skript type instead of a Discord option type: a member, a colour, a text channel, a player, or any enum (its constants become the choices, or an autocomplete past 25). The same types work as '<name: type>' arguments of a 'slash command' structure.Describing options
An arguments: section on the structure describes each option by name: a plain line for a one-line description, or a sub-section when an option also needs choices.
slash command mod ban <target: member> [<reason: string>]: description: Ban a member arguments: target: Who to ban reason: description: Why choices: Spam: spam Rude: rude trigger: reply with hidden "Would ban %{_target}% for %{_reason}%"
An option left out of arguments: entirely, or without a description: line, keeps Discord's own placeholder: No description provided. choices: is a section of Name: value lines, up to 25, and only valid on a string, integer or number option; the value on the right must parse as that option's type (a number for integer or number, anything for string). Once an option has choices, Discord only lets the user pick from that list.
Autocomplete
An argument with an on completion request: section instead of choices: is flagged auto-complete: the section runs on every keystroke, and return choices answers it and stops the trigger there, up to 25 suggestions.
slash command fruit <name: string>: description: Pick a fruit arguments: name: description: The fruit on completion request: send "[CMD] completion for %current argument%" to console return choices "apple", "banana" and "cherry" trigger: reply with hidden "You picked %{_name}%"
current argument names the option Discord is asking about (useful once a command has more than one auto-complete option); return choices takes plain texts or numbers, used as both the label and the value, or a new choice named "..." with value ... when they need to differ.
Without an on completion request: section, a typed option (color, player, offlineplayer, or an enum past 25 constants) still autocompletes on its own, from its built-in list. An option can't have both choices: and on completion request: (see Errors below).
A builder-declared option with auto complete set has no structure section to answer it in: the generic on slash completion event plus return choices handles it instead, the same way command builders answer their commands generically.
return [the] [slash] (choices|completions) %slashchoices/strings/numbers%Answers an autocomplete request with up to 25 suggestions and stops the trigger. Give choices, or plain texts / numbers (used as both the label and the value).Reading options anywhere
slash option "name" reads any option by name, structure or builder, wherever a slash interaction is in scope.
Expression | Returns |
|---|---|
| a named option's value, only for a command declared by a |
| positional or by-type reads, the same idioms as a |
| the value, typed as Discord sent it |
| the same option's value, resolved to the guild member |
| the same option's value, read back as a specific Discord type ( |
on slash command: set {_target} to slash option "target" send "%used slash command% option target=%{_target}%" to console
slash option only resolves inside on slash command, on slash completion or on slash command cooldown; used elsewhere it's a load error. It works the same whether the command behind it came from a slash command structure or a builder, which is why the generic events see both.
[the] [slash] (option|arg[ument]) [value] [(named|with [the] name)] %string% [as (%-*optiontype%|:member)]The value the user gave to an option of the current slash command, by option name. Typed after what Discord sent (a text, an integer, a number, a boolean, a user, a channel, a role, a mentionable, an attachment), or after the option type you ask for; 'as member' turns a user into the guild member.Bounds and channel kinds
A slash command header's <name: type> has no entry for bounds: a numeric range, a text length or a restricted set of channel kinds only exist on a builder option, a new <type> slash option or a new typed ... slash option.
set {_sides} to a new integer option named "sides" with description "How many sides" set min value of {_sides} to 2 set max value of {_sides} to 100
Property | Default | Accepted values |
|---|---|---|
none | any number, | |
none | any number, | |
none |
| |
none |
| |
empty (any kind) | one or more channel kinds, |
set channel types of {_opt} to text and voice narrows a channel option the same way declaring it as textchannel does, but lets it accept more than one kind. See Command builders for building and pushing the option itself.
Errors you may see
Message (console) | Cause | Fix |
|---|---|---|
Unknown type 'x' for an argument of the slash command | a type word in | check the words in Option types |
The argument 'x' has more than 25 choices; use 'on completion request' instead | a | switch to autocomplete |
The argument 'x' cannot have both choices and an 'on completion request' section | an argument's sub-section has both | keep only one |
The argument 'x' is a <type> option, which cannot have choices |
| only |
'x' is not a valid <type> for the choice 'y' | a choice's value doesn't parse as its option's type | give an |
a <type> option cannot have choices / a <type> option cannot have autocomplete | a builder option's | same restriction, on the builder side |
only integer and number options have a minimum value (same for maximum) |
| only |
A slash option can only be read in a slash command, slash completion or slash command cooldown event |
| move the read into one of them |