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
15.46k stars 3.68k forks source link

Sticker info #2723

Open diegofemello opened 9 months ago

diegofemello commented 9 months ago

Is there an existing issue for this?

Is your feature request related to a problem? Please describe.

Is there any way to get the sticker info when retrieving the message? like the name and author from the message data? I'm creating a guessing game with stickers, and recovering this data would help a lot.

Describe the solution you'd like.

image

in quoted raw

console.log(message)

Message {
  _data: {
  ....,
    quotedMsg: {
      type: 'sticker',
      // caption: "◓ caption test", // perfect solution for what I need
      stickerAuthorName: "Bit Bot Stickers",
      stickerName: "◓ Quem é esse pokemon?"
    }
  }
}

or when getting quoted info: (not so much performatic, but it would solve the problem)

const quoted = message.getQuotedMessage()
console.log(quoted)

Message {
 ...,
 type: 'sticker',
 stickerAuthorName: "Bit Bot Stickers",
 stickerName: "◓ Quem é esse pokemon?"
}

Describe an alternate solution.

It would also help if I could hide information in the message/sticker, then I would send it with a "secret" that I chose or a caption inside sticker

Additional context

No response

Nurutomo commented 8 months ago

see #511 and #527

const img = new webp.Image()
await img.loadBuffer(WEBP_IMAGE_BUFFER_INPUT)

const json_str = img.exif.slice(22).toString('utf8')
const json = JSON.parse(json_str)