@botonic/core
Version:
Build Chatbots using React
21 lines • 776 B
JavaScript
import { __awaiter } from "tslib";
export function runPlugins({ botContext, mode, response = null, }) {
return __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);
}
}
});
}
//# sourceMappingURL=plugins.js.map