pedroslopez / whatsapp-web.js

A WhatsApp client library for NodeJS that connects through the WhatsApp Web browser app
https://wwebjs.dev
Apache License 2.0
14.62k stars 3.48k forks source link

Unable to Generate GIF Sticker from MessageMedia.fromurl #2532

Closed byshivam closed 7 months ago

byshivam commented 9 months ago

Is there an existing issue for this?

Describe the bug

After fetching a GIF from the API and attempting to send it as a sticker, the response only contains a single image sticker instead of the expected sticker.

Expected behavior

The expected behavior is that the API should generate a sticker from the fetched GIF and return the GIF sticker in the response.

Steps to Reproduce the Bug or Issue

...

Relevant Code

try{
    const media = await MessageMedia.fromUrl('https://cdn.nekos.life/slap/slap_013.gif');
    await chat.sendMessage(media, {sendMediaAsSticker:true})

} catch (e){
    console.log(e)
}

Browser Type

Chromium

WhatsApp Account Type

Standard

Does your WhatsApp account have multidevice enabled?

Yes, I am using Multi Device

Environment

OS : Windows, Phone: Android 13

Additional context

I try to sendMediaAsDocument , it was working fine , it sended the file in GIF

alechkos commented 7 months ago

I just sent that sticker successfully:

// ...
try {
      const media = await MessageMedia.fromUrl('https://cdn.nekos.life/slap/slap_013.gif');
      await client.sendMessage(chatId, media, { sendMediaAsSticker: true });
  } catch (error) {
      console.log(error);
  }
// ...

The issue is likely in your code