From 051a31b73f5d41c15956fa512cb6d0f098cb477e Mon Sep 17 00:00:00 2001 From: icleitoncosta Date: Tue, 29 Oct 2024 18:49:37 -0300 Subject: [PATCH] fix: Fixed delay for send ptt audios (close #2464) --- src/chat/functions/prepareRawMessage.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/chat/functions/prepareRawMessage.ts b/src/chat/functions/prepareRawMessage.ts index 5c160ce9ee..2376c0dab1 100644 --- a/src/chat/functions/prepareRawMessage.ts +++ b/src/chat/functions/prepareRawMessage.ts @@ -38,6 +38,7 @@ import { getMessageById, markIsComposing, markIsPaused, + markIsRecording, } from '.'; /** @@ -66,8 +67,12 @@ export async function prepareRawMessage( ...message, }; - if (options.delay && message.type === 'chat') { - await markIsComposing(chat.id); + if (options.delay) { + if (message.type == 'chat') { + await markIsComposing(chat.id); + } else if ((options as any)?.isPtt) { + await markIsRecording(chat.id); + } await new Promise((resolve) => setTimeout(() => resolve(true), options.delay) );