added simple and no_input parameters options

This commit is contained in:
mmacierzanka committed 2021-08-07 23:44:24 +02:00
1 parent 80ac62a80f
commit af390743db
2 files changed
+8 -4

No files matched your search

+7 -3
View File
@@ -48,9 +48,13 @@ export class Command {
*/
constructor(options: CommandBuilder) {
this.name = options.name.split(" ").join("_");
this.parameters = options.parameters
? options.parameters.map((p) => new Parameter(p))
: [new DefaultParameter()];
if (options.parameters == "no_input" || !options.parameters) {
this.parameters = [];
} else if (options.parameters == "simple") {
this.parameters = [new DefaultParameter()];
} else {
this.parameters = options.parameters.map((ps) => new Parameter(ps));
}
this.aliases = Command.processPhrase(options.aliases);
this.keywords = Command.processPhrase(options.keywords);
this.description = options.description || "No description";
+1 -1
View File
@@ -20,7 +20,7 @@ export type GetMode = "ALL" | "PREFIX" | "NO_PREFIX";
export type PermissionCheckTypes = "ALL" | "ANY";
export interface CommandBuilder {
name: string;
parameters?: ParameterSchema[];
parameters?: ParameterSchema[] | "simple" | "no_input";
aliases?: string[] | string;
keywords?: string[] | string;
description?: string;