mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-16 03:23:29 +01:00
feat(ApplicationCommandOptionType): add NUMBER (10) (#6128)
This commit is contained in:
@@ -164,6 +164,17 @@ class CommandInteractionOptionResolver {
|
|||||||
return option?.value ?? null;
|
return option?.value ?? null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets a number option.
|
||||||
|
* @param {string} name The name of the option.
|
||||||
|
* @param {boolean} [required=false] Whether to throw an error if the option is not found.
|
||||||
|
* @returns {?number} The value of the option, or null if not set and not required.
|
||||||
|
*/
|
||||||
|
getNumber(name, required = false) {
|
||||||
|
const option = this._getTypedOption(name, 'NUMBER', ['value'], required);
|
||||||
|
return option?.value ?? null;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets a user option.
|
* Gets a user option.
|
||||||
* @param {string} name The name of the option.
|
* @param {string} name The name of the option.
|
||||||
|
|||||||
@@ -861,6 +861,7 @@ exports.OverwriteTypes = createEnum(['role', 'member']);
|
|||||||
* * CHANNEL
|
* * CHANNEL
|
||||||
* * ROLE
|
* * ROLE
|
||||||
* * MENTIONABLE
|
* * MENTIONABLE
|
||||||
|
* * NUMBER
|
||||||
* @typedef {string} ApplicationCommandOptionType
|
* @typedef {string} ApplicationCommandOptionType
|
||||||
*/
|
*/
|
||||||
exports.ApplicationCommandOptionTypes = createEnum([
|
exports.ApplicationCommandOptionTypes = createEnum([
|
||||||
@@ -874,6 +875,7 @@ exports.ApplicationCommandOptionTypes = createEnum([
|
|||||||
'CHANNEL',
|
'CHANNEL',
|
||||||
'ROLE',
|
'ROLE',
|
||||||
'MENTIONABLE',
|
'MENTIONABLE',
|
||||||
|
'NUMBER',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
1
typings/enums.d.ts
vendored
1
typings/enums.d.ts
vendored
@@ -20,6 +20,7 @@ export enum ApplicationCommandOptionTypes {
|
|||||||
CHANNEL = 7,
|
CHANNEL = 7,
|
||||||
ROLE = 8,
|
ROLE = 8,
|
||||||
MENTIONABLE = 9,
|
MENTIONABLE = 9,
|
||||||
|
NUMBER = 10,
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum ApplicationCommandPermissionTypes {
|
export enum ApplicationCommandPermissionTypes {
|
||||||
|
|||||||
2
typings/index.d.ts
vendored
2
typings/index.d.ts
vendored
@@ -460,6 +460,8 @@ export class CommandInteractionOptionResolver {
|
|||||||
public getString(name: string, required?: boolean): string | null;
|
public getString(name: string, required?: boolean): string | null;
|
||||||
public getInteger(name: string, required: true): number;
|
public getInteger(name: string, required: true): number;
|
||||||
public getInteger(name: string, required?: boolean): number | null;
|
public getInteger(name: string, required?: boolean): number | null;
|
||||||
|
public getNumber(name: string, required: true): number;
|
||||||
|
public getNumber(name: string, required?: boolean): number | null;
|
||||||
public getUser(name: string, required: true): NonNullable<CommandInteractionOption['user']>;
|
public getUser(name: string, required: true): NonNullable<CommandInteractionOption['user']>;
|
||||||
public getUser(name: string, required?: boolean): NonNullable<CommandInteractionOption['user']> | null;
|
public getUser(name: string, required?: boolean): NonNullable<CommandInteractionOption['user']> | null;
|
||||||
public getMember(name: string, required: true): NonNullable<CommandInteractionOption['member']>;
|
public getMember(name: string, required: true): NonNullable<CommandInteractionOption['member']>;
|
||||||
|
|||||||
Reference in New Issue
Block a user