fix: address removal of Conn.me

This change on WhatsApp Web v2.2045.15 caused errors when sending messages and getting the current user id
This commit is contained in:
Pedro Lopez
2020-11-05 01:37:51 -04:00
parent b0465ceeff
commit fc7a1a9974
3 changed files with 741 additions and 730 deletions

7
index.d.ts vendored
View File

@@ -203,8 +203,13 @@ declare namespace WAWebJS {
/** Current connection information */
export interface ClientInfo {
/** Current user ID */
/**
* Current user ID
* @deprecated Use .wid instead
*/
me: ContactId
/** Current user ID */
wid: ContactId
/** Information about the phone this client is connected to */
phone: ClientInfoPhone
/** Platform the phone is running on */

View File

@@ -20,11 +20,17 @@ class ClientInfo extends Base {
*/
this.pushname = data.pushname;
/**
* @type {object}
* @deprecated Use .wid instead
*/
this.me = data.wid;
/**
* Current user ID
* @type {object}
*/
this.me = data.me;
this.wid = data.wid;
/**
* Information about the phone this client is connected to

View File

@@ -126,8 +126,8 @@ exports.LoadUtils = () => {
}
const newMsgId = new window.Store.MsgKey({
from: window.Store.Conn.me,
to: chat.id,
fromMe: true,
remote: chat.id,
id: window.Store.genId(),
});
@@ -136,7 +136,7 @@ exports.LoadUtils = () => {
id: newMsgId,
ack: 0,
body: content,
from: window.Store.Conn.me,
from: window.Store.Conn.wid,
to: chat.id,
local: true,
self: 'out',