Skip to content

[BUG] 'lid-mapping.update' event never fires #2263

Description

@royalh23

Describe the bug
I'm trying to respond to specific people (an array called TARGET_PEOPLE) in a group with my bot. Basically, I have their PNs in 123456...@s.whatsapp.net format, but since WhatsApp only returns each user's LID, I need to get each user's PN using their LID so that I can compare each PN to my array. In order not to always depend on the 'lid-mapping.update' event, I created a lidMapper method for my database, which basically:

  1. Gets a user's PN using their LID after a messages.upsert event, so that my bot doesn't query the WhatsApp servers;
  2. In case the database is empty, after the lid-mapping.update event fires, it saves the user's LID and PN in the database for future queries.

The problem is, lid-mapping.update never fires and I can't figure out how I can manually force the WP servers to fire this event either. I tried asking the Discord bot (since the docs aren't even complete/barely understandable), and it suggested using the onWhatsApp method, but it never returns the LID of a user, so I don't know what to do.

To Reproduce
Steps to reproduce the behavior:

  1. Create a new connection
  2. Listen for the lid-mapping.update event
  3. Inside the callback of this function, iterate through update.mapping and save each LID with the PN

Expected behavior
I am expecting this event to fire and thus save all LID -> PN mappings to my database, but it never happens.

Environment (please complete the following information):

  • Is this on a server?
  • No, I am running the code locally
  • What do your connectOptions look like?
  • N/A
  • Do you have multiple clients on the same IP?
  • N/A
  • Are you using a proxy?
  • No

Additional context
Baileys version: "@whiskeysockets/baileys": "^7.0.0-rc.9"

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status
    In progress

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions