mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-07-13 15:14:49 -06:00
lint fix
This commit is contained in:
parent
027401b839
commit
658dae0b59
@ -2704,11 +2704,9 @@ export class BaileysStartupService extends ChannelStartupService {
|
||||
}
|
||||
|
||||
const isAnimated = this.isAnimated(image, imageBuffer);
|
||||
|
||||
|
||||
if (isAnimated) {
|
||||
return await sharp(imageBuffer, { animated: true })
|
||||
.webp({ quality: 80, animated: true })
|
||||
.toBuffer();
|
||||
return await sharp(imageBuffer, { animated: true }).webp({ quality: 80, animated: true }).toBuffer();
|
||||
} else {
|
||||
return await sharp(imageBuffer).webp().toBuffer();
|
||||
}
|
||||
@ -2720,17 +2718,17 @@ export class BaileysStartupService extends ChannelStartupService {
|
||||
|
||||
private isAnimatedWebp(buffer: Buffer): boolean {
|
||||
if (buffer.length < 12) return false;
|
||||
|
||||
|
||||
return buffer.indexOf(Buffer.from('ANIM')) !== -1;
|
||||
}
|
||||
|
||||
private isAnimated(image: string, buffer: Buffer): boolean {
|
||||
const lowerCaseImage = image.toLowerCase();
|
||||
|
||||
|
||||
if (lowerCaseImage.includes('.gif')) return true;
|
||||
|
||||
|
||||
if (lowerCaseImage.includes('.webp')) return this.isAnimatedWebp(buffer);
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user