Class DurationInput

Constructors

Properties

formatSuffix: " (e.g. 1d, 2h, 15m, 30s)" = ' (e.g. 1d, 2h, 15m, 30s)'
formatSuffixShort: " (e.g. 2h, 15m)" = ' (e.g. 2h, 15m)'
regex: RegExp = ...

Regular expression to match time units

timeUnits: Record<string, number> = ...

Supported time units in milliseconds

Methods

  • Parameters

    • i: SlashCommandStringOption
    • Optionaloptions: {
          description?: string;
          name?: string;
          omitSuffix?: boolean;
          required?: boolean;
          shortSuffix?: boolean;
      }

    Returns SlashCommandStringOption

  • Parameters

    • Optionaloptions: {
          customId?: string;
          label?: string;
          omitSuffix?: boolean;
          placeholder?: string;
          required?: boolean;
          shortSuffix?: boolean | "short";
      }

    Returns ActionRowBuilder<TextInputBuilder>

  • Resolves human input (user prompts) to milliseconds

    Supported formats (please note that spaces are ignored):

    • Full: 1 day, 2 hours, 15 minutes, and 30 seconds
    • Short: 1d, 2h, 15m, 30s
    • Mixed: 1 day,2h,15m,30s

    Parameters

    • input: string

      The human input string

    • OptionalmaxMs: number

    Returns number

    The time in milliseconds

  • Parameters

    • input: string
    • omitSuffix: boolean | "short" = false

    Returns string