mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
.
This commit is contained in:
@@ -166,6 +166,8 @@ module.exports = function (WhatsAppWeb) {
|
|||||||
}
|
}
|
||||||
}, 25 * 1000)
|
}, 25 * 1000)
|
||||||
}
|
}
|
||||||
|
// disconnect from the phone. Your auth credentials become invalid after sending a disconnect request.
|
||||||
|
// use close() if you just want to close the connection
|
||||||
WhatsAppWeb.prototype.disconnect = function () {
|
WhatsAppWeb.prototype.disconnect = function () {
|
||||||
if (this.status === Status.connected) {
|
if (this.status === Status.connected) {
|
||||||
this.conn.send('goodbye,["admin","Conn","disconnect"]', null, () => {
|
this.conn.send('goodbye,["admin","Conn","disconnect"]', null, () => {
|
||||||
@@ -177,6 +179,7 @@ module.exports = function (WhatsAppWeb) {
|
|||||||
this.close()
|
this.close()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// close the connection
|
||||||
WhatsAppWeb.prototype.close = function () {
|
WhatsAppWeb.prototype.close = function () {
|
||||||
this.conn.close()
|
this.conn.close()
|
||||||
this.conn = null
|
this.conn = null
|
||||||
|
|||||||
2
test.js
2
test.js
@@ -39,7 +39,7 @@ const readline = require('readline').createInterface({
|
|||||||
})
|
})
|
||||||
readline.question("type exit to disconnect\n", (txt) => {
|
readline.question("type exit to disconnect\n", (txt) => {
|
||||||
if (txt === "exit") {
|
if (txt === "exit") {
|
||||||
client.disconnect()
|
client.close()
|
||||||
process.exit(0)
|
process.exit(0)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
Reference in New Issue
Block a user