Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

Fix middleware pipeline #1717

Merged
merged 4 commits into from
Jul 19, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 10 additions & 11 deletions packages/botkit/src/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -765,22 +765,21 @@ export class Botkit {
*/
private async ingest(bot: BotWorker, message: BotkitMessage): Promise<any> {
return new Promise(async (resolve, reject) => {
const listen_results = await this.listenForTriggers(bot, message);

if (listen_results !== false) {
resolve(listen_results);
} else {
this.middleware.receive.run(bot, message, async (err, bot, message) => {
if (err) {
return reject(err);
}
this.middleware.receive.run(bot, message, async (err, bot, message) => {
if (err) {
return reject(err);
}
const listen_results = await this.listenForTriggers(bot, message);

if (listen_results !== false) {
resolve(listen_results);
} else {
// Trigger event handlers
const trigger_results = await this.trigger(message.type, bot, message);

resolve(trigger_results);
});
}
}
});
});
}

Expand Down