msg.ts
Version:
MSG is the framework for make discord bot easily
32 lines • 1.32 kB
JavaScript
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const MiddlewareChainRunner_1 = __importDefault(require("./MiddlewareChainRunner"));
const Command_1 = __importDefault(require("./Command"));
class CondCommand {
constructor(condString, nameAndDescription = {}) {
this.condString = condString;
this.nameAndDescription = nameAndDescription;
this.innerMiddlewareChainRunner = [];
}
cond(ctx) {
return (ctx.header.currentCommand === this.condString ||
this.condString === true);
}
executor(ctx) {
return new MiddlewareChainRunner_1.default(this.innerMiddlewareChainRunner).run(ctx);
}
subCommand(subCommand) {
this.innerMiddlewareChainRunner.push(subCommand);
return this;
}
subCall(condString, executorCallBack, tag = {}) {
this.innerMiddlewareChainRunner.push(new Command_1.default((ctx) => ctx.header.currentCommand === condString ||
condString === true, executorCallBack, tag));
return this;
}
}
exports.default = CondCommand;
//# sourceMappingURL=../../src/dist/class/CondCommand.js.map
;