mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
support for custom queries + presence update handler
This commit is contained in:
@@ -19,6 +19,10 @@ client.handlers.onConnected = () => {
|
||||
Despite the convenience, be careful with this file
|
||||
*/
|
||||
}
|
||||
// called when someone's presence is updated
|
||||
client.handlers.presenceUpdated = (id, type) => {
|
||||
console.log("presence of " + id + " is " + type)
|
||||
}
|
||||
// called when you have a pending unread message or recieve a new message
|
||||
client.handlers.onUnreadMessage = (m) => {
|
||||
// console.log("recieved message: " + JSON.stringify(m)) // uncomment to see what the raw message looks like
|
||||
@@ -58,6 +62,7 @@ client.handlers.onUnreadMessage = (m) => {
|
||||
}
|
||||
}, 4*1000) // send after 4 seconds
|
||||
}
|
||||
|
||||
// called if an error occurs
|
||||
client.handlers.onError = (err) => console.log(err)
|
||||
client.handlers.onDisconnect = () => { /* internet got disconnected, save chats here or whatever; will reconnect automatically */ }
|
||||
|
||||
Reference in New Issue
Block a user