mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
Callbacks via EventEmitter + possible memory leak fix
This commit is contained in:
@@ -123,7 +123,7 @@ async function example() {
|
||||
})
|
||||
|
||||
/* example of custom functionality for tracking battery */
|
||||
conn.registerCallback(['action', null, 'battery'], json => {
|
||||
conn.on('CB:action,,battery', json => {
|
||||
const batteryLevelStr = json[2][0][1].value
|
||||
const batterylevel = parseInt(batteryLevelStr)
|
||||
console.log('battery level: ' + batterylevel)
|
||||
|
||||
Reference in New Issue
Block a user