Skip to main content
Options are what people fill in after the name of a command. Declare them as an object, and run receives their values already typed: you never write a type.
src/commands/mod/ban.ts
That is all: Discord asks for target, reason and days in that order, and your editor knows that options.target is a User and that options.reason may be missing.
Every field of every kind of option is in the reference.

Declaring an option

The key is the name of the option, the value says what it is. Every option has a type and a description (1 to 100 characters, shown under its name): Names follow the rules of Discord: lowercase letters, digits, - and _, 32 characters at most. A command has 25 options at most.

Required or optional

An option is optional unless it says required: true. In run, a required option is always there; an optional one may be undefined, and your editor reminds you:
src/commands/greet.ts
Discord wants the required options first. You can declare them in any order: ChapterJS puts the required ones first for you, and keeps the order you wrote for the rest.

Choices

With choices, the person picks in a list instead of typing, and the value is typed as one of the choices. A string, integer or number option can have between 1 and 25 choices:
src/commands/color.ts
The choices of a string option are texts, those of an integer or number option are numbers; what is shown is 1 to 100 characters. The same choice can’t appear twice.

Autocomplete

When the values are not known in advance, or change (a song, a player, a ticket), autocomplete suggests them while the person types: Discord asks your bot every few keystrokes, and shows what your function returns under the option. The person may still type something else.
src/commands/play.ts
autocomplete has one function per option, by its name, for a string, integer or number option without choices. It receives: It returns the suggestions (or a promise of them): a value, shown as is, or { name, value } to show a text and receive another value. A string option suggests texts, an integer or number option numbers. Discord shows 25 at most, in the order you return them, and waits 3 seconds: return quickly, your best matches first.
A suggestion is a help, not a limit: Discord sends your run what the person typed, picked in the list or not. Check the value, as in the sample.
What the function returns is checked when it is sent. Too many suggestions are cut to 25, and a name over 100 characters is shortened, said once with ⚠. What can’t be fixed is an error, and nothing is suggested:

Limits on what is typed

A text can be given a length, a number a range: Discord refuses what is outside before the command even reaches your bot. For an integer option, min, max and the choices are whole numbers.

Channels of some kinds only

channelTypes says which kinds of channels can be picked. By default, all of them:
src/commands/announce.ts
The values are those of ChannelType. What run receives is still a Channel: check its kind with isTextBased() or isVoice() before using what only that kind has.

What is checked

Everything an option declares is checked when the file loads, against the limits of Discord. A mistake is explained in your terminal before Discord refuses it, with the file in front:
Your editor underlines most of these before you even save: the types of command() only accept what exists.

Answering

Reply, defer, edit, follow up.

Translations

Options and choices in the language of each person.