feat: add support to ptvMessage in sendMessage method (#738)

* add support to ptvMessage in sendMessage method

* fix(ptv-sendmessage): Eslint

---------

Co-authored-by: Rajeh Taher <rajeh@reforward.dev>
This commit is contained in:
arthur simas
2024-04-28 08:00:49 -03:00
committed by GitHub
parent f5c1affc4d
commit 111601bc73
2 changed files with 8 additions and 0 deletions

View File

@@ -116,6 +116,8 @@ export type AnyMediaMessageContent = (
caption?: string
gifPlayback?: boolean
jpegThumbnail?: string
/** if set to true, will send as a `video note` */
ptv?: boolean
} & Mentionable & Contextable & Buttonable & Templatable & WithDimensions)
| {
audio: WAMediaUpload

View File

@@ -32,6 +32,7 @@ type MediaUploadData = {
media: WAMediaUpload
caption?: string
ptt?: boolean
ptv?: boolean
seconds?: number
gifPlayback?: boolean
fileName?: string
@@ -254,6 +255,11 @@ export const prepareWAMessageMedia = async(
)
})
if(uploadData.ptv) {
obj.ptvMessage = obj.videoMessage
delete obj.videoMessage
}
if(cacheableKey) {
logger?.debug({ cacheableKey }, 'set cache')
options.mediaCache!.set(cacheableKey, WAProto.Message.encode(obj).finish())