fix(ApplicationCommand): default option.required to false (#5838)

This commit is contained in:
Rodry
2021-06-13 19:31:00 +01:00
committed by GitHub
parent d5bb7585da
commit 77c1f15c9f

View File

@@ -210,11 +210,13 @@ class ApplicationCommand extends Base {
* @private
*/
static transformOption(option, received) {
const stringType = typeof option.type === 'string' ? option.type : ApplicationCommandOptionTypes[option.type];
return {
type: typeof option.type === 'number' && !received ? option.type : ApplicationCommandOptionTypes[option.type],
name: option.name,
description: option.description,
required: option.required,
required:
option.required ?? (stringType === 'SUB_COMMAND' || stringType === 'SUB_COMMAND_GROUP') ? undefined : false,
choices: option.choices,
options: option.options?.map(o => this.transformOption(o, received)),
};