chore: import maquina-comercial-pessoal history via subtree
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> git-subtree-dir: maquina-comercial-pessoal git-subtree-mainline:f5af038e19git-subtree-split:a9ef4d776d
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
import { loadDotEnv, paths } from '../src/env.mjs';
|
||||
import { openDb, ensureSeeds } from '../src/db.mjs';
|
||||
import { runOutreachBatch } from '../src/outreach/run.mjs';
|
||||
import { createWhatsAppManager, hasWhatsAppSession } from '../src/whatsapp/manager.mjs';
|
||||
|
||||
// Dispara um lote pela sessao local existente, respeitando as mesmas regras do servidor.
|
||||
|
||||
await loadDotEnv();
|
||||
|
||||
const log = (message) => console.log(`[outreach] ${message}`);
|
||||
|
||||
const db = openDb();
|
||||
await ensureSeeds(db, { log });
|
||||
const whatsapp = createWhatsAppManager({ authDir: paths.whatsappAuth, log });
|
||||
if (await hasWhatsAppSession(paths.whatsappAuth)) {
|
||||
await whatsapp.connect().catch((error) => log(`conexao local falhou: ${error.message}`));
|
||||
}
|
||||
|
||||
const resumo = await runOutreachBatch({ db, whatsapp, log });
|
||||
console.log(JSON.stringify(resumo, null, 2));
|
||||
|
||||
await whatsapp.close();
|
||||
db.close();
|
||||
Reference in New Issue
Block a user