mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
feat: add WA Web version auto fetch
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { Boom } from '@hapi/boom'
|
||||
import P from 'pino'
|
||||
import makeWASocket, { AnyMessageContent, delay, DisconnectReason, makeInMemoryStore, useSingleFileAuthState } from '../src'
|
||||
import makeWASocket, { AnyMessageContent, delay, DisconnectReason, fetchLatestBaileysVersion, makeInMemoryStore, useSingleFileAuthState } from '../src'
|
||||
|
||||
// the store maintains the data of the WA connection in memory
|
||||
// can be written out to a file & read from it
|
||||
@@ -14,9 +14,13 @@ setInterval(() => {
|
||||
const { state, saveState } = useSingleFileAuthState('./auth_info_multi.json')
|
||||
|
||||
// start a connection
|
||||
const startSock = () => {
|
||||
|
||||
const startSock = async() => {
|
||||
// fetch latest version of WA Web
|
||||
const { version, isLatest } = await fetchLatestBaileysVersion()
|
||||
console.log(`using WA v${version.join('.')}, isLatest: ${isLatest}`)
|
||||
|
||||
const sock = makeWASocket({
|
||||
version,
|
||||
logger: P({ level: 'trace' }),
|
||||
printQRInTerminal: true,
|
||||
auth: state,
|
||||
|
||||
Reference in New Issue
Block a user