fix: carousel renders on WhatsApp Web without F5

Two fixes:
1. Stanza type="media" for carousel messages — WhatsApp Web needs this
   to render carousel in real-time. Without it, only shows header until
   page refresh (F5).
2. Fix jimp detection: typeof Jimp === 'function' (not just 'object')
   so jpegThumbnail is generated for card images.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Renato Alcara
2026-03-07 00:25:07 -03:00
parent ac2acf3d87
commit f2c14f9ad6
2 changed files with 6 additions and 1 deletions
+5
View File
@@ -1068,6 +1068,11 @@ export const makeMessagesSocket = (config: SocketConfig) => {
return 'media'
}
// Carousel with images → media type for Web real-time rendering
if (normalizedMessage.interactiveMessage?.carouselMessage) {
return 'media'
}
return 'text'
}
+1 -1
View File
@@ -160,7 +160,7 @@ export const extractImageThumb = async (bufferOrFilePath: Readable | Buffer | st
height: dimensions.height
}
}
} else if ('jimp' in lib && typeof lib.jimp?.Jimp === 'object') {
} else if ('jimp' in lib && (typeof lib.jimp?.Jimp === 'object' || typeof lib.jimp?.Jimp === 'function')) {
const jimp = await (lib.jimp.Jimp as any).read(bufferOrFilePath)
const dimensions = {
width: jimp.width,