Acknowledge type update

This commit is contained in:
Adhiraj
2020-07-13 23:13:13 +05:30
parent 41c486422d
commit 3f84325bad
2 changed files with 2 additions and 3 deletions

View File

@@ -18,14 +18,13 @@ export default class WhatsAppWebBase extends WAConnection {
if (json.cmd === 'ack') { if (json.cmd === 'ack') {
ids = [json.id] ids = [json.id]
} }
const ackTypes = [MessageStatus.sent, MessageStatus.received, MessageStatus.read]
const data: MessageStatusUpdate = { const data: MessageStatusUpdate = {
from: json.from, from: json.from,
to: json.to, to: json.to,
participant: json.participant, participant: json.participant,
timestamp: new Date(json.t * 1000), timestamp: new Date(json.t * 1000),
ids: ids, ids: ids,
type: ackTypes[json.ack - 1] || 'unknown (' + json.ack + ')', type: json.ack,
} }
callback(data) callback(data)
} }

View File

@@ -100,7 +100,7 @@ export interface MessageStatusUpdate {
/** Message IDs read/delivered */ /** Message IDs read/delivered */
ids: string[] ids: string[]
/** Status of the Message IDs */ /** Status of the Message IDs */
type: string type: proto.WebMessageInfo.WEB_MESSAGE_INFO_STATUS
} }
export interface PresenceUpdate { export interface PresenceUpdate {
id: string id: string