mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
Deprecated message-new & message-update + fix presence update for groups
The chat-update event is fired now when a message is received/updated
This commit is contained in:
@@ -47,8 +47,11 @@ async function example() {
|
||||
const participant = json.participant ? ' (' + json.participant + ')' : '' // participant exists when the message is from a group
|
||||
console.log(`${json.to}${participant} acknlowledged message(s) ${json.ids} as ${json.type}`)
|
||||
})
|
||||
// set to false to NOT relay your own sent messages
|
||||
conn.on('message-new', async (m) => {
|
||||
conn.on('chat-update', async chat => {
|
||||
// only do something when a new message is received; i.e. the unread count is updated
|
||||
if (!chat.count) return
|
||||
|
||||
const m = chat.messages.all()[0] // pull the new message from the update
|
||||
const messageStubType = WA_MESSAGE_STUB_TYPES[m.messageStubType] || 'MESSAGE'
|
||||
console.log('got notification of type: ' + messageStubType)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user