wppconnect-team / wppconnect

WPPConnect is an open source project developed by the JavaScript community with the aim of exporting functions from WhatsApp Web to the node, which can be used to support the creation of any interaction, such as customer service, media sending, intelligence recognition based on phrases artificial and many other things, use your imagination
https://wppconnect.io
Other
1.86k stars 328 forks source link

Cannot open the chat with openChatAt() #2293

Closed gekkedev closed 1 month ago

gekkedev commented 2 months ago

Description

Cannot open the chat when using openChatAt(), but openChat() works.

Environment

Steps to Reproduce

  1. Receive a message
  2. Try to open the chat at this exact message

Log Output

Error: messageId is not defined

but the 2nd parameter is something like false_987654321098765432@g.us_ABCDEF1234567890_0987654321098@c.us

Your Code

client.onMessage(async message => 
  await client.openChatAt(message.chatId._serialized, message.id)
}

this approach works, but won't necessarily scroll to the right message:

client.onMessage(async message => 
  await client.openChat(message.chatId._serialized)
}

Additional context / Screenshot

Maybe we can add support for the 1st param being a message object (2nd one would become optional) so that the method extracts all the data that it needs from the message.