Deploy: 2026-05-23 23:25:19

This commit is contained in:
Hamza-Ayed
2026-05-23 23:25:19 +03:00
parent b627a52c6e
commit 621f63dcd2

View File

@@ -668,9 +668,16 @@ async function checkContact(session_key, phone) {
} }
async function exportChatHistory(session_key) { async function exportChatHistory(session_key) {
const store = sessionStores.get(session_key); let store = sessionStores.get(session_key);
if (!store) { 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(); const chats = store.chats.all();