Skip to content

Commit

Permalink
fix(ApplicationCommand): default option.required to false (#5838)
Browse files Browse the repository at this point in the history
  • Loading branch information
ImRodry committed Jun 13, 2021
1 parent d5bb758 commit 77c1f15
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/structures/ApplicationCommand.js
Expand Up @@ -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)),
};
Expand Down

0 comments on commit 77c1f15

Please sign in to comment.