diff --git a/src/Command.ts b/src/Command.ts index 2d0a248..54a39d1 100644 --- a/src/Command.ts +++ b/src/Command.ts @@ -148,7 +148,7 @@ export class Command { name: p.name, description: p.description || "No description", required: !p.optional, - type: type, + type: p.choices ? 3 : type, choices: p.choices?.map((c) => { return { name: c, value: c }; diff --git a/src/CommandManager.ts b/src/CommandManager.ts index b545e95..05a18fc 100644 --- a/src/CommandManager.ts +++ b/src/CommandManager.ts @@ -64,6 +64,12 @@ export class CommandManager { ar.splice(i, 1); } }); + command.parameters && + command.parameters.map((p) => { + if (p.type != "string" && p.choices) { + throw new Error('Parameter with defined choices must have a "string" type'); + } + }); this.list.push(command); return true; } catch (e) {