CommandOption

class CommandOption<TValue, TOptional, TKind>()

Configures one slash-command option. The schema key becomes the handler argument name; use discordName only when Discord should receive a different option name.

exported from lib.weeble.d

Type parameters

  • TValue

  • TOptional – (extends boolean)

  • TKind – (extends string)

Properties

CommandOption.kind

type: readonly TKind

Methods

CommandOption.autocomplete(
provider: TValue extends string | number ? (context: { interaction: Interaction; value: TValue; }) => (TValue | AutocompleteChoice<TValue>)[] | Promise<(TValue | AutocompleteChoice<TValue>)[]> : never
) CommandOption<TValue, TOptional, TKind>
CommandOption.channelTypes(types: number[]) CommandOption<TValue, TOptional, TKind>
CommandOption.choices(...choices: (TValue | OptionChoice<Extract<TValue, string | number>>)[]) CommandOption<TValue, TOptional, TKind>
CommandOption.discordName(name: string) CommandOption<TValue, TOptional, TKind>

Sets the option name registered with Discord.

CommandOption.localizations(values: { description?: LocaleMap; name?: LocaleMap; }) CommandOption<TValue, TOptional, TKind>
CommandOption.maxLength(value: number) CommandOption<TValue, TOptional, TKind>
CommandOption.maxValue(value: number) CommandOption<TValue, TOptional, TKind>
CommandOption.minLength(value: number) CommandOption<TValue, TOptional, TKind>
CommandOption.minValue(value: number) CommandOption<TValue, TOptional, TKind>
CommandOption.optional() CommandOption<TValue, true, TKind>

Makes this option optional. Its handler value becomes TValue | null.