mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-19 21:13:30 +01:00
fix(ApplicationCommand): default option.required to false (#5838)
This commit is contained in:
@@ -210,11 +210,13 @@ class ApplicationCommand extends Base {
|
|||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
static transformOption(option, received) {
|
static transformOption(option, received) {
|
||||||
|
const stringType = typeof option.type === 'string' ? option.type : ApplicationCommandOptionTypes[option.type];
|
||||||
return {
|
return {
|
||||||
type: typeof option.type === 'number' && !received ? option.type : ApplicationCommandOptionTypes[option.type],
|
type: typeof option.type === 'number' && !received ? option.type : ApplicationCommandOptionTypes[option.type],
|
||||||
name: option.name,
|
name: option.name,
|
||||||
description: option.description,
|
description: option.description,
|
||||||
required: option.required,
|
required:
|
||||||
|
option.required ?? (stringType === 'SUB_COMMAND' || stringType === 'SUB_COMMAND_GROUP') ? undefined : false,
|
||||||
choices: option.choices,
|
choices: option.choices,
|
||||||
options: option.options?.map(o => this.transformOption(o, received)),
|
options: option.options?.map(o => this.transformOption(o, received)),
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user