UNPKG

@botonic/core

Version:
25 lines 915 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.runPlugins = void 0; const tslib_1 = require("tslib"); function runPlugins({ botContext, mode, response = null, }) { return tslib_1.__awaiter(this, void 0, void 0, function* () { const plugins = botContext.plugins; for (const key in plugins) { const plugin = plugins[key]; try { if (mode === 'pre' && typeof plugin.pre === 'function') { yield plugin.pre(botContext); } if (mode === 'post' && typeof plugin.post === 'function') { yield plugin.post(Object.assign(Object.assign({}, botContext), { response })); } } catch (e) { console.log(e); } } }); } exports.runPlugins = runPlugins; //# sourceMappingURL=plugins.js.map