From 80b9e74066fb1f2c3111663c664b974a35eb523d Mon Sep 17 00:00:00 2001 From: Adhiraj Singh Date: Tue, 21 Feb 2023 11:41:04 +0530 Subject: [PATCH] fix: example --- Example/example.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Example/example.ts b/Example/example.ts index 6e8a5d0..dcb6eff 100644 --- a/Example/example.ts +++ b/Example/example.ts @@ -1,5 +1,6 @@ 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' 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 // 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 // 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 */ keys: makeCacheableSignalKeyStore(state.keys, logger), }, - msgRetryCounterMap, + msgRetryCounterCache, generateHighQualityLinkPreview: true, // ignore all broadcast messages -- to receive the same // comment the line below out