From d399cbf81075f36cd0bc9dfe7f9d5f9d981cc4c0 Mon Sep 17 00:00:00 2001 From: Adhiraj Singh Date: Tue, 12 Apr 2022 19:21:45 +0530 Subject: [PATCH] feat: add "--no-store" option --- Example/example.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Example/example.ts b/Example/example.ts index 9e4e259..28aa66e 100644 --- a/Example/example.ts +++ b/Example/example.ts @@ -5,13 +5,15 @@ import MAIN_LOGGER from '../src/Utils/logger' const logger = MAIN_LOGGER.child({ }) logger.level = 'trace' +const useStore = !process.argv.includes('--no-store') + // the store maintains the data of the WA connection in memory // can be written out to a file & read from it -const store = makeInMemoryStore({ logger }) -store.readFromFile('./baileys_store_multi.json') +const store = useStore ? makeInMemoryStore({ logger }) : undefined +store?.readFromFile('./baileys_store_multi.json') // save every 10s setInterval(() => { - store.writeToFile('./baileys_store_multi.json') + store?.writeToFile('./baileys_store_multi.json') }, 10_000) const { state, saveState } = useSingleFileAuthState('./auth_info_multi.json') @@ -35,7 +37,7 @@ const startSock = async() => { } }) - store.bind(sock.ev) + store?.bind(sock.ev) const sendMessageWTyping = async(msg: AnyMessageContent, jid: string) => { await sock.presenceSubscribe(jid)