Skip to content

Commit

Permalink
fix: Fixed delay for send ptt audios (close #2464)
Browse files Browse the repository at this point in the history
  • Loading branch information
icleitoncosta committed Oct 29, 2024
1 parent 96d014a commit 051a31b
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/chat/functions/prepareRawMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import {
getMessageById,
markIsComposing,
markIsPaused,
markIsRecording,
} from '.';

/**
Expand Down Expand Up @@ -66,8 +67,12 @@ export async function prepareRawMessage<T extends RawMessage>(
...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)
);
Expand Down

0 comments on commit 051a31b

Please sign in to comment.