2017-09-24 23:07:35 +03:00
|
|
|
module.exports = class Command {
|
|
|
|
constructor({ name, description, syntax, admin, invoke }) {
|
|
|
|
this.name = name;
|
|
|
|
this.description = description;
|
|
|
|
this.syntax = syntax;
|
|
|
|
this.admin = admin;
|
|
|
|
this.invoke = invoke;
|
|
|
|
|
2017-11-11 05:44:44 +02:00
|
|
|
const params = this.syntax.split(/ +/);
|
|
|
|
const optionalParams = params.filter(x => x.match(/^\[.+\]$/));
|
|
|
|
|
|
|
|
this.maxParamCount = params.length - 1;
|
|
|
|
this.expectedParamCount = this.maxParamCount - optionalParams.length;
|
2017-09-24 23:07:35 +03:00
|
|
|
}
|
|
|
|
};
|