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.18k stars 3.62k forks source link

Sent messages receiving wrong timestamp #3212

Closed farias-77 closed 2 months ago

farias-77 commented 2 months ago

Is there an existing issue for this?

Describe the bug

Im facing a bug related to the timestamp of the messages

Im using the message_create event to handle all the messages that go through the account, sent or received

For incoming messages, everything works fine. When I open whatsapp web or whatsapp mobile app to send messages, it works perfectly at the event. The bug comes when i use the .sendMessage method, it sends the message perfectly, we can see the message at the other devices, but the timestamp is coming with approximately 1030 in difference.

Expected behavior

The expected behavior was the sent messages (using the sendMessage method) coming with the same timestamp as they would if sent using the whatsapp web or mobile app

Steps to Reproduce the Bug or Issue

  1. Initialize client
  2. initialize a chat class (im using const chat = await client.getChatById(chatId))
  3. run chat.sendMessage(stringMessage)

Relevant Code

No response

Browser Type

Chromium

WhatsApp Account Type

Standard

Does your WhatsApp account have multidevice enabled?

No, I am not using Multi Device

Environment

Additional context

No response