From 77c1f15c9f7562465c07727602c3213ddcf02778 Mon Sep 17 00:00:00 2001 From: Rodry <38259440+ImRodry@users.noreply.github.com> Date: Sun, 13 Jun 2021 19:31:00 +0100 Subject: [PATCH] fix(ApplicationCommand): default option.required to false (#5838) --- src/structures/ApplicationCommand.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/structures/ApplicationCommand.js b/src/structures/ApplicationCommand.js index 88159d127c88..483a595a407e 100644 --- a/src/structures/ApplicationCommand.js +++ b/src/structures/ApplicationCommand.js @@ -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)), };