mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
read message in example
This commit is contained in:
@@ -38,13 +38,14 @@ import makeWASocket, { WASocket, AuthenticationState, DisconnectReason, AnyMessa
|
|||||||
logger: P({ level: 'trace' }),
|
logger: P({ level: 'trace' }),
|
||||||
auth: loadState()
|
auth: loadState()
|
||||||
})
|
})
|
||||||
sock.ev.on('messages.upsert', m => {
|
sock.ev.on('messages.upsert', async m => {
|
||||||
console.log(JSON.stringify(m, undefined, 2))
|
console.log(JSON.stringify(m, undefined, 2))
|
||||||
|
|
||||||
const msg = m.messages[0]
|
const msg = m.messages[0]
|
||||||
if(!msg.key.fromMe && m.type === 'notify') {
|
if(!msg.key.fromMe && m.type === 'notify') {
|
||||||
console.log('replying to', m.messages[0].key.remoteJid)
|
console.log('replying to', m.messages[0].key.remoteJid)
|
||||||
sendMessageWTyping({ text: 'Hello there!' }, m.messages[0].key.remoteJid!)
|
await sock!.sendReadReceipt(msg.key.remoteJid, msg.key.participant, [msg.key.id])
|
||||||
|
await sendMessageWTyping({ text: 'Hello there!' }, msg.key.remoteJid)
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user