mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
Fix Played Status (message update event) (#1089)
* Fix Played Status * Update messages-recv.ts Co-authored-by: Adhiraj Singh <adhirajsingh1001@gmail.com>
This commit is contained in:
@@ -7,16 +7,14 @@ import { KEY_BUNDLE_TYPE } from "../Defaults"
|
|||||||
import { makeChatsSocket } from "./chats"
|
import { makeChatsSocket } from "./chats"
|
||||||
import { extractGroupMetadata } from "./groups"
|
import { extractGroupMetadata } from "./groups"
|
||||||
|
|
||||||
const getStatusFromReceiptType = (type: string | undefined) => {
|
const STATUS_MAP: { [_: string]: proto.WebMessageInfo.WebMessageInfoStatus } = {
|
||||||
if(type === 'read' || type === 'read-self') {
|
'played': proto.WebMessageInfo.WebMessageInfoStatus.PLAYED,
|
||||||
return proto.WebMessageInfo.WebMessageInfoStatus.READ
|
'read': proto.WebMessageInfo.WebMessageInfoStatus.READ,
|
||||||
}
|
'read-self': proto.WebMessageInfo.WebMessageInfoStatus.READ
|
||||||
if(typeof type === 'undefined') {
|
|
||||||
return proto.WebMessageInfo.WebMessageInfoStatus.DELIVERY_ACK
|
|
||||||
}
|
|
||||||
return undefined
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const getStatusFromReceiptType = (type: string | undefined) => STATUS_MAP[type]
|
||||||
|
|
||||||
export const makeMessagesRecvSocket = (config: SocketConfig) => {
|
export const makeMessagesRecvSocket = (config: SocketConfig) => {
|
||||||
const { logger } = config
|
const { logger } = config
|
||||||
const sock = makeChatsSocket(config)
|
const sock = makeChatsSocket(config)
|
||||||
@@ -606,4 +604,4 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
return { ...sock, processMessage, sendMessageAck }
|
return { ...sock, processMessage, sendMessageAck }
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user