refactor: move processMessage out of socket
This commit is contained in:
+16
-1
@@ -253,4 +253,19 @@ export const fetchLatestBaileysVersion = async() => {
|
||||
error
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const STATUS_MAP: { [_: string]: proto.WebMessageInfo.WebMessageInfoStatus } = {
|
||||
'played': proto.WebMessageInfo.WebMessageInfoStatus.PLAYED,
|
||||
'read': proto.WebMessageInfo.WebMessageInfoStatus.READ,
|
||||
'read-self': proto.WebMessageInfo.WebMessageInfoStatus.READ
|
||||
}
|
||||
|
||||
export const getStatusFromReceiptType = (type: string | undefined) => {
|
||||
const status = STATUS_MAP[type]
|
||||
if(typeof type === 'undefined') {
|
||||
return proto.WebMessageInfo.WebMessageInfoStatus.DELIVERY_ACK
|
||||
}
|
||||
|
||||
return status
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user