Skip to content

option

const option: object

Defined in: packages/core/src/commands.ts:137

Describes the options of a command. The key you give each one in command({ options }) is its name; the handler gets them typed.

  • An option is required when required: true, and also never missing when it has a default.
  • user, role and channel give the id; mentionable gives { id, type }; attachment gives the attachment.

attachment: <C>(config?) => OptionDef<APIAttachment, C>

C extends OptionConfig

C

OptionDef<APIAttachment, C>

boolean: <C>(config?) => OptionDef<boolean, C>

C extends BooleanConfig

C

OptionDef<boolean, C>

channel: <C>(config?) => OptionDef<string, C>

C extends ChannelConfig

C

OptionDef<string, C>

choice: <W, C>(words, config?) => OptionDef<W[number], C>

A choice between fixed words; the handler gets the word, typed as the union.

W extends readonly string[]

C extends ChoiceConfig<W[number]>

W

C

OptionDef<W[number], C>

integer: <C>(config?) => OptionDef<number, C>

C extends NumberConfig

C

OptionDef<number, C>

mentionable: <C>(config?) => OptionDef<MentionableValue, C>

C extends OptionConfig

C

OptionDef<MentionableValue, C>

number: <C>(config?) => OptionDef<number, C>

C extends NumberConfig

C

OptionDef<number, C>

role: <C>(config?) => OptionDef<string, C>

C extends OptionConfig

C

OptionDef<string, C>

string: <C>(config?) => OptionDef<string, C>

C extends StringConfig

C

OptionDef<string, C>

user: <C>(config?) => OptionDef<string, C>

C extends OptionConfig

C

OptionDef<string, C>