msg.ts
Version:
MSG is the framework for make discord bot easily
23 lines • 1.13 kB
JavaScript
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.indent = exports.subCall = void 0;
const MiddlewareChainRunner_1 = __importDefault(require("./MiddlewareChainRunner"));
const subCall = (condString, executorCallBack, tag = {}) => new Command((ctx) => ctx.header.currentCommand === condString || condString === true, executorCallBack, tag);
exports.subCall = subCall;
const indent = (condString, subCommands) => new Command((ctx) => ctx.header.currentCommand === condString || condString === true, (ctx) => new MiddlewareChainRunner_1.default(subCommands).run(ctx));
exports.indent = indent;
class Command {
constructor(cond, executor, tag = {}) {
this.cond = cond;
this.executor = executor;
Object.assign(this, tag);
}
}
Command.alwaysTrue = (_) => true;
Command.alwaysFalse = (_) => false;
Command.empty = (_) => _;
exports.default = Command;
//# sourceMappingURL=../../src/dist/class/Command.js.map
;