mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
Fix: Readme use upsert events (#908)
This commit is contained in:
@@ -324,13 +324,13 @@ const sock = makeWASocket({ })
|
|||||||
// the store can listen from a new socket once the current socket outlives its lifetime
|
// the store can listen from a new socket once the current socket outlives its lifetime
|
||||||
store.bind(sock.ev)
|
store.bind(sock.ev)
|
||||||
|
|
||||||
sock.ev.on('chats.set', () => {
|
sock.ev.on('chats.upsert', () => {
|
||||||
// can use "store.chats" however you want, even after the socket dies out
|
// can use "store.chats" however you want, even after the socket dies out
|
||||||
// "chats" => a KeyedDB instance
|
// "chats" => a KeyedDB instance
|
||||||
console.log('got chats', store.chats.all())
|
console.log('got chats', store.chats.all())
|
||||||
})
|
})
|
||||||
|
|
||||||
sock.ev.on('contacts.set', () => {
|
sock.ev.on('contacts.upsert', () => {
|
||||||
console.log('got contacts', Object.values(store.contacts))
|
console.log('got contacts', Object.values(store.contacts))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user