Skip to content

Commit e17721b

Browse files
committed
Additional changes to get the actual phone number
1 parent f4ef0ce commit e17721b

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

src/Client.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -534,8 +534,8 @@ class Client extends EventEmitter {
534534
/** @type {GroupNotification} object does not provide enough information about this event, so a @type {Message} object is used. */
535535
const message = new Message(this, msg);
536536

537-
const newId = isParticipant ? msg.recipients[0] : msg._data.templateParams[1];
538-
const oldId = isParticipant ? msg.author : msg._data.templateParams[0];
537+
let newId = isParticipant ? msg.recipients[0] : msg._data.templateParams[1];
538+
let oldId = isParticipant ? msg.author : msg._data.templateParams[0];
539539

540540
/**
541541
* Emitted when a contact or a group participant changes their phone number.
@@ -546,6 +546,14 @@ class Client extends EventEmitter {
546546
* @param {String} newId The user's new id after the change.
547547
* @param {Boolean} isContact Indicates if a contact or a group participant changed their phone number.
548548
*/
549+
if (newId.endsWith('@lid')) {
550+
let u = await this.getContactLidAndPhone(newId);
551+
newId = u[0].pn;
552+
}
553+
if (oldId.endsWith('@lid')) {
554+
let u = await this.getContactLidAndPhone(oldId);
555+
oldId = u[0].pn;
556+
}
549557
this.emit(Events.CONTACT_CHANGED, message, oldId, newId, isContact);
550558
}
551559
});

0 commit comments

Comments
 (0)