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

View File

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