WhiskeySockets / Baileys

Lightweight full-featured typescript/javascript WhatsApp Web API
https://baileys.whiskeysockets.io/
MIT License
3.1k stars 1.07k forks source link

[BUG] sendPresenceUpdate() fails when connecting via QR #893

Open oscarguindzberg opened 1 week ago

oscarguindzberg commented 1 week ago

Describe the bug chat.ts sendPresenceUpdate() fails when connecting via QR https://github.com/WhiskeySockets/Baileys/blob/76d2a9d759c31e4b2346fb2f02ec572f4d4c0437/src/Socket/chats.ts#L544 This is printed on the logs: {"level":40,"time":"2024-06....","pid":37...,"hostname":"myHost","msg":"no name present, ignoring presence update request..."}

The cause is authState.creds.me.name was not set yet by the time sendPresenceUpdate() is executed.

This is a problem when using markOnlineOnConnect: false because: 1) The user is seen as "Online" by other users. 2) Phone notifications are reduced e.g. phone doesn't vibrate on incoming messages.

To Reproduce Steps to reproduce the behavior:

Expected behavior

Environment (please complete the following information):

Additional context Add any other context about the problem here.

oscarguindzberg commented 1 week ago

This is a temporary workaround https://github.com/oscarguindzberg/Baileys/commit/da32b391872fb2c504775a98298bd30e24376c81

bobslavtriev commented 1 week ago

it's not a bug