add image+video+sticker dimensions

This commit is contained in:
Adhiraj Singh
2021-08-15 13:19:54 +05:30
parent 15f759a52b
commit 96cd3b985e
2 changed files with 9 additions and 4 deletions

View File

@@ -57,27 +57,31 @@ type Buttonable = {
/** add buttons to the message */ /** add buttons to the message */
buttons?: proto.IButton[] buttons?: proto.IButton[]
} }
type WithDimensions = {
width?: number
height?: number
}
export type MediaType = 'image' | 'video' | 'sticker' | 'audio' | 'document' export type MediaType = 'image' | 'video' | 'sticker' | 'audio' | 'document'
export type AnyMediaMessageContent = ( export type AnyMediaMessageContent = (
({ ({
image: WAMediaUpload image: WAMediaUpload
caption?: string caption?: string
jpegThumbnail?: string jpegThumbnail?: string
} & Mentionable & Buttonable) | } & Mentionable & Buttonable & WithDimensions) |
({ ({
video: WAMediaUpload video: WAMediaUpload
caption?: string caption?: string
gifPlayback?: boolean gifPlayback?: boolean
jpegThumbnail?: string jpegThumbnail?: string
} & Mentionable & Buttonable) | { } & Mentionable & Buttonable & WithDimensions) | {
audio: WAMediaUpload audio: WAMediaUpload
/** if set to true, will send as a `voice note` */ /** if set to true, will send as a `voice note` */
pttAudio?: boolean pttAudio?: boolean
/** optionally tell the duration of the audio */ /** optionally tell the duration of the audio */
seconds?: number seconds?: number
} | {
sticker: WAMediaUpload
} | ({ } | ({
sticker: WAMediaUpload
} & WithDimensions) | ({
document: WAMediaUpload document: WAMediaUpload
mimetype: string mimetype: string
fileName?: string fileName?: string

View File

@@ -120,6 +120,7 @@ export const prepareWAMessageMedia = async(
fileEncSha256, fileEncSha256,
fileSha256, fileSha256,
fileLength, fileLength,
...uploadData ...uploadData
} }
) )