mirror of
https://github.com/discordjs/discord-api-types.git
synced 2026-05-29 23:00:08 +00:00
feat: add max/min option for number-based options (#221)
This commit is contained in:
@@ -26,11 +26,14 @@ interface APIApplicationCommandOptionBase {
|
||||
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-structure
|
||||
*/
|
||||
export type APIApplicationCommandOption =
|
||||
| APIApplicationCommandArgumentOptions
|
||||
| APIApplicationCommandStringArgumentOptions
|
||||
| APIApplicationCommandSubCommandOptions
|
||||
| APIApplicationCommandOptionBase
|
||||
| APIApplicationCommandChannelOptions
|
||||
| APIApplicationCommandAutocompleteOptions;
|
||||
| APIApplicationCommandOptionBase
|
||||
| APIApplicationCommandNumberArgumentOptions
|
||||
| APIApplicationCommandStringAutocompleteOptions
|
||||
| APIApplicationCommandNumericAutocompleteOptions;
|
||||
|
||||
/**
|
||||
* This type is exported as a way to make it stricter for you when you're writing your commands
|
||||
@@ -48,6 +51,31 @@ export interface APIApplicationCommandSubCommandOptions extends Omit<APIApplicat
|
||||
* In contrast to `APIApplicationCommandSubCommandOptions`, these types cannot have an `options` array,
|
||||
* but they can have a `choices` one
|
||||
*/
|
||||
export interface APIApplicationCommandStringArgumentOptions extends Omit<APIApplicationCommandOptionBase, 'type'> {
|
||||
type: ApplicationCommandOptionType.String;
|
||||
choices?: APIApplicationCommandOptionChoice[];
|
||||
}
|
||||
|
||||
/**
|
||||
* This type is exported as a way to make it stricter for you when you're writing your commands
|
||||
*
|
||||
* In contrast to `APIApplicationCommandSubCommandOptions`, these types cannot have an `options` array,
|
||||
* but they can have a `choices`, a `min_value` and `max_value` field
|
||||
*/
|
||||
export interface APIApplicationCommandNumberArgumentOptions
|
||||
extends Omit<APIApplicationCommandOptionBase, 'type' | 'autocomplete'> {
|
||||
type: ApplicationCommandOptionType.Integer | ApplicationCommandOptionType.Number;
|
||||
choices?: APIApplicationCommandOptionChoice[];
|
||||
/**
|
||||
* If the option is an `INTEGER` or `NUMBER` type, the minimum value permitted.
|
||||
*/
|
||||
min_value?: number;
|
||||
/**
|
||||
* if the option is an `INTEGER` or `NUMBER` type, the maximum value permitted
|
||||
*/
|
||||
max_value?: number;
|
||||
autocomplete?: false;
|
||||
}
|
||||
export interface APIApplicationCommandArgumentOptions
|
||||
extends Omit<APIApplicationCommandOptionBase, 'type' | 'autocomplete'> {
|
||||
type:
|
||||
@@ -64,15 +92,32 @@ export interface APIApplicationCommandArgumentOptions
|
||||
* In contrast to `APIApplicationCommandArgumentOptions`, these types cannot have an `choices` array,
|
||||
* but they can a `autocomplete` field where it's set to `true`
|
||||
*/
|
||||
export interface APIApplicationCommandAutocompleteOptions
|
||||
export interface APIApplicationCommandStringAutocompleteOptions
|
||||
extends Omit<APIApplicationCommandOptionBase, 'type' | 'autocomplete'> {
|
||||
type:
|
||||
| ApplicationCommandOptionType.String
|
||||
| ApplicationCommandOptionType.Integer
|
||||
| ApplicationCommandOptionType.Number;
|
||||
type: ApplicationCommandOptionType.String;
|
||||
autocomplete: true;
|
||||
}
|
||||
|
||||
/**
|
||||
* This type is exported as a way to make it stricter for you when you're writing your commands
|
||||
*
|
||||
* In contrast to `APIApplicationCommandArgumentOptions`, these types cannot have an `choices` array,
|
||||
* but they can a `autocomplete` field where it's set to `true`
|
||||
*/
|
||||
export interface APIApplicationCommandNumericAutocompleteOptions
|
||||
extends Omit<APIApplicationCommandOptionBase, 'type' | 'autocomplete'> {
|
||||
type: ApplicationCommandOptionType.Integer | ApplicationCommandOptionType.Number;
|
||||
autocomplete: true;
|
||||
/**
|
||||
* If the option is an `INTEGER` or `NUMBER` type, the minimum value permitted.
|
||||
*/
|
||||
min_value?: number;
|
||||
/**
|
||||
* If the option is an `INTEGER` or `NUMBER` type, the minimum value permitted.
|
||||
*/
|
||||
max_value?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* This type is exported as a way to make it stricter for you when you're writing your commands
|
||||
*
|
||||
|
||||
@@ -26,11 +26,14 @@ interface APIApplicationCommandOptionBase {
|
||||
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-structure
|
||||
*/
|
||||
export type APIApplicationCommandOption =
|
||||
| APIApplicationCommandArgumentOptions
|
||||
| APIApplicationCommandStringArgumentOptions
|
||||
| APIApplicationCommandSubCommandOptions
|
||||
| APIApplicationCommandOptionBase
|
||||
| APIApplicationCommandChannelOptions
|
||||
| APIApplicationCommandAutocompleteOptions;
|
||||
| APIApplicationCommandOptionBase
|
||||
| APIApplicationCommandNumberArgumentOptions
|
||||
| APIApplicationCommandStringAutocompleteOptions
|
||||
| APIApplicationCommandNumericAutocompleteOptions;
|
||||
|
||||
/**
|
||||
* This type is exported as a way to make it stricter for you when you're writing your commands
|
||||
@@ -48,7 +51,7 @@ export interface APIApplicationCommandSubCommandOptions extends Omit<APIApplicat
|
||||
* In contrast to `APIApplicationCommandSubCommandOptions`, these types cannot have an `options` array,
|
||||
* but they can have a either a `choices` or a `autocomplete` field where it's set to false.
|
||||
*/
|
||||
export interface APIApplicationCommandArgumentOptions
|
||||
export interface APIApplicationCommandStringArgumentOptions
|
||||
extends Omit<APIApplicationCommandOptionBase, 'type' | 'autocomplete'> {
|
||||
type:
|
||||
| ApplicationCommandOptionType.String
|
||||
@@ -64,15 +67,53 @@ export interface APIApplicationCommandArgumentOptions
|
||||
* In contrast to `APIApplicationCommandArgumentOptions`, these types cannot have an `choices` array,
|
||||
* but they can a `autocomplete` field where it's set to `true`
|
||||
*/
|
||||
export interface APIApplicationCommandAutocompleteOptions
|
||||
export interface APIApplicationCommandStringAutocompleteOptions
|
||||
extends Omit<APIApplicationCommandOptionBase, 'type' | 'autocomplete'> {
|
||||
type:
|
||||
| ApplicationCommandOptionType.String
|
||||
| ApplicationCommandOptionType.Integer
|
||||
| ApplicationCommandOptionType.Number;
|
||||
type: ApplicationCommandOptionType.String;
|
||||
autocomplete: true;
|
||||
}
|
||||
|
||||
/**
|
||||
* This type is exported as a way to make it stricter for you when you're writing your commands
|
||||
*
|
||||
* In contrast to `APIApplicationCommandArgumentOptions`, these types cannot have an `choices` array,
|
||||
* but they can a `autocomplete` field where it's set to `true`
|
||||
*/
|
||||
export interface APIApplicationCommandNumericAutocompleteOptions
|
||||
extends Omit<APIApplicationCommandOptionBase, 'type' | 'autocomplete'> {
|
||||
type: ApplicationCommandOptionType.Integer | ApplicationCommandOptionType.Number;
|
||||
autocomplete: true;
|
||||
/**
|
||||
* If the option is an `INTEGER` or `NUMBER` type, the minimum value permitted.
|
||||
*/
|
||||
min_value?: number;
|
||||
/**
|
||||
* If the option is an `INTEGER` or `NUMBER` type, the minimum value permitted.
|
||||
*/
|
||||
max_value?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* This type is exported as a way to make it stricter for you when you're writing your commands
|
||||
*
|
||||
* In contrast to `APIApplicationCommandSubCommandOptions`, these types cannot have an `options` array,
|
||||
* but they can have a `choices`, a `min_value` and `max_value` field
|
||||
*/
|
||||
export interface APIApplicationCommandNumberArgumentOptions
|
||||
extends Omit<APIApplicationCommandOptionBase, 'type' | 'autocomplete'> {
|
||||
type: ApplicationCommandOptionType.Integer | ApplicationCommandOptionType.Number;
|
||||
choices?: APIApplicationCommandOptionChoice[];
|
||||
/**
|
||||
* If the option is an `INTEGER` or `NUMBER` type, the minimum value permitted.
|
||||
*/
|
||||
min_value?: number;
|
||||
/**
|
||||
* if the option is an `INTEGER` or `NUMBER` type, the maximum value permitted
|
||||
*/
|
||||
max_value?: number;
|
||||
autocomplete?: false;
|
||||
}
|
||||
|
||||
/**
|
||||
* This type is exported as a way to make it stricter for you when you're writing your commands
|
||||
*
|
||||
|
||||
@@ -26,11 +26,14 @@ interface APIApplicationCommandOptionBase {
|
||||
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-structure
|
||||
*/
|
||||
export type APIApplicationCommandOption =
|
||||
| APIApplicationCommandArgumentOptions
|
||||
| APIApplicationCommandStringArgumentOptions
|
||||
| APIApplicationCommandSubCommandOptions
|
||||
| APIApplicationCommandOptionBase
|
||||
| APIApplicationCommandChannelOptions
|
||||
| APIApplicationCommandAutocompleteOptions;
|
||||
| APIApplicationCommandOptionBase
|
||||
| APIApplicationCommandNumberArgumentOptions
|
||||
| APIApplicationCommandStringAutocompleteOptions
|
||||
| APIApplicationCommandNumericAutocompleteOptions;
|
||||
|
||||
/**
|
||||
* This type is exported as a way to make it stricter for you when you're writing your commands
|
||||
@@ -48,6 +51,31 @@ export interface APIApplicationCommandSubCommandOptions extends Omit<APIApplicat
|
||||
* In contrast to `APIApplicationCommandSubCommandOptions`, these types cannot have an `options` array,
|
||||
* but they can have a `choices` one
|
||||
*/
|
||||
export interface APIApplicationCommandStringArgumentOptions extends Omit<APIApplicationCommandOptionBase, 'type'> {
|
||||
type: ApplicationCommandOptionType.String;
|
||||
choices?: APIApplicationCommandOptionChoice[];
|
||||
}
|
||||
|
||||
/**
|
||||
* This type is exported as a way to make it stricter for you when you're writing your commands
|
||||
*
|
||||
* In contrast to `APIApplicationCommandSubCommandOptions`, these types cannot have an `options` array,
|
||||
* but they can have a `choices`, a `min_value` and `max_value` field
|
||||
*/
|
||||
export interface APIApplicationCommandNumberArgumentOptions
|
||||
extends Omit<APIApplicationCommandOptionBase, 'type' | 'autocomplete'> {
|
||||
type: ApplicationCommandOptionType.Integer | ApplicationCommandOptionType.Number;
|
||||
choices?: APIApplicationCommandOptionChoice[];
|
||||
/**
|
||||
* If the option is an `INTEGER` or `NUMBER` type, the minimum value permitted.
|
||||
*/
|
||||
min_value?: number;
|
||||
/**
|
||||
* if the option is an `INTEGER` or `NUMBER` type, the maximum value permitted
|
||||
*/
|
||||
max_value?: number;
|
||||
autocomplete?: false;
|
||||
}
|
||||
export interface APIApplicationCommandArgumentOptions
|
||||
extends Omit<APIApplicationCommandOptionBase, 'type' | 'autocomplete'> {
|
||||
type:
|
||||
@@ -64,15 +92,32 @@ export interface APIApplicationCommandArgumentOptions
|
||||
* In contrast to `APIApplicationCommandArgumentOptions`, these types cannot have an `choices` array,
|
||||
* but they can a `autocomplete` field where it's set to `true`
|
||||
*/
|
||||
export interface APIApplicationCommandAutocompleteOptions
|
||||
export interface APIApplicationCommandStringAutocompleteOptions
|
||||
extends Omit<APIApplicationCommandOptionBase, 'type' | 'autocomplete'> {
|
||||
type:
|
||||
| ApplicationCommandOptionType.String
|
||||
| ApplicationCommandOptionType.Integer
|
||||
| ApplicationCommandOptionType.Number;
|
||||
type: ApplicationCommandOptionType.String;
|
||||
autocomplete: true;
|
||||
}
|
||||
|
||||
/**
|
||||
* This type is exported as a way to make it stricter for you when you're writing your commands
|
||||
*
|
||||
* In contrast to `APIApplicationCommandArgumentOptions`, these types cannot have an `choices` array,
|
||||
* but they can a `autocomplete` field where it's set to `true`
|
||||
*/
|
||||
export interface APIApplicationCommandNumericAutocompleteOptions
|
||||
extends Omit<APIApplicationCommandOptionBase, 'type' | 'autocomplete'> {
|
||||
type: ApplicationCommandOptionType.Integer | ApplicationCommandOptionType.Number;
|
||||
autocomplete: true;
|
||||
/**
|
||||
* If the option is an `INTEGER` or `NUMBER` type, the minimum value permitted.
|
||||
*/
|
||||
min_value?: number;
|
||||
/**
|
||||
* If the option is an `INTEGER` or `NUMBER` type, the minimum value permitted.
|
||||
*/
|
||||
max_value?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* This type is exported as a way to make it stricter for you when you're writing your commands
|
||||
*
|
||||
|
||||
@@ -26,11 +26,14 @@ interface APIApplicationCommandOptionBase {
|
||||
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-structure
|
||||
*/
|
||||
export type APIApplicationCommandOption =
|
||||
| APIApplicationCommandArgumentOptions
|
||||
| APIApplicationCommandStringArgumentOptions
|
||||
| APIApplicationCommandSubCommandOptions
|
||||
| APIApplicationCommandOptionBase
|
||||
| APIApplicationCommandChannelOptions
|
||||
| APIApplicationCommandAutocompleteOptions;
|
||||
| APIApplicationCommandOptionBase
|
||||
| APIApplicationCommandNumberArgumentOptions
|
||||
| APIApplicationCommandStringAutocompleteOptions
|
||||
| APIApplicationCommandNumericAutocompleteOptions;
|
||||
|
||||
/**
|
||||
* This type is exported as a way to make it stricter for you when you're writing your commands
|
||||
@@ -48,7 +51,7 @@ export interface APIApplicationCommandSubCommandOptions extends Omit<APIApplicat
|
||||
* In contrast to `APIApplicationCommandSubCommandOptions`, these types cannot have an `options` array,
|
||||
* but they can have a either a `choices` or a `autocomplete` field where it's set to false.
|
||||
*/
|
||||
export interface APIApplicationCommandArgumentOptions
|
||||
export interface APIApplicationCommandStringArgumentOptions
|
||||
extends Omit<APIApplicationCommandOptionBase, 'type' | 'autocomplete'> {
|
||||
type:
|
||||
| ApplicationCommandOptionType.String
|
||||
@@ -64,15 +67,53 @@ export interface APIApplicationCommandArgumentOptions
|
||||
* In contrast to `APIApplicationCommandArgumentOptions`, these types cannot have an `choices` array,
|
||||
* but they can a `autocomplete` field where it's set to `true`
|
||||
*/
|
||||
export interface APIApplicationCommandAutocompleteOptions
|
||||
export interface APIApplicationCommandStringAutocompleteOptions
|
||||
extends Omit<APIApplicationCommandOptionBase, 'type' | 'autocomplete'> {
|
||||
type:
|
||||
| ApplicationCommandOptionType.String
|
||||
| ApplicationCommandOptionType.Integer
|
||||
| ApplicationCommandOptionType.Number;
|
||||
type: ApplicationCommandOptionType.String;
|
||||
autocomplete: true;
|
||||
}
|
||||
|
||||
/**
|
||||
* This type is exported as a way to make it stricter for you when you're writing your commands
|
||||
*
|
||||
* In contrast to `APIApplicationCommandArgumentOptions`, these types cannot have an `choices` array,
|
||||
* but they can a `autocomplete` field where it's set to `true`
|
||||
*/
|
||||
export interface APIApplicationCommandNumericAutocompleteOptions
|
||||
extends Omit<APIApplicationCommandOptionBase, 'type' | 'autocomplete'> {
|
||||
type: ApplicationCommandOptionType.Integer | ApplicationCommandOptionType.Number;
|
||||
autocomplete: true;
|
||||
/**
|
||||
* If the option is an `INTEGER` or `NUMBER` type, the minimum value permitted.
|
||||
*/
|
||||
min_value?: number;
|
||||
/**
|
||||
* If the option is an `INTEGER` or `NUMBER` type, the minimum value permitted.
|
||||
*/
|
||||
max_value?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* This type is exported as a way to make it stricter for you when you're writing your commands
|
||||
*
|
||||
* In contrast to `APIApplicationCommandSubCommandOptions`, these types cannot have an `options` array,
|
||||
* but they can have a `choices`, a `min_value` and `max_value` field
|
||||
*/
|
||||
export interface APIApplicationCommandNumberArgumentOptions
|
||||
extends Omit<APIApplicationCommandOptionBase, 'type' | 'autocomplete'> {
|
||||
type: ApplicationCommandOptionType.Integer | ApplicationCommandOptionType.Number;
|
||||
choices?: APIApplicationCommandOptionChoice[];
|
||||
/**
|
||||
* If the option is an `INTEGER` or `NUMBER` type, the minimum value permitted.
|
||||
*/
|
||||
min_value?: number;
|
||||
/**
|
||||
* if the option is an `INTEGER` or `NUMBER` type, the maximum value permitted
|
||||
*/
|
||||
max_value?: number;
|
||||
autocomplete?: false;
|
||||
}
|
||||
|
||||
/**
|
||||
* This type is exported as a way to make it stricter for you when you're writing your commands
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user