mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
connect fixes
This commit is contained in:
@@ -314,6 +314,7 @@ export class WAConnection extends EventEmitter {
|
|||||||
this.conn = null
|
this.conn = null
|
||||||
this.phoneConnected = false
|
this.phoneConnected = false
|
||||||
this.lastDisconnectReason = reason
|
this.lastDisconnectReason = reason
|
||||||
|
this.lastSeen = null
|
||||||
|
|
||||||
if (reason === 'invalid_session' || reason === 'intentional') {
|
if (reason === 'invalid_session' || reason === 'intentional') {
|
||||||
this.pendingRequests.forEach (({reject}) => reject(new Error('close')))
|
this.pendingRequests.forEach (({reject}) => reject(new Error('close')))
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ export class WAConnection extends Base {
|
|||||||
// determine whether reconnect should be used or not
|
// determine whether reconnect should be used or not
|
||||||
const shouldUseReconnect = this.lastDisconnectReason !== DisconnectReason.replaced &&
|
const shouldUseReconnect = this.lastDisconnectReason !== DisconnectReason.replaced &&
|
||||||
this.lastDisconnectReason !== DisconnectReason.unknown &&
|
this.lastDisconnectReason !== DisconnectReason.unknown &&
|
||||||
this.lastDisconnectReason !== DisconnectReason.intentional && this.user
|
this.lastDisconnectReason !== DisconnectReason.intentional && this.user?.jid
|
||||||
const reconnectID = shouldUseReconnect ? this.user.jid.replace ('@s.whatsapp.net', '@c.us') : null
|
const reconnectID = shouldUseReconnect ? this.user.jid.replace ('@s.whatsapp.net', '@c.us') : null
|
||||||
|
|
||||||
const promise = Utils.promiseTimeout(timeoutMs, (resolve, reject) => {
|
const promise = Utils.promiseTimeout(timeoutMs, (resolve, reject) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user