From 416cfb7a01dc1d17db0b8ea4d07b03ab7a7a495f Mon Sep 17 00:00:00 2001 From: "Navy.gif" Date: Fri, 15 Jul 2022 11:53:00 +0300 Subject: [PATCH] thing for command options --- src/structure/interfaces/CommandOption.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/structure/interfaces/CommandOption.js b/src/structure/interfaces/CommandOption.js index 81e64e6..238b36d 100644 --- a/src/structure/interfaces/CommandOption.js +++ b/src/structure/interfaces/CommandOption.js @@ -54,18 +54,22 @@ class CommandOption { // console.log(opt); if (opt instanceof CommandOption) this.options.push(opt); else if (opt.name instanceof Array) { - const { name: names, description, type, ...opts } = opt; + const { name: names, description, type, dependsOn, ...opts } = opt; for (const name of names) { // console.log(name); const index = names.indexOf(name); let desc = description, - _type = type; + _type = type, + _dependsOn = dependsOn; if (description instanceof Array) desc = description[index] || 'Missing description'; if (type instanceof Array) { _type = type[index]; if (!_type) throw new Error(`Missing type for option ${name} in command ${this.name}`); } - this.options.push(new CommandOption({ name, type: _type, description: desc, ...opts })); + if (dependsOn instanceof Array) { + _dependsOn = dependsOn[index]; + } + this.options.push(new CommandOption({ name, type: _type, description: desc, dependsOn: _dependsOn, ...opts })); } } else this.options.push(new CommandOption(opt)); }