mirror of
https://github.com/cheveguerra/whatsapp-web.js.git
synced 2026-04-21 04:59:14 +00:00
add disconnect reason
This commit is contained in:
@@ -160,7 +160,7 @@ client.on('message_revoke_me', async (msg) => {
|
|||||||
console.log(msg.body); // message before it was deleted.
|
console.log(msg.body); // message before it was deleted.
|
||||||
});
|
});
|
||||||
|
|
||||||
client.on('disconnected', () => {
|
client.on('disconnected', (reason) => {
|
||||||
console.log('Client was logged out');
|
console.log('Client was logged out', reason);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -206,8 +206,9 @@ class Client extends EventEmitter {
|
|||||||
/**
|
/**
|
||||||
* Emitted when the client has been disconnected
|
* Emitted when the client has been disconnected
|
||||||
* @event Client#disconnected
|
* @event Client#disconnected
|
||||||
|
* @param {WAState} reason state that caused the disconnect
|
||||||
*/
|
*/
|
||||||
this.emit(Events.DISCONNECTED);
|
this.emit(Events.DISCONNECTED, state);
|
||||||
this.destroy();
|
this.destroy();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user