feat: generate high quality thumbs on link preview

This commit is contained in:
Adhiraj Singh
2022-09-15 18:40:22 +05:30
parent 864a01f9a5
commit f0bdb12e56
8 changed files with 95 additions and 21 deletions

View File

@@ -42,6 +42,7 @@ export interface WAUrlInfo {
title: string
description?: string
jpegThumbnail?: Buffer
highQualityThumbnail?: proto.Message.IImageMessage
}
// types to generate WA messages
@@ -192,6 +193,7 @@ export type WAMediaUploadFunction = (readStream: Readable, opts: { fileEncSha256
export type MediaGenerationOptions = {
logger?: Logger
mediaTypeOverride?: MediaType
upload: WAMediaUploadFunction
/** cache media so it does not have to be uploaded again */
mediaCache?: NodeCache

View File

@@ -38,6 +38,11 @@ export type SocketConfig = CommonSocketConfig & {
syncFullHistory: boolean
/** Should baileys fire init queries automatically, default true */
fireInitQueries: boolean
/**
* generate a high quality link preview,
* entails uploading the jpegThumbnail to WA
* */
generateHighQualityLinkPreview: boolean
/**
* fetch a message from your store
* implement this so that messages failed to send (solves the "this message can take a while" issue) can be retried