feat(ApplicationCommandOptionType): add NUMBER (10) (#6128)

This commit is contained in:
Advaith
2021-07-27 03:12:43 -07:00
committed by GitHub
parent 4886ae23ab
commit 2f1cc1fc27
4 changed files with 16 additions and 0 deletions

View File

@@ -164,6 +164,17 @@ class CommandInteractionOptionResolver {
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.
* @param {string} name The name of the option.

View File

@@ -861,6 +861,7 @@ exports.OverwriteTypes = createEnum(['role', 'member']);
* * CHANNEL
* * ROLE
* * MENTIONABLE
* * NUMBER
* @typedef {string} ApplicationCommandOptionType
*/
exports.ApplicationCommandOptionTypes = createEnum([
@@ -874,6 +875,7 @@ exports.ApplicationCommandOptionTypes = createEnum([
'CHANNEL',
'ROLE',
'MENTIONABLE',
'NUMBER',
]);
/**