diff --git a/src/constants.ts b/src/constants.ts index f3dc35c5..fbf37198 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -1527,6 +1527,7 @@ export const DiscordKeys = Object.freeze({ MAX_MEMBERS: 'max_members', MAX_PRESENCES: 'max_presences', MAX_USES: 'max_uses', + MAX_VALUE: 'max_value', MAX_VALUES: 'max_values', MAX_VIDEO_CHANNEL_USERS: 'max_video_channel_users', ME: 'me', @@ -1549,6 +1550,7 @@ export const DiscordKeys = Object.freeze({ MFA_ENABLED: 'mfa_enabled', MFA_LEVEL: 'mfa_level', MIME_TYPE: 'mime_type', + MIN_VALUE: 'min_value', MIN_VALUES: 'min_values', MOBILE: 'mobile', MUTE: 'mute', @@ -1900,6 +1902,7 @@ export const DetritusKeys = Object.freeze({ [DiscordKeys.MAX_PRESENCES]: 'maxPresences', [DiscordKeys.MAX_USES]: 'maxUses', [DiscordKeys.MAX_VALUES]: 'maxValues', + [DiscordKeys.MAX_VALUE]: 'maxValue', [DiscordKeys.MAX_VIDEO_CHANNEL_USERS]: 'maxVideoChannelUsers', [DiscordKeys.ME]: 'me', [DiscordKeys.MEMBER]: 'member', @@ -1922,6 +1925,7 @@ export const DetritusKeys = Object.freeze({ [DiscordKeys.MFA_LEVEL]: 'mfaLevel', [DiscordKeys.MIME_TYPE]: 'mimeType', [DiscordKeys.MIN_VALUES]: 'minValues', + [DiscordKeys.MIN_VALUE]: 'minValue', [DiscordKeys.MOBILE]: 'mobile', [DiscordKeys.MUTE]: 'mute', [DiscordKeys.MUTUAL_GUILDS]: 'mutualGuilds', diff --git a/src/interaction/command.ts b/src/interaction/command.ts index 68776c8a..ef617555 100644 --- a/src/interaction/command.ts +++ b/src/interaction/command.ts @@ -215,6 +215,8 @@ export interface InteractionCommandOptionOptions { ratelimits?: Array, triggerLoadingAfter?: number, triggerLoadingAsEphemeral?: boolean, + minValue?: number, + maxValue?: number, onAutoComplete?: CommandCallbackAutoComplete, onAutoCompleteError?: CommandCallbackAutoCompleteError, @@ -574,6 +576,8 @@ const keysInteractionCommandOption = new BaseSet([ DiscordKeys.OPTIONS, DiscordKeys.REQUIRED, DiscordKeys.TYPE, + DiscordKeys.MAX_VALUE, + DiscordKeys.MIN_VALUE, ]); export class InteractionCommandOption extends Structure { @@ -589,6 +593,8 @@ export class InteractionCommandOption extends S name: string = ''; required?: boolean; type: ApplicationCommandOptionTypes = ApplicationCommandOptionTypes.STRING; + minValue?: number; + maxValue?: number; default?: ArgumentDefault; disableDm?: boolean; @@ -621,6 +627,13 @@ export class InteractionCommandOption extends S constructor(data: InteractionCommandOptionOptions = {}) { super(); + if (DetritusKeys[DiscordKeys.MIN_VALUE] in data) { + (data as any)[DiscordKeys.MIN_VALUE] = (data as any)[DetritusKeys[DiscordKeys.MIN_VALUE]]; + } + + if (DetritusKeys[DiscordKeys.MAX_VALUE] in data) { + (data as any)[DiscordKeys.MAX_VALUE] = (data as any)[DetritusKeys[DiscordKeys.MAX_VALUE]]; + } this.disableDm = (data.disableDm !== undefined) ? !!data.disableDm : this.disableDm; this.label = data.label || this.label;