Skip to content

Commit

Permalink
fix: Fixed send view once messages types (#1869) (close #1868)
Browse files Browse the repository at this point in the history
  • Loading branch information
DXPRO committed Apr 26, 2024
1 parent a240107 commit 16a1bd0
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/chat/functions/sendFileMessage.ts
Expand Up @@ -75,6 +75,7 @@ export interface AutoDetectMessageOptions extends FileMessageOptions {
export interface AudioMessageOptions extends FileMessageOptions {
type: 'audio';
isPtt?: boolean;
isViewOnce?: boolean;
/**
* Send an audio message as a PTT with waveform
*
Expand Down Expand Up @@ -128,6 +129,7 @@ export interface VideoMessageOptions
type: 'video';
isGif?: boolean;
isPtv?: boolean;
isViewOnce?: boolean;
}

/**
Expand Down Expand Up @@ -266,13 +268,17 @@ export async function sendFileMessage(

if (options.type === 'audio') {
rawMediaOptions.isPtt = options.isPtt;
if (options.isPtt) {
isViewOnce = options.isViewOnce;
}
rawMediaOptions.precomputedFields = await prepareAudioWaveform(
options as any,
file
);
} else if (options.type === 'image') {
isViewOnce = options.isViewOnce;
} else if (options.type === 'video') {
isViewOnce = options.isViewOnce;
rawMediaOptions.asGif = options.isGif;
} else if (options.type === 'document') {
rawMediaOptions.asDocument = true;
Expand Down

0 comments on commit 16a1bd0

Please sign in to comment.