Archived
added parameter type choice error
This commit is contained in:
1 parent
a8efeae9cc
commit
2537261e80
2 files changed
+7
-1
No files matched your search
+1
-1
@@ -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 };
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in new issue
Block a user