mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
Fix connection example snippet (#1190)
Signed-off-by: Prince Mendiratta <prince.mendi@gmail.com>
This commit is contained in:
committed by
GitHub
parent
21f4ba92f9
commit
669dce1ea8
@@ -51,7 +51,8 @@ TODO
|
||||
## Connecting
|
||||
|
||||
``` ts
|
||||
import makeWASocket from '@adiwajshing/baileys'
|
||||
import makeWASocket, { DisconnectReason } from '@adiwajshing/baileys'
|
||||
import { Boom } from '@hapi/boom'
|
||||
|
||||
async function connectToWhatsApp () {
|
||||
const sock = makeWASocket({
|
||||
@@ -65,7 +66,7 @@ async function connectToWhatsApp () {
|
||||
console.log('connection closed due to ', lastDisconnect.error, ', reconnecting ', shouldReconnect)
|
||||
// reconnect if not logged out
|
||||
if(shouldReconnect) {
|
||||
sock = startSock()
|
||||
connectToWhatsApp()
|
||||
}
|
||||
} else if(connection === 'open') {
|
||||
console.log('opened connection')
|
||||
|
||||
Reference in New Issue
Block a user