diff --git a/README.md b/README.md index bbe232cda..580251404 100644 --- a/README.md +++ b/README.md @@ -387,7 +387,7 @@ await client }); // Generates sticker from the provided animated gif image and sends it (Send image as animated sticker) -// image path imageBase64 A valid gif image is required. You can also send via http/https (http://www.website.com/img.gif) +// image path imageBase64 A valid gif and webp image is required. You can also send via http/https (http://www.website.com/img.gif) await client .sendImageAsStickerGif('000000000000@c.us', './image.gif') .then((result) => { diff --git a/src/api/layers/sender.layer.ts b/src/api/layers/sender.layer.ts index e6f848353..af6491e11 100644 --- a/src/api/layers/sender.layer.ts +++ b/src/api/layers/sender.layer.ts @@ -514,13 +514,13 @@ export class SenderLayer extends ListenerLayer { * @param to chatId '000000000000@c.us' */ public async sendImageAsStickerGif(to: string, path: string) { - let b64 = await downloadFileImgHttp(path, ['image/gif']); + let b64 = await downloadFileImgHttp(path, ['image/gif', 'image/webp']); if (!b64) { b64 = await fileToBase64(path); } if (b64) { const buff = Buffer.from( - b64.replace(/^data:image\/(gif);base64,/, ''), + b64.replace(/^data:image\/(gif|webp);base64,/, ''), 'base64' ); const mimeInfo = base64MimeType(b64);