mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
feat: add label feature (#955)
Co-authored-by: 刘建辉 <liujianhui@gongchang.com>
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user