diff --git a/src/Socket/messages-recv.ts b/src/Socket/messages-recv.ts index 5ad9abf..4ea2098 100644 --- a/src/Socket/messages-recv.ts +++ b/src/Socket/messages-recv.ts @@ -8,21 +8,6 @@ import { areJidsSameUser, BinaryNode, BinaryNodeAttributes, getAllBinaryNodeChil import { makeChatsSocket } from './chats' import { extractGroupMetadata } from './groups' -const STATUS_MAP: { [_: string]: proto.WebMessageInfo.WebMessageInfoStatus } = { - 'played': proto.WebMessageInfo.WebMessageInfoStatus.PLAYED, - 'read': proto.WebMessageInfo.WebMessageInfoStatus.READ, - 'read-self': proto.WebMessageInfo.WebMessageInfoStatus.READ -} - -const getStatusFromReceiptType = (type: string | undefined) => { - const status = STATUS_MAP[type] - if(typeof type === 'undefined') { - return proto.WebMessageInfo.WebMessageInfoStatus.DELIVERY_ACK - } - - return status -} - export const makeMessagesRecvSocket = (config: SocketConfig) => { const { logger } = config const sock = makeChatsSocket(config) @@ -571,3 +556,18 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => { return { ...sock, processMessage, sendMessageAck, sendRetryRequest } } + +const STATUS_MAP: { [_: string]: proto.WebMessageInfo.WebMessageInfoStatus } = { + 'played': proto.WebMessageInfo.WebMessageInfoStatus.PLAYED, + 'read': proto.WebMessageInfo.WebMessageInfoStatus.READ, + 'read-self': proto.WebMessageInfo.WebMessageInfoStatus.READ +} + +const getStatusFromReceiptType = (type: string | undefined) => { + const status = STATUS_MAP[type] + if(typeof type === 'undefined') { + return proto.WebMessageInfo.WebMessageInfoStatus.DELIVERY_ACK + } + + return status +}