feat: add label feature (#955)

Co-authored-by: 刘建辉 <liujianhui@gongchang.com>
This commit is contained in:
建辉
2024-09-22 19:48:17 +08:00
committed by GitHub
parent 9e4e211751
commit 6ff945502d
4 changed files with 43 additions and 0 deletions

View File

@@ -8,6 +8,7 @@ import { makeMutex } from '../Utils/make-mutex'
import processMessage from '../Utils/process-message'
import { BinaryNode, getBinaryNodeChild, getBinaryNodeChildren, jidNormalizedUser, reduceBinaryNodeToDictionary, S_WHATSAPP_NET } from '../WABinary'
import { makeSocket } from './socket'
import { Label, LabelActionBody } from '../Types/Label'
const MAX_SYNC_ATTEMPTS = 2
@@ -804,6 +805,17 @@ export const makeChatsSocket = (config: SocketConfig) => {
}, jid)
}
/**
* Adds label
*/
const addLabel = (jid: string, labels: LabelActionBody) => {
return chatModify({
addLabel: {
...labels
}
}, jid)
}
/**
* Adds label for the chats
*/
@@ -1024,6 +1036,7 @@ export const makeChatsSocket = (config: SocketConfig) => {
resyncAppState,
chatModify,
cleanDirtyBits,
addLabel,
addChatLabel,
removeChatLabel,
addMessageLabel,