mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
fix: example
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
import { Boom } from '@hapi/boom'
|
import { Boom } from '@hapi/boom'
|
||||||
import makeWASocket, { AnyMessageContent, delay, DisconnectReason, fetchLatestBaileysVersion, isJidBroadcast, makeCacheableSignalKeyStore, makeInMemoryStore, MessageRetryMap, useMultiFileAuthState } from '../src'
|
import NodeCache from 'node-cache'
|
||||||
|
import makeWASocket, { AnyMessageContent, delay, DisconnectReason, fetchLatestBaileysVersion, makeCacheableSignalKeyStore, makeInMemoryStore, useMultiFileAuthState } from '../src'
|
||||||
import MAIN_LOGGER from '../src/Utils/logger'
|
import MAIN_LOGGER from '../src/Utils/logger'
|
||||||
|
|
||||||
const logger = MAIN_LOGGER.child({ })
|
const logger = MAIN_LOGGER.child({ })
|
||||||
@@ -10,7 +11,7 @@ const doReplies = !process.argv.includes('--no-reply')
|
|||||||
|
|
||||||
// external map to store retry counts of messages when decryption/encryption fails
|
// external map to store retry counts of messages when decryption/encryption fails
|
||||||
// keep this out of the socket itself, so as to prevent a message decryption/encryption loop across socket restarts
|
// keep this out of the socket itself, so as to prevent a message decryption/encryption loop across socket restarts
|
||||||
const msgRetryCounterMap: MessageRetryMap = { }
|
const msgRetryCounterCache = new NodeCache()
|
||||||
|
|
||||||
// the store maintains the data of the WA connection in memory
|
// the store maintains the data of the WA connection in memory
|
||||||
// can be written out to a file & read from it
|
// can be written out to a file & read from it
|
||||||
@@ -37,7 +38,7 @@ const startSock = async() => {
|
|||||||
/** caching makes the store faster to send/recv messages */
|
/** caching makes the store faster to send/recv messages */
|
||||||
keys: makeCacheableSignalKeyStore(state.keys, logger),
|
keys: makeCacheableSignalKeyStore(state.keys, logger),
|
||||||
},
|
},
|
||||||
msgRetryCounterMap,
|
msgRetryCounterCache,
|
||||||
generateHighQualityLinkPreview: true,
|
generateHighQualityLinkPreview: true,
|
||||||
// ignore all broadcast messages -- to receive the same
|
// ignore all broadcast messages -- to receive the same
|
||||||
// comment the line below out
|
// comment the line below out
|
||||||
|
|||||||
Reference in New Issue
Block a user