fix(api): resolve messages order response

This commit is contained in:
yassinedorbozgithub 2025-04-13 22:06:34 +01:00
parent dadb263176
commit 0203662234
2 changed files with 8 additions and 3 deletions

View File

@ -88,7 +88,7 @@ export class BotService {
read: false,
delivery: false,
};
this.eventEmitter.emit('hook:chatbot:sent', sentMessage, event);
await this.eventEmitter.emitAsync('hook:chatbot:sent', sentMessage, event);
// analytics log block or local fallback
if (fallback) {
@ -425,7 +425,12 @@ export class BotService {
subscriber.id,
block.name,
);
return this.triggerBlock(event, updatedConversation, block, false);
return await this.triggerBlock(
event,
updatedConversation,
block,
false,
);
} catch (err) {
this.logger.error('Unable to store context data!', err);
this.eventEmitter.emit('hook:conversation:end', convo);

View File

@ -96,7 +96,7 @@ export class ChatService {
*
* @param sentMessage - The message that has been sent
*/
@OnEvent('hook:chatbot:sent')
@OnEvent('hook:chatbot:sent', { promisify: true })
async handleSentMessage(
sentMessage: MessageCreateDto,
_event: EventWrapper<any, any>,