waha icon indicating copy to clipboard operation
waha copied to clipboard

[Feature Request][NOWEB] - Add chat.name (pushName?) in the poll.vote evnet

Open marinaglancy opened this issue 1 year ago • 4 comments

Describe the bug

The name of the person who voted is not available in the poll.vote event. In the message event, for example, it can be found under payload._data.pushName but in the poll.vote event there is no payload._data property

Version

{
  "version": "2025.1.3",
  "engine": "NOWEB",
  "tier": "PLUS",
  "browser": "/usr/bin/chromium"
}

marinaglancy avatar Jan 11 '25 16:01 marinaglancy

It's how WA send us the data, yeah. Probably we can populate it from chats/contacts, and place it in data.chat.name or somewhere, you're right! For now you can request get contact and populate the data if you need from this! https://waha.devlike.pro/docs/how-to/contacts/#get-contact

patron:PRO

devlikepro avatar Jan 12 '25 09:01 devlikepro

Thanks, but the person who voted in not in my contacts.

This is my workaround:

  • Listen to event 'engine.event' with type 'messages.upsert', and if it has message.pollUpdateMessage.vote, I extract and remember the pushName for the phone number.
  • Listen to event 'poll.vote', when it happens, I wait 2 seconds (to make sure the other event is processed first) and extract the phone number and the voted option, then look up the pushName saved in the previous event.

The first event does not contain the option the person is voted for but the second event does not contain the pushName. In the end it works. Eventually I would prefer not to listen to the 'engine.event' because it is triggered too often, but right now I have to listen to it anyway because of https://github.com/devlikeapro/waha/issues/583

marinaglancy avatar Jan 18 '25 00:01 marinaglancy

in the poll.vote event there is no payload._data property

I guess it'll be the easiest fix for now.

It'd be cool if anyone could create the PR for that! 👍

patron:PRO

devlikepro avatar Jan 19 '25 08:01 devlikepro

Ok I tried. Here is my commit:

https://github.com/devlikeapro/waha/compare/core...marinaglancy:waha:i734

But it only has pushName in the poll.vote.failed . The poll.vote event is triggered from messages.update and not from messages.upsert. I created an issue in the Baileys library:

https://github.com/WhiskeySockets/Baileys/issues/1212

marinaglancy avatar Jan 19 '25 19:01 marinaglancy