From 621f63dcd24069cfe6ef86d158e58f671881dce2 Mon Sep 17 00:00:00 2001 From: Hamza-Ayed Date: Sat, 23 May 2026 23:25:19 +0300 Subject: [PATCH] Deploy: 2026-05-23 23:25:19 --- whatsapp-gateway/baileys-client.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/whatsapp-gateway/baileys-client.js b/whatsapp-gateway/baileys-client.js index f6a74d7..a6d0bc9 100644 --- a/whatsapp-gateway/baileys-client.js +++ b/whatsapp-gateway/baileys-client.js @@ -668,9 +668,16 @@ async function checkContact(session_key, phone) { } async function exportChatHistory(session_key) { - const store = sessionStores.get(session_key); + let store = sessionStores.get(session_key); if (!store) { - throw new Error(`No store found for session ${session_key}`); + const storeFile = path.join(SESSIONS_DIR, `${session_key}_store.json`); + if (fs.existsSync(storeFile)) { + store = makeInMemoryStore(); + store.readFromFile(storeFile); + console.log(`[Store] Loaded store from file for ${session_key} (Export)`); + } else { + throw new Error(`No store found for session ${session_key}`); + } } const chats = store.chats.all();