dffdfd
This commit is contained in:
parent
1e3929c484
commit
e44f0e0f52
13
index.js
13
index.js
@ -38,12 +38,18 @@ const initBaileys = async () => {
|
||||
printQRInTerminal: false
|
||||
})
|
||||
|
||||
sock.ev.on('connection.update', update => {
|
||||
sock.ev.on('connection.update', async update => {
|
||||
const { connection, lastDisconnect, qr } = update
|
||||
|
||||
if (qr) {
|
||||
qrData = qrcode.toDataURL(qr)
|
||||
isConnected = false
|
||||
try {
|
||||
qrData = await qrcode.toDataURL(qr)
|
||||
isConnected = false
|
||||
} catch (e) {
|
||||
console.error('❌ Erreur génération QR :', e)
|
||||
}
|
||||
}
|
||||
|
||||
if (connection === 'close') {
|
||||
const shouldReconnect = lastDisconnect?.error?.output?.statusCode !== DisconnectReason.loggedOut
|
||||
console.log(shouldReconnect ? '🔁 Reconnexion...' : '❌ Déconnecté.')
|
||||
@ -53,6 +59,7 @@ const initBaileys = async () => {
|
||||
isConnected = true
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
sock.ev.on('creds.update', saveCreds)
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user